# Search payroll templates

Operation ID: `searchPayrollTemplate`

Group: Accounting › Payroll Templates

[Open in the interactive reference](https://docs.api.lensing.ai/lensing/v1/endpoints/searchPayrollTemplate)

`POST /accounting/payroll-templates/search`

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

Searches payroll templates. Each match is the same record that GET accounting/payroll-templates/:id returns. Search here to find a template by name or by a legal entity it serves.

## 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`: searchPayrollTemplateInput.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `filters` | object | no | The filters to apply. A template must match every filter you send. Omit to return all payroll templates. Example: `{"status":"active"}`. |
| `filters.id` | string | no | Limits results to the template with this identifier. |
| `filters.name` | string | no | Limits results to the template with this exact name. The name is unique across payroll templates, so this returns at most one template. |
| `filters.groupBy` | string | no | Limits results to templates that enter amounts at this level. Accepted values: 'Employee', 'Department', 'Multi-level'. Any other value matches no template. |
| `filters.status` | string | no | Limits results to templates in this lifecycle status. Accepted values: 'create', 'active', 'inactive'. Any other value matches no template. |
| `filters.source` | string | no | Limits results to templates importing from this payroll system. Accepted values: 'datev', 'datevEmployeePayroll', 'datevEmployeePayrollPersonLevel', 'rippling', 'lexware', 'briars', 'gusto', 'adpGLReport', 'adpPayrollHistory', 'sage', 'none'. Any other value matches no template. |
| `filters.journalEntryGroupBy` | string | no | Limits results to templates with this default journal consolidation level. Accepted values: 'account', 'accountAndPayrollCategory', 'payrollCategory', 'payrollCategoryByEmployee'. Any other value matches no template. |
| `filters.entityId` | string | no | Limits results to templates mapped to this legal entity. An id that matches no entity returns no template. See id on GET base/entities. |
| `page` | object | no | Pagination controls. Omit for the first page. Example: `{"size":50}`. |
| `page.cursor` | string | no | The cursor from the previous response's pagination.nextCursor. Omit for the first page. |
| `page.size` | number | no | The number of payroll templates per page. Defaults to 50. A value above 200 is treated as 200, not rejected. |

```json
{
  "filters": {
    "status": "active"
  },
  "page": {
    "size": 50
  }
}
```

## Response

`200` Success

Under `data` (searchPayrollTemplateOutput):

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `items` | array<object> | yes | The payroll templates on this page, most recently created first. An empty array when nothing matches. |
| `items[].id` | string | yes | The unique identifier for the payroll template. |
| `items[].name` | string | yes | The name of the payroll template. Unique across payroll templates. |
| `items[].description` | string | no | A free-form description of the payroll template. |
| `items[].groupBy` | string | yes | The level at which payroll amounts are entered. Possible values: 'Employee', 'Department', 'Multi-level'. |
| `items[].journalEntryDate` | string | yes | The date the generated journal entry is posted on. Possible values: 'payrollDate', 'endDate'. |
| `items[].journalEntryGroupBy` | string | yes | The default consolidation level for generated journal lines. Possible values: 'account', 'accountAndPayrollCategory', 'payrollCategory', 'payrollCategoryByEmployee'. |
| `items[].deductionsType` | string | yes | Whether deduction amounts in imported data arrive positive or negative. Possible values: 'positive', 'negative'. |
| `items[].source` | string | no | The payroll system this template imports from. Possible values: 'datev', 'datevEmployeePayroll', 'datevEmployeePayrollPersonLevel', 'rippling', 'lexware', 'briars', 'gusto', 'adpGLReport', 'adpPayrollHistory', 'sage', 'none'. |
| `items[].status` | string | no | The lifecycle status of the payroll template. Possible values: 'create', 'active', 'inactive'. It is computed from the template's categories, not set through the API. |
| `items[].clearingAccountId` | string | no | The general ledger account payroll amounts are cleared through. See id on GET accounting/accounts/:id. |
| `items[].entities` | array<string> | yes | The names of the legal entities this template is mapped to. An empty array when it is mapped to none. |
| `items[].lastModifiedDate` | date-time | yes | The date and time the payroll template last changed, in UTC. Format YYYY-MM-DDTHH:mm:ss.sssZ. |
| `items[].categories` | array<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. |
| `items[].categories[].id` | string | yes | The unique identifier for the payroll category. |
| `items[].categories[].name` | string | yes | The name of the category, for example 'Gross Salary'. Unique within the template. |
| `items[].categories[].subType` | string | yes | The kind of payroll amount this category represents. Possible values: 'grossPay', 'deduction', 'netPay', 'employer'. |
| `items[].categories[].status` | string | no | The lifecycle status of the category. Possible values: 'active', 'inactive'. |
| `items[].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'. |
| `items[].categories[].isManagedFromPayroll` | boolean | no | Whether payments for this category are recorded through payroll rather than separately. |
| `items[].categories[].debitAccountId` | string | no | The general ledger account this category debits. See id on GET accounting/accounts/:id. |
| `items[].categories[].debitJournalAggregation` | string | no | The consolidation level for journal lines posted to the debit account. Absent means the template default applies. |
| `items[].categories[].creditAccountId` | string | no | The general ledger account this category credits. See id on GET accounting/accounts/:id. |
| `items[].categories[].creditJournalAggregation` | string | no | The consolidation level for journal lines posted to the credit account. Absent means the template default applies. |
| `items[].categories[].debitTags` | array<object> | no | Tags stamped on every journal line this category debits, one per dimension. Absent when none. |
| `items[].categories[].debitTags[].dimension` | string | yes | The tag dimension, e.g. 'vendor'. |
| `items[].categories[].debitTags[].id` | string | yes | The tagged record. For 'vendor', see id on GET accounting/vendors/:id. |
| `items[].categories[].creditTags` | array<object> | no | Tags stamped on every journal line this category credits, one per dimension. Absent when none. |
| `items[].categories[].creditTags[].dimension` | string | yes | The tag dimension, e.g. 'vendor'. |
| `items[].categories[].creditTags[].id` | string | yes | The tagged record. For 'vendor', see id on GET accounting/vendors/:id. |
| `pagination` | object | yes | The pagination cursor for this page. |
| `pagination.nextCursor` | string | no | The cursor for the next page. Pass it as page.cursor. Absent on the last page. |
| `pagination.hasMore` | boolean | yes | True when more matches remain beyond this page. |

```json
{
  "data": {
    "items": [
      {
        "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "name": "<name>",
        "description": "<description>",
        "groupBy": "<groupBy>",
        "journalEntryDate": "<journalEntryDate>",
        "journalEntryGroupBy": "<journalEntryGroupBy>",
        "deductionsType": "<deductionsType>",
        "source": "<source>",
        "status": "<status>",
        "clearingAccountId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "entities": [
          "<entities>"
        ],
        "lastModifiedDate": "2026-01-15T09:30:00.000Z",
        "categories": [
          {
            "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
            "name": "<name>",
            "subType": "<subType>",
            "status": "<status>",
            "payee": "<payee>",
            "isManagedFromPayroll": true,
            "debitAccountId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
            "debitJournalAggregation": "<debitJournalAggregation>",
            "creditAccountId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
            "creditJournalAggregation": "<creditJournalAggregation>",
            "debitTags": [
              null
            ],
            "creditTags": [
              null
            ]
          }
        ]
      }
    ],
    "pagination": {
      "nextCursor": "<nextCursor>",
      "hasMore": true
    }
  },
  "diagnostics": [
    {
      "code": "<code>",
      "message": "<message>",
      "severity": "error",
      "path": [
        "<path>"
      ],
      "details": "<details>"
    }
  ]
}
```

## Statuses

- `400` — Invalid request or business failure
- `401` — The request carries no valid access token.
- `403` — Not authorized
- `404` — Not found
- `429` — Too many requests from this client address. The response has no body and no `Retry-After` header.
- `500` — Internal server error
