# Create Recruitment

`POST /people/recruitments`

Group: People Management › Recruitments · Operation ID: `createRecruitment`

Creates a recruitment, one job opening. A department, a position, or both must be named. When name is omitted, it is derived from whichever was given. The hiring manager and the owner are granted the permissions they need to work the opening. The response is only the new recruitment's id, so read the full record with GET people/recruitments/:id.

[Open in the interactive reference](https://docs.api.lensing.ai/?op=createRecruitment)

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Api-Version` | header | `"v1"` | yes | The API version this request targets, named by its public identifier. Required on every request; omitting it, or naming a version this company does not have, is answered with 400. This document describes version `v1`. |
| `Idempotency-Key` | header | string | no | An opaque caller-chosen string (1-255 characters) that makes this request safe to retry. Repeating the same key with an identical request body replays the original response instead of re-executing - but only once that original request succeeded; a failed attempt re-executes on retry. Repeating the key with a different body is answered with 422. A key still in flight is answered with 409 - as is a key whose original request was interrupted before it finished, for a few minutes afterwards, until that attempt is presumed dead. A completed response stays replayable for 24 hours. The key is scoped to the caller, not to the action: reusing it for a different action is answered with 409 or 422 rather than treated independently. On read actions this header is ignored. On write actions that cannot offer the guarantee it is answered with `400 IDEMPOTENCY_NOT_SUPPORTED` rather than silently ignored. |

## Request body

Required, `application/json`: createRecruitmentInput.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | no | The name of the opening. When omitted, it is derived from the department or position name. |
| `category` | string | no | A free-text category of the opening, for example internal, external or student. |
| `deadline` | string | no | The application deadline. Use format YYYY-MM-DD. The status is derived from it. |
| `vacancies` | number | no | The number of vacant positions the opening covers, from 0 to 1000. |
| `departmentId` | string | no | The identifier of the department the opening belongs to. Required unless positionId is given. See id on GET departments/:id. |
| `positionId` | string | no | The identifier of the position being recruited for. Required unless departmentId is given. See id on GET positions/:id. |
| `teamId` | string | no | The identifier of the team. See id on GET people/teams/:id. |
| `locationId` | string | no | The identifier of the work location. There is no endpoint for it. |
| `entityId` | string | no | The legal entity that will employ the hire. |
| `employmentCategoryId` | string | no | The identifier of the employment category. There is no endpoint for it. |
| `hiringManagerId` | string | no | The identifier of the employee who is the hiring manager. They are granted the permissions to work the opening. See id on GET people/:id. |
| `ownerId` | string | no | The identifier of the employee who owns the recruitment, the recruiter. They are granted the permissions to work the opening. See id on GET people/:id. |
| `jobDescription` | string | no | The job description, as plain text. |
| `viabilityCriteria` | string | no | The internal viability criteria used to screen applicants, as plain text. Stored as an empty string when omitted. |
| `website` | string | no | The URL of the posting or the hiring team's page. |
| `relocationRequired` | string | no | Whether and how relocation is required. Free text, not a boolean. |

Example:

```json
{
  "name": "<name>",
  "category": "<category>",
  "deadline": "<deadline>",
  "vacancies": 0,
  "departmentId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "positionId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "teamId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "locationId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "entityId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "employmentCategoryId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "hiringManagerId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "ownerId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "jobDescription": "<jobDescription>",
  "viabilityCriteria": "<viabilityCriteria>",
  "website": "<website>",
  "relocationRequired": "<relocationRequired>"
}
```

## Response

`200` Success

Under `data` (createRecruitmentOutput):

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes | The unique identifier for the created recruitment. |

## Response headers

- `Idempotency-Replayed` — Present and `true` only when this response replays a previously stored one for the same Idempotency-Key, rather than reflecting a live execution. Absent on a live response - never sent as `false`.

## Errors

| Code | Status |
| --- | --- |
| `DEPARTMENT_OR_POSITION_REQUIRED` | 400 |
| `REFERENCE_NOT_FOUND` | 400 |
| `INVALID_DEADLINE` | 400 |
| `INVALID_VACANCIES` | 400 |
| `IDEMPOTENCY_KEY_CONFLICT` | 409 |
| `IDEMPOTENCY_PAYLOAD_MISMATCH` | 422 |

## Statuses

- `400` — Invalid request or business failure. Codes: DEPARTMENT_OR_POSITION_REQUIRED, REFERENCE_NOT_FOUND, INVALID_DEADLINE, INVALID_VACANCIES
- `401` — Missing or invalid access token
- `403` — Not authorized
- `404` — Not found
- `409` — The Idempotency-Key is still being processed by another request.
- `422` — The Idempotency-Key was already used with a different request payload.
- `429` — Too many requests
- `500` — Internal server error
