# Get Payroll Template

`GET /accounting/payroll-templates/{id}`

Group: Accounting › Payroll Templates · Operation ID: `getPayrollTemplate`

Returns the payroll template with the given identifier, including its categories.

A template describes how an imported payroll file is turned into a journal entry. groupBy says at what level amounts are entered, journalEntryGroupBy how journal lines are consolidated, and each category maps one payroll line type onto a debit and a credit account. To look up a template by name, which is unique, use POST accounting/payroll-templates/search.

[Open in the interactive reference](https://docs.api.lensing.ai/?op=getPayrollTemplate)

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

## Response

`200` Success

Under `data` (getPayrollTemplateOutput):

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes | The unique identifier for the payroll template. |
| `name` | string | yes | The name of the payroll template. Unique across payroll templates. |
| `description` | string | no | A free-form description of the payroll template. |
| `groupBy` | string | yes | The level at which payroll amounts are entered. One of 'Employee', 'Department' or 'Multi-level'. |
| `journalEntryDate` | string | yes | The date the generated journal entry is posted on. Possible values: 'payrollDate', 'endDate'. |
| `journalEntryGroupBy` | string | yes | The default consolidation level for generated journal lines. One of 'account', 'accountAndPayrollCategory', 'payrollCategory' or 'payrollCategoryByEmployee'. |
| `deductionsType` | string | yes | Whether deduction amounts in imported data arrive positive or negative. Possible values: 'positive', 'negative'. |
| `source` | string | no | The payroll system this template imports from. Possible values: 'datev', 'datevEmployeePayroll', 'datevEmployeePayrollPersonLevel', 'rippling', 'lexware', 'briars', 'gusto', 'adpGLReport', 'adpPayrollHistory', 'sage', 'none'. |
| `status` | string | no | The lifecycle status of the payroll template. One of 'create', 'active', 'inactive'. It is computed from the template's categories, not set through the API. |
| `clearingAccountId` | string | no | The GL account payroll amounts are cleared through. See id on GET accounting/accounts/:id. |
| `entities` | array of string | yes | The names of the legal entities this template is mapped to. An empty array when it is mapped to none. |
| `lastModifiedDate` | string (date-time) | yes | The date and time the payroll template last changed, in UTC. Format YYYY-MM-DDTHH:mm:ss.sssZ. |
| `categories` | array of object | no | The payroll categories defined on this template, each mapping one payroll line type onto a debit and a credit account. An empty array when the template has none. |
| `categories[].id` | string | yes | The unique identifier for the payroll category. |
| `categories[].name` | string | yes | The name of the category, for example 'Gross Salary'. Unique within the template. |
| `categories[].subType` | string | yes | The kind of payroll amount this category represents. One of 'grossPay', 'deduction', 'netPay' or 'employer'. |
| `categories[].status` | string | no | The lifecycle status of the category. One of 'active' or 'inactive'. |
| `categories[].payee` | string | no | Who the amount is paid to, as a payee code from your tenant's configured payee list, for example 'employee', 'payrollProvider', 'benefitsProvider' or 'taxOffice'. |
| `categories[].isManagedFromPayroll` | boolean | no | Whether payments for this category are recorded through payroll rather than separately. |
| `categories[].debitAccountId` | string | no | The GL account this category debits. See id on GET accounting/accounts/:id. |
| `categories[].debitJournalAggregation` | string | no | The consolidation level for journal lines posted to the debit account. Absent means the template default applies. |
| `categories[].creditAccountId` | string | no | The GL account this category credits. See id on GET accounting/accounts/:id. |
| `categories[].creditJournalAggregation` | string | no | The consolidation level for journal lines posted to the credit account. Absent means the template default applies. |

## Errors

| Code | Status |
| --- | --- |
| `NOT_FOUND` | 400 |

## Statuses

- `400` — Invalid request or business failure. Codes: NOT_FOUND
- `401` — Missing or invalid access token
- `403` — Not authorized
- `404` — Not found
- `429` — Too many requests
- `500` — Internal server error
