---
title: "Search Entities"
method: POST
path: "/v2/entities/search"
tags: ["Entity API"]
---

# Search Entities

`POST /v2/entities/search`

Search entities with advanced filtering, sorting, and pagination. Supports filtering by entity type, name search, field filters (with OR between filter groups and AND within groups), and custom sorting.

## Request body

- SvstorePublicapiSearchEntitiesRequest
  - `teamId` string — The ID of the team.
  - `entityTypeId` string, nullable — Optional filter by entity type ID.
  - `entityTypeKey` string, nullable — Optional filter by entity type key (alternative to entity_type_id).
  - `filterGroups` SvstoreEntityFilterGroup[] — Filter groups for complex filtering. OR between groups, AND within each group.
    - `filters` SvstoreEntityFieldFilter[] — AND within group
      - union
        - object
          - `boolValue` union, required
            - object
              - …
            - object
              - …
            - object
              - …
            - object
              - …
          - `fieldId` string, nullable
          - `fieldKey` string, nullable
        - object
          - `entityRef` union, required
            - object
              - …
            - object
              - …
            - object
              - …
            - object
              - …
          - `fieldId` string, nullable
          - `fieldKey` string, nullable
        - object
          - `enumValue` union, required
            - object
              - …
            - object
              - …
            - object
              - …
            - object
              - …
          - `fieldId` string, nullable
          - `fieldKey` string, nullable
        - object — FILE fields support only is-null / is-not-null; other operations on the predicate are rejected at the serialization boundary.
          - `fileValue` union, required
            - object
              - …
            - object
              - …
            - object
              - …
            - object
              - …
          - `fieldId` string, nullable
          - `fieldKey` string, nullable
        - object
          - `multiSelectValue` union, required
            - object
              - …
            - object
              - …
            - object
              - …
            - object
              - …
            - object
              - …
            - object
              - …
          - `fieldId` string, nullable
          - `fieldKey` string, nullable
        - object
          - `number` union, required
            - object
              - …
            - object
              - …
            - object
              - …
            - object
              - …
            - object
              - …
            - object
              - …
            - object
              - …
            - object
              - …
          - `fieldId` string, nullable
          - `fieldKey` string, nullable
        - object
          - `text` union, required
            - object
              - …
            - object
              - …
            - object
              - …
            - object
              - …
            - object
              - …
            - object
              - …
            - object
              - …
            - object
              - …
            - object
              - …
            - object
              - …
          - `fieldId` string, nullable
          - `fieldKey` string, nullable
        - object
          - `timestamp` union, required
            - object
              - …
            - object
              - …
            - object
              - …
            - object
              - …
            - object
              - …
            - object
              - …
            - object
              - …
            - object
              - …
          - `fieldId` string, nullable
          - `fieldKey` string, nullable
        - object
          - `userRef` union, required
            - object
              - …
            - object
              - …
            - object
              - …
            - object
              - …
          - `fieldId` string, nullable
          - `fieldKey` string, nullable
    - `sourceFilter` SvstoreEntitySourcePredicate — Built-in entity source supports filtering by source_app_instance_id. **Set exactly ONE of:** eq, ne
      - `eq` string — **Option: eq**
      - `ne` string — **Option: ne**
  - `fieldSorts` SvstoreEntitySort[] — Sorting specifications.
    - union
      - object
        - `entitySource` GoogleProtobufEmpty, required — A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
        - `descending` boolean — false = ASC, true = DESC
      - object
        - `fieldId` string, required
        - `descending` boolean — false = ASC, true = DESC
      - object
        - `fieldKey` string, required
        - `descending` boolean — false = ASC, true = DESC
  - `pageSize` integer, nullable — Maximum number of results to return. Default is 2000, maximum is 5000.
  - `pageToken` string, nullable — Token for pagination. Leave empty for the first request.
  - `key` string, nullable — Optional filter by entity key (exact match).

## Response `200`

Success

- SvstorePublicapiSearchEntitiesResponse
  - `data` SvstoreEntity[] — The list of matching entities.
    - `id` string — Identity
    - `key` string
    - `name` string
    - `teamId` string
    - `entityTypeId` string
    - `entityTypeKey` string
    - `createdByUserId` string — Audit
    - `updatedByUserId` string
    - `createdAt` string, date-time — A timestamp in RFC 3339 format (e.g., "2025-01-15T01:30:15Z").
    - `updatedAt` string, date-time — A timestamp in RFC 3339 format (e.g., "2025-01-15T01:30:15Z").
    - `deletedAt` string, date-time — A timestamp in RFC 3339 format (e.g., "2025-01-15T01:30:15Z").
    - `fieldValues` SvstoreEntityFieldValue[] — Data
      - `id` string — The EAV row id. NOT populated on entity read paths (Entity.field_values: search / list / get / create / update) since the v4 slim document_json dropped it — it has no consumer there. It IS populated on the listEntityFieldValueHistory RPC, which reads EAV rows directly.
      - `entityId` string
      - `fieldId` string
      - `fieldKey` string
      - `fieldName` string
      - `dataType` 'DATA_TYPE_UNSPECIFIED' | 'TEXT' | 'NUMBER' | 'BOOL' | 'TIMESTAMP' | 'ENUM' | 'ENTITY_REF' | 'USER_REF' | 'UNIQUE' | 'MULTI_SELECT' | 'FILE'
      - `value` union — `Value` represents a dynamically typed value which can be either null, a number, a string, a boolean, a recursive struct value, or a list of values. A producer of value is expected to set one of these variants. Absence of any variant indicates an error. The JSON representation for `Value` is JSON value.
        - number
        - string
        - boolean
        - object
      - `setByUserId` string, nullable — Attribution: who/what set this field value. Stored in the slim document_json and populated on ALL entity read paths (search / list / get / create / update) as well as field-value history.
      - `setByAppInstanceId` string, nullable
      - `createdAt` string, date-time — A timestamp in RFC 3339 format (e.g., "2025-01-15T01:30:15Z").
      - `deletedAt` string, date-time — A timestamp in RFC 3339 format (e.g., "2025-01-15T01:30:15Z").
      - `pinned` boolean — When true, ingestion cannot overwrite this user-set value. Stored in the slim document_json and populated on ALL entity read paths.
    - `sourceAppInstanceIds` string[]
    - `sharedMetadata` SvstoreSharedEntityMetadata — Metadata for entities shared from another team's schema.
      - `sourceTeamId` string
      - `sourceTeamName` string
  - `nextPageToken` string, nullable — Token for retrieving the next page of results. Empty if no more results.

## Other responses

- `default` — Error

---

[API](https://skmtc.net/serval/apis/serval-public-api.md) · [All operations](https://skmtc.net/serval/apis/serval-public-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/serval/serval-public-api/versions/0549515e9384/schema)
