# Search entities

Operation ID: `searchEntities`

Group: Accounting › Entities

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

`POST /base/entities/search`

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

Searches entities. Every filter you send must match. entityName matches a case-insensitive substring; entityNumber, status, entityType, country and parentEntityId match exactly; externalIdentifier matches one identifier exactly and needs both fieldName and value. Results are ordered by creation and paged with an opaque forward cursor: pass pagination.nextCursor back as page.cursor until hasMore is false. Every call sends the Api-Version header: a missing or empty header, or an unknown version, answers 400; a route the requested version does not contain answers 404.

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

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `filters` | object | no | The filters to apply. An entity must match every filter you send. Omit to return all entities. Example: `{"entityName":"acme","status":"active"}`. |
| `filters.entityName` | string | no | Limits results to entities whose name contains this text. The match is case-insensitive. |
| `filters.entityNumber` | string | no | Limits results to the entity with this number. The match is exact. |
| `filters.status` | string | no | Limits results to entities with this status. One of: `"active"`, `"inactive"`, `"created"`. |
| `filters.entityType` | string | no | Limits results to entities of this type. Omit to return both types. One of: `"LegalEntity"`, `"NonLegalReportingEntity"`. |
| `filters.parentEntityId` | string | no | Limits results to the direct children of this entity. An identifier that matches no entity returns an empty page. |
| `filters.country` | string | no | Limits results to entities registered in this country. Format ISO 3166-1 alpha-2, for example 'US'. |
| `filters.externalIdentifier` | object | no | Limits results to entities carrying this external identifier. Both members are required. Several entities may share a value, so this returns the items array. |
| `filters.externalIdentifier.fieldName` | string | yes | The configured key of the external identifier. A fieldName with no configuration fails with UNKNOWN_EXTERNAL_IDENTIFIER. List the configured fieldNames on GET base/entity-external-identifier-fields. |
| `filters.externalIdentifier.value` | string | yes | The identifier as the source system holds it. The match is exact and case-sensitive. |
| `page` | object | no | Cursor and page size. Omit for the first page at the default size. Example: `{"size":50}`. |
| `page.cursor` | string | no | The cursor returned by the previous response as pagination.nextCursor. Do not construct it manually. Omit for the first page. |
| `page.size` | number | no | The number of entities per page. Defaults to 50. Values above 200 are treated as 200, values below 1 as 1. |

```json
{}
```

## Response

`200` Success

Under `data` (searchEntitiesOutput):

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `items` | array<object> | yes | The matching entities. Example: `[{"id":"3b7d5e9c-1a24-4f80-9c6d-2e8f70b13a45","entityName":"Acme GmbH","status":"active","entityType":"LegalEntity","lastModifiedDate":"2026-05-12T09:30:00.000Z"}]`. |
| `items[].id` | string | yes | The unique identifier for the entity. Other resources reference it as entityId. |
| `items[].entityName` | string | yes | The name of the entity, for example 'Acme Inc.'. Unique within the tenant. |
| `items[].entityNumber` | string | no | The entity's business number, assigned by the system. Absent until one is assigned. |
| `items[].currency` | string | no | The entity's functional currency. Format ISO 4217, for example 'USD'. Entity-only: a book's currency for the entity is set on the book's entity assignment. Absent when none has been set. |
| `items[].timeZone` | string | no | The time zone the entity operates in. Format IANA time-zone name, for example 'Europe/Berlin'. Absent when none has been set. |
| `items[].status` | string | no | The lifecycle status of the entity. Possible values: 'active', 'inactive', 'created'. A new entity starts as 'created'. |
| `items[].entityType` | string | no | Whether the entity is a legal entity or a non-legal reporting entity. Possible values: 'LegalEntity', 'NonLegalReportingEntity'. |
| `items[].country` | string | no | The country the entity is registered in. Format ISO 3166-1 alpha-2, for example 'US'. Absent when none has been set. |
| `items[].entityCode` | string | no | A short code for the entity, separate from its entityNumber. Absent until one is assigned. |
| `items[].localeCode` | string | no | The locale for documents sent from this entity. Format BCP 47, for example 'en-US'. Absent when none has been set. |
| `items[].startDate` | date | no | The date the entity became effective. Format YYYY-MM-DD. Absent when none has been set. |
| `items[].endDate` | date | no | The date the entity stops being effective. Format YYYY-MM-DD. Absent when the entity has no scheduled end. |
| `items[].lastModifiedDate` | date-time | yes | The date and time the entity last changed, in UTC. ISO 8601 UTC (YYYY-MM-DDTHH:mm:ss.sssZ). |
| `items[].parentEntityId` | string | no | The parent entity in the entity hierarchy, which a consolidation rolls this entity up to. See id on GET base/entities/:id. Absent on the top-level entity. |
| `items[].registeredAddress` | object | no | The entity's registered address. Absent when none has been set. |
| `items[].registeredAddress.line1` | string | yes | The first address line: street number and name, or PO box. |
| `items[].registeredAddress.line2` | string | no | The second address line: apartment, suite, unit, building, or floor. |
| `items[].registeredAddress.city` | string | yes | The city or locality. |
| `items[].registeredAddress.stateProvince` | string | no | The state, province, or region. |
| `items[].registeredAddress.country` | string | yes | The country of the address. Format ISO 3166-1 alpha-2, for example 'US'. |
| `items[].registeredAddress.zipCode` | string | yes | The postal or ZIP code. |
| `items[].externalIdentifiers` | array<object> | no | External identifiers owned by other systems, at most one per fieldName. Absent or empty when the entity has none. |
| `items[].externalIdentifiers[].fieldName` | string | yes | The configured key of the external identifier, a camelCase slug such as 'netsuiteSubsidiaryId'. |
| `items[].externalIdentifiers[].value` | string | yes | The identifier as the source system holds it. |
| `items[].externalIdentifiers[].externalUrl` | string | no | An absolute http(s) link to the object in the source system. Absent when none is set. |
| `pagination` | object | yes | Cursor and flag for fetching the next page. Example: `{"hasMore":false}`. |
| `pagination.nextCursor` | string | no | The cursor for the next page. Pass it back as page.cursor. Absent on the last page. |
| `pagination.hasMore` | boolean | yes | True when more matches remain beyond this page. |

```json
{
  "data": {
    "items": [
      {
        "id": "3b7d5e9c-1a24-4f80-9c6d-2e8f70b13a45",
        "entityName": "Acme GmbH",
        "status": "active",
        "entityType": "LegalEntity",
        "lastModifiedDate": "2026-05-12T09:30:00.000Z"
      }
    ],
    "pagination": {
      "hasMore": false
    }
  },
  "diagnostics": [
    {
      "code": "<code>",
      "message": "<message>",
      "severity": "error",
      "path": [
        "<path>"
      ],
      "details": "<details>"
    }
  ]
}
```

## Errors

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

## Statuses

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