Update a payroll template

Operation ID: updatePayrollTemplate

Group: Accounting › Payroll Templates

Open in the interactive reference

PATCH /accounting/payroll-templates/{id}

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

Updates a payroll template with the fields you send. A field you leave out keeps its current value. categories and entityIds are lists.

A list you send replaces the whole list, so include every item you want to keep. Leave a list out to keep it as it is.

Send categories or entityIds to change the template's categories or legal entities.

To keep an existing category, include it with its id. To add one, include it without an id. An existing category you leave out is deleted, and the request is refused while any payroll item still uses that category.

status isn't an input. On every update, the template is 'active' when it has an active netPay category and an active grossPay category, and 'inactive' otherwise.

The response is empty. To see the updated template, use GET accounting/payroll-templates/:id.

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.
id path string yes The unique identifier of the payroll template you want to update. Example: "d4a1c7e0-2b93-4f56-8071-9e3a5c8b1d42".

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. Accepted values: 'Employee', 'Department', '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. Accepted values: 'account', 'accountAndPayrollCategory', 'payrollCategory', 'payrollCategoryByEmployee'. Omit to leave it unchanged.
description string no The new description. Omit to leave it unchanged. Example: "Revised for 2027".
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<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<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. Example: [{"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"}].
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. Accepted values: 'grossPay', 'deduction', 'netPay', 'employer'. At most one netPay category per template.
categories[].status string no Whether the category is usable. Accepted values: 'active', '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. Accepted values: 'account', 'accountAndPayrollCategory', 'payrollCategory', '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.
categories[].debitTags array<object> no Tags stamped on every journal line this category debits, at most one per dimension. Supported dimension: 'vendor'. Requires debitJournalAggregation to be above 'account'.
categories[].debitTags[].dimension string yes The tag dimension. Accepted values: 'vendor'.
categories[].debitTags[].id string yes The tagged record. For 'vendor', see id on GET accounting/vendors/:id.
categories[].creditTags array<object> no Tags stamped on every journal line this category credits. The same values and rules as the debit side apply.
categories[].creditTags[].dimension string yes The tag dimension. Accepted values: 'vendor'.
categories[].creditTags[].id string yes The tagged record. For 'vendor', see id on GET accounting/vendors/:id.
{
  "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

{
  "data": {},
  "diagnostics": [
    {
      "code": "<code>",
      "message": "<message>",
      "severity": "error",
      "path": [
        "<path>"
      ],
      "details": "<details>"
    }
  ]
}

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
TAGS_REQUIRE_CATEGORY_AGGREGATION 400
INVALID_CATEGORY_TAG 400
IDEMPOTENCY_KEY_CONFLICT 409
IDEMPOTENCY_PAYLOAD_MISMATCH 422

Statuses