---
title: "Search playtable views"
method: POST
path: "/api/playtable-views/search"
tags: ["playtable_views"]
---

# Search playtable views

`POST /api/playtable-views/search`

## Request

- Base URL: `https://beta.getsales.io/playtables/v1`
- URL: `https://beta.getsales.io/playtables/v1/api/playtable-views/search`
- Auth: HTTP bearer and API key in header `Team-SID`

List saved views of a playtable - grid lenses and workflow audiences. Scope with filter.playtable_sid + object_type for one tab; q searches names; include workflow_sources to see which views are live audiences; counts.groups.object_type feeds tab badges. Use it to resolve a view name into a pt_vw_ sid. NOT for listing the objects matching a view - execute the stored definition via people/companies search.

Contract:
- MCP tool `search_playtable_views`, registry package `mcp.playtables/playtable_views`, mount `playtables.tables`.
- Operation `search`, response envelope `search`.
- Flags: read only.

## Request body

- SearchPlaytableViewsRequest: Request body of `search_playtable_views`.
  - `filter` object: Field filters, ANDed: {field: {eq | ne | in | nin | gte | lte | gt | lt | is_null}}; q inside it is free text. Omit for every row.
    - `q` string: Free-text over view names (MySQL LIKE prefix/infix).
    - `sid` object: View sid(s), pt_vw_ prefix.
      - `eq` string
      - `in` string[]
    - `playtable_sid` object: Primary scope - views of one table (pt_tb_).
      - `eq` string
      - `in` string[]
    - `object_type` object: Tab filter: people | company.
      - `eq` 'people' | 'company'
      - `in` string[]
    - `name` object: Exact name match; substring goes through q.
      - `eq` string
      - `in` string[]
    - `created_at` object: ISO 8601 range; combine bounds in one object.
      - `gte` string
      - `lte` string
      - `gt` string
      - `lt` string
    - `deleted_at` object: Default scope is { is_null: true } (live views).
      - `gte` string
      - `lte` string
      - `is_null` boolean
  - `include` string[]: Relations to attach to every item; omit for the bare rows.
  - `sort` object: One column and its direction; omit for the default order.
    - `field` 'created_at' | 'name', required: The column to order by.
    - `direction` 'asc' | 'desc': asc or desc; default desc.
  - `page_size` integer: 0..500, default 50; 0 = counts only, 1 = the first row.
  - `cursor` string, nullable: pagination.next_cursor of the previous page.

## Response `200`

`search` success envelope.

