Update Payroll Template

PATCH /accounting/payroll-templates/{id}

Group: Accounting › Payroll Templates · Operation ID: updatePayrollTemplate

Updates the payroll template with the given identifier. Only the header fields in the request body change.

Header fields are optional and omitting one leaves it unchanged. categories and entityIds are each a complete set. Send categories and the template ends up with exactly those. A stored category whose id is left out is deleted, and the deletion is refused while any payroll item still uses it. To keep a category, include it with its id. To add one, include it without an id. Send entityIds and the template serves exactly those entities. Omit either to leave the stored set unchanged. status is not an input. It is recomputed on every write from whether an active netPay and an active grossPay category are present. The response is empty. Read the updated record with GET accounting/payroll-templates/:id.

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.
id path string yes The unique identifier for the payroll template to update.

Request body

Required, application/json: updatePayrollTemplateInput.

Field Type Required Description
name string no The new name. Omit to leave it unchanged. It must stay unique across payroll templates.
groupBy string no The new grouping. One of 'Employee', 'Department' or 'Multi-level'. Omit to leave it unchanged.
journalEntryDate string no The new journal entry date rule. Accepted values: 'payrollDate', 'endDate'. Omit to leave it unchanged.
journalEntryGroupBy string no The new default journal aggregation. One of 'account', 'accountAndPayrollCategory', 'payrollCategory' or 'payrollCategoryByEmployee'. Omit to leave it unchanged.
description string no The new description. Omit to leave it unchanged.
clearingAccountId string no The new clearing account. Omit to leave it unchanged. See id on GET accounting/accounts/:id.
source string no The new source. Accepted values: 'datev', 'datevEmployeePayroll', 'datevEmployeePayrollPersonLevel', 'rippling', 'lexware', 'briars', 'gusto', 'adpGLReport', 'adpPayrollHistory', 'sage', 'none'. Omit to leave it unchanged.
entityIds array of string no The complete set of legal entities this template serves. Sending it replaces the assignment. Omit it to leave the current set unchanged. At least one entity if sent. See id on GET base/entities.
categories array of object no The complete set of categories. Sending it replaces them. Include an existing category with its id to keep it, and leave one out to delete it. Omit the field to leave the stored categories unchanged.
categories[].id string no The identifier of an existing category to keep. Omit for a new category. It must belong to this template.
categories[].name string yes The name of the category. Unique within the template.
categories[].subType string yes What the category represents. One of 'grossPay', 'deduction', 'netPay' or 'employer'. At most one netPay category per template.
categories[].status string no Whether the category is usable. One of 'active' or 'inactive'. Defaults to 'active'.
categories[].payee string no Who gets paid, as a payee code from your tenant's configured payee list, for example 'employee', 'payrollProvider', 'benefitsProvider' or 'taxOffice'.
categories[].isManagedFromPayroll boolean yes Whether payment for this category is managed from payroll. Required, the category model has no default.
categories[].debitAccountId string no The account debited for this category. See id on GET accounting/accounts/:id.
categories[].creditAccountId string no The account credited for this category. See id on GET accounting/accounts/:id.
categories[].debitJournalAggregation string no How debit journal lines are aggregated. One of 'account', 'accountAndPayrollCategory', 'payrollCategory' or 'payrollCategoryByEmployee'. Defaults to the template's setting. 'payrollCategoryByEmployee' requires groupBy 'Employee'.
categories[].creditJournalAggregation string no How credit journal lines are aggregated. The same values and rule as the debit side apply.

Example:

{
  "name": "<name>",
  "groupBy": "<groupBy>",
  "journalEntryDate": "<journalEntryDate>",
  "journalEntryGroupBy": "<journalEntryGroupBy>",
  "description": "Revised for 2027",
  "clearingAccountId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "source": "<source>",
  "entityIds": [
    "<entityIds>"
  ],
  "categories": [
    {
      "id": "6c9e2b41-8a35-4f70-b183-2d5a7c04e916",
      "name": "Gross Pay",
      "subType": "grossPay",
      "isManagedFromPayroll": false,
      "debitAccountId": "7c1a9e40-2b53-4d68-9f01-3a5b7c9d1e24"
    },
    {
      "name": "Pension",
      "subType": "deduction",
      "payee": "benefitsProvider",
      "isManagedFromPayroll": true,
      "creditAccountId": "7c1a9e40-2b53-4d68-9f01-3a5b7c9d1e24"
    }
  ]
}

Response

200 Success

Response headers

Errors

Code Status
NOT_FOUND 400
CATEGORY_NOT_FOUND 400
REFERENCE_NOT_FOUND 400
DUPLICATE_NAME 400
NO_CATEGORIES 400
DUPLICATE_CATEGORY_NAME 400
MULTIPLE_NET_PAY_CATEGORIES 400
AGGREGATION_REQUIRES_EMPLOYEE_GROUPING 400
NO_ENTITIES 400
NO_CATEGORY_ACCOUNTS 400
IDEMPOTENCY_KEY_CONFLICT 409
IDEMPOTENCY_PAYLOAD_MISMATCH 422

Statuses