# Search payments

Operation ID: `searchPayment`

Group: Accounting › Payments

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

`POST /accounting/payments/search`

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

Searches payments.

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

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `filters` | object | no | The filters to apply. A payment must match every filter you send. Omit to return all payments. |
| `filters.id` | string | no | Limits results to the payment with this identifier. |
| `filters.paymentNumber` | string | no | Limits results to the payment with this payment number. |
| `filters.paymentType` | string | no | Limits results to payments tendered this way. Possible values: 'check', 'ach', 'wire', 'creditCard', 'directDebit', 'sepaCreditTransfer'. Any other value matches no payment. |
| `filters.customerPaymentStatus` | string | no | Limits results to payments in this lifecycle status. Possible values: 'unapplied', 'partiallyApplied', 'appliedInFull', 'partiallyRefunded', 'refunded', 'disputed', 'chargedBack'. Any other value matches no payment. |
| `filters.disputeStatus` | string | no | Limits results to payments in this dispute state. Possible values: 'disputed', 'chargedBack'. Any other value matches no payment. |
| `filters.paymentReference` | string | no | Limits results to payments with this payer-supplied reference. |
| `filters.customerId` | string | no | Limits results to payments from this customer. See id on GET accounting/customers/:id. |
| `filters.entityId` | string | no | Limits results to payments received by this legal entity. See id on GET base/entities. |
| `filters.paymentDate` | object | no | Limits results to payments whose paymentDate falls in this range. Both bounds are inclusive. Omit either bound to leave that side open. |
| `filters.paymentDate.start` | date | no | The earliest paymentDate to include, inclusive. Format YYYY-MM-DD. |
| `filters.paymentDate.end` | date | no | The latest paymentDate to include, inclusive. Format YYYY-MM-DD. |
| `page` | object | no | The pagination controls. Omit for the first page. |
| `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 payments per page. Defaults to 50. A value above 200 is treated as 200, not rejected. |

```json
{
  "filters": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "paymentNumber": "<paymentNumber>",
    "paymentType": "<paymentType>",
    "customerPaymentStatus": "<customerPaymentStatus>",
    "disputeStatus": "<disputeStatus>",
    "paymentReference": "<paymentReference>",
    "customerId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "entityId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "paymentDate": {
      "start": "2026-01-15",
      "end": "2026-01-15"
    }
  },
  "page": {
    "cursor": "<cursor>",
    "size": 0
  }
}
```

## Response

`200` Success

Under `data` (searchPaymentOutput):

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `items` | array<object> | yes | The payments that match, most recently created first. An empty array when nothing matches. |
| `items[].id` | string | yes | The unique identifier for the payment. |
| `items[].paymentNumber` | string | no | The payment number, unique within the tenant. A human-readable reference used for reconciliation. |
| `items[].paymentDate` | date | yes | The date the payment was made. Format YYYY-MM-DD. |
| `items[].paymentType` | string | yes | The payment method. Possible values: 'check', 'ach', 'wire', 'creditCard', 'directDebit', 'sepaCreditTransfer'. |
| `items[].currency` | string | yes | The currency the customer paid in. Every amount on the payment is in this currency. Format ISO 4217, for example 'USD'. |
| `items[].paymentAccountCurrency` | string | no | The currency of the bank account the payment was received into. Present only when it differs from the payment currency. Format ISO 4217, for example 'USD'. |
| `items[].amount` | decimal | no | The amount paid, in the payment currency. |
| `items[].appliedAmount` | decimal | no | The portion already applied to invoices, in the payment currency. The sum of the payment's applications. |
| `items[].unappliedAmount` | decimal | no | The portion not yet applied to any invoice, in the payment currency. unappliedAmount = amount - appliedAmount - refundAmount. |
| `items[].refundAmount` | decimal | no | The portion refunded through approved refunds, in the payment currency. |
| `items[].bankFeeAmount` | decimal | no | The bank fee deducted from the payment, in the payment currency. |
| `items[].smallBalanceWriteOffAmount` | decimal | no | The total written off as a small residual balance across the payment's applications, in the payment currency. |
| `items[].totalEarlyPaymentDiscount` | decimal | no | The total early-payment discount granted across the payment's applications, in the payment currency. |
| `items[].exchangeRate` | decimal | no | The rate used to convert the payment currency to the entity's functional currency. A ratio, not an amount, with no currency of its own. |
| `items[].customerPaymentStatus` | string | no | The derived lifecycle status of the payment. Possible values: 'unapplied', 'partiallyApplied', 'appliedInFull', 'partiallyRefunded', 'refunded', 'disputed', 'chargedBack'. |
| `items[].disputeStatus` | string | no | The dispute state of the payment. Possible values: 'disputed', 'chargedBack'. Absent on an undisputed payment. |
| `items[].paymentReference` | string | no | The reference the payer supplied with the payment, for example a remittance or wire reference. Absent when none was supplied. |
| `items[].paymentNote` | string | no | A free-form note recorded on the payment. Absent when none was set. |
| `items[].customerId` | string | no | The customer the payment came from. See id on GET accounting/customers/:id. |
| `items[].customerName` | string | no | The name of the customer the payment came from. |
| `items[].thirdPartyPayerId` | string | no | The customer who actually paid, when a third party paid on the invoiced customer's behalf. Absent when the invoiced customer paid. See id on GET accounting/customers/:id. |
| `items[].entityId` | string | no | The legal entity that received the payment. See id on GET base/entities. |
| `items[].accountId` | string | no | The ledger account the payment was posted to. See id on GET accounting/accounts/:id. |
| `items[].accountName` | string | no | The name of the ledger account the payment was posted to. |
| `items[].lastModifiedDate` | date-time | yes | The date and time the payment last changed, in UTC. Format YYYY-MM-DDTHH:mm:ss.sssZ. |
| `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",
        "paymentNumber": "<paymentNumber>",
        "paymentDate": "2026-01-15",
        "paymentType": "<paymentType>",
        "currency": "<currency>",
        "paymentAccountCurrency": "<paymentAccountCurrency>",
        "amount": "19.99",
        "appliedAmount": "19.99",
        "unappliedAmount": "19.99",
        "refundAmount": "19.99",
        "bankFeeAmount": "19.99",
        "smallBalanceWriteOffAmount": "19.99",
        "totalEarlyPaymentDiscount": "19.99",
        "exchangeRate": "19.99",
        "customerPaymentStatus": "<customerPaymentStatus>",
        "disputeStatus": "<disputeStatus>",
        "paymentReference": "<paymentReference>",
        "paymentNote": "<paymentNote>",
        "customerId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "customerName": "<customerName>",
        "thirdPartyPayerId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "entityId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "accountId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "accountName": "<accountName>",
        "lastModifiedDate": "2026-01-15T09:30:00.000Z"
      }
    ],
    "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
