Skip to main content
POST
← Own Workforce API Load your headcount from your HR system: employees, their contracts and what they earn. A record is a row of the own workforce import template: an employee, one of its contracts and, optionally, one remuneration of that contract. Send one record per contract, or per remuneration of a contract; the records of one employee share its external_employee_id. The request applies the records as the file import does and answers 201 Created with the employee of each record. Nothing is calculated, so there is no job to follow.
Beta. Part of the bulk ingest API, currently in beta. The contract may still change before general availability.

How it works

Each record is applied as the file import applies a row, in the order sent:
  1. The employee is found by external_employee_id in the x-organization-id organization, or created with the record’s personal data. An employee that already exists keeps its personal data (birth date, gender, disability, nationality): the record’s are not applied.
  2. The contract is identified by its start date.
    • A contract the employee already has with the same contract_start_date is updated with every field of the record except its dates.
    • A new contract is added. If the stored contract before it is open, that one is closed the day before the new one starts. If there is none before it but a stored one after, an open new contract ends the day before that one starts. Contracts sent in the same request are not closed for each other: send the end date of every contract but the employee’s last, or the request answers CONTRACT_OVERLAP.
  3. The remuneration, when sent, is identified by its start date within the contract. One that already exists is left as it is. A new one closes the open remuneration before it, as contracts do.
The request is all or nothing. Every record is checked, the resulting contracts and remunerations included: an employee’s contracts must not overlap, nor a contract’s remunerations. If any record is invalid, the answer is 422 listing every invalid record and nothing is written. Otherwise everything is written at once.

Request

Headers

string
required
Your API key (see Authentication).
string
required
The organization the employees belong to. A record cannot name another organization: send each organization’s employees with its own x-organization-id.
string
required
1 to 255 characters, unique per batch. A retry with the same key and body answers the same employees (with Idempotent-Replayed: true) instead of applying the records again; the same key with another body is 422 IDEMPOTENCY_KEY_REUSED, and while the first request is still being processed 409 IDEMPOTENCY_KEY_IN_PROGRESS.

Query Parameters

boolean
default:"false"
Check only: the same 422 for invalid records, nothing written; 200 with {"dry_run": true, "submitted": n, "valid": n} when every record is valid.

Body Parameters

array[object]
required
The template rows, 1 to 1,000. A field not listed here is rejected (SCHEMA_INVALID). The codes below are the values of the template’s columns; Get Options Source lists them.

Response

201 Created with items: one per record, in the order sent, with its source_row_index, client_row_id and the employee it was applied to. The records of one employee answer the same employee. Its id is the one Delete Workforce Employees (v2) takes. Read the contracts and remunerations with List Workforce Contracts.

Errors

Problem details. Per-record codes in errors[].error_code of a 422 BULK_RECORDS_REJECTED: The overlaps are checked once every record is otherwise valid. Request-level errors: 401 for a missing or invalid API key, 403 LOGGED_USER_NOT_MEMBER when the key’s user is not a member of the organization, 422 REQUEST_VALIDATION_FAILED for a malformed body (no records, more than 1,000, no Idempotency-Key), 422 IDEMPOTENCY_KEY_REUSED, 409 IDEMPOTENCY_KEY_IN_PROGRESS, and 429 beyond the rate limits.

Limits

Delete Workforce Employees (v2)

Delete employees by id

Own Workforce Import Templates

The template the records follow

Get Options Source

The accepted codes

List Workforce Contracts

The contracts of an employee