---
title: "Create company"
method: POST
path: "/api/companies"
tags: ["companies"]
---

# Create company

`POST /api/companies`

## Request

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

Manually add ONE company, optionally attaching it to a playtable. The service walks the identity dedup ladder (ln_id > canonical company page URL > domain, team-scoped) before inserting; a name-only company (no identity field) skips dedup and is created directly. A stoplist check runs at insert - a domain/LinkedIn match sets status=stoplisted.

Duplicates are never a dead-end. Without on_duplicate, a dedup hit returns 409 duplicate_rejected with context {existing_sid, already_in_playtable_sids, matched_identifier_kind}. Retry with on_duplicate:"attach" to union playtable_sid into the existing row's membership (requires playtable_sid), or "skip" to return it untouched - both respond already_exists:true, and item.playtable_sids lists every table the company now lives in. Companies attach, never move (multi-table membership; each member table keeps an independent cell set).

Omit playtable_sid to create a table-less account (anchor for people.company_sid links). Firmographics (industry, size, HQ, …) are playtable field values, not create fields. NOT for bulk import (create a data source + run) or for adding humans (people tools).

Contract:
- MCP tool `create_company`, registry package `mcp.playtables/companies`, mount `playtables.people`.
- Operation `create`, response envelope `create`.
- Flags: none.

## Request body

- CreateCompanyRequest: Request body of `create_company`.
  - `playtable_sid` string, nullable: Table to attach to; omitted → playtable_sids: [] (table-less account - anchor for people.company_sid links).
  - `name` string, nullable: Display name, a manual observation (context), never a column. NOT a dedup key - a name-only company skips the dedup ladder.
  - `logo_url` string, uri, nullable: Company logo URL (max 2048), a manual observation; null = the domain favicon.
  - `ln_id` string, nullable: Numeric LinkedIn company id - strongest dedup key.
  - `ln_nickname` string, nullable: Company page slug or page URL (reduced to the slug on write; a person profile or free text is a 422); dedup key #2.
  - `website` string, uri, nullable: The full URL, a manual observation; domain (a column, the identifier) is derived from it when domain is absent.
  - `domain` string, nullable: Normalized to lowercased apex on write; public-suffix validated; dedup key #3.
  - `deal_size` number, nullable: Deal value (decimal 15,2).
  - `tag_sids` string[], nullable: Labels; each existence-checked (422 relation_not_found).
  - `external_refs` object, nullable: Free-form CRM sync hook; round-tripped as-is.
  - `on_duplicate` 'skip' | 'attach': Dedup resolution: omitted → duplicate = 409 duplicate_rejected with context; "skip" = return the existing row untouched; "attach" = union playtable_sid into the existing row's membership (requires playtable_sid). Companies attach, never move.

## Response `200`

`create` success envelope.

- CreateCompanyResponse
  - `success` true, required
  - `operation` 'create', required
  - `item` object, required
    - `sid` string, required
    - `team_sid` string, required
    - `playtable_sids` string[], required: Member tables (pt_tb_…) - MULTI membership; service-managed (create/import union, detach / table-delete pull); may be empty. Filtering/counting on it is ES-served.
    - `data_source_sid` string, nullable, required
    - `data_source_type` string, nullable, required
    - `data_source_item_sid` string, nullable, required
    - `ln_id` string, nullable, required: Numeric LinkedIn company id - strongest dedup key.
    - `ln_nickname` string, nullable, required: The company page vanity slug (acme-corp), lowercased; a page URL is reduced to it on write, never stored (SERVICE_CONVENTIONS §Y). Dedup key #2.
    - `context` object, nullable, required: DERIVED and read-only (CONTEXT_FIELDS_RESEARCH.md section 5): the name, the logo and the website a surface or a model shows next to the row, resolved at read from the observations ledger with the same precedence as a person's. The only place these words are: the row keeps identifiers (phase E, 2026-10-22).
      - `name` string, nullable, required
      - `picture_url` string, nullable, required: The logo: a permanent copy over a wire link; null = the reader falls back to the domain favicon.
      - `website` string, nullable, required: The full URL a source gave; domain on the row stays the identifier.
      - `sources` object, required: Per resolved key, where it came from and when.
    - `domain` string, nullable, required: Lowercased apex domain; derived from website when absent; dedup key #3.
    - `deal_size` number, nullable, required: Deal value attached to the account (decimal 15,2) - the one client-writable business column.
    - `status` 'ok' | 'failed_validation' | 'duplicate' | 'stoplisted', required: Service-managed (import validation, stoplist); not client-writable.
    - `status_reason` string, nullable, required: Human-readable context for the current status (validation error, matched stoplist identifier); service-written together with status. A duplicate carries none: its pointer is duplicate_of_sid.
    - `duplicate_of_sid` string, nullable, required: While status is duplicate: the PRIMARY account (cr_co_…) this one is a copy of - one primary per group, re-derived on every recheck, swapped by make_company_primary. Null otherwise.
    - `duplicate_matched_kind` 'ln_id' | 'ln_nickname' | 'domain', nullable, required: While status is duplicate: the identity column the late write collided on. Null otherwise.
    - `tag_sids` string[], nullable, required
    - `external_refs` union, required: Free-form CRM sync hook ({ hubspot_company_id: "902", … }); keys are integration-defined, stored as-is, round-tripped, never validated; PHP empty map serialises as [].
      - object
      - unknown[]
        - unknown
      - unknown
    - `last_enrich_at` string, nullable, required: ISO 8601 UTC; stamped when an enrichment cycle completes - drives enrichment scheduling.
    - `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
    - `pipeline_stage_sid` string, nullable, required: The funnel stage the company is in (cr_ps_...): derived from its people unless pinned (pipeline_stages.md); null = no stage.
    - `pipeline_stage_source` 'derived' | 'manual', nullable, required: How the stage was set (CompanyPipelineStageSourceEnum): derived from the people, or pinned by a manual move; reset_pipeline_stages_derivation drops the pin. Null with no stage.
  - `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.

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