# Search Payroll Payment

`POST /accounting/payroll-payments/search`

Group: Accounting › Payroll Payments · Operation ID: `searchPayrollPayment`

Returns the payroll payments that match the given filters, each with its applications.

Only outbound payments that settle payroll are in scope: a payment qualifies when its items point at a payroll payment application. Every filter is applied on top of that, so this returns strictly fewer records than POST accounting/outbound-payments/search. Matching nothing returns an empty items array, not an error.

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

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

## Request body

Required, `application/json`: searchPayrollPaymentInput.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `filters` | object | no | The filters to apply. A payroll payment must match every filter you send. Omit to return all payroll payments. |
| `filters.id` | string | no | Limits results to the payroll payment with this identifier. |
| `filters.payrollPaymentNumber` | string | no | Limits results to the payroll payment with this number. |
| `filters.entityId` | string | no | Limits results to payments made by this legal entity. See id on GET base/entities. |
| `filters.entityName` | string | no | Limits results to payments made by a legal entity with this name. The match is exact and case-sensitive. |
| `filters.paymentAccountId` | string | no | Limits results to payments booked against this GL account. See id on GET accounting/accounts/:id. |
| `filters.paymentType` | string | no | Limits results to payments made this way. Values include 'manual' and 'bank'. Any other value matches no payment. |
| `filters.paymentCurrency` | string | no | Limits results to payments in this currency. Format ISO 4217, for example 'USD'. |
| `filters.status` | string | no | Limits results to payments in this status. Values include 'successful', 'rejected', 'cancelled', 'processing', 'partiallySuccessful', 'unknown', 'unsigned', 'manuallyRecorded', 'scheduled' and 'voided'. Any other value matches no payment. |
| `filters.approvalStatus` | string | no | Limits results to payments in this approval status. |
| `filters.externalId` | string | no | Limits results to payments with this upstream identifier. It is not unique, so this can match several payments. |
| `page` | object | no | Pagination controls. Omit for the first page. |
| `page.cursor` | string | no | The cursor from the previous response's pagination.nextCursor. Omit for the first request. |
| `page.size` | number | no | The number of payroll payments per page. Defaults to 50. A value above 200 is treated as 200, not rejected. |

Example:

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

## Response

`200` Success

Under `data` (searchPayrollPaymentOutput):

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `items` | array of object | yes | The payroll payments that match, most recently created first. An empty array when nothing matches. |
| `items[].id` | string | yes | The unique identifier for the payroll payment. |
| `items[].payrollPaymentNumber` | string | no | The payment number. Absent until a number has been assigned. |
| `items[].paymentDate` | string (date) | yes | The date the payment is made. Format YYYY-MM-DD. |
| `items[].paymentCurrency` | string | yes | The currency the payment is made in. Format ISO 4217, for example 'USD'. Governs totalPaid and every application amount. |
| `items[].paymentType` | string | yes | How the payment was made: the instrument, not the origin. Values include 'manual' and 'bank'. |
| `items[].status` | string | yes | The status of the payment. Values include 'successful', 'rejected', 'cancelled', 'processing', 'partiallySuccessful', 'unknown', 'unsigned', 'manuallyRecorded', 'scheduled' and 'voided'. |
| `items[].approvalStatus` | string | no | The approval status of the payment. |
| `items[].description` | string | no | A description recorded on the payment. |
| `items[].totalPaid` | string (decimal) | no | The total amount paid, in paymentCurrency. |
| `items[].externalId` | string | no | The identifier this payment has in the upstream system that produced it. It is not unique. |
| `items[].paymentAccountId` | string | no | The GL account the payment is booked against. See id on GET accounting/accounts/:id. |
| `items[].paymentAccountName` | string | no | The name of the GL account the payment is booked against. |
| `items[].entityId` | string | no | The legal entity that made the payment. See id on GET base/entities. |
| `items[].entityName` | string | no | The name of the legal entity that made the payment. |
| `items[].lastModifiedDate` | string (date-time) | yes | The date and time the payroll payment last changed, in UTC. Format YYYY-MM-DDTHH:mm:ss.sssZ. |
| `items[].origin` | string | no | The source system this record came from, as free-form text. Absent when none was supplied. |
| `items[].applications` | array of object | no | The payroll payment applications, each tying part of this payment to one payroll detail and one payee. An empty array when the payment has none. |
| `items[].applications[].id` | string | yes | The unique identifier for the payroll payment application. |
| `items[].applications[].applicationNumber` | string | no | The application number. |
| `items[].applications[].description` | string | no | A description of the application. |
| `items[].applications[].amountPaid` | string (decimal) | no | The amount paid by this application, as a decimal in currency. |
| `items[].applications[].currency` | string | no | The currency governing amountPaid, the payroll run's currency. Format ISO 4217, for example 'USD'. |
| `items[].applications[].paymentStatus` | string | no | The status of the paying payment item, mirrored onto the application. It uses the same values as the payment's status. |
| `items[].applications[].payrollDetailId` | string | no | The payroll detail this application settles. See id on GET accounting/payroll-details/:id. |
| `items[].applications[].accountId` | string | no | The GL account this application is booked against. See id on GET accounting/accounts/:id. |
| `items[].applications[].accountName` | string | no | The name of the GL account this application is booked against. |
| `items[].applications[].accountNumber` | string | no | The number of the GL account this application is booked against. |
| `items[].applications[].payeeCode` | string | no | The payee, as a payroll-payee code from your tenant's configuration, for example 'employee' or 'taxOffice'. |
| `items[].applications[].payeeLabel` | string | no | The display label for the payee. |
| `items[].applications[].vendorId` | string | no | The vendor being paid, when the payee is a vendor. See id on GET accounting/vendors/:id. |
| `items[].applications[].vendorName` | string | no | The name of the vendor being paid. |
| `items[].applications[].employeeId` | string | no | The employee being paid, when the payee is an employee. There is no endpoint for it. |
| `items[].applications[].employeeName` | string | no | The name of the employee being paid. |
| `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 payments remain beyond this page. |

## Statuses

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