# Returns the expense categories that match the given filters.

`POST /accounting/expense-categories/search`

Group: Accounting › Expense Categories · Operation ID: `searchExpenseCategory`

All filters are optional and are combined with AND. Omit every filter to match all expense categories. This endpoint accepts externalId, which is not unique, so a lookup on it can return several categories.

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

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

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `filters` | object | no | The filters to apply. A category must match every filter you send. Omit to return all expense categories. |
| `filters.id` | string | no | Limits results to the category with this identifier. |
| `filters.category` | string | no | Limits results to the category with this exact name, for example 'Meals'. The name is unique within the tenant, so this returns at most one category. The match is case-sensitive. |
| `filters.categoryType` | string | no | Limits results to categories of this kind. One of 'Pur', 'Dis' or 'PerDiem'. Any other value matches no category. |
| `filters.status` | string | no | Limits results to categories in this lifecycle status. Accepted values: 'active', 'inactive'. Any other value matches no category. |
| `filters.externalId` | string | no | Limits results to categories with this external identifier. It is not unique, so this can return several categories. |
| `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 page. |
| `page.size` | number | no | The number of expense categories per page. Defaults to 50. A value above 200 is treated as 200, not rejected. |

Example:

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

## Response

`200` Success

Under `data` (searchExpenseCategoryOutput):

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `items` | array of object | yes | The expense categories on this page, most recently created first. An empty array when nothing matches. |
| `items[].id` | string | yes | The unique identifier for the expense category. |
| `items[].category` | string | yes | The display name of the expense category, for example 'Meals'. Unique within the tenant. |
| `items[].categoryType` | string | no | The kind of expense. One of 'Pur', 'Dis' or 'PerDiem'. 'Dis' is distance traveled. |
| `items[].reimbursable` | boolean | yes | Whether expenses in this category are reimbursed to the employee. |
| `items[].status` | string | no | The lifecycle status of the expense category. Possible values: 'active', 'inactive'. An inactive category stays readable so historical expense items still resolve, and is not offered for new ones. |
| `items[].requireAttachment` | boolean | no | Whether an expense in this category must have a receipt attachment. |
| `items[].requireAttendees` | boolean | no | Whether an expense in this category must list attendees. |
| `items[].externalId` | string | no | The identifier this category has in an external system. It is not unique. |
| `items[].lastModifiedDate` | string (date-time) | yes | The date and time the expense category 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. |

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