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

# Search plays

`POST /api/plays/search`

## Request

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

A table's plays as rows: the playbook's born ones (catalog_key set) and the ones saved from a view's filter (catalog_key null), with the audience, the action, the cadence, the switch and what the last run did (last_run_counts). Scope with filter.playtable_sid; page_size:0 = counts only. For the brief and the packaged moves read list_play_catalog; the signal counts behind it are counts.groups.signals of search_companies and search_people with page_size:0.

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

## Request body

- SearchPlaysRequest: Request body of `search_plays`.
  - `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
      - `eq` string: Play sid (pt_pl_…).
      - `in` string[]
    - `playtable_sid` object: The Plays tab of a table: every table's list passes { eq: <pt_tb_> }.
      - `eq` string
      - `in` string[]
    - `catalog_key` object: The playbook's rows ({ is_null: false }) against the plays saved from a view ({ is_null: true }).
      - `eq` 'keep_fresh' | 'congratulate' | 'on_job_change' | 'engage_posts' | 'on_website_visit' | 'find_people_empty' | 'top_up_thin' | 'top_up_silent' | 'top_up_no_reply' | 'top_up_exhausted' | 'find_decision_maker' | 'reengage_dormant' | 'reach_untouched'
      - `in` string[]
      - `is_null` boolean
    - `object_type` object
      - `eq` 'people' | 'company'
      - `in` string[]
    - `action_type` object
      - `eq` 'find_people' | 'add_to_workflow' | 'refresh' | 'congratulate' | 'on_job_change' | 'engage_posts' | 'on_website_visit'
      - `in` string[]
    - `cadence` object
      - `eq` 'manual' | 'daily'
      - `in` string[]
    - `enabled` object: The daily plays that run by themselves: { eq: true }.
      - `eq` boolean
    - `q` string: Free-text LIKE over name.
    - `created_at` object
      - `gte` string
      - `lte` string
      - `gt` string
      - `lt` string
    - `deleted_at` object: Default scope is { is_null: true } (live plays).
      - `gte` string
      - `lte` string
      - `is_null` boolean
  - `sort` object: One column and its direction; omit for the default order.
    - `field` 'created_at' | 'name' | 'last_run_at' | 'next_run_at', 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.

- SearchPlaysResponse
  - `success` true, required
  - `operation` 'search', required
  - `items` object[], required
    - `item` object, required
      - `sid` string, required: Play sid (pt_pl_…).
      - `team_sid` string, required: Owning team (ts_tm_…).
      - `playtable_sid` string, required: The table the play lives in (pt_tb_…): its tab, and the scope of its audience.
      - `catalog_key` 'keep_fresh' | 'congratulate' | 'on_job_change' | 'engage_posts' | 'on_website_visit' | 'find_people_empty' | 'top_up_thin' | 'top_up_silent' | 'top_up_no_reply' | 'top_up_exhausted' | 'find_decision_maker' | 'reengage_dormant' | 'reach_untouched', nullable, required: The playbook entry the row was born from; null = a play saved from a view's filter.
      - `name` string, required: The play's name, 1..255.
      - `object_type` 'people' | 'company', required: What the audience selects: people, or company (accounts).
      - `action_type` 'find_people' | 'add_to_workflow' | 'refresh' | 'congratulate' | 'on_job_change' | 'engage_posts' | 'on_website_visit', required: find_people (a company audience); every other kind runs on a people audience: add_to_workflow, refresh (Keep data fresh), congratulate, on_job_change, engage_posts, on_website_visit.
      - `action` union, required: The action's parameters, the shape of its action_type: the sids of the sources a find_people or add_to_workflow play owns; the moments of a congratulate play; the Do of on_job_change and on_website_visit; the like, the comment and the weekly cap of engage_posts; {} for refresh.
        - object
          - `prompt` string, nullable, required: Who to find at each account ("owner, founder, VP and up"); planned once into a Sales Navigator filter by the play's source. null = everyone the page gives.
          - `per_company_limit` integer, nullable, required: People taken per account, 1..25; null = the whole first page.
          - `data_source_sid` string, nullable, required: The play's own find_people source (ds_sc_…), born at the first run that had accounts; its queue and funnel are read with get_data_source. null until then.
        - object
          - `workflow_sid` string, nullable, required: The workflow the audience enters (wf_wf_…); null while the play waits for one (picked once, with update_play), and fixed from then on.
          - `workflow_source_sid` string, nullable, required: The play's own manual source in that workflow (wf_sr_…), born when the workflow is picked; its entry counters are read with search_workflow_sources.
        - object
          - `moments` object, required: A switch per moment with its own Do under it; a kind absent is off.
            - `birthday` object
              - …
            - `work_anniversary` object
              - …
            - `job_change` object
              - …
        - object
          - `do` 'pause_and_ask' | 'remove_from_workflows' | 'move_to_workflow', required: For a person in a workflow whose title or company moved.
          - `workflow_sid` string, nullable, required: wf_wf_…: where move_to_workflow moves the person (required then).
        - object
          - `like` object, required
            - `on` boolean, required
            - `reaction` 'ai' | 'like' | 'celebrate' | 'support' | 'love' | 'insightful' | 'funny', required: ai = the AI reads the post and picks one of the six; else always this one. One reaction a post, never changed later.
          - `comment` object, required
            - `on` boolean, required
            - `brief` string, nullable, required: What the AI writes the comment from; required while on.
          - `per_person_weekly_cap` integer, required: At most this many acts a week per person.
          - `sender_profile_sid` string, nullable, required: ub_sp_…: who acts on a person connected to no sender profile (the connected one acts otherwise; the social workspace is the team's); null = the team's first that can.
        - object
          - `do` 'pause_and_ask' | 'add_to_workflow', required: On a visit of a key page or a form: pause the journey and ask, or the workflow named.
          - `workflow_sid` string, nullable, required: wf_wf_…: required when the Do is a workflow.
          - `pages` string[], nullable, required: Path prefixes of the team's site (/pricing) that count; null = every visit the snippet reports.
        - object: Keep data fresh acts on nothing: the refresh of what it watches is the deed.
      - `audience` unknown
      - `watch` object, nullable, required: What the play keeps refreshed and how often; null = nothing (2026-10-13).
        - `profile_days` union, required: The LinkedIn profile every N days: 7 | 14 | 30 | 90; null = not watched.
          - 7
          - 14
          - 30
          - 90
          - unknown
        - `company_days` union, required: The company page every N days: 30 | 90; null = not watched.
          - 30
          - 90
          - unknown
        - `posts_days` union, required: The person's posts every N days: 1 | 3 | 7; null = not watched.
          - 1
          - 3
          - 7
          - unknown
        - `moments` boolean, required: The network's moments (birthdays, work anniversaries, job changes) through the sender profiles' catch-up feed, daily, free.
      - `cadence` 'manual' | 'daily', required: manual: runs on run_play; daily: runs by itself every day while enabled.
      - `mode` 'ask_me' | 'automatic', required: ask_me: the act waits for approval as a task in the Signals feed; automatic: it goes out by itself. The plays that act are born asking (2026-10-13).
      - `enabled` boolean, required: The switch of a daily play; a manual play is always false.
      - `enabled_by` object, nullable, required: Who gave the consent (switched the play on).
        - `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.
      - `enabled_at` string, nullable, required: ISO 8601 UTC: when.
      - `daily_credit_limit` integer, nullable, required: The plays that spend (find_people, and a watching play's reads): the credits one day may spend; null = no ceiling (the queue's room and the 500-row cap still bound a run). 422 on add_to_workflow.
      - `last_run_at` string, nullable, required: ISO 8601 UTC.
      - `last_run_counts` object, nullable, required: What the last run did; null before the first run.
        - `matched` integer, required: Rows the audience matched at the run (the tab's count under the filter).
        - `acted` integer, required: Accounts appended to the queue, or people entered or re-entered.
        - `skipped` integer, required: Left alone: already queued or searched, in flight, held at the door, past the ceiling or the 500-row cap.
        - `credits` integer, required: What the run committed: the walk's estimate for the accounts appended (one credit per account); 0 for an add_to_workflow play.
      - `next_run_at` string, nullable, required: ISO 8601 UTC: when the daily sweep runs it next; null on a manual or switched-off play.
      - `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: ISO 8601 UTC.
      - `updated_at` string, required: ISO 8601 UTC.
      - `deleted_at` string, nullable, required: ISO 8601 UTC; null = live.
    - `included` object, 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: Plays matching the filter scope.
    - `groups` object, required
      - `object_type` union, required: Plays per object (people | company).
        - object
        - unknown[]
          - unknown
      - `action_type` union, required: Plays per action (find_people | add_to_workflow).
        - object
        - unknown[]
          - unknown
      - `cadence` union, required: Plays per cadence (manual | daily).
        - object
        - unknown[]
          - unknown
      - `enabled` union, required: Plays per switch ("true" | "false").
        - 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)