- SearchPlaytableViewsResponse
  - `success` true, required
  - `operation` 'search', required
  - `items` object[], required
    - `item` object, required
      - `sid` string, required: View sid (pt_vw_…).
      - `team_sid` string, required: Owning team (ts_tm_…, external - gs.service.id).
      - `playtable_sid` string, required: Owner playtable (pt_tb_…).
      - `object_type` 'people' | 'company', required: Object tab the view lenses: people | company. Fixed at create.
      - `name` string, required: View name; unique per (playtable, object_type) among live rows.
      - `columns` object[], required: Ordered left→right; [] = base-attribute catalog fallback.
        - `column_type` 'group' | 'field' | 'field_group', required: 'field' = custom field of the table; 'group' = built-in attribute group of the object.
        - `column_value` string, nullable, required: For 'field': pt_fd_ sid of the custom field. For 'group': built-in attribute-group key of the object_type. null for 'field_group'.
        - `column_values` object[], nullable: 'field_group' only: the band's member fields in grid order.
          - `column_value` string, required
          - `width` integer, required
          - `is_visible` boolean, required
        - `is_collapsed` boolean, nullable: 'field_group' only: the band folded to its tag.
        - `column_name` string, nullable, required: Header label override; null = catalog / field name.
        - `is_pinned` boolean, required: Pinned to the left edge of the grid.
        - `width` number, required: Column width in px (40..1000).
        - `is_visible` boolean, required: Hidden columns keep their slot and order.
      - `sort` object[], required: Applied in array order; max 3 entries.
        - `field` string, required: Built-in object column ("created_at", "full_name") or "record.<slug>" custom-field reference.
        - `direction` 'asc' | 'desc', required: 'asc' | 'desc'.
      - `filter` union, required: Stored filter AST (§4.18-atom tree); null = whole tab.
        - object
          - `and` object[], required
        - object
          - `or` object[], required
        - object
          - `not` object, required: Recursive node: the same object shape repeats here. A static OpenAPI document cannot express the cycle, so this level is documented as an open object.
        - object
          - `any` object, required
            - `path` string, required: Array-valued path - the only way to reach inside an array.
            - `where` object, required: Recursive node: the same object shape repeats here. A static OpenAPI document cannot express the cycle, so this level is documented as an open object.
        - object
          - `field` string, required: Namespaced path: built-in object attribute or "record.<slug>" of the same tab; element-relative inside any.where.
          - `op` object, required
            - `eq` union: Scalar equality. eq: null is rejected - use is_null.
              - …
            - `ne` union: Scalar inequality. ne: null is rejected - use is_null.
              - …
            - `in` union[]: Value in list, 1..100 scalars.
              - …
            - `nin` union[]: Value not in list, 1..100 scalars.
              - …
            - `gt` union: Greater than; string operand = ISO 8601 datetime.
              - …
            - `gte` union: >= bound; pair with lte in the SAME op for a range.
              - …
            - `lt` union: Less than; string operand = ISO 8601 datetime.
              - …
            - `lte` union: <= bound; pair with gte in the SAME op for a range.
              - …
            - `is_null` boolean: true = absent-or-null; false = present and non-null.
            - `contains` string: Case-insensitive substring match.
            - `not_contains` string: Negated case-insensitive substring match.
            - `contains_any` string[]: 1..50 strings; true when ANY is a ci substring.
            - `not_contains_any` string[]: 1..50 strings; true when NONE is a ci substring.
            - `starts_with` string: Case-insensitive prefix match.
        - unknown
      - `created_by` object, required: Actor that created the view (AccessIdentityValue).
        - `actor_type` 'user' | 'support' | 'api_key' | 'system' | 'agent', required
        - `actor_sid` string, nullable, required
        - `team_sid` string, required
        - `actor_name` string, nullable: The OAuth client that acted ("Claude", "n8n"); null for a user, an API key or a system job.
        - `oauth_client_sid` string, nullable: The acting OAuth client (id_oc_*); null off the OAuth path.
        - `reason` string, nullable: Why a system actor wrote the row (snapshot_capture_job, ...); null otherwise.
        - `permissions` object, required: Internal audit context: the grant set the actor held at write time. Not a contract.
        - `cluster_id` integer, nullable: Internal audit context: the cluster that served the write.
        - `trace_id` string, nullable: Internal audit context: the trace id of the request that wrote the row.
      - `deleted_by` object, nullable, required: Actor that soft-deleted the view; null while live.
        - `actor_type` 'user' | 'support' | 'api_key' | 'system' | 'agent', required
        - `actor_sid` string, nullable, required
        - `team_sid` string, required
        - `actor_name` string, nullable: The OAuth client that acted ("Claude", "n8n"); null for a user, an API key or a system job.
        - `oauth_client_sid` string, nullable: The acting OAuth client (id_oc_*); null off the OAuth path.
        - `reason` string, nullable: Why a system actor wrote the row (snapshot_capture_job, ...); null otherwise.
        - `permissions` object, required: Internal audit context: the grant set the actor held at write time. Not a contract.
        - `cluster_id` integer, nullable: Internal audit context: the cluster that served the write.
        - `trace_id` string, nullable: Internal audit context: the trace id of the request that wrote the row.
      - `created_at` string, required: ISO 8601 UTC.
      - `updated_at` string, required: ISO 8601 UTC.
      - `deleted_at` string, nullable, required: ISO 8601 UTC; null = live (soft delete).
    - `included` object, required
      - `playtable` object: Owner playtable row (PlaytableDomain - entities/playtables.md). Present when requested and found.
      - `workflow_sources` object[]: Sources consuming this view as an audience (WorkflowSourceDomain - entities/workflow_sources.md); max 20, created_at DESC.
  - `pagination` object, required
    - `next_cursor` string, nullable, required
    - `has_more` boolean, required
    - `total_count` integer, nullable, required
  - `applied_filters` object, required
  - `includes` string[], required
  - `meta` object, required
    - `trace_id` string, required: UUID v7; same 128-bit value as the X-Trace-Id header.
    - `span_id` string, required: 16 hex chars, root span of this request.
    - `timestamp` string, required: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
    - `duration_ms` integer, required: Server-side wall clock.
    - `team_sid` string, nullable: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
    - `actor_type` string, nullable: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.
  - `counts` object
    - `total_count` integer, required: Rows matching the filter (full filter scope, not the page).
    - `groups` object, required
      - `object_type` object, required: View distribution across the two object tabs (feeds tab badges).
        - `people` integer, required
        - `company` integer, required

## Other responses

- `4XX`: MCP error envelope. `error.code` is one of validation_failed, nothing_to_update, not_found, relation_not_found, invalid_transition, limit_exceeded, payment_required, duplicate_rejected, conflict, delete_blocked, unauthorized, forbidden, rate_limited, not_implemented.
- `5XX`: MCP error envelope with `error.code` internal_error or service_unavailable.

---

[API](https://skmtc.dev/getsales/apis/getsales-public-contract-gs-service-playtables.md) - [All operations](https://skmtc.dev/getsales/apis/getsales-public-contract-gs-service-playtables/llms.txt) - [OpenAPI document](https://skmtc.dev/getsales/apis/getsales-public-contract-gs-service-playtables/revisions/aa394506515d?raw)
