{"openapi":"3.0.3","info":{"title":"leanDeals API","version":"1.0.0","description":"Programmatic access to your leanDeals workspace: deals, contacts, companies,\nboards, notes and everything the app itself works with.\n\nThe API lives on its own host, `https://api.lean-deals.com`. Requests to any\nother host return `404`, so the app domain will not serve `/v1` endpoints.\n\n## Authentication\n\nEvery `/v1` endpoint requires an API key. There is no anonymous access and no\nOAuth flow — one static key per integration, sent as a header:\n\n```\nx-api-key: ldk_your_key_here\n```\n\n```bash\ncurl https://api.lean-deals.com/v1/deals \\\n  -H \"x-api-key: $LEANDEALS_API_KEY\"\n```\n\nThe key belongs in the header only. It is never accepted as a query parameter\nor in the request body, and `Authorization: Bearer` is not supported.\n\n### Getting a key\n\nIn the app, go to **Profile → Workspace → API keys**\n([app.lean-deals.com/profile/workspace](https://app.lean-deals.com/profile/workspace)),\ncreate a key, pick its scopes and an expiry.\n\nKeys look like `ldk_` followed by 43 random characters. **The full key is shown\nexactly once, at creation.** Only a SHA-256 hash and the first 12 characters are\nstored, so a lost key cannot be recovered — create a new one and revoke the old.\nStore it as a server-side secret; it carries full workspace access within its\nscopes, so it does not belong in browser code, mobile apps or a public repo.\n\n### One key, one workspace\n\nA key is bound to the workspace it was created in and can never reach another\none. Endpoints that take a `workspace_id` treat it as optional — leave it out\nand the key's own workspace is used. Passing a different workspace's id returns\n`403`, it does not silently fall back.\n\nWrites are attributed to the user who created the key, and appear in a record's\nhistory marked as coming through the API rather than typed by a person.\n\n### Scopes\n\nEach key carries a list of scopes. The required scope is derived from the\nendpoint and the HTTP method: `GET` needs `<resource>.read`, and `POST`,\n`PUT`, `PATCH` and `DELETE` need `<resource>.write`. A key holding only\n`deals.read` can list deals but cannot create one, and cannot touch contacts\nat all.\n\n| Resource | Read | Write |\n| --- | --- | --- |\n| `/v1/deals` | `deals.read` | `deals.write` |\n| `/v1/organizations` | `organizations.read` | `organizations.write` |\n| `/v1/persons` | `persons.read` | `persons.write` |\n| `/v1/notes` | `notes.read` | `notes.write` |\n| `/v1/events` | `events.read` or `reminders.read` | `events.write` or `reminders.write` |\n| `/v1/reminders` | `reminders.read` | `reminders.write` |\n| `/v1/boards` | `boards.read` | `boards.write` |\n| `/v1/stages` | `stages.read` | `stages.write` |\n| `/v1/custom_fields` | `custom_fields.read` | `custom_fields.write` |\n| `/v1/record_history` | `record_history.read` | — (read-only) |\n| `/v1/users` | `users.read` | — (read-only) |\n| `/v1/workspaces` | `workspaces.read` | — (read-only) |\n\nThe wildcard scope `*` satisfies every check. It is convenient for a first\nprototype and a poor idea for anything long-lived — give an integration the two\nor three scopes it actually uses.\n\n`/v1/events` accepts either the `events.*` or the `reminders.*` scope. The\nresource was renamed and keys minted before the rename keep working; new keys\nshould use `events.*`.\n\nChanging a key's scopes in the app takes effect on the next request. There is\nno need to re-issue the key.\n\n### Expiry and revocation\n\nA key stops working the moment it expires or is revoked — both are immediate,\nand both produce the same `401` as a key that never existed. Revoking is the\nright response to a leak; there is no way to rotate a key in place, so issue the\nreplacement first, deploy it, then revoke the old one.\n\nEvery accepted request updates the key's `last_used_at`, which the key list in\nthe app shows — a quick way to find integrations that quietly stopped running,\nor a key nobody remembers creating.\n\n### Authentication errors\n\n| Status | `error` | What happened |\n| --- | --- | --- |\n| `401` | `Unauthorized` | No `x-api-key` header, or a key that is unknown, revoked or expired. |\n| `403` | `Forbidden` | The key is valid but lacks the scope for this endpoint and method, or points at a different workspace than the request. |\n| `404` | `Not Found` | The request did not reach `api.lean-deals.com`. |\n\nFailures carry a `message` explaining which check failed — a missing scope\nresponse names the scope it wanted:\n\n```json\n{\n  \"success\": false,\n  \"error\": \"Forbidden\",\n  \"message\": \"Missing required API key scope: deals.write\"\n}\n```\n\nRetrying a `401` or `403` with the same key will not help; both are decisions\nabout the key itself, not transient failures."},"servers":[{"url":"https://api.lean-deals.com"}],"components":{"securitySchemes":{"apiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Workspace API key, sent as the `x-api-key` header on every request:\n\n```\nx-api-key: ldk_your_key_here\n```\n\nCreate one in the app under **Profile → Workspace → API keys**. The full key is\nshown only at creation and cannot be recovered afterwards.\n\nThe key is bound to a single workspace, and each endpoint additionally requires a\nscope derived from the method: `GET` needs `<resource>.read`, writes need\n`<resource>.write`, and `*` satisfies everything. A missing or expired key returns\n`401`; a valid key without the required scope returns `403`."}},"schemas":{"AuthError":{"type":"object","required":["success","error","message"],"properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"Unauthorized"},"message":{"type":"string","description":"Which authentication check failed.","example":"Invalid or expired API key"}}},"Error":{"type":"object","required":["success","error"],"properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"Validation failed"}}},"Deal":{"type":"object","required":["id","workspace_id","title","amount","status","board_id","stage_id","created_at","updated_at"],"properties":{"id":{"type":"string","format":"uuid"},"workspace_id":{"type":"string","format":"uuid"},"title":{"type":"string"},"amount":{"type":"number","format":"float"},"status":{"type":"string"},"board_id":{"type":"string","format":"uuid"},"stage_id":{"type":"string","format":"uuid"},"person_id":{"type":"string","format":"uuid","nullable":true},"organization_id":{"type":"string","format":"uuid","nullable":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"DealInput":{"type":"object","required":["workspace_id","title","board_id","stage_id"],"properties":{"workspace_id":{"type":"string","format":"uuid"},"title":{"type":"string"},"amount":{"type":"number","format":"float"},"status":{"type":"string"},"board_id":{"type":"string","format":"uuid"},"stage_id":{"type":"string","format":"uuid"},"person_id":{"type":"string","format":"uuid","nullable":true},"organization_id":{"type":"string","format":"uuid","nullable":true}}},"DealUpdate":{"type":"object","required":["board_id","stage_id"],"properties":{"title":{"type":"string"},"amount":{"type":"number","format":"float"},"status":{"type":"string"},"board_id":{"type":"string","format":"uuid"},"stage_id":{"type":"string","format":"uuid"},"person_id":{"type":"string","format":"uuid","nullable":true},"organization_id":{"type":"string","format":"uuid","nullable":true}}},"Board":{"type":"object","required":["id","workspace_id","name","created_at","updated_at"],"properties":{"id":{"type":"string","format":"uuid"},"workspace_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"BoardInput":{"type":"object","required":["workspace_id","name"],"properties":{"workspace_id":{"type":"string","format":"uuid"},"name":{"type":"string"}},"example":{"workspace_id":"00000000-0000-0000-0000-000000000001","name":"Sales Pipeline"}},"BoardUpdate":{"type":"object","properties":{"name":{"type":"string"}},"example":{"name":"Enterprise Sales Pipeline"}},"Stage":{"type":"object","required":["id","board_id","name","color","position"],"properties":{"id":{"type":"string","format":"uuid"},"board_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"color":{"type":"string"},"position":{"type":"integer","minimum":0}}},"StageInput":{"type":"object","required":["board_id","name"],"properties":{"board_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"color":{"type":"string","default":"bg-gray-200"},"position":{"type":"integer","minimum":0,"default":0}},"example":{"board_id":"00000000-0000-0000-0000-000000000001","name":"Qualified","color":"bg-blue-200","position":1}},"StageUpdate":{"type":"object","properties":{"name":{"type":"string"},"color":{"type":"string"},"position":{"type":"integer","minimum":0}},"example":{"name":"Proposal Sent","color":"bg-green-200","position":2}},"StageBulkPositionInput":{"type":"object","required":["stages"],"properties":{"stages":{"type":"array","minItems":1,"items":{"type":"object","required":["id","position"],"properties":{"id":{"type":"string","format":"uuid"},"position":{"type":"integer","minimum":0}}}}},"example":{"stages":[{"id":"00000000-0000-0000-0000-000000000001","position":0},{"id":"00000000-0000-0000-0000-000000000002","position":1}]}},"Organization":{"type":"object","required":["id","workspace_id","name","created_at","updated_at"],"properties":{"id":{"type":"string","format":"uuid"},"workspace_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"domain":{"type":"string","nullable":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"OrganizationInput":{"type":"object","required":["workspace_id","name"],"properties":{"workspace_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"domain":{"type":"string","nullable":true}}},"OrganizationUpdate":{"type":"object","properties":{"name":{"type":"string"},"domain":{"type":"string","nullable":true}}},"ContactPoint":{"type":"object","description":"One e-mail address or phone number of a contact. A contact may have several of each; exactly one of each kind is the primary, and that is the value mirrored into the flat `email` / `phone` fields.\n","required":["id","value","is_primary","position"],"properties":{"id":{"type":"string","format":"uuid"},"value":{"type":"string"},"label":{"type":"string","nullable":true,"description":"Free text. The app offers work / personal / billing / other."},"is_primary":{"type":"boolean"},"position":{"type":"integer"}}},"ContactPointInput":{"type":"object","required":["value"],"properties":{"value":{"type":"string"},"label":{"type":"string","nullable":true,"maxLength":50},"is_primary":{"type":"boolean","description":"When no entry is flagged, the first one becomes the primary. Flagging more than one keeps only the first.\n"}}},"Person":{"type":"object","required":["id","workspace_id","first_name","last_name","created_at","updated_at"],"properties":{"id":{"type":"string","format":"uuid"},"workspace_id":{"type":"string","format":"uuid"},"first_name":{"type":"string"},"last_name":{"type":"string"},"email":{"type":"string","format":"email","nullable":true,"description":"The primary address, kept in sync with `emails`."},"phone":{"type":"string","nullable":true,"description":"The primary number, kept in sync with `phones`."},"emails":{"type":"array","items":{"$ref":"#/components/schemas/ContactPoint"}},"phones":{"type":"array","items":{"$ref":"#/components/schemas/ContactPoint"}},"organization_id":{"type":"string","format":"uuid","nullable":true},"job_title":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"linkedin_url":{"type":"string","format":"uri","nullable":true},"notes":{"type":"string","nullable":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"PersonInput":{"type":"object","required":["workspace_id","first_name","last_name"],"properties":{"workspace_id":{"type":"string","format":"uuid"},"first_name":{"type":"string"},"last_name":{"type":"string"},"email":{"type":"string","format":"email","nullable":true,"description":"Sets the primary address. Ignored when `emails` is also sent."},"phone":{"type":"string","nullable":true,"description":"Sets the primary number. Ignored when `phones` is also sent."},"emails":{"type":"array","maxItems":20,"items":{"$ref":"#/components/schemas/ContactPointInput"}},"phones":{"type":"array","maxItems":20,"items":{"$ref":"#/components/schemas/ContactPointInput"}},"organization_id":{"type":"string","format":"uuid","nullable":true},"job_title":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"linkedin_url":{"type":"string","format":"uri","nullable":true},"notes":{"type":"string","nullable":true}}},"PersonUpdate":{"type":"object","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"email":{"type":"string","format":"email","nullable":true,"description":"Sets the primary address. Ignored when `emails` is also sent."},"phone":{"type":"string","nullable":true,"description":"Sets the primary number. Ignored when `phones` is also sent."},"emails":{"type":"array","maxItems":20,"description":"Replaces the whole list. Omit the field to leave the addresses untouched; send an empty array to remove them all.\n","items":{"$ref":"#/components/schemas/ContactPointInput"}},"phones":{"type":"array","maxItems":20,"items":{"$ref":"#/components/schemas/ContactPointInput"}},"organization_id":{"type":"string","format":"uuid","nullable":true},"job_title":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"linkedin_url":{"type":"string","format":"uri","nullable":true},"notes":{"type":"string","nullable":true}}},"Event":{"type":"object","required":["id","workspace_id","title","type","starts_at","completed","created_at","updated_at"],"properties":{"id":{"type":"string","format":"uuid"},"workspace_id":{"type":"string","format":"uuid"},"title":{"type":"string"},"type":{"type":"string","enum":["task","meeting","call","email"]},"starts_at":{"type":"string","format":"date-time"},"ends_at":{"type":"string","format":"date-time","nullable":true},"all_day":{"type":"boolean"},"location":{"type":"string","nullable":true},"conference_url":{"type":"string","format":"uri","nullable":true},"description":{"type":"string","nullable":true},"completed":{"type":"boolean"},"completed_at":{"type":"string","format":"date-time","nullable":true},"outcome":{"type":"string","enum":["done","no_answer","rescheduled","cancelled","no_show"],"nullable":true},"outcome_note":{"type":"string","nullable":true},"person_id":{"type":"string","format":"uuid","nullable":true},"organization_id":{"type":"string","format":"uuid","nullable":true},"deal_id":{"type":"string","format":"uuid","nullable":true},"owner_id":{"type":"string","format":"uuid","nullable":true,"description":"Who the event is assigned to. Null means unassigned."},"created_by":{"type":"string","format":"uuid","nullable":true,"description":"Who created it. Never changes","and is not the same as owner_id.":null},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"EventInput":{"type":"object","required":["workspace_id","title","starts_at"],"properties":{"workspace_id":{"type":"string","format":"uuid"},"title":{"type":"string","maxLength":500},"type":{"type":"string","enum":["task","meeting","call","email"],"default":"task"},"starts_at":{"type":"string","format":"date-time"},"ends_at":{"type":"string","format":"date-time","nullable":true,"description":"Must not be before starts_at"},"all_day":{"type":"boolean","default":false},"location":{"type":"string","maxLength":500,"nullable":true},"conference_url":{"type":"string","format":"uri","nullable":true},"description":{"type":"string","nullable":true},"completed":{"type":"boolean","default":false},"outcome":{"type":"string","enum":["done","no_answer","rescheduled","cancelled","no_show"],"nullable":true},"outcome_note":{"type":"string","nullable":true},"person_id":{"type":"string","format":"uuid","nullable":true},"organization_id":{"type":"string","format":"uuid","nullable":true},"deal_id":{"type":"string","format":"uuid","nullable":true},"owner_id":{"type":"string","format":"uuid","nullable":true,"description":"Who the event is assigned to. Must be a member of the workspace. Not defaulted — omit it and the event is unassigned."}}},"EventUpdate":{"type":"object","properties":{"title":{"type":"string","maxLength":500},"type":{"type":"string","enum":["task","meeting","call","email"]},"starts_at":{"type":"string","format":"date-time","description":"Moving this clears any pending due-date notification"},"ends_at":{"type":"string","format":"date-time","nullable":true},"all_day":{"type":"boolean"},"location":{"type":"string","maxLength":500,"nullable":true},"conference_url":{"type":"string","format":"uri","nullable":true},"description":{"type":"string","nullable":true},"completed":{"type":"boolean"},"outcome":{"type":"string","enum":["done","no_answer","rescheduled","cancelled","no_show"],"nullable":true},"outcome_note":{"type":"string","nullable":true},"person_id":{"type":"string","format":"uuid","nullable":true},"organization_id":{"type":"string","format":"uuid","nullable":true},"deal_id":{"type":"string","format":"uuid","nullable":true},"owner_id":{"type":"string","format":"uuid","nullable":true,"description":"Must be a member of the workspace. Reassigning clears any pending due-date notification so the new owner is told."}}},"Reminder":{"type":"object","deprecated":true,"description":"Legacy view of an Event of type `task`. Use Event instead.","required":["id","workspace_id","note","due_date","completed","created_at","updated_at"],"properties":{"id":{"type":"string","format":"uuid"},"workspace_id":{"type":"string","format":"uuid"},"note":{"type":"string"},"due_date":{"type":"string","format":"date-time"},"completed":{"type":"boolean"},"person_id":{"type":"string","format":"uuid","nullable":true},"organization_id":{"type":"string","format":"uuid","nullable":true},"deal_id":{"type":"string","format":"uuid","nullable":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"ReminderInput":{"type":"object","required":["workspace_id","note","due_date"],"properties":{"workspace_id":{"type":"string","format":"uuid"},"note":{"type":"string"},"due_date":{"type":"string","format":"date-time"},"completed":{"type":"boolean","default":false},"person_id":{"type":"string","format":"uuid","nullable":true},"organization_id":{"type":"string","format":"uuid","nullable":true},"deal_id":{"type":"string","format":"uuid","nullable":true}}},"ReminderUpdate":{"type":"object","properties":{"note":{"type":"string"},"due_date":{"type":"string","format":"date-time"},"completed":{"type":"boolean"},"person_id":{"type":"string","format":"uuid","nullable":true},"organization_id":{"type":"string","format":"uuid","nullable":true},"deal_id":{"type":"string","format":"uuid","nullable":true}}},"Note":{"type":"object","required":["id","workspace_id","content","created_at","updated_at"],"properties":{"id":{"type":"string","format":"uuid"},"workspace_id":{"type":"string","format":"uuid"},"content":{"type":"string"},"user_id":{"type":"string","format":"uuid","nullable":true},"person_id":{"type":"string","format":"uuid","nullable":true},"organization_id":{"type":"string","format":"uuid","nullable":true},"deal_id":{"type":"string","format":"uuid","nullable":true},"event_id":{"type":"string","format":"uuid","nullable":true,"description":"Was reminder_id; the old name is still accepted on write"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"NoteInput":{"type":"object","required":["workspace_id","content"],"description":"At least one of organization_id, person_id, deal_id or event_id must be present — a note always hangs off a record. Omitting all four is a 400.\n","properties":{"workspace_id":{"type":"string","format":"uuid"},"content":{"type":"string"},"user_id":{"type":"string","format":"uuid","description":"Author of the note. Defaults to the owner of the API key. An explicit value must belong to a member of the same workspace."},"person_id":{"type":"string","format":"uuid","nullable":true},"organization_id":{"type":"string","format":"uuid","nullable":true},"deal_id":{"type":"string","format":"uuid","nullable":true},"event_id":{"type":"string","format":"uuid","nullable":true},"reminder_id":{"type":"string","format":"uuid","nullable":true,"deprecated":true,"description":"Old name for event_id; still accepted, but sending both is a 400."}}},"NoteUpdate":{"type":"object","properties":{"content":{"type":"string"},"person_id":{"type":"string","format":"uuid","nullable":true},"organization_id":{"type":"string","format":"uuid","nullable":true},"deal_id":{"type":"string","format":"uuid","nullable":true},"event_id":{"type":"string","format":"uuid","nullable":true},"reminder_id":{"type":"string","format":"uuid","nullable":true,"deprecated":true,"description":"Old name for event_id; still accepted, but sending both is a 400."}}},"CustomField":{"type":"object","required":["id","workspace_id","entity_type","field_key","label","field_type","created_at","updated_at"],"properties":{"id":{"type":"string","format":"uuid"},"workspace_id":{"type":"string","format":"uuid"},"entity_type":{"type":"string","enum":["organization","person","deal"]},"field_key":{"type":"string"},"label":{"type":"string"},"field_type":{"type":"string","enum":["text","number","date","boolean","single_select","multi_select"]},"constraints":{"type":"object","nullable":true},"is_required":{"type":"boolean","default":false},"is_archived":{"type":"boolean","default":false},"visible_to_public":{"type":"boolean","default":false},"custom_field_options":{"type":"array","items":{"$ref":"#/components/schemas/CustomFieldOption"}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"CustomFieldInput":{"type":"object","required":["workspace_id","entity_type","field_key","label","field_type"],"properties":{"workspace_id":{"type":"string","format":"uuid"},"entity_type":{"type":"string","enum":["organization","person","deal"]},"field_key":{"type":"string"},"label":{"type":"string"},"field_type":{"type":"string","enum":["text","number","date","boolean","single_select","multi_select"]},"constraints":{"type":"object","nullable":true},"is_required":{"type":"boolean","default":false},"visible_to_public":{"type":"boolean","default":false}}},"CustomFieldUpdate":{"type":"object","properties":{"label":{"type":"string"},"constraints":{"type":"object","nullable":true},"is_required":{"type":"boolean"},"visible_to_public":{"type":"boolean"}}},"CustomFieldOption":{"type":"object","required":["id","custom_field_id","option_label","option_value","created_at"],"properties":{"id":{"type":"string","format":"uuid"},"custom_field_id":{"type":"string","format":"uuid"},"option_label":{"type":"string"},"option_value":{"type":"string"},"color":{"type":"string","nullable":true},"sort_order":{"type":"integer","default":0},"created_at":{"type":"string","format":"date-time"}}},"CustomFieldOptionInput":{"type":"object","required":["option_label","option_value"],"properties":{"option_label":{"type":"string"},"option_value":{"type":"string"},"color":{"type":"string","nullable":true},"sort_order":{"type":"integer","default":0}}},"CustomFieldValue":{"type":"object","required":["id","workspace_id","entity_type","entity_id","custom_field_id","created_at"],"properties":{"id":{"type":"string","format":"uuid"},"workspace_id":{"type":"string","format":"uuid"},"entity_type":{"type":"string","enum":["organization","person","deal"]},"entity_id":{"type":"string","format":"uuid"},"custom_field_id":{"type":"string","format":"uuid"},"value_text":{"type":"string","nullable":true},"value_number":{"type":"number","nullable":true},"value_date":{"type":"string","format":"date","nullable":true},"value_boolean":{"type":"boolean","nullable":true},"option_id":{"type":"string","format":"uuid","nullable":true},"custom_fields":{"$ref":"#/components/schemas/CustomField"},"options":{"$ref":"#/components/schemas/CustomFieldOption"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"CustomFieldValueInput":{"type":"object","required":["workspace_id","entity_type","entity_id","custom_field_id"],"properties":{"workspace_id":{"type":"string","format":"uuid"},"entity_type":{"type":"string","enum":["organization","person","deal"]},"entity_id":{"type":"string","format":"uuid"},"custom_field_id":{"type":"string","format":"uuid"},"value_text":{"type":"string","nullable":true},"value_number":{"type":"number","nullable":true},"value_date":{"type":"string","format":"date","nullable":true},"value_boolean":{"type":"boolean","nullable":true},"option_id":{"type":"string","format":"uuid","nullable":true}}},"CustomFieldValueUpdate":{"type":"object","minProperties":1,"description":"The value columns only. Which record and which field the value belongs to is fixed at creation and identified by the id in the path, so those are not re-sent here.\n","properties":{"value_text":{"type":"string","nullable":true},"value_number":{"type":"number","nullable":true},"value_date":{"type":"string","format":"date","nullable":true},"value_boolean":{"type":"boolean","nullable":true},"option_id":{"type":"string","format":"uuid","nullable":true}}},"User":{"type":"object","required":["id","email"],"properties":{"id":{"type":"string","format":"uuid"},"email":{"type":"string","format":"email"},"first_name":{"type":"string","nullable":true},"last_name":{"type":"string","nullable":true},"locale":{"type":"string","nullable":true},"timezone":{"type":"string","nullable":true},"created_at":{"type":"string","format":"date-time","nullable":true},"role":{"type":"string","nullable":true,"description":"The user's role in the workspace the API key belongs to."}}}},"responses":{"UnauthorizedError":{"description":"Missing `x-api-key` header, or a key that is unknown, revoked or expired.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthError"},"examples":{"missingKey":{"summary":"No key sent","value":{"success":false,"error":"Unauthorized","message":"Missing API key"}},"invalidKey":{"summary":"Unknown, revoked or expired key","value":{"success":false,"error":"Unauthorized","message":"Invalid or expired API key"}}}}}},"ForbiddenError":{"description":"The key is valid but lacks the scope this endpoint and method require, or the request targets a different workspace than the key is bound to.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthError"},"examples":{"missingScope":{"summary":"Key lacks the required scope","value":{"success":false,"error":"Forbidden","message":"Missing required API key scope: deals.write"}},"wrongWorkspace":{"summary":"Key belongs to another workspace","value":{"success":false,"error":"Forbidden","message":"API key cannot access this workspace"}}}}}}},"parameters":{"PageParam":{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1},"description":"Page number for paginated list responses."},"LimitParam":{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"description":"Number of records per page."}}},"security":[{"apiKeyAuth":[]}],"paths":{"/v1/boards":{"get":{"summary":"List boards","tags":["Boards"],"security":[{"apiKeyAuth":[]}],"parameters":[{"in":"query","name":"workspace_id","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Boards fetched successfully"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"500":{"description":"Internal server error"}}},"post":{"summary":"Create board","tags":["Boards"],"security":[{"apiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BoardInput"}}}},"responses":{"201":{"description":"Board created successfully"},"400":{"description":"Validation error"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"500":{"description":"Internal server error"}}}},"/v1/boards/{id}":{"get":{"summary":"Get board by ID","tags":["Boards"],"security":[{"apiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Board fetched successfully"},"400":{"description":"Invalid id"},"401":{"description":"Unauthorized"},"403":{"$ref":"#/components/responses/ForbiddenError"},"404":{"description":"Board not found"},"500":{"description":"Internal server error"}}},"put":{"summary":"Update board","tags":["Boards"],"security":[{"apiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BoardUpdate"}}}},"responses":{"200":{"description":"Board updated successfully"},"400":{"description":"Validation error"},"401":{"description":"Unauthorized"},"403":{"$ref":"#/components/responses/ForbiddenError"},"404":{"description":"Board not found"},"500":{"description":"Internal server error"}}},"delete":{"summary":"Delete board","tags":["Boards"],"security":[{"apiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Board deleted successfully"},"400":{"description":"Invalid id"},"401":{"description":"Unauthorized"},"403":{"$ref":"#/components/responses/ForbiddenError"},"404":{"description":"Board not found"},"500":{"description":"Internal server error"}}}},"/v1/custom_fields":{"get":{"summary":"List custom fields by entity type","tags":["Custom Fields"],"security":[{"apiKeyAuth":[]}],"parameters":[{"in":"query","name":"entity_type","required":true,"schema":{"type":"string","enum":["organization","person","deal"]},"description":"The entity type to get custom fields for"}],"responses":{"200":{"description":"Custom fields fetched successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"array","items":{"$ref":"#/components/schemas/CustomField"}}}}}}},"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"}}},"post":{"summary":"Create custom field","tags":["Custom Fields"],"security":[{"apiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomFieldInput"}}}},"responses":{"201":{"description":"Custom field created successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"$ref":"#/components/schemas/CustomField"}}}}}},"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"}}}},"/v1/custom_fields/{id}":{"get":{"summary":"Get custom field by ID","tags":["Custom Fields"],"security":[{"apiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Custom field fetched successfully"},"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"}}},"put":{"summary":"Update custom field","tags":["Custom Fields"],"security":[{"apiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomFieldUpdate"}}}},"responses":{"200":{"description":"Custom field updated successfully"},"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"}}},"delete":{"summary":"Delete (archive) custom field","tags":["Custom Fields"],"security":[{"apiKeyAuth":[]}],"responses":{"200":{"description":"Custom field deleted successfully"},"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"}}}},"/v1/custom_fields/{id}/options":{"get":{"summary":"Get options for a custom field","tags":["Custom Fields"],"security":[{"apiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"}}},"post":{"summary":"Create custom field option","tags":["Custom Fields"],"security":[{"apiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomFieldOptionInput"}}}},"responses":{"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"}}}},"/v1/custom_fields/values/{entity_type}/{entity_id}":{"get":{"summary":"Get custom field values for an entity","tags":["Custom Fields"],"security":[{"apiKeyAuth":[]}],"parameters":[{"in":"path","name":"entity_type","required":true,"schema":{"type":"string","enum":["organization","person","deal"]}},{"in":"path","name":"entity_id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"}}}},"/v1/custom_fields/values":{"post":{"summary":"Create or update custom field value","description":"Creates the value, or overwrites it when the record already has one for this field (and option, for multi_select). A repeated POST is therefore idempotent: 201 the first time, 200 with the same id afterwards. PUT /v1/custom_fields/values/{id} still works when you already hold the id.\n\nA record holds one value per field, so posting twice used to leave a second row the application never showed — it built its map by custom_field_id, so whichever row came last in the response won and the displayed value was arbitrary. The entity_type must match the entity the field is defined on; anything else is a 400.\n","tags":["Custom Fields"],"security":[{"apiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomFieldValueInput"}}}},"responses":{"200":{"description":"An existing value for this field was overwritten"},"201":{"description":"Custom field value created successfully"},"400":{"description":"The field is unknown or belongs to a different entity type"},"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"}}}},"/v1/custom_fields/values/{id}":{"put":{"summary":"Update custom field value","description":"The id comes from the POST /values response or from GET /values/{entity_type}/{entity_id}.","tags":["Custom Fields"],"security":[{"apiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomFieldValueUpdate"}}}},"responses":{"200":{"description":"Custom field value updated successfully"},"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"},"404":{"description":"Custom field value not found"}}}},"/v1/deals":{"get":{"summary":"List deals","tags":["Deals"],"security":[{"apiKeyAuth":[]}],"parameters":[{"in":"query","name":"workspace_id","schema":{"type":"string","format":"uuid"}},{"in":"query","name":"board_id","schema":{"type":"string","format":"uuid"}},{"in":"query","name":"stage_id","schema":{"type":"string","format":"uuid"}},{"in":"query","name":"organization_id","schema":{"type":"string","format":"uuid"}},{"in":"query","name":"person_id","schema":{"type":"string","format":"uuid"}},{"in":"query","name":"status","schema":{"type":"string"}},{"in":"query","name":"title","schema":{"type":"string"}},{"in":"query","name":"amount","schema":{"type":"number","format":"float"}},{"in":"query","name":"amount_gte","schema":{"type":"number","format":"float"}},{"in":"query","name":"amount_lte","schema":{"type":"number","format":"float"}},{"in":"query","name":"sort_by","schema":{"type":"string","enum":["title","amount","status","created_at","updated_at"]}},{"in":"query","name":"sort_order","schema":{"type":"string","enum":["asc","desc"]}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":500,"default":100}},{"in":"query","name":"offset","schema":{"type":"integer","minimum":0,"default":0}}],"responses":{"200":{"description":"Deals fetched successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"array","items":{"$ref":"#/components/schemas/Deal"}}}}}}},"400":{"description":"Invalid query parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"$ref":"#/components/responses/ForbiddenError"},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"summary":"Create deal","tags":["Deals"],"security":[{"apiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DealInput"}}}},"responses":{"200":{"description":"Deal created successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"$ref":"#/components/schemas/Deal"}}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"$ref":"#/components/responses/ForbiddenError"},"404":{"description":"Related resource not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/deals/{id}":{"get":{"summary":"Get deal by ID","tags":["Deals"],"security":[{"apiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Deal fetched successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"$ref":"#/components/schemas/Deal"}}}}}},"400":{"description":"Invalid id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"$ref":"#/components/responses/ForbiddenError"},"404":{"description":"Deal not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"summary":"Patch deal","tags":["Deals"],"security":[{"apiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DealUpdate"}}}},"responses":{"200":{"description":"Deal patched successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"$ref":"#/components/schemas/Deal"}}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"$ref":"#/components/responses/ForbiddenError"},"404":{"description":"Deal not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"summary":"Delete deal","tags":["Deals"],"security":[{"apiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Deal deleted successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"message":{"type":"string","example":"Deal deleted successfully"}}}}}},"400":{"description":"Invalid id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"$ref":"#/components/responses/ForbiddenError"},"404":{"description":"Deal not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/events":{"get":{"summary":"List events","description":"Tasks, meetings, calls and logged e-mails. Filter with `type`, `deal_id`, `person_id`, `organization_id`, `owner_id` or `completed`.","tags":["Events"],"security":[{"apiKeyAuth":[]}],"responses":{"200":{"description":"Events fetched successfully"},"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"}}},"post":{"summary":"Create event","tags":["Events"],"security":[{"apiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventInput"}}}},"responses":{"201":{"description":"Event created successfully"},"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"}}}},"/v1/events/{id}":{"get":{"summary":"Get event by ID","tags":["Events"],"security":[{"apiKeyAuth":[]}],"responses":{"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"}}},"put":{"summary":"Update event","tags":["Events"],"security":[{"apiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventUpdate"}}}},"responses":{"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"}}},"delete":{"summary":"Delete event","tags":["Events"],"security":[{"apiKeyAuth":[]}],"responses":{"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"}}}},"/v1/notes":{"get":{"summary":"List notes","tags":["Notes"],"security":[{"apiKeyAuth":[]}],"responses":{"200":{"description":"Notes fetched successfully"},"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"}}},"post":{"summary":"Create note","tags":["Notes"],"security":[{"apiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NoteInput"}}}},"responses":{"201":{"description":"Note created successfully"},"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"}}}},"/v1/notes/deal/{dealId}":{"get":{"summary":"Get notes by deal","tags":["Notes"],"security":[{"apiKeyAuth":[]}],"parameters":[{"in":"path","name":"dealId","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Notes fetched successfully"},"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"}}}},"/v1/notes/{id}":{"get":{"summary":"Get note by ID","tags":["Notes"],"security":[{"apiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"}}},"put":{"summary":"Update note","tags":["Notes"],"security":[{"apiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NoteUpdate"}}}},"responses":{"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"}}},"delete":{"summary":"Delete note","tags":["Notes"],"security":[{"apiKeyAuth":[]}],"responses":{"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"}}}},"/v1/organizations":{"get":{"summary":"List organizations","tags":["Organizations"],"security":[{"apiKeyAuth":[]}],"parameters":[{"in":"query","name":"workspace_id","schema":{"type":"string","format":"uuid"}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":500,"default":100}},{"in":"query","name":"offset","schema":{"type":"integer","minimum":0,"default":0}}],"responses":{"200":{"description":"Organizations fetched successfully"},"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"}}},"post":{"summary":"Create organization","tags":["Organizations"],"security":[{"apiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationInput"}}}},"responses":{"201":{"description":"Organization created successfully"},"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"}}}},"/v1/organizations/{id}":{"get":{"summary":"Get organization by ID","tags":["Organizations"],"security":[{"apiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"}}},"put":{"summary":"Update organization","tags":["Organizations"],"security":[{"apiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationUpdate"}}}},"responses":{"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"}}},"delete":{"summary":"Delete organization","tags":["Organizations"],"security":[{"apiKeyAuth":[]}],"responses":{"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"}}}},"/v1/persons":{"get":{"summary":"List persons","tags":["Persons"],"security":[{"apiKeyAuth":[]}],"parameters":[{"in":"query","name":"workspace_id","schema":{"type":"string","format":"uuid"}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":500,"default":100}},{"in":"query","name":"offset","schema":{"type":"integer","minimum":0,"default":0}}],"responses":{"200":{"description":"Persons fetched successfully"},"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"}}},"post":{"summary":"Create person","tags":["Persons"],"security":[{"apiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PersonInput"}}}},"responses":{"201":{"description":"Person created successfully"},"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"}}}},"/v1/persons/{id}":{"get":{"summary":"Get person by ID","tags":["Persons"],"security":[{"apiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"}}},"put":{"summary":"Update person","tags":["Persons"],"security":[{"apiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PersonUpdate"}}}},"responses":{"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"}}},"delete":{"summary":"Delete person","tags":["Persons"],"security":[{"apiKeyAuth":[]}],"responses":{"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"}}}},"/v1/record_history":{"get":{"summary":"List record history","tags":["Record History"],"security":[{"apiKeyAuth":[]}],"parameters":[{"in":"query","name":"workspace_id","schema":{"type":"string","format":"uuid"}},{"in":"query","name":"record_type","schema":{"type":"string"}},{"in":"query","name":"record_id","schema":{"type":"string","format":"uuid"}},{"in":"query","name":"related_record_type","schema":{"type":"string"}},{"in":"query","name":"related_record_id","schema":{"type":"string","format":"uuid"}},{"in":"query","name":"event_type","schema":{"type":"string"}},{"in":"query","name":"sort_order","schema":{"type":"string","enum":["asc","desc"]}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":200}}],"responses":{"200":{"description":"Record history fetched successfully"},"400":{"description":"Invalid query parameters"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"500":{"description":"Internal server error"}}}},"/v1/reminders":{"get":{"summary":"List reminders","deprecated":true,"description":"Superseded by /v1/events. Returns every event in the workspace in the legacy reminder shape.","tags":["Reminders"],"security":[{"apiKeyAuth":[]}],"responses":{"200":{"description":"Reminders fetched successfully"},"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"}}},"post":{"summary":"Create reminder","deprecated":true,"description":"Superseded by /v1/events. Creates an event of type `task`.","tags":["Reminders"],"security":[{"apiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReminderInput"}}}},"responses":{"201":{"description":"Reminder created successfully"},"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"}}}},"/v1/reminders/deal/{dealId}":{"get":{"summary":"Get reminders by deal","deprecated":true,"tags":["Reminders"],"security":[{"apiKeyAuth":[]}],"responses":{"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"}}}},"/v1/reminders/{id}":{"get":{"summary":"Get reminder by ID","deprecated":true,"tags":["Reminders"],"security":[{"apiKeyAuth":[]}],"responses":{"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"}}},"put":{"summary":"Update reminder","deprecated":true,"tags":["Reminders"],"security":[{"apiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReminderUpdate"}}}},"responses":{"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"}}},"delete":{"summary":"Delete reminder","deprecated":true,"tags":["Reminders"],"security":[{"apiKeyAuth":[]}],"responses":{"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"}}}},"/v1/stages":{"get":{"summary":"List stages","tags":["Stages"],"security":[{"apiKeyAuth":[]}],"responses":{"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"}}},"post":{"summary":"Create stage","tags":["Stages"],"security":[{"apiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StageInput"}}}},"responses":{"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"}}}},"/v1/stages/board/{boardId}":{"get":{"summary":"Get stages by board","tags":["Stages"],"security":[{"apiKeyAuth":[]}],"responses":{"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"}}}},"/v1/stages/{id}":{"get":{"summary":"Get stage by ID","tags":["Stages"],"security":[{"apiKeyAuth":[]}],"responses":{"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"}}},"put":{"summary":"Update stage","tags":["Stages"],"security":[{"apiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StageUpdate"}}}},"responses":{"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"}}},"delete":{"summary":"Delete stage","tags":["Stages"],"security":[{"apiKeyAuth":[]}],"responses":{"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"}}}},"/v1/stages/bulk/positions":{"patch":{"summary":"Bulk update stage positions","tags":["Stages"],"security":[{"apiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StageBulkPositionInput"}}}},"responses":{"200":{"description":"Stage positions updated successfully"},"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"}}}},"/v1/users":{"get":{"summary":"List users in workspace","description":"Members of the workspace the API key belongs to. Use it to map record owners onto real users.","tags":["Users"],"security":[{"apiKeyAuth":[]}],"responses":{"200":{"description":"Users fetched successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"array","items":{"$ref":"#/components/schemas/User"}}}}}}},"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"}}}},"/v1/users/{id}":{"get":{"summary":"Get user by ID in workspace","tags":["Users"],"security":[{"apiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"User fetched successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"$ref":"#/components/schemas/User"}}}}}},"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"},"404":{"description":"User not found"}}}},"/v1/workspaces":{"get":{"summary":"Get workspace for API key","tags":["Workspaces"],"security":[{"apiKeyAuth":[]}],"responses":{"200":{"description":"Workspace fetched successfully"},"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"}}}},"/v1/workspaces/{id}":{"get":{"summary":"Get workspace by ID","tags":["Workspaces"],"security":[{"apiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Workspace fetched successfully"},"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"description":"Forbidden"},"404":{"description":"Workspace not found"}}}}},"tags":[]}