Skip to main content

Entity and Entities

const { Entity, Entities } = sdk.asAdmin().Customers()

Available on asAdmin() and asUser(). All calls resolve { status, result }.

Entity.get(humanId, fields?)​

GET /api/v2/entity/{humanId}

ParameterTypeDescription
humanIdstringRequired. Throws customers/missing-humanId if empty
fieldsstring[] or { include?, exclude? }Limit the returned fields. An array becomes ?fields=a,b, an object ?include=…&exclude=…
await Entity.get('SC-ZW2VEG')
await Entity.get('SC-ZW2VEG', ['data.name', 'data.city'])
await Entity.get('SC-ZW2VEG', { exclude: ['data.bankHistory'] })

Errors: 400 entity/not-found. The entity type is not checked, the same call reads companies, people and groups.

Entities.list(params)​

POST /api/v2/entities/list. Lists entities of one or more types.

ParameterTypeDescription
entityTypes('ou' | 'person' | 'group')[]Required
fieldsstring[]Additional fields to return. Always included: entityType, id, humanId, data.title, data.name, data.firstName, data.lastName, data.legalType
filterModelobject{ logicOperator: 'and' | 'or', items: [{ field, fieldType?, operator, value }] }
hideInactivebooleanOnly data.active === true
sortarrayWithout pagination: ES clauses [{ 'data.name.keyword': 'asc' }]. With pagination: [{ field, sort: 'asc' | 'desc', fieldType? }]
pagination{ page, pageSize = 100 }Switches the response to { rows, totalCount }. Window limit 10,000

Response:

  • without pagination: an array of all matches. Each element is the source document plus score;
  • with pagination: { rows, totalCount }.

Errors: 400 entity/missing-entity-type, 400 entity/pagination-window-exceeded.

Filter operators​

TypeOperators
stringcontains, doesNotContain, startsWith, endsWith, equals, isEmpty, isNotEmpty
booleanequals, isEmpty, isNotEmpty
virtual relation fieldsincludes (default), excludes

Virtual fields: __GROUPS__, __MEMBERS__, __EMPLOYEES__, __EMPLOYMENTS__, __ROLES__.

Aliases: originalHumanId → humanId. contacts.<type> (email, phone, mobile, fax). data.bankHistory → data.bankHistory.iban.

Entities.search(params)​

POST /api/v2/entities/search. Single-type search with free text.

ParameterTypeDescription
entityTypestringRequired. Throws customers/missing-entity-type
quickFilterstringFree text against n-gram fields
fields, filterModel, hideInactive, sortAs above
searchSubEntitiesbooleanAlso search sub-entities
idsOnlybooleanReturn identifiers only

Returns an array ordered by score. For OU results, the ancestors of the matches are appended without a score.

See the search guide for examples.