{"openapi":"3.1.0","info":{"title":"Orinax Public CRM API","version":"1.2.0","description":"Per-organization REST API for Grok, Codex, Claude, n8n and custom backends. Authenticate with `Authorization: Bearer oxk_…` or an MCP OAuth JWT. Claude/ChatGPT connect at my.orinax.ru/profile/mcp. Actions are limited by both token scopes and the actor's CRM ACL."},"servers":[{"url":"https://api.orinax.ru/v1","description":"Production"},{"url":"https://api.dev.orinax.ru/v1","description":"Development"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"oxk"}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}}},"Page":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object"}},"nextCursor":{"type":["string","null"]}}}}},"paths":{"/health":{"get":{"security":[],"summary":"Liveness","responses":{"200":{"description":"OK"}}}},"/me":{"get":{"summary":"Current key + actor","responses":{"200":{"description":"Key and actor"}}}},"/pipelines":{"get":{"summary":"Deal and lead pipelines with stages","responses":{"200":{"description":"Pipelines"}}}},"/members":{"get":{"summary":"Organization members","responses":{"200":{"description":"Members"}}}},"/deals":{"get":{"summary":"List deals","parameters":[{"name":"pipelineId","in":"query","schema":{"type":"string"}},{"name":"stageId","in":"query","schema":{"type":"string"}},{"name":"search","in":"query","schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"integer"}},{"name":"cursor","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Page of deals"}}},"post":{"summary":"Create a deal","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string"},"value":{"type":"number"},"description":{"type":"string"},"pipelineId":{"type":"string"},"stageId":{"type":"string"},"contactId":{"type":"string"},"companyId":{"type":"string"},"assignedId":{"type":"string"}}}}}},"responses":{"201":{"description":"Created deal"}}}},"/deals/{id}":{"get":{"summary":"Get deal by UUID or serialNumber (e.g. 39716). Does not include messenger chats.","responses":{"200":{"description":"Deal"}}},"patch":{"summary":"Update deal","responses":{"200":{"description":"Deal"}}},"delete":{"summary":"Soft-delete deal","responses":{"200":{"description":"OK"}}}},"/deals/{id}/conversations":{"get":{"summary":"Messenger chats linked to the deal (MAX, Avito, Telegram, WhatsApp, VK), same as the CRM Chat tab. {id} is UUID or serialNumber. Requires connector.conversations.read. REST default: no messages; pass includeMessages=true to attach last stored messages (max 200/chat).","parameters":[{"name":"includeMessages","in":"query","schema":{"type":"boolean"}},{"name":"messageLimit","in":"query","schema":{"type":"integer","minimum":1,"maximum":200}}],"responses":{"200":{"description":"Deal chats from the connector database"}}}},"/deals/{id}/stage":{"post":{"summary":"Move deal to a stage","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["stageId"],"properties":{"stageId":{"type":"string"}}}}}},"responses":{"200":{"description":"Deal"}}}},"/deals/{id}/comments":{"get":{"summary":"Deal comments","responses":{"200":{"description":"Comments"}}},"post":{"summary":"Add comment","responses":{"201":{"description":"Comment"}}}},"/deals/{id}/timeline":{"get":{"summary":"Deal activity timeline","responses":{"200":{"description":"Activities"}}}},"/contacts":{"get":{"summary":"List contacts","responses":{"200":{"description":"Page"}}},"post":{"summary":"Create contact","responses":{"201":{"description":"Contact"}}}},"/contacts/{id}":{"get":{"summary":"Get contact","responses":{"200":{"description":"Contact"}}},"patch":{"summary":"Update contact","responses":{"200":{"description":"Contact"}}},"delete":{"summary":"Soft-delete contact","responses":{"200":{"description":"OK"}}}},"/companies":{"get":{"summary":"List companies","responses":{"200":{"description":"Page"}}},"post":{"summary":"Create company","responses":{"201":{"description":"Company"}}}},"/companies/{id}":{"get":{"summary":"Get company","responses":{"200":{"description":"Company"}}},"patch":{"summary":"Update company","responses":{"200":{"description":"Company"}}},"delete":{"summary":"Soft-delete company","responses":{"200":{"description":"OK"}}}},"/leads":{"get":{"summary":"List leads","responses":{"200":{"description":"Page"}}},"post":{"summary":"Create lead","responses":{"201":{"description":"Lead"}}}},"/leads/{id}":{"get":{"summary":"Get lead","responses":{"200":{"description":"Lead"}}},"patch":{"summary":"Update lead","responses":{"200":{"description":"Lead"}}},"delete":{"summary":"Soft-delete lead","responses":{"200":{"description":"OK"}}}},"/leads/{id}/convert":{"post":{"summary":"Convert lead to deal","responses":{"201":{"description":"Deal"}}}},"/tasks":{"get":{"summary":"List tasks","responses":{"200":{"description":"Page"}}},"post":{"summary":"Create task","responses":{"201":{"description":"Task"}}}},"/tasks/{id}":{"get":{"summary":"Get task","responses":{"200":{"description":"Task"}}},"patch":{"summary":"Update task (status, title, dueDate)","responses":{"200":{"description":"Task"}}},"delete":{"summary":"Soft-delete task","responses":{"200":{"description":"OK"}}}},"/custom-fields":{"get":{"summary":"Custom field definitions","parameters":[{"name":"entityType","in":"query","schema":{"type":"string","enum":["DEAL","CONTACT","COMPANY","LEAD"]}},{"name":"pipelineId","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Field definitions"}}}},"/conversations":{"get":{"summary":"List connector conversations (DB-only, no history import)","parameters":[{"name":"instanceId","in":"query","schema":{"type":"string"}},{"name":"channel","in":"query","schema":{"type":"string"}},{"name":"search","in":"query","schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"integer"}},{"name":"cursor","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Page of conversations"}}}},"/conversations/{id}":{"get":{"summary":"Get conversation","responses":{"200":{"description":"Conversation"}}}},"/conversations/{id}/messages":{"get":{"summary":"List messages (DB-only)","responses":{"200":{"description":"Messages"}}},"post":{"summary":"Send text or reply (Avito/Telegram reply)","responses":{"201":{"description":"Sent"}}}},"/conversations/{id}/messages/file":{"post":{"summary":"Send file","responses":{"201":{"description":"Sent"}}}},"/telephony/status":{"get":{"summary":"Telephony status without SIP secrets","responses":{"200":{"description":"Status"}}}},"/telephony/numbers":{"get":{"summary":"Purchased numbers","responses":{"200":{"description":"Numbers"}}}},"/telephony/calls":{"get":{"summary":"Call history","responses":{"200":{"description":"Calls"}}}},"/calendars":{"get":{"summary":"Calendars visible to the actor","responses":{"200":{"description":"Calendars"}}}},"/calendar-events":{"get":{"summary":"List calendar events","parameters":[{"name":"from","in":"query","required":true,"schema":{"type":"string","format":"date-time"}},{"name":"to","in":"query","required":true,"schema":{"type":"string","format":"date-time"}},{"name":"calendarId","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Events"}}},"post":{"summary":"Create calendar event","responses":{"201":{"description":"Event"}}}},"/calendar-events/{id}":{"get":{"summary":"Get event","responses":{"200":{"description":"Event"}}},"patch":{"summary":"Update event","responses":{"200":{"description":"Event"}}},"delete":{"summary":"Delete event","responses":{"200":{"description":"OK"}}}},"/webhooks":{"get":{"summary":"List outgoing webhooks","responses":{"200":{"description":"Webhooks"}}},"post":{"summary":"Create outgoing webhook","responses":{"201":{"description":"Webhook + secret once"}}}},"/webhooks/{id}":{"patch":{"summary":"Update webhook","responses":{"200":{"description":"Webhook"}}},"delete":{"summary":"Delete webhook","responses":{"200":{"description":"OK"}}}}}}