# Search Chart Of Accounts

`POST /accounting/chart-of-accounts/search`

Group: Accounting › Charts of Accounts · Operation ID: `searchChartOfAccounts`

Returns the charts of accounts that match the given filters, ordered by name.

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

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

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `filters` | object | no | The filters to apply. A chart of accounts must match every filter you send. Omit to return all charts of accounts. |
| `filters.id` | string | no | Limits results to the chart of accounts with this identifier. The match is exact. A value that is not a valid identifier matches nothing. |
| `filters.name` | string | no | Limits results to charts of accounts whose name contains this text. The match is case-insensitive, and '%' and '_' match themselves rather than acting as wildcards. An empty or blank value matches nothing. |
| `filters.description` | string | no | Limits results to charts of accounts whose description contains this text. The match is case-insensitive. |
| `filters.accountNumbering` | string | no | Limits results to charts of accounts with this numbering strategy. Possible values: 'hierarchical', 'manual'. Any other value matches nothing. |
| `filters.accountNumberingDigits` | string | no | Limits results to charts of accounts with this account-number width. Possible values: 'sixDigits', 'sevenDigits', 'eightDigits', 'nineDigits', 'tenDigits'. Any other value matches nothing. A width and the numbering strategy are independent. |
| `page` | object | no | Pagination controls. Omit for the first page. |
| `page.cursor` | string | no | The cursor from the previous response's pagination.nextCursor. Omit on the first request. |
| `page.size` | number | no | The number of charts of accounts per page, between 1 and 200. Defaults to 50. A value outside that range fails with INVALID_PAGE_SIZE rather than being adjusted. |

Example:

```json
{
  "filters": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "name": "<name>",
    "description": "<description>",
    "accountNumbering": "<accountNumbering>",
    "accountNumberingDigits": "<accountNumberingDigits>"
  },
  "page": {
    "cursor": "<cursor>",
    "size": 0
  }
}
```

## Response

`200` Success

Under `data` (searchChartOfAccountsOutput):

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `items` | array of object | yes | The charts of accounts that match, ordered by name. An empty array when nothing matches. |
| `items[].id` | string | yes | The unique identifier for the chart of accounts. |
| `items[].name` | string | yes | The display name of the chart of accounts. |
| `items[].accountNumbering` | string | yes | How account numbers are assigned within this chart of accounts. Possible values: 'hierarchical' (numbers follow the account's position in the hierarchy), 'manual' (numbers are assigned by hand). |
| `items[].accountNumberingDigits` | string | no | The total width of an account number, which caps how deep the hierarchy can go. Possible values: 'sixDigits' (up to 4 levels), 'sevenDigits' (5), 'eightDigits' (6), 'nineDigits' (7), 'tenDigits' (8). Absent when no width was set. A width and the numbering strategy are independent, so check this field directly rather than inferring it from accountNumbering. |
| `items[].description` | string | no | A free-form description of the chart of accounts. Absent when none was set. |
| `items[].lastModifiedDate` | string (date-time) | yes | The date and time the chart-of-accounts record 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. |

## Errors

| Code | Status |
| --- | --- |
| `INVALID_PAGE_SIZE` | 400 |

## Statuses

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