# Search Categories

Operation ID: `searchCategories`

Group: Value Accounting › Categories

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

`POST /value-accounting/categories/search`

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

Search value accounting categories by name — the exact name, or any category whose name contains a fragment. Read-only, cursor-paginated. A category is the grouping label value objects, custom value objects and value centers are filed under. Use filters.name to resolve a full name to its id (the name is this resource's unique semantic key, so at most one row matches) and filters.nameContains for a type-ahead: its sibling, the categories data-set (GET value-accounting/categories) can only filter on the EXACT name, which is why this target exists. Omitting filters entirely returns the whole catalog, paged, exactly as the list does. A filter matching nothing returns an empty items array with HTTP 200, never a 404 — 'no category by that name' and 'no categories at all' are both simply empty. Rows carry the same fields as getCategory (GET value-accounting/categories/:id). POST rather than GET because a free-text fragment does not belong in a URL.

Finds categories by name — either the exact name, or any category whose name contains a fragment, matched case-insensitively.

Use `filters.name` when you hold the name a caller typed and want the one category that holds it: the name is this resource's unique semantic key, so an exact match returns at most one row. Use `filters.nameContains` for a type-ahead or a fuzzy lookup; the routed list's `filter[name][eq]` cannot do that, which is the reason this target exists beside it.

An empty `filters` is a valid request for the whole catalog, paged. A filter that matches nothing returns an empty `items` array with HTTP 200 — not a 404: a name matching no category and a catalog with no categories are both simply empty.

Rows carry the same fields as getCategory (GET value-accounting/categories/:id), so a search result can be used wherever a fetched category can.

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

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `filters` | object | no | How to narrow the search. Omit it — or send it with no members — to page through every category, which is what the categories data-set (GET value-accounting/categories) returns. Supplying both members narrows by both. Example: `{"nameContains":"research"}`. |
| `filters.name` | string | no | Exact category name, matched on the stored text (case- and space-sensitive). The name is this resource's unique semantic key, so at most one category can match; a name that matches nothing yields an empty page, not an error. Use this to turn a name a caller typed in full into the id every other categories endpoint is keyed by. |
| `filters.nameContains` | string | no | Fragment the category name must contain, matched case-insensitively anywhere in the name. This is the lookup the routed list cannot do. Matching is a substring match, not a pattern language: the fragment is taken as literal text apart from the SQL wildcards % and _, which are not escaped and therefore still act as wildcards. A fragment matching nothing yields an empty page, not an error. |
| `page` | object | no | Cursor and page size. Omit for the first page at the default size. Example: `{"size":50}`. |
| `page.cursor` | string | no | Opaque forward cursor from a previous response's pagination.nextCursor; omit for the first page. Do not construct or decode it — a token is bound to this endpoint, so one this endpoint did not issue (a cursor from another list, or one altered by hand) raises INVALID_CURSOR rather than silently restarting at the first page, which would make a paging loop repeat forever. Keep filters identical across the pages of one walk; changing it mid-walk re-interprets the cursor against a different result set. It encodes the LAST ROW of the page you received, not a position, so the walk resumes AT THAT ROW rather than at a count: a row created or removed before your position cannot make a later page repeat a row you already saw or skip one you have not. |
| `page.size` | number | no | Maximum number of categories to return. Defaults to 50, capped at 200; a larger value is clamped rather than rejected, so the server may return fewer but never more. |

```json
{}
```

## Response

`200` Success

Under `data` (searchCategoriesOutput):

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `items` | array<object> | yes | The categories on this page, one row per category, in the same shape getCategory (GET value-accounting/categories/:id) returns. Empty when nothing matched — an empty page with HTTP 200, never a 404. Ordered by id ascending — a unique, immutable key, so a rename never moves a row across a page boundary. The cursor is a KEYSET cursor over that order (it resumes at the last row of the page you received), so the order is stable across the pages of one walk in the strong sense: a category created after your cursor position appears on a later page, one created before it does not, and no row is ever repeated or skipped, whatever else is written while you walk. |
| `items[].id` | string | yes | Id (a UUID) of the category — the id getCategory, updateCategory and deleteCategory (GET, PATCH and DELETE value-accounting/categories/:id) are keyed by, and what a master-data record's categoryId points at. |
| `items[].name` | string | yes | Display name of the category, e.g. 'Research & Development'. Unique across all categories — this resource's semantic key. |
| `items[].description` | string | no | Longer free-text explanation of what the category is for. Absent — not null — when it was never set or has been cleared. |
| `items[].lastModifiedDate` | date-time | yes | Instant the category last changed, as ISO 8601 UTC (YYYY-MM-DDTHH:mm:ss.sssZ). The same value the list and the keyed read publish. |
| `pagination` | object | yes | Pagination cursor for this page. |
| `pagination.nextCursor` | string | no | Opaque cursor to pass as `page.cursor` for the next page; absent on the last page. |
| `pagination.hasMore` | boolean | yes | True when more categories remain beyond this page. |

```json
{
  "data": {
    "items": [
      {
        "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "name": "<name>",
        "description": "<description>",
        "lastModifiedDate": "2026-01-15T09:30:00.000Z"
      }
    ],
    "pagination": {
      "nextCursor": "<nextCursor>",
      "hasMore": true
    }
  },
  "diagnostics": [
    {
      "code": "<code>",
      "message": "<message>",
      "severity": "error",
      "path": [
        "<path>"
      ],
      "details": "<details>"
    }
  ]
}
```

## Errors

| Code | Status |
| --- | --- |
| `INVALID_CURSOR` | 400 |

## Statuses

- `400` — Invalid request or business failure. Codes: INVALID_CURSOR
- `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
