Import a document idempotently

Operation ID: importDocument

Group: People Management › Documents

Open in the interactive reference

POST /people/documents/import

Retry-safe: A write that accepts Idempotency-Key: repeating a request with the same key replays the stored answer instead of executing twice.

Files one document for an employee the way the bulk document upload in Everest does. Send the file base64-encoded. Choose a new UUID as importKey for each document: if a call fails or times out, send it again with the same importKey and values, and you get the id of the document that was already filed instead of a second copy.

The file name is stored as you send it, trimmed of surrounding spaces. Its extension, mimeType and the file content must all be the same format: PDF, PNG, JPEG or TIFF. No notifications are sent. The status is 'approved' when you file a document for another employee and 'pending' for your own.

The response contains only the document's id. Read the stored file name and status with GET people/documents.

The whole request must stay within the platform's request size limit of about 2 MiB, so the file itself can be about 1.5 MB. A larger request is refused by the platform with HTTP 500 before this endpoint runs.

Only HR administrators can call this endpoint. To check file names against your naming rules first, use POST people/documents/match.

Parameters

Name In Type Required Description
Api-Version header string · 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: importDocumentInput.

Field Type Required Description
importKey string yes A UUID you choose for this document. Sending the same importKey with the same file and values again returns the document already imported instead of creating another. Example: "6d2b8f3e-1c4a-4e7b-9f05-3a8c2d1e7b64".
employeeId string yes The identifier of the employee the document belongs to. See id on GET people/person/:id. Example: "3f2a9c14-6b1d-4f0e-9a52-0c7d8e1b2a34".
categoryId string yes The identifier of the document category to file the document under. See id on GET people/document-categories. Example: "8c1e4b27-2d9a-4c63-b0f1-5e7a9d3c6b18".
fileName string yes The file name to store, with its extension: pdf, tif, tiff, jpg, jpeg or png. Stored as sent, trimmed of surrounding spaces. At most 200 characters, with no path and no control characters. Example: "EMP-1001_Payslip_2026-12.pdf".
mimeType string yes The MIME type of the file: 'application/pdf', 'image/png', 'image/jpeg' or 'image/tiff'. Must describe the same format as the extension and the content. Example: "application/pdf".
contentBase64 string yes The file's bytes, base64-encoded with the standard alphabet and padding. Must be non-empty and well-formed. Example: "JVBERi0xLjQK".
expiryDate date no The day the document expires. Format YYYY-MM-DD. Omit for a document that does not expire. Example: "2027-12-31".
{
  "importKey": "6d2b8f3e-1c4a-4e7b-9f05-3a8c2d1e7b64",
  "employeeId": "3f2a9c14-6b1d-4f0e-9a52-0c7d8e1b2a34",
  "categoryId": "8c1e4b27-2d9a-4c63-b0f1-5e7a9d3c6b18",
  "fileName": "EMP-1001_Payslip_2026-12.pdf",
  "mimeType": "application/pdf",
  "contentBase64": "JVBERi0xLjQK"
}

Response

200 Success

Under data (importDocumentOutput):

Field Type Required Description
id string yes The unique identifier for the document, also when importKey was already used for the same document. See id on GET people/documents. Example: "5b7e2c91-8a4d-4f36-b1e0-9c2d7a6f3e85".
{
  "data": {
    "id": "5b7e2c91-8a4d-4f36-b1e0-9c2d7a6f3e85"
  },
  "diagnostics": [
    {
      "code": "<code>",
      "message": "<message>",
      "severity": "error",
      "path": [
        "<path>"
      ],
      "details": "<details>"
    }
  ]
}

Response headers

Errors

Code Status
INVALID_IMPORT_KEY 400
IMPORT_KEY_CONFLICT 400
INVALID_FILE_CONTENT 400
INVALID_FILE_NAME 400
UNSUPPORTED_FILE_TYPE 400
FILE_FORMAT_MISMATCH 400
FILE_TOO_LARGE 400
INVALID_EXPIRY_DATE 400
EMPLOYEE_NOT_FOUND 400
EMPLOYEE_OUT_OF_SCOPE 400
CATEGORY_NOT_FOUND 400
CATEGORY_NOT_USABLE 400
IDEMPOTENCY_KEY_CONFLICT 409
IDEMPOTENCY_PAYLOAD_MISMATCH 422

Statuses