---
title: "Search data sources"
method: POST
path: "/api/data-sources/search"
tags: ["data_sources"]
---

# Search data sources

`POST /api/data-sources/search`

## Request

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

The team's ingestion sources, one row per pipeline into a table: ai_search (the pool, for credits), sender_search (a sender profile's account), post_engagement (who engaged with a post or someone's posts), find_people, csv, webhook. Filter by type, status, playtable_sid, sender_profile_sid; q is a LIKE over names; include data_source_items_counts (the funnel, with the duplicates left elsewhere) or indexed_counts (rows the grids show). Rows that failed or duplicated: search_data_source_items.

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

## Request body

- SearchDataSourcesRequest: Request body of `search_data_sources`.
  - `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 ds_sc_ sid(s).
      - `eq` string: Data source sid (ds_sc_…).
      - `in` string[]
    - `playtable_sid` object: Sources feeding table X; is_null:true = orphaned by playtable deletion.
      - `eq` string
      - `in` string[]
      - `is_null` boolean
    - `type` object: The kind tabs of the sources page: ai_search | sender_search | post_engagement | find_people | csv | webhook.
      - `eq` 'ai_search' | 'sender_search' | 'post_engagement' | 'find_people' | 'csv' | 'webhook'
      - `in` string[]
    - `object_type` object: What the source brings: people | company.
      - `eq` 'people' | 'company'
      - `in` string[]
    - `sender_profile_sid` object: Sources run by a given sender profile (ub_sp_…); is_null:true = everything the platform pool or a file feeds.
      - `eq` string
      - `in` string[]
      - `is_null` boolean
    - `status` object
      - `eq` 'draft' | 'active' | 'paused' | 'completed' | 'failed'
      - `ne` 'draft' | 'active' | 'paused' | 'completed' | 'failed'
      - `in` string[]
      - `nin` string[]
    - `q` string: Free text over name only (MySQL LIKE, infix).
    - `next_collect_at` object: Due/overdue scans; ISO 8601. is_null:true = clock-less (csv, webhook, and a bus-served sender search).
      - `gte` string
      - `lte` string
      - `is_null` boolean
    - `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' | 'name' | 'next_collect_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.

- SearchDataSourcesResponse
  - `success` true, required
  - `operation` 'search', required
  - `items` object[], required
    - `item` object, required
      - `sid` string, required
      - `team_sid` string, required
      - `playtable_sid` string, nullable, required: pt_tb_… target table, required on every create; becomes null only when the target playtable is deleted (the source auto-pauses, status_reason=playtable_deleted).
      - `name` string, required: min 1, max 255. Defaulted from the kind and its link when omitted on create ("Sales Navigator saved search", "My conversations", "AI search: CMOs in DACH").
      - `type` 'ai_search' | 'sender_search' | 'post_engagement' | 'find_people' | 'csv' | 'webhook', required: [ro] The source kind: ai_search | sender_search | post_engagement | find_people | csv | webhook. Immutable after create.
      - `object_type` 'people' | 'company', required: What promoted items become: people | company. An input of create, not a derivation of type; [ro] once the source is past draft (a csv draft's import step may still change it).
      - `sender_profile_sid` string, nullable, required: ub_sp_… the sender profile whose own LinkedIn account collects. Required for type=sender_search and post_engagement, null for every other kind - see ./sender_profiles.md.
      - `ingest_key` string, nullable, required: type=webhook only: the 40-char capability secret in the ingest URL ({api_base}/external/ingest/{ingest_key}). Stored plaintext by design so the URL stays re-viewable; rotate-ingest-key revokes it. null for every other kind.
      - `payload` union, required: Kind-discriminated config JSON, validated per kind server-side. ai_search: prompt | url + platform + surface, filters + engine (the stored plan), plan_chips / plan_warnings, next_page / latest_page (the walk cursor), collect_error (what stopped the walk: kind transient | refused, http, code, reason, message, fields; with status_reason collect_failed | collect_interrupted). sender_search: url + platform + surface, repeat, and the collector's own cursor (next_page / latest_page for the Recruiter walker, poll_since / poll_cursor / poll_max for the network and inbox pollers; the bus-served surfaces keep none). find_people: company_sids, next_index, per_company_limit, prompt, filters + engine. csv: file_path, file_type, mode, total_rows, config, match. webhook: records_path. post_engagement (2026-10-28): target + post {urn} | person {ln_nickname; ln_id, ln_member_id, name once resolved} | company {ln_nickname, ln_id, name, logo_url}, window, relevance, collect, repeat, and the walk's own state: stage (posts | judge | engage | done), posts (what it read, with verdicts and feed cursors), cycle, next_page / latest_page, migrated_from on a row born as a search with a post link before the kind existed.
        - object
          - `platform` 'linkedin' | 'sales_navigator' | 'recruiter': ai_search (link mode) and sender_search: which LinkedIn product the link opens in.
          - `surface` 'search' | 'saved_search' | 'list' | 'post' | 'my_network' | 'messenger': ai_search (link mode) and sender_search: what kind of list the link is.
          - `repeat` 'hourly' | 'daily' | 'weekly' | 'monthly', nullable: sender_search, post_engagement: the rerun interval; absent or null = runs once.
          - `mode` 'create' | 'update': csv: what the import does with its rows.
          - `target` 'post' | 'person' | 'company': post_engagement: what the source watches; the axis beside it names it (post.urn, person.ln_nickname, or company.ln_nickname with ln_id, name and logo_url once the walk resolved the page). A link is never stored: rebuild it from the axis.
          - `window` union: post_engagement, a person or a company: the window the posts are read from.
            - object
              - …
            - object
              - …
          - `relevance` object: post_engagement: the AI post filter; absent = every post is walked.
            - `prompt` string, required
          - `collect` object: post_engagement: the feeds the walk collects.
            - `reactions` boolean
            - `comments` boolean
            - `reposts` boolean
          - `posts` object[]: post_engagement: the posts the walk read, newest first, each with its title (the first line), text, author, published_at, counts, the filter's verdict with the reason of a skip, and the walk's cursor per feed (feeds.reactors | comments | resharers: {cursor} or {done: true}).
            - `urn` string, required
            - `title` string
            - `published_at` string, nullable
            - `verdict` 'match' | 'skip'
            - `verdict_reason` string
        - unknown[]
          - unknown
      - `field_mapping` object[], nullable, required: source→target entries: set at import for csv (and may be []), an optional override for webhook (absent = attribute auto-detect at promotion), forbidden for the three search kinds (their collector emits the canonical parser shape).
        - `source` string, required: CSV column index as a string ("3") or JSON path into the webhook body ("contact.email").
        - `target_kind` 'people_attribute' | 'company_attribute' | 'field_slug', required: people_attribute | company_attribute | field_slug.
        - `target` string, required: Attribute key (people / company) or a playtable field slug in the target table.
        - `name` string, nullable: Display name for the column a field_slug target creates (the header renamed in the mapping UI); null = the CSV header names it. Ignored for the attribute kinds and for fields that already exist.
      - `tag_sids` string[], nullable, required: cr_tg_… each - tags applied to every promoted object - see ./tags.md.
      - `qualify` object, nullable, required: The source gate, "Check on save": null = no check. The promotion reads it before a row is born (see ./data_source_items.md Lifecycle 6.5).
        - `on` boolean, required: The switch. `on` with no criterion is refused (422 on qualify.criterion, rule required_if).
        - `criterion` string, nullable, required: Who passes, in the user's words ("a decision maker at a marketing agency, not a freelancer"). Trimmed; null while the check is off.
      - `on_duplicate` 'skip' | 'move', required: Duplicate-person policy; default 'skip'.
      - `add_tags_to_duplicate` boolean, required: Merge tag_sids onto matched duplicates; default false.
      - `status` 'draft' | 'active' | 'paused' | 'completed' | 'failed', required
      - `status_reason` string, nullable, required: Reason token behind a paused or failed state (max 2048): playtable_deleted, sales_nav_required, recruiter_required, recruiter_reauth_required, executor_account_missing, plan_failed, collect_failed, collect_interrupted, post_unavailable (the post could not be read: deleted or private), target_not_found (no page at the slug), allowance_exhausted (the AI post filter ran out of credits; paused), …
      - `next_collect_at` string, nullable, required: ISO 8601 UTC - the collect clock of a search kind, advanced by checkpoints and the repeat interval. null for csv and webhook, and nulled on a bus-served sender search once its scrapes are provisioned (gtm-api owns the cadence from then on).
      - `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
      - `playtable` object: PlaytableDomain (1:1 via playtable_sid) - see ./playtables.md.
        - `sid` string, required
      - `sender_profile` object: SenderProfileDomain (1:1 via sender_profile_sid), the sender profile that collects a sender search or a post engagement; its linkedin_has_sn / linkedin_recruiter_status say which links it can open - see ./sender_profiles.md.
        - `sid` string, required
      - `data_source_items_counts` object: DataSourceItemCounts computed over { data_source_sid: parent.sid } - the per-source import funnel at full scope (§4.17 parent-include) - see ./data_source_items.md.
        - `total_count` integer, required
        - `groups` object, required
          - `status` union, required: The import funnel: pending / promoted / duplicate / stoplisted / failed.
            - object
            - unknown[]
              - …
      - `indexed_counts` object: How many of the source's objects are already VISIBLE in the People / Companies grids (the read-plane twin of the funnel's `promoted`, which counts MySQL truth the moment an item lands). Quote this one, not `promoted`, next to a link into the grid.
        - `total_count` integer, required
      - `csv_preview` object, nullable: type=csv only: header row + the first 5 data rows + total_rows, replayed from the stored file so a draft's mapping step can resume. null for every other kind and for an unreadable file. Request it on get, not as list hydration.
        - `headers` string[], required
        - `rows` array[], required
          - string[]
        - `total_rows` 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: Source rows matching the filter scope.
    - `groups` object, required
      - `status` union, required
        - object
        - unknown[]
          - unknown
      - `type` union, required
        - object
        - unknown[]
          - unknown
      - `object_type` union, required
        - 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)
