Creates a payroll detail.

POST /accounting/payroll-details

Group: Accounting › Payroll Details · Operation ID: createPayrollDetail

The response contains only the new run's id. Read the record with GET accounting/payroll-details/:id if you need its stored state, where payrollDetailNumber appears once assigned. The payroll must post in balance: gross pay must equal deductions plus net pay across every line, or the request is refused with AMOUNT_NOT_BALANCED. The posting period is derived, not supplied: the template's journal-entry-date rule picks the payroll date or the period end date, and the entity's default transactions book supplies the period, so a missing book, a date no period covers, and a closed or locked period are three distinct errors. The payroll is created non-draft and, unless status says otherwise, pending approval.

Open in the interactive reference

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: createPayrollDetailInput.

Field Type Required Description
templateId string yes The payroll template this run uses. See id on GET accounting/payroll-templates/:id. It supplies the categories, the journal-entry-date rule, the group-by and the clearing account.
entityId string yes The legal entity that owns the payroll. See id on GET base/entities.
grouping string yes How the payroll is grouped. Values include 'Employee', 'Department' and 'Multi-level'.
status string no The status of the payroll. Defaults to 'pendingApproval' when omitted.
payrollDate string (date) yes The issue date of the payroll. Use format YYYY-MM-DD.
startDate string (date) no The first day of the payroll period. Use format YYYY-MM-DD.
endDate string (date) no The last day of the payroll period, which must not be before the start date. Use format YYYY-MM-DD.
currency string yes The currency the payroll is denominated in. Format ISO 4217, for example 'USD'.
description string no A description of the payroll.
isNetPayCategoryMapped boolean no Whether the net-pay category is matched in the account mapping. Defaults to false.
origin string no The source system this record came from, as free-form text, for example 'Ramp'. Omit it and it stays unset. The server does not set a value.
lines array of object yes The payroll's lines, one per employee or department depending on the grouping.
lines[].employeeId string no The employee this line is for. There is no endpoint for it. With grouping 'Employee', a line that names an employee but no department has the department backfilled from that employee's primary job.
lines[].departmentId string no The department this line is charged to. See id on GET departments/:id.
lines[].lineItems array of object yes The amounts on this line, one per payroll category. Each category must be reachable from the payroll's template. An item whose amount is null is dropped before the payroll is saved.
lines[].lineItems[].categoryId string yes The payroll category this amount belongs to. There is no endpoint for it. It must be an active category of the payroll's template.
lines[].lineItems[].amount string (decimal) yes The amount for this category, as a decimal in the payroll's currency.
attachments array of object no Files to attach to the payroll. Omit for none, unless your tenant requires an attachment, in which case omitting them fails with ATTACHMENT_REQUIRED.
attachments[].fileName string yes The display name of the attached file.
attachments[].fileId string yes The identifier of the uploaded file in file storage, as a text reference. There is no endpoint for it.

Example:

{
  "templateId": "b7e4c1a9-3f52-4d86-9017-5a2c8e0b4d61",
  "entityId": "7c1a9e40-2b53-4d68-9f01-3a5b7c9d1e24",
  "grouping": "Employee",
  "status": "<status>",
  "payrollDate": "2026-08-31",
  "startDate": "2026-08-01",
  "endDate": "2026-08-31",
  "currency": "USD",
  "description": "August 2026 payroll",
  "isNetPayCategoryMapped": true,
  "origin": "<origin>",
  "lines": [
    {
      "employeeId": "3f1a8c25-9d47-4e60-b892-0c5a7e3b1d84",
      "lineItems": [
        {
          "categoryId": "9b2d5e10-4c78-4a36-8f51-6e0a3c7b2d95",
          "amount": "5000.00"
        },
        {
          "categoryId": "e5c7a390-1d64-4b28-9a07-2f8b6d4c1e53",
          "amount": "5000.00"
        }
      ]
    }
  ],
  "attachments": [
    {
      "fileName": "<fileName>",
      "fileId": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
    }
  ]
}

Response

200 Success

Under data (createPayrollDetailOutput):

Field Type Required Description
id string yes The unique identifier for the created payroll run.

Response headers

Errors

Code Status
REFERENCE_NOT_FOUND 400
CATEGORY_NOT_IN_TEMPLATE 400
INVALID_DATE_RANGE 400
AMOUNT_NOT_BALANCED 400
NO_ACCOUNTING_BOOK 400
NO_ACCOUNTING_PERIOD 400
POSTING_PERIOD_CLOSED 400
TOO_MANY_LINES 400
ATTACHMENT_REQUIRED 400
IDEMPOTENCY_KEY_CONFLICT 409
IDEMPOTENCY_PAYLOAD_MISMATCH 422

Statuses