---
title: "Search pipeline stages"
method: POST
path: "/api/pipeline-stages/search"
tags: ["pipeline_stages"]
---

# Search pipeline stages

`POST /api/pipeline-stages/search`

## Request

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

A team's pipeline stages. Pin filter object (person | company). The resolver a stage name goes through before any people or companies filter: name eq or q (LIKE over name) for a label the user said, key eq for a system anchor; category in slices the funnel, key is_null true = the custom stages. page_size 0 returns the count alone. Objects per stage: get_pipeline_stages_metrics; the people or companies of a category: search_people or search_companies with filter pipeline_stage_category.

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

## Request body

- SearchPipelineStagesRequest: Request body of `search_pipeline_stages`.
  - `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 name (MySQL LIKE, prefix/infix - a small per-team list, no FULLTEXT).
    - `sid` object: Prefix-validated cr_ps_ sid(s) - also the point-lookup path (no get tool).
      - `eq` string: Pipeline stage sid (cr_ps_…).
      - `in` string[]
    - `object` object: Which pipeline. Pin it on nearly every call: the person and company lists are separate and reading both at once is almost never what was asked.
      - `eq` 'person' | 'company'
    - `category` object: Funnel bucket - category.in:['positive','nurture'] slices the winnable end of the funnel; category.eq:'approaching' the stages where we reached out and nothing came back.
      - `eq` 'cold' | 'approaching' | 'engaging' | 'positive' | 'nurture' | 'negative' | 'disqualified'
      - `in` string[]
    - `key` object: Stable system anchor. key.eq resolves one system stage to its sid; is_null:true = the custom stages only.
      - `eq` string
      - `in` string[]
      - `is_null` boolean
    - `name` object: Exact label lookup (resolve a stage name the user said into a sid); substring matching 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 stages).
      - `gte` string
      - `lte` string
      - `is_null` boolean
  - `sort` object: One column and its direction; omit for the default order.
    - `field` 'order' | 'name' | 'created_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.

- SearchPipelineStagesResponse
  - `success` true, required
  - `operation` 'search', required
  - `items` object[], required
    - `item` object, required
      - `sid` string, required: Pipeline stage sid (cr_ps_…) - the value people.pipeline_stage_sid / companies.pipeline_stage_sid store.
      - `team_sid` string, required: Owning team (ts_tm_…, external - gs.service.id).
      - `object` 'person' | 'company', required: Which pipeline this stage belongs to: person (leads) | company (accounts). Immutable after create.
      - `name` string, required: Stage label (1..255), unique per (team, object) among live rows, case-insensitively.
      - `category` 'cold' | 'approaching' | 'engaging' | 'positive' | 'nurture' | 'negative' | 'disqualified', required: Funnel bucket, one of seven: the grouping of the company card and the grid, the chip colour, the funnel analytics and the company derivation (positive > engaging > approaching > nurture > negative > cold; a person on a disqualified stage is not an active member of the account). negative = a real no (Not interested); disqualified = not a target, filtered out (Wrong Decision Maker, Disqualified). Locked on a system stage (key != null).
      - `created_by` object, required: Actor that created the stage (AccessIdentityValue); the seeded system stages carry the system identity.
        - `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.
      - `key` string, nullable, required: Stable snake_case anchor on SYSTEM stages ('new_contact', 'company_opportunity', …), the target the auto-transition engine resolves; null = a custom stage. key != null is what makes a stage system: locked category, non-deletable. Read-only.
      - `order` integer, nullable, required: Position within its (team, object) pipeline, contiguous 1..N, and the forward-only rank for a person (a target stage is only auto-entered when its order >= the current one). 0 = pulled out of the ordering (a soft-deleted row).
      - `created_at` string, required: ISO 8601 UTC.
      - `updated_at` string, required: ISO 8601 UTC; bumped by rename / recategorize / reorder.
      - `deleted_at` string, nullable, required: ISO 8601 UTC; null = live (soft delete).
    - `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: Stages matching the filter (full filter scope, not the page).
    - `groups` union, required: Always empty - the stage list has no bounded group axis (research §Groupable fields). PHP serialises an empty map 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)
