{"openapi":"3.1.0","info":{"title":"Strkr Public REST API","version":"1.0.0","description":"Public REST surface for the Strkr CRM. All endpoints under /v1/* authenticate via tenant-scoped API keys passed as `Authorization: Bearer stk_live_<token>`. Internal Clerk-authenticated endpoints (everything NOT under /v1/) are out of scope for this spec. Rate limits: 200 req/min per key (configurable per-key by admins) and 1000 req/min per tenant.\n\n**Consent enforcement (DND):** every send-path (email, SMS, phone, postal, WhatsApp) checks the target record's `ContactPreferences` bag before dispatch. A blocked send returns `409 CONSENT_DENIED` with a human-readable `reason`. Automation actions surface the block as `{sent: false, skipped: true, reason: ...}` instead. Callers MUST NOT retry 409s; the reason is definitive and safe to surface to the composing user. Contact-level preferences override account-level rollup. Global do-not-contact hard-blocks every channel. See `PATCH /v1/{contacts|accounts|leads}/{id}/preferences` to read/write consent state programmatically.\n\n**Polymorphic activity linking:** every CRM record (contact, lead, account, deal, custom object) can be the parent of activities, tasks, files, and email threads through polymorphic link tables (`activity_links`, `task_links`, `attachments`, `inbox_thread_links`). To enumerate email threads for a record use `GET /v1/inbox/threads/for-entity?entityType=<apiName>&entityId=<uuid>`. Gmail-sync auto-links threads when a message's sender or recipient email matches a record; a lead's Emails tab surfaces these without any manual linking. On lead convert, every polymorphic `lead` link is duplicated onto the created `contact` (and, for inbox threads, also onto the `account`) so the historical timeline follows through. The original `lead` rows are preserved for audit.\n\n**Reject-unknown-fields (2026-08-23):** every v1 write endpoint (POST/PATCH) validates the request body against a strict schema. Unknown keys return `422 UNKNOWN_FIELD` naming the offending key. The previous behavior of silently discarding unrecognized fields is retired. If your integration was implicitly relying on the silent-drop, remove the extra keys or move them to `customFields`.\n\n**customFields round-trip:** `customFields` is a free-form JSON bag persisted on every standard object (Account, Contact, Deal, Lead, Task, Activity). Round-trips on create + read + list. On PATCH, `customFields` shallow-merges into the existing bag (not replaces), so an integration updating one metadata key preserves every other key. Use this for external system IDs, sync status, idempotency keys, or any per-integration workflow state.\n\n**leadId as a first-class relation:** Task and Activity accept `leadId` on create/update/read, filterable via `?leadId=<uuid>` on the list surface. Auto-populates the polymorphic `activity_links` / `task_links` row so the Lead detail page picks it up too.\n\n**Messaging (Slice M6, 2026-09-04):** SMS/MMS via `POST /v1/messaging/send` funnels through the same server-side pipeline as the internal composer: module gate + DND enforcement + auto-STOP language + carrier segment count + Stripe usage metering. Return codes: `402 MODULE_INACTIVE` when the tenant hasn't activated Messaging, `409 CONSENT_DENIED` when the target opted out of SMS or is inside their quiet-hours window, `409 CHANNEL_UNAVAILABLE` when the messaging channel is not active. Callers MUST NOT retry a 409; the reason is definitive.","contact":{"name":"Strkr support","email":"support@strkr.io"}},"servers":[{"url":"https://api.strkr.io","description":"Production"},{"url":"https://api-dev.strkr.io","description":"Development"}],"tags":[{"name":"Account"},{"name":"Contact"},{"name":"Deal"},{"name":"Lead"},{"name":"Task"},{"name":"Activity"},{"name":"CustomObject"},{"name":"Schema"},{"name":"File"},{"name":"Consent","description":"Do-not-contact / preferences state that gates every send-path."},{"name":"Inbox","description":"Email threads polymorphically linked to CRM records."},{"name":"Messaging","description":"SMS/MMS send + thread reads. Requires the Messaging module."}],"paths":{"/v1/accounts":{"get":{"summary":"List accounts","operationId":"listAccounts","tags":["Account"],"security":[{"bearerApiKey":["accounts:read"]}],"parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":500,"default":200}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"accounts":{"type":"array","items":{"$ref":"#/components/schemas/Account"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"summary":"Create account","operationId":"createAccount","tags":["Account"],"security":[{"bearerApiKey":["accounts:write"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountCreate"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"account":{"$ref":"#/components/schemas/Account"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"422":{"$ref":"#/components/responses/ValidationError"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/v1/accounts/{id}":{"get":{"summary":"Get account by id","operationId":"getAccount","tags":["Account"],"security":[{"bearerApiKey":["accounts:read"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"account":{"$ref":"#/components/schemas/Account"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"patch":{"summary":"Update account","operationId":"updateAccount","tags":["Account"],"security":[{"bearerApiKey":["accounts:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountUpdate"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"account":{"$ref":"#/components/schemas/Account"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationError"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"summary":"Delete account","operationId":"deleteAccount","tags":["Account"],"security":[{"bearerApiKey":["accounts:delete"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"deletedId":{"type":"string","format":"uuid"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/v1/contacts":{"get":{"summary":"List contacts","operationId":"listContacts","tags":["Contact"],"security":[{"bearerApiKey":["contacts:read"]}],"parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":500,"default":200}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"contacts":{"type":"array","items":{"$ref":"#/components/schemas/Contact"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"summary":"Create contact","operationId":"createContact","tags":["Contact"],"security":[{"bearerApiKey":["contacts:write"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactCreate"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"contact":{"$ref":"#/components/schemas/Contact"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"422":{"$ref":"#/components/responses/ValidationError"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/v1/contacts/{id}":{"get":{"summary":"Get contact by id","operationId":"getContact","tags":["Contact"],"security":[{"bearerApiKey":["contacts:read"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"contact":{"$ref":"#/components/schemas/Contact"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"patch":{"summary":"Update contact","operationId":"updateContact","tags":["Contact"],"security":[{"bearerApiKey":["contacts:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactUpdate"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"contact":{"$ref":"#/components/schemas/Contact"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationError"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"summary":"Delete contact","operationId":"deleteContact","tags":["Contact"],"security":[{"bearerApiKey":["contacts:delete"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"deletedId":{"type":"string","format":"uuid"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/v1/deals":{"get":{"summary":"List deals","operationId":"listDeals","tags":["Deal"],"security":[{"bearerApiKey":["deals:read"]}],"parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":500,"default":200}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"deals":{"type":"array","items":{"$ref":"#/components/schemas/Deal"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"summary":"Create deal","operationId":"createDeal","tags":["Deal"],"security":[{"bearerApiKey":["deals:write"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DealCreate"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"deal":{"$ref":"#/components/schemas/Deal"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"422":{"$ref":"#/components/responses/ValidationError"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/v1/deals/{id}":{"get":{"summary":"Get deal by id","operationId":"getDeal","tags":["Deal"],"security":[{"bearerApiKey":["deals:read"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"deal":{"$ref":"#/components/schemas/Deal"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"patch":{"summary":"Update deal","operationId":"updateDeal","tags":["Deal"],"security":[{"bearerApiKey":["deals:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DealUpdate"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"deal":{"$ref":"#/components/schemas/Deal"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationError"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"summary":"Delete deal","operationId":"deleteDeal","tags":["Deal"],"security":[{"bearerApiKey":["deals:delete"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"deletedId":{"type":"string","format":"uuid"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/v1/tasks":{"get":{"summary":"List tasks","operationId":"listTasks","tags":["Task"],"security":[{"bearerApiKey":["tasks:read"]}],"parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":500,"default":200}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"tasks":{"type":"array","items":{"$ref":"#/components/schemas/Task"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"summary":"Create task","operationId":"createTask","tags":["Task"],"security":[{"bearerApiKey":["tasks:write"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskCreate"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"task":{"$ref":"#/components/schemas/Task"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"422":{"$ref":"#/components/responses/ValidationError"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/v1/tasks/{id}":{"get":{"summary":"Get task by id","operationId":"getTask","tags":["Task"],"security":[{"bearerApiKey":["tasks:read"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"task":{"$ref":"#/components/schemas/Task"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"patch":{"summary":"Update task","operationId":"updateTask","tags":["Task"],"security":[{"bearerApiKey":["tasks:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskUpdate"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"task":{"$ref":"#/components/schemas/Task"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationError"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"summary":"Delete task","operationId":"deleteTask","tags":["Task"],"security":[{"bearerApiKey":["tasks:delete"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"deletedId":{"type":"string","format":"uuid"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/v1/activities":{"get":{"summary":"List activities","operationId":"listActivitys","tags":["Activity"],"security":[{"bearerApiKey":["activities:read"]}],"parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":500,"default":200}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"activities":{"type":"array","items":{"$ref":"#/components/schemas/Activity"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"summary":"Create activity","operationId":"createActivity","tags":["Activity"],"security":[{"bearerApiKey":["activities:write"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ActivityCreate"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"activity":{"$ref":"#/components/schemas/Activity"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"422":{"$ref":"#/components/responses/ValidationError"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/v1/activities/{id}":{"get":{"summary":"Get activity by id","operationId":"getActivity","tags":["Activity"],"security":[{"bearerApiKey":["activities:read"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"activity":{"$ref":"#/components/schemas/Activity"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"patch":{"summary":"Update activity","operationId":"updateActivity","tags":["Activity"],"security":[{"bearerApiKey":["activities:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ActivityUpdate"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"activity":{"$ref":"#/components/schemas/Activity"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationError"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"summary":"Delete activity","operationId":"deleteActivity","tags":["Activity"],"security":[{"bearerApiKey":["activities:delete"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"deletedId":{"type":"string","format":"uuid"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/v1/leads":{"get":{"summary":"List leads","operationId":"listLeads","tags":["Lead"],"security":[{"bearerApiKey":["leads:read"]}],"parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":500,"default":200}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"leads":{"type":"array","items":{"$ref":"#/components/schemas/Lead"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"summary":"Create lead","operationId":"createLead","tags":["Lead"],"security":[{"bearerApiKey":["leads:write"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadCreate"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"lead":{"$ref":"#/components/schemas/Lead"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"422":{"$ref":"#/components/responses/ValidationError"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/v1/leads/{id}":{"get":{"summary":"Get lead by id","operationId":"getLead","tags":["Lead"],"security":[{"bearerApiKey":["leads:read"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"lead":{"$ref":"#/components/schemas/Lead"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"patch":{"summary":"Update lead","operationId":"updateLead","tags":["Lead"],"security":[{"bearerApiKey":["leads:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadUpdate"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"lead":{"$ref":"#/components/schemas/Lead"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationError"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"summary":"Delete lead","operationId":"deleteLead","tags":["Lead"],"security":[{"bearerApiKey":["leads:delete"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"deletedId":{"type":"string","format":"uuid"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/v1/objects":{"get":{"summary":"List object definitions in the tenant","operationId":"listObjects","tags":["Schema"],"security":[{"bearerApiKey":["schema:read"]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"objects":{"type":"array","items":{"$ref":"#/components/schemas/ObjectDef"}}}}}}}}}},"/v1/objects/{apiName}":{"get":{"summary":"Get a single object definition with its fields","operationId":"getObject","tags":["Schema"],"security":[{"bearerApiKey":["schema:read"]}],"parameters":[{"name":"apiName","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"$ref":"#/components/schemas/ObjectDef"},"fields":{"type":"array","items":{"$ref":"#/components/schemas/FieldDef"}}}}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/objects/{apiName}/records":{"get":{"summary":"List custom-object records","operationId":"listRecords","tags":["CustomObject"],"security":[{"bearerApiKey":["custom-objects:read"]}],"parameters":[{"name":"apiName","in":"path","required":true,"schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":500,"default":50}},{"name":"q","in":"query","schema":{"type":"string"}},{"name":"sortField","in":"query","schema":{"type":"string"}},{"name":"sortDir","in":"query","schema":{"type":"string","enum":["asc","desc"]}},{"name":"columns","in":"query","schema":{"type":"string"}},{"name":"filterField","in":"query","schema":{"type":"string"}},{"name":"filterValue","in":"query","schema":{"type":"string"}},{"name":"filters","in":"query","schema":{"type":"string"},"description":"JSON array of {field, op, value}"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/CustomRecord"}},"total":{"type":"integer"}}}}}},"404":{"$ref":"#/components/responses/NotFound"}}},"post":{"summary":"Create a custom-object record","operationId":"createRecord","tags":["CustomObject"],"security":[{"bearerApiKey":["custom-objects:write"]}],"parameters":[{"name":"apiName","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomRecordCreate"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"record":{"$ref":"#/components/schemas/CustomRecord"}}}}}},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/objects/{apiName}/records/{id}":{"get":{"summary":"Get a single custom-object record","operationId":"getRecord","tags":["CustomObject"],"security":[{"bearerApiKey":["custom-objects:read"]}],"parameters":[{"name":"apiName","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"record":{"$ref":"#/components/schemas/CustomRecord"}}}}}},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"summary":"Update a custom-object record","operationId":"updateRecord","tags":["CustomObject"],"security":[{"bearerApiKey":["custom-objects:write"]}],"parameters":[{"name":"apiName","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomRecordUpdate"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"record":{"$ref":"#/components/schemas/CustomRecord"}}}}}},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationError"}}},"delete":{"summary":"Delete a custom-object record","operationId":"deleteRecord","tags":["CustomObject"],"security":[{"bearerApiKey":["custom-objects:delete"]}],"parameters":[{"name":"apiName","in":"path","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"deletedId":{"type":"string","format":"uuid"}}}}}}}}},"/v1/attachments":{"get":{"summary":"List attachments","operationId":"listAttachments","tags":["File"],"security":[{"bearerApiKey":["files:read"]}],"parameters":[{"name":"parentObjectApiName","in":"query","schema":{"type":"string"}},{"name":"parentRecordId","in":"query","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"attachments":{"type":"array","items":{"$ref":"#/components/schemas/Attachment"}}}}}}}}},"post":{"summary":"Record attachment metadata after S3 upload completes","operationId":"createAttachment","tags":["File"],"security":[{"bearerApiKey":["files:write"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttachmentCreate"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"attachment":{"$ref":"#/components/schemas/Attachment"}}}}}},"410":{"description":"Upload incomplete. S3 object not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/attachments/presign":{"post":{"summary":"Get a presigned PUT URL for direct upload to S3","operationId":"presignAttachment","tags":["File"],"security":[{"bearerApiKey":["files:write"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttachmentPresignRequest"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttachmentPresignResponse"}}}}}}},"/v1/attachments/{id}/download":{"get":{"summary":"Get a presigned GET URL for the file","operationId":"downloadAttachment","tags":["File"],"security":[{"bearerApiKey":["files:read"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"downloadUrl":{"type":"string","format":"uri"},"expiresAt":{"type":"string","format":"date-time"}}}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/attachments/{id}":{"delete":{"summary":"Soft-delete an attachment","operationId":"deleteAttachment","tags":["File"],"security":[{"bearerApiKey":["files:delete"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"deletedId":{"type":"string","format":"uuid"}}}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/contacts/{id}/preferences":{"patch":{"summary":"Update consent + contact preferences on a contact","operationId":"patchContactPreferences","tags":["Contact","Consent"],"description":"Shallow-merges the provided ContactPreferences bag into the contact's current preferences. Every mutation writes an audit row to contact_preference_changes with source='api' + the caller's IP + user agent. Contact-level preferences win over account-level rollup when both exist. Send-paths (email, sms, phone, postal, whatsapp) refuse dispatches to opted-out channels with 409 CONSENT_DENIED.","security":[{"bearerApiKey":["contacts:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactPreferences"},"examples":{"Opt a contact out of email marketing":{"value":{"channels":{"email":{"state":"opted_out","source":"api","note":"Customer replied STOP"}}}},"Hard do-not-contact everything":{"value":{"global_do_not_contact":true,"reason":"GDPR erasure request"}},"Allow SMS marketing but deny phone":{"value":{"channels":{"sms":{"state":"opted_in","source":"api"},"phone":{"state":"opted_out","source":"api"}}}},"Set quiet hours in a timezone":{"value":{"quiet_hours":{"start":"20:00","end":"08:00","tz":"America/Chicago"}}}}}}},"responses":{"200":{"description":"Updated preferences bag as persisted.","content":{"application/json":{"schema":{"type":"object","properties":{"preferences":{"$ref":"#/components/schemas/ContactPreferences"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"description":"Validation error. Preferences payload rejected.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/v1/accounts/{id}/preferences":{"patch":{"summary":"Update consent + contact preferences on a account","operationId":"patchAccountPreferences","tags":["Account","Consent"],"description":"Shallow-merges the provided ContactPreferences bag into the account's current preferences. Every mutation writes an audit row to contact_preference_changes with source='api' + the caller's IP + user agent. Contact-level preferences win over account-level rollup when both exist. Send-paths (email, sms, phone, postal, whatsapp) refuse dispatches to opted-out channels with 409 CONSENT_DENIED.","security":[{"bearerApiKey":["accounts:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactPreferences"},"examples":{"Opt a contact out of email marketing":{"value":{"channels":{"email":{"state":"opted_out","source":"api","note":"Customer replied STOP"}}}},"Hard do-not-contact everything":{"value":{"global_do_not_contact":true,"reason":"GDPR erasure request"}},"Allow SMS marketing but deny phone":{"value":{"channels":{"sms":{"state":"opted_in","source":"api"},"phone":{"state":"opted_out","source":"api"}}}},"Set quiet hours in a timezone":{"value":{"quiet_hours":{"start":"20:00","end":"08:00","tz":"America/Chicago"}}}}}}},"responses":{"200":{"description":"Updated preferences bag as persisted.","content":{"application/json":{"schema":{"type":"object","properties":{"preferences":{"$ref":"#/components/schemas/ContactPreferences"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"description":"Validation error. Preferences payload rejected.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/v1/leads/{id}/preferences":{"patch":{"summary":"Update consent + contact preferences on a lead","operationId":"patchLeadPreferences","tags":["Lead","Consent"],"description":"Shallow-merges the provided ContactPreferences bag into the lead's current preferences. Every mutation writes an audit row to contact_preference_changes with source='api' + the caller's IP + user agent. Contact-level preferences win over account-level rollup when both exist. Send-paths (email, sms, phone, postal, whatsapp) refuse dispatches to opted-out channels with 409 CONSENT_DENIED.","security":[{"bearerApiKey":["leads:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactPreferences"},"examples":{"Opt a contact out of email marketing":{"value":{"channels":{"email":{"state":"opted_out","source":"api","note":"Customer replied STOP"}}}},"Hard do-not-contact everything":{"value":{"global_do_not_contact":true,"reason":"GDPR erasure request"}},"Allow SMS marketing but deny phone":{"value":{"channels":{"sms":{"state":"opted_in","source":"api"},"phone":{"state":"opted_out","source":"api"}}}},"Set quiet hours in a timezone":{"value":{"quiet_hours":{"start":"20:00","end":"08:00","tz":"America/Chicago"}}}}}}},"responses":{"200":{"description":"Updated preferences bag as persisted.","content":{"application/json":{"schema":{"type":"object","properties":{"preferences":{"$ref":"#/components/schemas/ContactPreferences"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"description":"Validation error. Preferences payload rejected.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/v1/messaging/channels":{"get":{"summary":"List provisioned messaging numbers","operationId":"listMessagingChannels","tags":["Messaging"],"security":[{"bearerApiKey":["messaging:read"]}],"parameters":[{"name":"includeInactive","in":"query","schema":{"type":"boolean","default":false},"description":"Include pending/suspended/released channels."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"channels":{"type":"array","items":{"$ref":"#/components/schemas/MessagingChannel"}},"total":{"type":"integer"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/v1/messaging/threads":{"get":{"summary":"List SMS/MMS threads","operationId":"listMessagingThreads","tags":["Messaging"],"security":[{"bearerApiKey":["messaging:read"]}],"parameters":[{"name":"channelId","in":"query","schema":{"type":"string","format":"uuid"}},{"name":"peerNumber","in":"query","schema":{"type":"string"},"description":"E.164 counterpart."},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":500,"default":100}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"threads":{"type":"array","items":{"$ref":"#/components/schemas/MessagingThread"}},"total":{"type":"integer"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/v1/messaging/threads/{id}/messages":{"get":{"summary":"List messages on a thread (oldest-first)","operationId":"listMessagingThreadMessages","tags":["Messaging"],"security":[{"bearerApiKey":["messaging:read"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":500,"default":100}},{"name":"before","in":"query","schema":{"type":"string","format":"date-time"},"description":"Cursor. Return messages older than this timestamp."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"messages":{"type":"array","items":{"$ref":"#/components/schemas/MessagingMessage"}},"total":{"type":"integer"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/v1/messaging/send":{"post":{"summary":"Send an SMS or MMS","operationId":"sendMessage","tags":["Messaging"],"description":"Sends via the shared sendMessage() library. Consent enforcement: pass `consentContext` when the target maps to a CRM record. The send-path will check that record's contact_preferences bag and return `409 CONSENT_DENIED` if the target has opted out of SMS or the tenant's quiet_hours window is active. Without `consentContext`, only explicit prior opt-outs on stray records with matching phone block. Automatically appends `Reply STOP to opt out.` on the first outbound message to any peer (CTIA compliance). Returns 402 MODULE_INACTIVE when the tenant's Messaging module is not active.","security":[{"bearerApiKey":["messaging:write"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessagingSendRequest"},"examples":{"Bare SMS to a raw number":{"value":{"channelId":"00000000-0000-0000-0000-000000000001","toNumber":"+14155551234","body":"Hi from Strkr!"}},"SMS with CRM consent context":{"value":{"channelId":"00000000-0000-0000-0000-000000000001","toNumber":"+14155551234","body":"Following up on your demo request.","consentContext":{"entity":{"kind":"lead","id":"00000000-0000-0000-0000-000000000002"},"purpose":"marketing"}}},"MMS with attached media":{"value":{"channelId":"00000000-0000-0000-0000-000000000001","toNumber":"+14155551234","body":"Your receipt is attached.","attachmentIds":["00000000-0000-0000-0000-000000000042"],"consentContext":{"entity":{"kind":"contact","id":"00000000-0000-0000-0000-000000000003"},"purpose":"transactional"}}}}}}},"responses":{"201":{"description":"Sent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessagingSendResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"description":"Messaging module is not active for this tenant.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"description":"Send blocked. Either `CONSENT_DENIED` (target opted out or quiet hours) or `CHANNEL_UNAVAILABLE` (channel not active). Callers MUST NOT retry; the reason is definitive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"$ref":"#/components/responses/ValidationError"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/v1/inbox/threads/for-entity":{"get":{"summary":"List email threads linked to a CRM record","operationId":"listThreadsForEntity","tags":["Inbox"],"description":"Returns every inbox thread the polymorphic link table associates with the target record, across every Strkr user's inbox in this workspace. Populated automatically by gmail-sync when a message's participants match the record's email address; also grows when a rep clicks the \"Linked to\" chip on the thread detail. Message bodies stay behind `/inbox/threads/{id}/messages` (internal only).","security":[{"bearerApiKey":["inbox:read"]}],"parameters":[{"name":"entityType","in":"query","required":true,"description":"apiName of the parent object: `contact`, `lead`, `account`, or a custom object apiName.","schema":{"type":"string","example":"lead"}},{"name":"entityId","in":"query","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":200,"default":100}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"threads":{"type":"array","items":{"$ref":"#/components/schemas/InboxThreadSummary"}},"total":{"type":"integer"}}}}}},"400":{"description":"Bad request. Missing or invalid query params.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}}},"components":{"securitySchemes":{"bearerApiKey":{"type":"http","scheme":"bearer","bearerFormat":"stk_live_<32-hex>","description":"Tenant API key issued from Admin → Integrations → API keys. Pass as `Authorization: Bearer stk_live_<token>`. The key carries one or more scopes; each endpoint documents which scopes it accepts. The `admin` scope is a wildcard."}},"responses":{"Unauthorized":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Forbidden":{"description":"API key lacks required scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"NotFound":{"description":"Record not found in tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"ValidationError":{"description":"Body fails validation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"RateLimited":{"description":"Per-key (200/min) or per-tenant (1000/min) rate limit exceeded. `Retry-After` header indicates seconds to wait.","headers":{"Retry-After":{"schema":{"type":"integer"}},"X-RateLimit-Limit":{"schema":{"type":"integer"}},"X-RateLimit-Remaining":{"schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","examples":["MISSING_TOKEN","INVALID_TOKEN","INVALID_TOKEN_TYPE","INSUFFICIENT_SCOPE","RATE_LIMITED","VALIDATION_ERROR","NOT_FOUND"]},"message":{"type":"string"}}}}},"Account":{"type":"object","additionalProperties":true,"properties":{"id":{"type":"string","format":"uuid"},"tenantId":{"type":"string","format":"uuid"},"name":{"type":"string"},"domain":{"type":["string","null"]},"industry":{"type":["string","null"]},"tier":{"type":["string","null"],"enum":["strategic","growth","mid-market","smb",null]},"region":{"type":["string","null"],"enum":["NA-East","NA-West","NA-Central","EMEA","APAC","LATAM",null]},"status":{"type":["string","null"],"enum":["prospect","customer","churned",null]},"arrCents":{"type":["integer","null"]},"ownerId":{"type":["string","null"],"format":"uuid"},"tags":{"type":"array","items":{"type":"string"}},"customFields":{"$ref":"#/components/schemas/CustomFields"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"AccountCreate":{"type":"object","additionalProperties":false,"required":["name"],"description":"Reject-unknown-fields: a 422 UNKNOWN_FIELD is returned when unrecognized keys are sent.","properties":{"name":{"type":"string","maxLength":200},"domain":{"type":["string","null"]},"industry":{"type":["string","null"]},"ownerId":{"type":["string","null"],"format":"uuid"},"customFields":{"$ref":"#/components/schemas/CustomFields"}}},"AccountUpdate":{"type":"object","additionalProperties":false,"description":"Reject-unknown-fields. customFields shallow-merges into the existing bag.","properties":{"name":{"type":"string"},"domain":{"type":["string","null"]},"industry":{"type":["string","null"]},"tier":{"type":["string","null"],"enum":["strategic","growth","mid-market","smb",null]},"region":{"type":["string","null"],"enum":["NA-East","NA-West","NA-Central","EMEA","APAC","LATAM",null]},"hq":{"type":["string","null"]},"size":{"type":["string","null"]},"employees":{"type":["integer","null"]},"arrCents":{"type":["integer","null"]},"health":{"type":["integer","null"],"minimum":0,"maximum":100},"healthTrend":{"type":["string","null"],"enum":["up","flat","down",null]},"renewalDate":{"type":["string","null"],"format":"date-time"},"ownerId":{"type":["string","null"],"format":"uuid"},"csmId":{"type":["string","null"],"format":"uuid"},"parentId":{"type":["string","null"],"format":"uuid"},"status":{"type":["string","null"],"enum":["prospect","customer","churned",null]},"country":{"type":["string","null"]},"tags":{"type":"array","items":{"type":"string"}},"notes":{"type":["string","null"]},"customFields":{"$ref":"#/components/schemas/CustomFields"}}},"Contact":{"type":"object","additionalProperties":true,"properties":{"id":{"type":"string","format":"uuid"},"tenantId":{"type":"string","format":"uuid"},"firstName":{"type":["string","null"]},"lastName":{"type":["string","null"]},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"title":{"type":["string","null"]},"accountId":{"type":["string","null"],"format":"uuid"},"ownerId":{"type":["string","null"],"format":"uuid"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"ContactCreate":{"type":"object","additionalProperties":false,"description":"Reject-unknown-fields. At least one of firstName, lastName, or email is required.","properties":{"firstName":{"type":["string","null"]},"lastName":{"type":["string","null"]},"email":{"type":["string","null"],"format":"email"},"phone":{"type":["string","null"]},"title":{"type":["string","null"]},"city":{"type":["string","null"]},"accountId":{"type":["string","null"],"format":"uuid"},"ownerId":{"type":["string","null"],"format":"uuid"},"linkedinUrl":{"type":["string","null"]},"timezone":{"type":["string","null"]},"buyingRole":{"type":["string","null"]},"notes":{"type":["string","null"]},"tags":{"type":"array","items":{"type":"string"}},"customFields":{"$ref":"#/components/schemas/CustomFields"}}},"ContactUpdate":{"type":"object","additionalProperties":false,"description":"Reject-unknown-fields. customFields shallow-merges into the existing bag.","properties":{"firstName":{"type":["string","null"]},"lastName":{"type":["string","null"]},"email":{"type":["string","null"],"format":"email"},"phone":{"type":["string","null"]},"title":{"type":["string","null"]},"city":{"type":["string","null"]},"accountId":{"type":["string","null"],"format":"uuid"},"ownerId":{"type":["string","null"],"format":"uuid"},"linkedinUrl":{"type":["string","null"]},"timezone":{"type":["string","null"]},"buyingRole":{"type":["string","null"]},"notes":{"type":["string","null"]},"tags":{"type":"array","items":{"type":"string"}},"customFields":{"$ref":"#/components/schemas/CustomFields"}}},"Deal":{"type":"object","additionalProperties":true,"properties":{"id":{"type":"string","format":"uuid"},"tenantId":{"type":"string","format":"uuid"},"name":{"type":"string"},"stage":{"type":"string"},"amountCents":{"type":["integer","null"]},"closeDate":{"type":["string","null"],"format":"date-time"},"accountId":{"type":["string","null"],"format":"uuid"},"ownerId":{"type":["string","null"],"format":"uuid"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"DealCreate":{"type":"object","additionalProperties":false,"required":["name"],"description":"Reject-unknown-fields.","properties":{"name":{"type":"string"},"stage":{"type":"string","enum":["new","qualified","proposal","negotiation","closed_won","closed_lost"]},"amountCents":{"type":["integer","null"]},"closeDate":{"type":["string","null"],"format":"date-time"},"accountId":{"type":["string","null"],"format":"uuid"},"primaryContactId":{"type":["string","null"],"format":"uuid"},"ownerId":{"type":["string","null"],"format":"uuid"},"source":{"type":["string","null"]},"dealType":{"type":["string","null"]},"currency":{"type":"string","minLength":3,"maxLength":3},"tags":{"type":"array","items":{"type":"string"}},"customFields":{"$ref":"#/components/schemas/CustomFields"}}},"DealUpdate":{"type":"object","additionalProperties":false,"description":"Reject-unknown-fields. customFields shallow-merges into the existing bag.","properties":{"name":{"type":"string"},"stage":{"type":"string","enum":["new","qualified","proposal","negotiation","closed_won","closed_lost"]},"amountCents":{"type":["integer","null"]},"closeDate":{"type":["string","null"],"format":"date-time"},"accountId":{"type":["string","null"],"format":"uuid"},"primaryContactId":{"type":["string","null"],"format":"uuid"},"ownerId":{"type":["string","null"],"format":"uuid"},"source":{"type":["string","null"]},"dealType":{"type":["string","null"]},"currency":{"type":"string","minLength":3,"maxLength":3},"tags":{"type":"array","items":{"type":"string"}},"customFields":{"$ref":"#/components/schemas/CustomFields"}}},"Lead":{"type":"object","additionalProperties":true,"properties":{"id":{"type":"string","format":"uuid"},"tenantId":{"type":"string","format":"uuid"},"name":{"type":["string","null"]},"email":{"type":["string","null"]},"company":{"type":["string","null"]},"phone":{"type":["string","null"]},"score":{"type":["integer","null"]},"source":{"type":["string","null"]},"country":{"type":["string","null"]},"region":{"type":["string","null"]},"plan":{"type":["string","null"]},"status":{"type":"string","enum":["new","working","converted","discarded"]},"ownerId":{"type":["string","null"],"format":"uuid"},"notes":{"type":["string","null"]},"tags":{"type":"array","items":{"type":"string"}},"convertedContactId":{"type":["string","null"],"format":"uuid"},"convertedAccountId":{"type":["string","null"],"format":"uuid"},"convertedDealId":{"type":["string","null"],"format":"uuid"},"convertedAt":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"LeadCreate":{"type":"object","additionalProperties":false,"description":"Reject-unknown-fields. At least one of email, name, or company is required.","properties":{"name":{"type":["string","null"]},"email":{"type":["string","null"],"format":"email"},"company":{"type":["string","null"]},"phone":{"type":["string","null"]},"score":{"type":["integer","null"],"minimum":0,"maximum":100},"source":{"type":["string","null"]},"country":{"type":["string","null"]},"region":{"type":["string","null"]},"plan":{"type":["string","null"]},"ownerId":{"type":["string","null"],"format":"uuid"},"notes":{"type":["string","null"]},"tags":{"type":"array","items":{"type":"string"}},"customFields":{"$ref":"#/components/schemas/CustomFields"}}},"LeadUpdate":{"type":"object","additionalProperties":false,"description":"Reject-unknown-fields. customFields shallow-merges into the existing bag.","properties":{"name":{"type":["string","null"]},"email":{"type":["string","null"],"format":"email"},"company":{"type":["string","null"]},"phone":{"type":["string","null"]},"score":{"type":["integer","null"]},"source":{"type":["string","null"]},"country":{"type":["string","null"]},"region":{"type":["string","null"]},"plan":{"type":["string","null"]},"status":{"type":"string","enum":["new","working"]},"ownerId":{"type":["string","null"],"format":"uuid"},"notes":{"type":["string","null"]},"tags":{"type":"array","items":{"type":"string"}},"customFields":{"$ref":"#/components/schemas/CustomFields"}}},"Task":{"type":"object","additionalProperties":true,"properties":{"id":{"type":"string","format":"uuid"},"tenantId":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["call","email","meeting","todo","followup","review","demo"]},"title":{"type":"string"},"notes":{"type":["string","null"]},"done":{"type":"boolean"},"priority":{"type":"string","enum":["urgent","high","normal","low"]},"dueAt":{"type":["string","null"],"format":"date-time"},"snoozedUntil":{"type":["string","null"],"format":"date-time"},"contactId":{"type":["string","null"],"format":"uuid"},"accountId":{"type":["string","null"],"format":"uuid"},"dealId":{"type":["string","null"],"format":"uuid"},"leadId":{"type":["string","null"],"format":"uuid"},"ownerId":{"type":["string","null"],"format":"uuid"},"customFields":{"$ref":"#/components/schemas/CustomFields"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"TaskCreate":{"type":"object","additionalProperties":false,"required":["title"],"description":"Reject-unknown-fields.","properties":{"kind":{"type":"string","enum":["call","email","meeting","todo","followup","review","demo"]},"title":{"type":"string"},"notes":{"type":["string","null"]},"dueAt":{"type":["string","null"],"format":"date-time"},"priority":{"type":"string","enum":["urgent","high","normal","low"]},"done":{"type":"boolean"},"snoozedUntil":{"type":["string","null"],"format":"date-time"},"waitingOnUserId":{"type":["string","null"],"format":"uuid"},"waitingOnLabel":{"type":["string","null"]},"automationName":{"type":["string","null"]},"contactId":{"type":["string","null"],"format":"uuid"},"accountId":{"type":["string","null"],"format":"uuid"},"dealId":{"type":["string","null"],"format":"uuid"},"leadId":{"type":["string","null"],"format":"uuid"},"ownerId":{"type":["string","null"],"format":"uuid"},"customFields":{"$ref":"#/components/schemas/CustomFields"},"subtasks":{"type":"array","items":{"type":"object","required":["text"],"properties":{"text":{"type":"string"},"done":{"type":"boolean"}}}}}},"TaskUpdate":{"type":"object","additionalProperties":false,"description":"Reject-unknown-fields. customFields shallow-merges into the existing bag.","properties":{"kind":{"type":"string","enum":["call","email","meeting","todo","followup","review","demo"]},"title":{"type":"string"},"notes":{"type":["string","null"]},"dueAt":{"type":["string","null"],"format":"date-time"},"priority":{"type":"string","enum":["urgent","high","normal","low"]},"done":{"type":"boolean"},"snoozedUntil":{"type":["string","null"],"format":"date-time"},"waitingOnUserId":{"type":["string","null"],"format":"uuid"},"waitingOnLabel":{"type":["string","null"]},"contactId":{"type":["string","null"],"format":"uuid"},"accountId":{"type":["string","null"],"format":"uuid"},"dealId":{"type":["string","null"],"format":"uuid"},"leadId":{"type":["string","null"],"format":"uuid"},"ownerId":{"type":["string","null"],"format":"uuid"},"customFields":{"$ref":"#/components/schemas/CustomFields"}}},"Activity":{"type":"object","additionalProperties":true,"properties":{"id":{"type":"string","format":"uuid"},"tenantId":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["call","email","meeting","note","task","demo","stage_change","record_created","assignment","form_fill","automation_run"]},"subject":{"type":"string"},"body":{"type":["string","null"]},"occurredAt":{"type":"string","format":"date-time"},"durationSeconds":{"type":["integer","null"]},"outcome":{"type":["string","null"],"enum":["positive","neutral","negative",null]},"direction":{"type":["string","null"],"enum":["inbound","outbound",null]},"attendees":{"type":"array"},"starred":{"type":"boolean"},"pinned":{"type":"boolean"},"contactId":{"type":["string","null"],"format":"uuid"},"accountId":{"type":["string","null"],"format":"uuid"},"dealId":{"type":["string","null"],"format":"uuid"},"leadId":{"type":["string","null"],"format":"uuid"},"ownerId":{"type":["string","null"],"format":"uuid"},"automationId":{"type":["string","null"],"format":"uuid"},"parentActivityId":{"type":["string","null"],"format":"uuid"},"customFields":{"$ref":"#/components/schemas/CustomFields"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"ActivityCreate":{"type":"object","additionalProperties":false,"required":["type","subject"],"description":"Reject-unknown-fields. All relation fields (contactId/accountId/dealId/leadId) and ownerId are settable on create (no create-then-PATCH round-trip required). `ownerId` is gated by `activities:write`; any user in the tenant may be set.","properties":{"type":{"type":"string","enum":["call","email","meeting","note","task","demo","stage_change","record_created","assignment","form_fill","automation_run"]},"subject":{"type":"string"},"body":{"type":["string","null"]},"occurredAt":{"type":"string","format":"date-time"},"durationSeconds":{"type":["integer","null"]},"outcome":{"type":["string","null"],"enum":["positive","neutral","negative",null]},"direction":{"type":["string","null"],"enum":["inbound","outbound",null]},"attendees":{"type":"array"},"starred":{"type":"boolean"},"pinned":{"type":"boolean"},"parentActivityId":{"type":["string","null"],"format":"uuid"},"contactId":{"type":["string","null"],"format":"uuid"},"accountId":{"type":["string","null"],"format":"uuid"},"dealId":{"type":["string","null"],"format":"uuid"},"leadId":{"type":["string","null"],"format":"uuid"},"ownerId":{"type":["string","null"],"format":"uuid"},"customFields":{"$ref":"#/components/schemas/CustomFields"},"links":{"type":"array","description":"Polymorphic activity_links inserts. Same shape as activity_links table.","items":{"type":"object","required":["entityType","entityId"],"properties":{"entityType":{"type":"string"},"entityId":{"type":"string","format":"uuid"}}}}}},"ActivityUpdate":{"type":"object","additionalProperties":false,"description":"Reject-unknown-fields. customFields shallow-merges into the existing bag.","properties":{"subject":{"type":"string"},"body":{"type":["string","null"]},"occurredAt":{"type":"string","format":"date-time"},"durationSeconds":{"type":["integer","null"]},"outcome":{"type":["string","null"],"enum":["positive","neutral","negative",null]},"direction":{"type":["string","null"],"enum":["inbound","outbound",null]},"starred":{"type":"boolean"},"pinned":{"type":"boolean"},"contactId":{"type":["string","null"],"format":"uuid"},"accountId":{"type":["string","null"],"format":"uuid"},"dealId":{"type":["string","null"],"format":"uuid"},"leadId":{"type":["string","null"],"format":"uuid"},"ownerId":{"type":["string","null"],"format":"uuid"},"customFields":{"$ref":"#/components/schemas/CustomFields"}}},"CustomFields":{"type":"object","additionalProperties":true,"description":"Free-form JSON metadata bag. Round-trips on every standard-object create + update. PATCH shallow-merges into the existing bag rather than replacing it, so a caller updating one key preserves the others. Silent-drop bug (Beauford Request 1) fixed 2026-08-23."},"ObjectDef":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"apiName":{"type":"string"},"label":{"type":"string"},"plural":{"type":["string","null"]},"kind":{"type":"string","enum":["standard","custom"]},"module":{"type":["string","null"]},"icon":{"type":["string","null"]},"description":{"type":["string","null"]}}},"FieldDef":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"apiName":{"type":"string"},"label":{"type":"string"},"fieldType":{"type":"string"},"isRequired":{"type":"boolean"},"isUnique":{"type":"boolean"},"options":{"type":"array","items":{"type":"object"}}}},"CustomRecord":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":["string","null"]},"ownerId":{"type":["string","null"],"format":"uuid"},"fields":{"type":"object","additionalProperties":true},"tags":{"type":"array","items":{"type":"string"}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"CustomRecordCreate":{"type":"object","properties":{"name":{"type":["string","null"]},"ownerId":{"type":["string","null"],"format":"uuid"},"fields":{"type":"object","additionalProperties":true},"tags":{"type":"array","items":{"type":"string"}}}},"CustomRecordUpdate":{"type":"object","properties":{"name":{"type":["string","null"]},"ownerId":{"type":["string","null"],"format":"uuid"},"fields":{"type":"object","additionalProperties":true},"tags":{"type":"array","items":{"type":"string"}}}},"Attachment":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"parentObjectId":{"type":["string","null"],"format":"uuid"},"parentRecordId":{"type":["string","null"],"format":"uuid"},"name":{"type":"string"},"mimeType":{"type":"string"},"sizeBytes":{"type":"integer"},"uploadedBy":{"type":["string","null"],"format":"uuid"},"uploadedAt":{"type":"string","format":"date-time"}}},"AttachmentCreate":{"type":"object","required":["attachmentId","name","mimeType","sizeBytes","s3Key"],"properties":{"attachmentId":{"type":"string","format":"uuid"},"parentObjectApiName":{"type":["string","null"]},"parentRecordId":{"type":["string","null"],"format":"uuid"},"name":{"type":"string"},"mimeType":{"type":"string"},"sizeBytes":{"type":"integer"},"s3Key":{"type":"string"}}},"AttachmentPresignRequest":{"type":"object","required":["name","mimeType","sizeBytes"],"properties":{"parentObjectApiName":{"type":["string","null"]},"parentRecordId":{"type":["string","null"],"format":"uuid"},"name":{"type":"string"},"mimeType":{"type":"string"},"sizeBytes":{"type":"integer","maximum":52428800}}},"AttachmentPresignResponse":{"type":"object","properties":{"uploadUrl":{"type":"string","format":"uri"},"fields":{"type":"object","additionalProperties":{"type":"string"}},"attachmentId":{"type":"string","format":"uuid"},"s3Key":{"type":"string"},"parentObjectId":{"type":["string","null"],"format":"uuid"}}},"ChannelConsent":{"type":"object","required":["state"],"properties":{"state":{"type":"string","enum":["opted_in","opted_out","unknown"],"description":"Consent state on this channel. `unknown` (default when never set) is resolved by the tenant marketing-posture setting: `permissive` allows sends, `strict` blocks marketing sends."},"last_changed_at":{"type":["string","null"],"format":"date-time","description":"When the state last changed. Set by the server on write."},"source":{"type":["string","null"],"description":"Where the change came from. Common values: `self_service_portal`, `unsubscribe_link`, `sms_stop`, `csv_import`, `api`, `admin`, `system`. Free-form so tenants can add their own."},"note":{"type":["string","null"],"maxLength":500,"description":"Optional free-text detail on why the state was set."}}},"QuietHours":{"type":"object","required":["start","end"],"properties":{"start":{"type":"string","pattern":"^\\d{2}:\\d{2}$","description":"24h HH:MM. Sends are held between start and end."},"end":{"type":"string","pattern":"^\\d{2}:\\d{2}$","description":"24h HH:MM. Windows that wrap midnight are supported (start > end)."},"tz":{"type":["string","null"],"description":"IANA tz db name (America/Chicago, Europe/London). Defaults to the tenant timezone."}}},"InboxThreadSummary":{"type":"object","description":"Lightweight thread record. For the full body of each message hit the internal `/inbox/threads/{id}/messages`; the public API surface intentionally stops at the summary to keep the auth boundary tight.","properties":{"id":{"type":"string","format":"uuid"},"provider":{"type":"string","enum":["gmail","microsoft-365"],"description":"Origin mail provider that owns the thread."},"subject":{"type":["string","null"]},"snippet":{"type":["string","null"],"description":"First ~1KB of the latest message body."},"participants":{"type":"array","items":{"type":"object","properties":{"email":{"type":"string"},"name":{"type":"string"}}}},"messageCount":{"type":"integer"},"lastMessageAt":{"type":["string","null"],"format":"date-time"},"unreadCount":{"type":"integer"},"labels":{"type":"array","items":{"type":"string"}},"isHotReply":{"type":"boolean","description":"Set when the scoring engine flagged the thread as a hot reply."}}},"MessagingChannel":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"channelType":{"type":"string","enum":["sms","mms","imessage","rcs","whatsapp","voice"]},"provider":{"type":"string","description":"Internal provider slug backing this channel. Values are managed by Strkr Messaging; treat as opaque."},"phoneNumber":{"type":"string","description":"E.164 sender."},"displayName":{"type":["string","null"]},"status":{"type":"string","enum":["pending","active","suspended","released"]},"capabilities":{"type":"object","additionalProperties":true},"createdAt":{"type":["string","null"],"format":"date-time"}}},"MessagingThread":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"channelId":{"type":"string","format":"uuid"},"ourNumber":{"type":"string"},"peerNumber":{"type":"string"},"snippet":{"type":["string","null"]},"messageCount":{"type":"integer"},"unreadCount":{"type":"integer"},"lastMessageAt":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":["string","null"],"format":"date-time"}}},"MessagingMessage":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"threadId":{"type":"string","format":"uuid"},"channelId":{"type":"string","format":"uuid"},"direction":{"type":"string","enum":["inbound","outbound"]},"fromNumber":{"type":"string"},"toNumber":{"type":"string"},"body":{"type":["string","null"]},"mediaUrls":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["queued","sent","delivered","undelivered","failed","received"]},"providerMessageId":{"type":["string","null"]},"segmentCount":{"type":"integer"},"sentAt":{"type":["string","null"],"format":"date-time","description":"Server timestamp of send (outbound) or carrier-reported timestamp (inbound)."},"createdAt":{"type":["string","null"],"format":"date-time"}}},"MessagingSendRequest":{"type":"object","additionalProperties":false,"required":["channelId","toNumber","body"],"description":"Reject-unknown-fields. Presence of `attachmentIds` promotes the message to MMS (higher segment cost). `consentContext` is optional but strongly recommended when the recipient maps to a CRM record. without it the send-path can't check purpose-scoped opt-out. Body cap of 1600 matches the internal composer so messages round-trip cleanly (M9 B4).","properties":{"channelId":{"type":"string","format":"uuid","description":"Messaging channel to send FROM."},"toNumber":{"type":"string","description":"E.164 recipient (+14155551234)."},"body":{"type":"string","minLength":1,"maxLength":1600},"attachmentIds":{"type":"array","maxItems":10,"items":{"type":"string","format":"uuid"},"description":"Attachment IDs (tenant-owned) to send as MMS media. Upload via `POST /v1/attachments` then reference the returned id here. Arbitrary URLs are NOT accepted (M9 B4, 2026-09-05) to prevent a caller from forcing the carrier to fetch attacker-controlled content on your tab."},"consentContext":{"type":"object","additionalProperties":false,"required":["entity","purpose"],"properties":{"entity":{"type":"object","additionalProperties":false,"required":["kind","id"],"properties":{"kind":{"type":"string","enum":["contact","lead","account"]},"id":{"type":"string","format":"uuid"}}},"purpose":{"type":"string","enum":["marketing","transactional","service"]}}}}},"MessagingSendResponse":{"type":"object","properties":{"messageId":{"type":"string","format":"uuid"},"threadId":{"type":"string","format":"uuid"},"providerMessageId":{"type":"string"},"segmentCount":{"type":"integer","description":"Carrier-reported segment count. Drives billing."}}},"ContactPreferences":{"type":"object","description":"Per-record consent + preferences bag. Every key is optional; a missing key reads as `unknown` at the resolver. Contact-level preferences win over the parent account's rollup when both are set. Every mutation lands in the audit log with source + actor metadata.","properties":{"channels":{"type":"object","description":"Consent state per channel. Absent channel = unknown.","properties":{"email":{"$ref":"#/components/schemas/ChannelConsent"},"sms":{"$ref":"#/components/schemas/ChannelConsent"},"phone":{"$ref":"#/components/schemas/ChannelConsent"},"postal":{"$ref":"#/components/schemas/ChannelConsent"},"whatsapp":{"$ref":"#/components/schemas/ChannelConsent"}},"additionalProperties":false},"purposes":{"type":"object","description":"Per-purpose gate. Intersected with channel state (both must pass).","properties":{"marketing":{"type":"string","enum":["allow","deny","unknown"]},"transactional":{"type":"string","enum":["allow","deny","unknown"]},"service":{"type":"string","enum":["allow","deny","unknown"]}},"additionalProperties":false},"global_do_not_contact":{"type":"boolean","description":"Hard override: when true, EVERY channel + purpose is blocked regardless of per-channel state. Set on GDPR erasure, legal hold, or the record's \"unsubscribe from everything\" click."},"reason":{"type":["string","null"],"maxLength":500,"description":"Free-text explanation for the current state (esp. global_do_not_contact)."},"quiet_hours":{"oneOf":[{"$ref":"#/components/schemas/QuietHours"},{"type":"null"}]},"updated_at":{"type":["string","null"],"format":"date-time","description":"Server-stamped on every write. Read-only from callers.","readOnly":true}},"additionalProperties":false}}},"x-strkr-scopes":["leads:write","leads:read","leads:delete","accounts:read","accounts:write","accounts:delete","contacts:read","contacts:write","contacts:delete","deals:read","deals:write","deals:delete","tasks:read","tasks:write","tasks:delete","activities:read","activities:write","activities:delete","custom-objects:read","custom-objects:write","custom-objects:delete","files:read","files:write","files:delete","schema:read","inbox:read","messaging:read","messaging:write","events:listen","admin"]}