# Search Vendor Credit

`POST /accounting/vendor-credits/search`

Group: Accounting › Vendor Credits · Operation ID: `searchVendorCredit`

Returns the vendor credits that match the given filters, each with its line items.

Searches vendor credits and pages through the matches, returning the full record, header and line items, for each. Matching nothing returns an empty items array, not an error.

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

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

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `filters` | object | no | The filters to apply. A vendor credit must match every filter you send. Omit to return all vendor credits. |
| `filters.id` | string | no | Limits results to the vendor credit with this identifier. |
| `filters.vendorCreditNumber` | string | no | Limits results to the vendor credit with this number. |
| `filters.referenceNumber` | string | no | Limits results to credits with this vendor reference number. It is not unique, so this can match several credits. |
| `filters.vendorId` | string | no | Limits results to credits from this vendor. See id on GET accounting/vendors/:id. |
| `filters.entityId` | string | no | Limits results to credits booked under this legal entity. See id on GET base/entities. |
| `filters.vendorName` | string | no | Limits results to credits from a vendor with this name. |
| `filters.entityName` | string | no | Limits results to credits booked under a legal entity with this name. |
| `filters.status` | string | no | Limits results to credits in this application status. Values include 'unapplied', 'partiallyApplied' and 'applied'. Any other value matches no credit. |
| `filters.externalId` | string | no | Limits results to credits with this upstream identifier. It is not unique, so this can match several credits. |
| `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 vendor credits per page. Defaults to 50. A value above 200 is treated as 200, not rejected. |

Example:

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

## Response

`200` Success

Under `data` (searchVendorCreditOutput):

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `items` | array of object | yes | The vendor credits that match, most recently created first. An empty array when nothing matches. |
| `items[].id` | string | yes | The unique identifier for the vendor credit. |
| `items[].vendorCreditNumber` | string | no | The vendor credit number. Absent until a number has been assigned. |
| `items[].referenceNumber` | string | yes | The vendor's credit memo reference number, as printed on the vendor's document. |
| `items[].creditDate` | string (date) | yes | The date on the vendor's credit memo. Format YYYY-MM-DD. |
| `items[].currency` | string | yes | The currency the credit is denominated in. Format ISO 4217, for example 'USD'. Governs totalAmount and every line amount. |
| `items[].status` | string | no | The application status, how much of the credit has been set against vendor bills. Values include 'unapplied', 'partiallyApplied' and 'applied'. |
| `items[].totalAmount` | string (decimal) | no | The total credit amount, in currency. |
| `items[].externalId` | string | no | The identifier this credit has in the upstream system that produced it. It is not unique. |
| `items[].vendorId` | string | no | The vendor this credit is from. See id on GET accounting/vendors/:id. |
| `items[].vendorName` | string | no | The name of the vendor this credit is from. |
| `items[].entityId` | string | no | The legal entity this credit is booked under. See id on GET base/entities. |
| `items[].entityName` | string | no | The name of the legal entity this credit is booked under. |
| `items[].lastModifiedDate` | string (date-time) | yes | The date and time the vendor credit 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[].lines` | array of object | no | The credit line items, in their order on the credit. An empty array when the credit has none. |
| `items[].lines[].id` | string | yes | The unique identifier for the line item. |
| `items[].lines[].lineNumber` | string | no | The line item number. |
| `items[].lines[].description` | string | no | A description of the credit line item. |
| `items[].lines[].lineType` | string | no | The type of line item. Possible values: 'expense', 'prepaid'. |
| `items[].lines[].amount` | string (decimal) | no | The line credit amount, in the credit currency. |
| `items[].lines[].currency` | string | no | The currency for the line. It always matches the credit currency. Format ISO 4217, for example 'USD'. |
| `items[].lines[].netAmount` | string (decimal) | no | The line amount excluding VAT, in the credit currency. |
| `items[].lines[].vatAmount` | string (decimal) | no | The computed VAT amount on the line, in the credit currency. |
| `items[].lines[].vatPercentage` | string (decimal) | no | The VAT rate applied, as a percentage. 19 means 19%, not 0.19. |
| `items[].lines[].accountId` | string | no | The GL account this line credits. See id on GET accounting/accounts/:id. |
| `items[].lines[].departmentId` | string | no | The department this line is allocated to. See id on GET departments/: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 credits 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
