Match file names to employees and document categories

Operation ID: matchDocuments

Group: People Management › Documents

Open in the interactive reference

POST /people/documents/match

Read-only: A read that takes its filters in the body. Changes nothing, and ignores Idempotency-Key.

Matches file names to employees and document categories using the same naming rules as the bulk document upload in Everest. Use it to check a batch of file names before you import the files with POST people/documents/import.

Each file name is split at the separator into parts, read in the order given by fileNameParts. The part named by employeeIdentifier identifies the employee; a 'category' part names the document category by its label or name, unless you send one categoryId for every file. An 'expiryDate' part is read with expiryDateFormat. A trailing 'ignored' part takes all remaining text.

The response has one item per file name, in the order you sent them. A file name that does not match is not an error: its item says what was found and lists its problems. Only HR administrators can call this endpoint.

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.

Request body

Required, application/json: matchDocumentsInput.

Field Type Required Description
fileNames array<string> yes The file names to match, each with its extension. Send 1 to 500 names. Example: ["EMP-1001_Payslip_2026-12-31.pdf"].
employeeIdentifier string yes What the identifier part of a file name holds. 'name' matches the firstName and lastName parts instead of an identifier part. One of: "employeeNumber" (The employee number.), "externalEmployeeId" (The external employee id.), "payrollProviderId" (The payroll provider's id for the employee.), "email" (The employee's e-mail address, compared case-insensitively.), "name" (The employee's first and last name, compared case-insensitively.). Example: "employeeNumber".
separator string no The text that separates the parts of a file name. Defaults to '_'. Must not be empty. Example: "_".
fileNameParts array<string> yes The parts of a file name, in order. A trailing 'ignored' part takes any number of remaining parts, including none. Example: ["identifier","category","expiryDate"].
categoryId string no The document category for every file. See id on GET people/document-categories. Omit to read the category from the file name's 'category' part.
expiryDateFormat string no How an 'expiryDate' part is written. Required when fileNameParts contains 'expiryDate'. One of: "yyyy-MM-dd" (For example 2026-12-31.), "dd.MM.yyyy" (For example 31.12.2026.), "yyyyMMdd" (For example 20261231.). Example: "yyyy-MM-dd".
defaultExpiryDate date no The expiry date for every file whose name has no expiry date part. Format YYYY-MM-DD.
employeeStatuses array<string> no The statuses of the employees a file name can match. Defaults to ['active']. Cancelled employees never match. Example: ["active"].
{
  "fileNames": [
    "EMP-1001_Payslip_2026-12-31.pdf"
  ],
  "employeeIdentifier": "employeeNumber",
  "fileNameParts": [
    "identifier",
    "category",
    "expiryDate"
  ]
}

Response

200 Success

Under data (matchDocumentsOutput):

Field Type Required Description
items array<object> yes One item per file name, in the order you sent them. Example: [{"fileName":"EMP-1001_Payslip_2026-12-31.pdf","employee":{"result":"matched","id":"3f2a9c14-6b1d-4f0e-9a52-0c7d8e1b2a34","candidates":[{"id":"3f2a9c14-6b1d-4f0e-9a52-0c7d8e1b2a34","name":"Alex Example","employeeNumber":"EMP-1001"}]},"category":{"result":"matched","id":"8c1e4b27-2d9a-4c63-b0f1-5e7a9d3c6b18","candidates":[{"id":"8c1e4b27-2d9a-4c63-b0f1-5e7a9d3c6b18","label":"Payslip"}]},"expiryDate":"2026-12-31","problems":[]}].
items[].fileName string yes The file name, as you sent it.
items[].employee object yes The employee the file name identifies.
items[].employee.result string yes Whether exactly one employee matched. One of: "matched" (Exactly one employee matched; see id.), "none" (No employee matched.), "multiple" (Several employees matched equally; see candidates.).
items[].employee.id string no The matched employee. See id on GET people/person/:id. Present only when result is 'matched'.
items[].employee.candidates array<object> yes The employees that matched: one when result is 'matched', several when it is 'multiple', none when it is 'none'.
items[].employee.candidates[].id string yes The employee's identifier.
items[].employee.candidates[].name string yes The employee's name.
items[].employee.candidates[].employeeNumber string no The employee number.
items[].category object yes The document category the file is filed under.
items[].category.result string yes Whether exactly one document category matched. One of: "matched" (Exactly one document category matched; see id.), "none" (No document category matched.), "multiple" (Several document categories matched equally; see candidates.).
items[].category.id string no The matched document category. See id on GET people/document-categories. Present only when result is 'matched'.
items[].category.candidates array<object> yes The document categories that matched: one when result is 'matched', several when it is 'multiple', none when it is 'none'.
items[].category.candidates[].id string yes The document category's identifier.
items[].category.candidates[].label string yes The document category's label.
items[].expiryDate date no The expiry date read from the file name, or defaultExpiryDate. Format YYYY-MM-DD. Absent when neither gives one.
items[].problems array<object> yes What stops this file from being imported as it is. Empty when the file matched one employee and one category.
items[].problems[].code string yes What is wrong. One of: "partCountMismatch" (The file name does not have the number of parts fileNameParts describes. 'detail' is the number of parts found.), "invalidExpiryDate" (The expiry date part is not a date in expiryDateFormat. 'detail' is the part.), "unsupportedExtension" (The extension is not pdf, tif, tiff, jpg, jpeg or png. 'detail' is the extension.), "employeeNotFound" (No employee matched.), "employeeAmbiguous" (Several employees matched.), "externalEmployeeIdNotUnique" (Several employees share this external employee id.), "categoryNotFound" (No document category matched.), "categoryAmbiguous" (Several document categories matched.).
items[].problems[].detail string no The value the problem is about, where the code describes one.
{
  "data": {
    "items": [
      {
        "fileName": "EMP-1001_Payslip_2026-12-31.pdf",
        "employee": {
          "result": "matched",
          "id": "3f2a9c14-6b1d-4f0e-9a52-0c7d8e1b2a34",
          "candidates": [
            {
              "id": "3f2a9c14-6b1d-4f0e-9a52-0c7d8e1b2a34",
              "name": "Alex Example",
              "employeeNumber": "EMP-1001"
            }
          ]
        },
        "category": {
          "result": "matched",
          "id": "8c1e4b27-2d9a-4c63-b0f1-5e7a9d3c6b18",
          "candidates": [
            {
              "id": "8c1e4b27-2d9a-4c63-b0f1-5e7a9d3c6b18",
              "label": "Payslip"
            }
          ]
        },
        "expiryDate": "2026-12-31",
        "problems": []
      }
    ]
  },
  "diagnostics": [
    {
      "code": "<code>",
      "message": "<message>",
      "severity": "error",
      "path": [
        "<path>"
      ],
      "details": "<details>"
    }
  ]
}

Errors

Code Status
NO_FILES 400
TOO_MANY_FILES 400
INVALID_NAMING_SETTINGS 400
CATEGORY_NOT_FOUND 400

Statuses