---
title: "Search playtables"
method: POST
path: "/api/playtables/search"
tags: ["playtables"]
---

# Search playtables

`POST /api/playtables/search`

## Request

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

The team's tables (CRM workspace containers, each with a companies tab and a people tab). Filter by sid or name; q matches name and description; include people_counts and companies_counts for the badges, data_sources_counts and workflows_counts. The first call: resolve a table name the user said into a pt_tb_ sid before any other tables call. page_size 0 = counts only. Not for the rows inside a table (search_people, search_companies).

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

## Request body

- SearchPlaytablesRequest: Request body of `search_playtables`.
  - `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.
    - `sid` object: Prefix-validated pt_tb_ sid(s).
      - `eq` string
      - `in` string[]
    - `name` object: Exact match (dedup checks); substring matching goes through q.
      - `eq` string
      - `in` string[]
    - `agent_sid` object: The AI SDR the table picked (ub_ag_…); is_null:true = the tables on the team's default agent.
      - `eq` string
      - `in` string[]
      - `is_null` boolean
    - `q` string: Full-text LIKE (prefix/infix) over name + description.
    - `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 rows).
      - `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' | 'updated_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.

- SearchPlaytablesResponse
  - `success` true, required
  - `operation` 'search', required
  - `items` object[], required
    - `item` object, required
      - `sid` string, required
      - `team_sid` string, required
      - `name` string, required
      - `description` string, nullable, required
      - `agent_sid` string, nullable, required: The AI SDR picked for this table (ub_ag_…, block 10 step 10.2): the agent that works every thread of its people, every setting on the agent itself (its Brief, goal, link, scenarios: update_agent). Null = the team's default agent, whichever it is. The table's own setup of before (ai_sdr_setup, 2026-10-12 to 2026-10-30) became an agent of its own in step 10.3.
      - `company_default_view_sid` string, required: pt_vw_… default view of the companies tab; auto-created with the table, read-only.
      - `people_default_view_sid` string, required: pt_vw_… default view of the people tab; auto-created with the table, read-only.
      - `config` object, required
        - `auto_run` boolean, required: When true, action fields fire automatically on rows entering the table (empty→queued). Default false.
      - `created_by` object, required
        - `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_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
      - `updated_at` string, required
      - `deleted_at` string, nullable, required
    - `included` object, required
      - `views` object[]: PlaytableViewDomain rows (1:N, default limit 50, created_at ASC) - see ./playtable_views.md.
        - `sid` string, required
      - `fields` object[]: PlaytableFieldDomain rows (1:N, default limit 100, created_at ASC) - see ./playtable_fields.md.
        - `sid` string, required
      - `data_sources_counts` object: DataSourceCounts of the sources feeding the table (every live one, no view scope): total_count + groups by status / type / object_type - see ./data_sources.md.
        - `total_count` integer, required
      - `people_counts` object: Reduced people count: total_count scoped to the people tab's DEFAULT VIEW filter (ES-served), indexing_count = the table's rows not in the index yet - see ./people.md.
        - `total_count` integer, required
        - `indexing_count` integer, required
      - `companies_counts` object: Reduced company count: total_count scoped to the companies tab's DEFAULT VIEW filter (ES-served), indexing_count = the table's rows not in the index yet - see ./companies.md.
        - `total_count` integer, required
        - `indexing_count` integer, required
      - `workflows_counts` object: WorkflowCounts of the workflows whose home is the table: total_count + groups.status - see ./workflows.md.
        - `total_count` integer, required
      - `outreach_counts` object: PlaytableOutreachCounts (2026-09-26): those workflows' outreach counted in PEOPLE, per channel, the list's accept / reply rates. linkedin.invited / accepted: people a connection request went to / who accepted; linkedin.messaged: people a message reached (a message, an InMail, or the invite's note, which LinkedIn delivers as the thread's first message at the accept); linkedin.replied: people who answered at or after they were messaged; email.emailed / replied: the same by email. A rate is replied / messaged (emailed), people over people - see ./activities.md.
        - `linkedin` object, required
          - `invited` integer, required
          - `accepted` integer, required
          - `messaged` integer, required
          - `replied` integer, required
        - `email` object, required
          - `emailed` integer, required
          - `replied` integer, required
  - `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: Playtable rows matching the filter scope.
    - `groups` union, required: Always empty - no group axes ('sid' is metrics-only). PHP empty map serialises as [].
      - object
      - unknown[]
        - unknown

## 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)
