---
title: "Detach company from playtable"
method: POST
path: "/api/companies/{sid}/detach"
tags: ["companies"]
---

# Detach company from playtable

`POST /api/companies/{sid}/detach`

## Request

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

Remove ONE table from the company's membership while keeping the account (other memberships, people links, tags, notes, activities intact) - the "remove row from this table" gesture. The detached table's cells are hard-deleted by job - destructive to that table's cell data. Idempotent: a non-member playtable_sid returns result.detached:false, no changes. Detaching the last table is allowed (empty membership). NOT a delete - delete_company removes the account everywhere.

Contract:
- MCP tool `detach_company_playtable`, registry package `mcp.playtables/companies`, mount `playtables.people`.
- Operation `action`, response envelope `action`.
- Flags: dangerous: the MCP layer gates it behind a preview/commit token, and the effect cannot be undone through this API.

## Path parameters

- `sid` string, required: Company sid (cr_co_…).

## Request body

- DetachCompanyPlaytableRequest: Request body of `detach_company_playtable`.
  - `playtable_sid` string, required: The table to remove the company from.

## Response `200`

`action` success envelope.

- DetachCompanyPlaytableResponse
  - `success` true, required
  - `operation` 'action', required
  - `action` string, required: kebab-case verb; matches the route segment.
  - `item` object, nullable, 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.
  - `result` object, required
    - `detached` boolean, required: false = the sid was not a member; nothing changed.
  - `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)
