---
title: "Create data source"
method: POST
path: "/api/data-sources"
tags: ["data_sources"]
---

# Create data source

`POST /api/data-sources`

## Request

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

Create an ingestion source into a table. `type` says who runs it and is required: the same Sales Navigator link is a valid ai_search and a valid sender_search, so a link's shape never decides.

ai_search: exactly one of url, payload.prompt or payload.filters; the pool runs it for credits, no sender. sender_search: sender_profile_sid plus url, unless payload.surface is my_network or messenger; payload.repeat reruns it. post_engagement: sender_profile_sid plus a post, profile or company page link (preview_post_engagement reads it back first); payload.window, relevance, collect and repeat tune it; every person lands with what they did. find_people: payload.company_sids and/or company_filter, plus a prompt or filters; always people. webhook: payload.records_path; the answer carries ingest_url (the credential: rotate to revoke). csv is refused: upload it, then import_data_source.

Refusals are 422, the reason in field_errors[field][0].rule: url needs_sender (only a Sales Navigator search runs on the pool: the rest is a sender_search), url post_engagement (a post link in a search kind), link_not_recognized, object_type or payload.target agreement, payload in, payload.collect required, and on sender_profile_sid linkedin_account_missing, sales_nav_required, recruiter_required or recruiter_signed_out. No dedup. When NOT: blocking identifiers (create_stoplist_entry); feeding people into outreach (workflow sources).

Contract:
- MCP tool `create_data_source`, registry package `mcp.playtables/data_sources`, mount `playtables.sources`.
- Operation `create`, response envelope `create`.
- Flags: none.

## Request body

- CreateDataSourceRequest: Request body of `create_data_source`.
  - `playtable_sid` string, required: Target table (pt_tb_…) receiving promoted objects. Required for every kind.
  - `type` 'ai_search' | 'sender_search' | 'post_engagement' | 'find_people' | 'csv' | 'webhook', required: Required. ai_search | sender_search | post_engagement | find_people | webhook. `csv` is accepted by the shape rule and then refused with the way in: upload the file through upload-csv, then confirm it with import_data_source.
  - `url` string, uri: LinkedIn link of an ai_search, sender_search or post_engagement: /search/results, /sales/search, /sales/lists, /talent/search?searchHistoryId=, /mynetwork, /messaging; post_engagement: /posts, /feed/update, lnkd.in, /in/{slug}, /company/{slug}.
  - `object_type` 'people' | 'company': What the rows become: people | company. Required for a description-mode ai_search. Elsewhere optional and checked for agreement with the link (or with the kind: find_people and webhook always bring people).
  - `name` string: Defaults from the kind and its link ("Sales Navigator saved search", "My network", "AI search: <the description>").
  - `sender_profile_sid` string: The sender profile whose own LinkedIn account collects (ub_sp_); required for sender_search and post_engagement, prohibited elsewhere. Must be live, hold a LinkedIn account and the licence the link needs (Sales Navigator, or an active Recruiter session).
  - `payload` object: The kind's own keys: ai_search {prompt | filters}, sender_search {surface, repeat}, post_engagement {target, window, relevance, collect, repeat}, find_people {company_sids, company_filter, per_company_limit, prompt, filters}, webhook {records_path}.
    - `prompt` string: ai_search, find_people. Who to find, in words. ai_search: a prompt that is only an http(s) link is read as the link. find_people: empty = everyone at each company. Planned into the search filter at the first collect; no filter from it = plan_failed.
    - `filters` object: ai_search, find_people. The by-params filter set plan_data_source_filters returns: it IS the plan, so planning is skipped (prompt may ride as the description). For find_people current companies are injected per anchor, never here.
    - `surface` 'search' | 'saved_search' | 'list' | 'post' | 'my_network' | 'messenger': sender_search only. my_network (the profile's 1st-degree connections) or messenger (its conversation partners) is how a sender search runs WITHOUT a url. Sent with a url it must agree with what the link is (422 on payload.surface, rule agreement).
    - `repeat` 'hourly' | 'daily' | 'weekly' | 'monthly', nullable: sender_search, post_engagement. hourly | daily | weekly | monthly = run again at that interval, bringing what is new (a post engagement: new people on the post, or new posts in the window); null or absent = once. Pool kinds never repeat.
    - `target` 'post' | 'person' | 'company': post_engagement only. What the link must be: post | person | company; refused when the link is something else (422 on payload.target, rule agreement). Absent = read off the link.
    - `window` union: post_engagement, a person or a company only: {days: 7 | 30 | 90} back from each run (default 30), or {since: "YYYY-MM-DD"} within the past year. On one post it is 422 rule prohibited.
      - object
        - `days` union, required
          - 7
          - 30
          - 90
      - object
        - `since` string, required
    - `relevance` object, nullable: post_engagement only. The AI post filter: which posts count, in the user's words ("posts about outbound; skip job ads"). One llm.generate per 20 posts, billed as the source's check; a post it could not judge passes. null or absent = every post is walked.
      - `prompt` string, required
    - `collect` object: post_engagement only. {reactions, comments, reposts}, each true or false; absent switches default to reactions and comments on, reposts off; all three off is 422 rule required.
      - `reactions` boolean
      - `comments` boolean
      - `reposts` boolean
    - `company_sids` string[]: find_people only; required there unless company_filter is given. The companies to find people at (cr_co_, from the companies grid), at most 500 per source: over the cap is 422 rule max. Grow the queue with add_companies_to_data_source.
    - `company_filter` object: find_people only. An account filter instead of (or with) company_sids: the search_companies filter object as is, resolved to sids at the call (a disqualified account is left out). No match and no sids is 422 rule required; past 500 matches 422 rule max.
    - `per_company_limit` integer: find_people only. People taken per company (1..25); absent = the whole first search page (25).
    - `records_path` string: webhook only. Where the array of records sits in an inbound body ("data.contacts"); absent = the body is the record or the array itself.
  - `field_mapping` object[]: Optional override for type=webhook (absent = attribute auto-detect at promotion); prohibited for the three search kinds, whose collector emits the canonical parser shape. A csv source gets its mapping at import.
    - `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[]: Each tag must exist (cr_tg_…); applied to every promoted object.
  - `on_duplicate` 'skip' | 'move': Default 'skip'.
  - `add_tags_to_duplicate` boolean: Default false - merge tag_sids onto matched duplicates.
  - `qualify` object, nullable: The source gate, "Check on save": {on, criterion}. A closed object (an unknown key is 422 rule invalid_qualify); on with no words is refused.
    - `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.

## Response `200`

`create` success envelope.

- CreateDataSourceResponse
  - `success` true, required
  - `operation` 'create', 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
            - `days` union, required
              - …
          - object
            - `since` string, required
        - `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
  - `already_exists` boolean, 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.
  - `ingest_url` string: type=webhook only: {api_base}/external/ingest/{ingest_key} - the endpoint the customer CRM POSTs records to. The URL IS the credential: hand it to the user over a channel they trust, and rotate it to revoke.

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