---
title: "Update company"
method: PATCH
path: "/api/companies/{sid}"
tags: ["companies"]
---

# Update company

`PATCH /api/companies/{sid}`

## Request

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

Partial attribute edit: identity fields, deal_size, tags (full-replace), external_refs. An identity edit that collides with another live account persists and flags the edited row status duplicate, naming the primary in duplicate_of_sid; nothing moves, never a 409. name, logo_url and website are manual observations. Firmographics are field values, not here. status and playtable_sids are service-managed. At least one field, else 422 nothing_to_update.

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

## Path parameters

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

## Request body

- UpdateCompanyRequest: Request body of `update_company`.
  - `name` string, nullable: A manual observation that outranks every source until reset; the linked people show it (their items, documents and templates resolve it).
  - `logo_url` string, uri, nullable: New logo URL (max 2048), a manual observation; null records a manual none (the domain favicon).
  - `ln_id` string, nullable: Identity edit - a collision with another live account flags this row status=duplicate (never a 409); the linked people's documents follow.
  - `ln_nickname` string, nullable: Identity edit - dedup guard re-runs; a page URL is reduced to the slug in place.
  - `website` string, uri, nullable: The full URL, a manual observation; domain is not derived on update.
  - `domain` string, nullable: Identity edit - dedup guard re-runs; normalized in place.
  - `deal_size` number, nullable: Deal value (decimal 15,2); null clears it.
  - `tag_sids` string[], nullable: Full-replace (not a merge).
  - `external_refs` object, nullable: Free-form CRM sync hook, full-replace; round-tripped as-is.

## Response `200`

`update` success envelope.

- UpdateCompanyResponse
  - `success` true, required
  - `operation` 'update', 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.
  - `updated_fields` string[], required
  - `previous_values` object, required
  - `kept_fields` string[]: The fields this write did not change because the person's own value stands on them (stamped person); read the item for what landed.
  - `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)
