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 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. A record follows a row of the own workforce import template, with three differences: contract_end_date_reason is contract_end_reason, remuneration_currency is remuneration_currency_unit_id, and organization_id is not accepted (the organization is the request’s x-organization-id). A record can also carry your own client_row_id. This is the own workforce of the ESRS S1 disclosures (headcount, FTE, pay gap). Your employees’ commuting, for scope 3 category 7, goes to Employees. The request applies the records as the file import does and answers 201 Created with the employee of each record: nothing is calculated, so the route is synchronous. It also records an ingest job, born completed with 0 of 0 chunks, that sends no webhook. See how bulk ingestion works.
Beta. Part of the bulk ingest API, 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 the record’s fields. A different contract_end_date ends it on that day, for example to record a leaver, and its remunerations that run past that day end on it too (one that starts after that day is kept as it is). The end date must be before the employee’s next contract starts, or the record answers CONTRACT_OVERLAP. Without contract_end_date the stored end date is kept, and without contract_end_reason the stored reason.
    • 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. A new contract must also start after the end date another record sends for the stored contract before it.
    • A contract with contract_end_reason needs an end date once the whole request is applied: the record’s, the stored one, or one another contract gives it as described above. Otherwise the record answers CONTRACT_END_REASON_WITHOUT_END_DATE. Sending again the reason an open stored contract already has changes nothing and is accepted.
  3. The remuneration, when sent, is identified by its start date within the contract. One that already exists takes the record’s remuneration_amount; its dates are kept. A new one closes the open remuneration before it, as contracts do.
Send the same contract fields in every record of a contract. The employee’s personal data comes from its first record. 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 and nothing is written: rejected is the number of invalid records and errors lists them (up to 100). Otherwise everything is written at once.

Correcting data

What is stored is kept as follows:
  • Personal data (birth date, gender, disability, nationality) stays as the employee was first sent: later records do not change it, nor fill in a nationality the first one omitted.
  • A stored contract takes the fields of a record with its contract_start_date, and its end date when the record sends one. An omitted contract_end_date, contract_end_reason or contract_annual_working_hours keeps the stored value.
  • A stored remuneration takes the remuneration_amount of a record with its remuneration_start_date (a corrected salary, or the same period re-sent with this year’s salary). Its dates are kept, unless a new end date of its contract ends it earlier. The last send wins, also over a correction made in the Dcycle app: send the corrected amount, or leave that period out of the request.
  • An open contract or remuneration (without an end date) is closed the day before a later one you send starts.
To change anything else (a contract’s start date, an ended contract that should be open again, a stored remuneration’s dates, personal data), delete the employee with Delete Workforce Employees (v2), which also deletes its contracts, remunerations, trainings, absences and accidents. Once the deletion job is completed (see following a job), send the employee again with all its records, then its trainings and absences and accidents with the employee’s new id as own_workforce_id.

Request

Headers

string
required
Your API key (see Authentication).
string
required
The organization the employees belong to. A record cannot name another organization of your perimeter: send each organization’s employees with its own x-organization-id.
string
required
1 to 255 characters, one per batch, looked up per organization across every v2 bulk route. Within 24 hours, the same key with the same route and body answers the same employees (with Idempotent-Replayed: true) instead of applying the records again; the same key with another body or on another route is 422 IDEMPOTENCY_KEY_REUSED, and while the first request is still being processed 409 IDEMPOTENCY_KEY_IN_PROGRESS. After 24 hours the key is free, and a request with it is a new one. See The Idempotency-Key.

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. The Idempotency-Key header is still required, but a dry run does not check or store it.

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. List Workforce Contracts returns each contract’s id and dates, Get Workforce Contract its terms, and List Workforce Remunerations (GET /v1/own_workforce_remunerations) the amounts of a contract.

Errors

Problem details. Per-record codes in errors[].error_code of a 422 BULK_RECORDS_REJECTED: The overlaps and the end reasons 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