{"openapi":"3.1.0","info":{"title":"CRMSix API","version":"1.0.0","description":"REST API for CRMSix: cases, accounts, contacts, leads, opportunities, and the setup behind them. Everything the app does goes through this API.\n\n## Authentication\nEvery endpoint needs one of these, except those marked otherwise:\n- **OAuth 2.0 client credentials** (recommended for integrations): create a client in **Settings → Connected Apps**, get a token from `POST /api/oauth/token`, send `Authorization: Bearer <access_token>`.\n- **API key**: create one in **Settings → API Keys**, send `X-API-Key: <key>` (or `Authorization: Bearer <key>`).\n- **Session token**: `POST /api/auth/login` (or single sign-on) returns a JWT for people using the app; it lasts 8 hours.\n\nAPI keys and OAuth clients act as their **run-as user**: they get that user’s profile permissions, and Created By / Updated By show that user. Endpoints note the permission they need; see `GET /api/profiles`.\n\n## Conventions\n- **IDs:** path `{id}`s accept the 14-character ID or the internal UUID. Request bodies take UUIDs (`accountId`, …), or External IDs (`accountExternalId`, …) where noted.\n- **External IDs:** accounts, contacts, cases, leads and opportunities support `GET` and `PUT` (upsert) at `/api/<object>/external/{externalId}`.\n- **Picklists** are per organization; send stored values (`apiName`) from `GET /api/picklists`.\n- **Custom fields** go in `customFields`, keyed by API name (`…__c`).\n- **Visibility:** with team sharing on, leads and opportunities (and their quotes, products and activity) you can’t see behave as if they don’t exist (404). Saving one to an owner you can’t see returns `{ transferred: true }`.\n- **Errors** are JSON: `{ \"error\": \"…\" }` with a 4xx status. `409` means a conflict, such as a duplicate External ID.\n- **Dates** are ISO 8601; date-only fields use `YYYY-MM-DD`.\n- **Money:** opportunities, their products, quotes and prices carry `currencyIsoCode`. Totals across records (list totals, forecasts, reports, dashboards) are in the corporate currency, converted at the rates in `GET /api/currencies`."},"servers":[{"url":"https://crmsix.com"}],"security":[{"oauth2":[]},{"apiKey":[]},{"bearer":[]}],"tags":[{"name":"Authentication"},{"name":"Cases"},{"name":"Case activity","description":"Emails, tasks, events, milestones and attachments on cases."},{"name":"Accounts"},{"name":"Contacts"},{"name":"Leads"},{"name":"Opportunities"},{"name":"Products & price lists","description":"The catalog, price lists and prices."},{"name":"Quotes","description":"Quotes built from opportunity products; one per opportunity can sync."},{"name":"Forecasts","description":"Quarterly forecasts by forecast category, with quotas."},{"name":"Team-based access","description":"Sales teams and sharing settings for leads and opportunities."},{"name":"Currencies","description":"Multi-currency: the corporate currency and conversion rates."},{"name":"Support teams"},{"name":"Users & profiles"},{"name":"Reports & search"},{"name":"Dropdown values"},{"name":"Data Model","description":"Objects, fields and custom fields."},{"name":"Case settings","description":"Default owners, assignment rules, milestones and escalation rules."},{"name":"Organization"},{"name":"Support Form"},{"name":"Lead Capture Form"},{"name":"Case surveys","description":"Customer satisfaction surveys sent when a case closes or by an agent, answered on a public page. CSAT (1–5), NPS (0–10), choice, yes/no and text questions."},{"name":"Workflow rules","description":"Automation when a case, lead, opportunity, account or contact is saved: field updates before save; emails, tasks and signed webhooks after save. Admins (customizeApplication)."},{"name":"Knowledge","description":"Articles for agents and the public help center. Full-text search; draft → published → archived."},{"name":"Live chat","description":"Visitor chat (no login; a per-chat visitor token) and the agent console. Delivery is by polling."},{"name":"Integrations setup","description":"Single sign-on, API keys and OAuth connected apps. Signed-in admins only."},{"name":"System"}],"paths":{"/api/auth/login":{"post":{"tags":["Authentication"],"summary":"Sign in (session token)","description":"For people. Returns a session JWT valid for 8 hours. Integrations should use an API key or OAuth 2.0 instead.","operationId":"signIn","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string"},"user":{"$ref":"#/components/schemas/SessionUser"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"tenantSlug":{"type":"string","description":"Organization sign-in name, e.g. `acme`."},"email":{"type":"string"},"password":{"type":"string"}},"required":["tenantSlug","email","password"]}}}},"security":[]}},"/api/auth/me":{"get":{"tags":["Authentication"],"summary":"Current user","description":"The authenticated user (for API keys and OAuth tokens: the run-as user).","operationId":"currentUser","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionUser"}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/api/oauth/token":{"post":{"tags":["Authentication"],"summary":"OAuth 2.0 token","description":"**client_credentials** (RFC 6749 §4.4) for connected apps: authenticate with HTTP Basic (`client_secret_basic`) **or** `client_id` + `client_secret` in the body (`client_secret_post`). Create clients in **Settings → Connected Apps**.\n\n**authorization_code** (with PKCE) and **refresh_token** are for MCP clients registered through `/api/oauth/register` (public clients: `client_id` only). Their access tokens last an hour and work only at `/api/mcp`. The body may be form-encoded or JSON.","security":[],"requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"type":"object","properties":{"grant_type":{"type":"string","enum":["client_credentials","authorization_code","refresh_token"]},"client_id":{"type":"string"},"client_secret":{"type":"string","description":"client_credentials only."},"code":{"type":"string","description":"authorization_code only."},"redirect_uri":{"type":"string","description":"authorization_code only: as in the authorization request."},"code_verifier":{"type":"string","description":"authorization_code only: the PKCE verifier."},"refresh_token":{"type":"string","description":"refresh_token only. Refresh tokens rotate: each works once."},"resource":{"type":"string","description":"Optional (RFC 8707): the MCP server URL."}},"required":["grant_type"]}},"application/json":{"schema":{"type":"object","properties":{"grant_type":{"type":"string","enum":["client_credentials","authorization_code","refresh_token"]},"client_id":{"type":"string"},"client_secret":{"type":"string","description":"client_credentials only."},"code":{"type":"string","description":"authorization_code only."},"redirect_uri":{"type":"string","description":"authorization_code only: as in the authorization request."},"code_verifier":{"type":"string","description":"authorization_code only: the PKCE verifier."},"refresh_token":{"type":"string","description":"refresh_token only. Refresh tokens rotate: each works once."},"resource":{"type":"string","description":"Optional (RFC 8707): the MCP server URL."}},"required":["grant_type"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthToken"}}}},"400":{"description":"`invalid_request` or `unsupported_grant_type`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthError"}}}},"401":{"description":"`invalid_client`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthError"}}}}},"operationId":"oauth20Token"}},"/api/oauth/register":{"post":{"tags":["Authentication"],"summary":"Register an MCP client (RFC 7591)","description":"Dynamic client registration for MCP clients such as claude.ai connectors. Public clients only (`token_endpoint_auth_method: none`, PKCE). Redirect URIs must be https, loopback http, or an app scheme. Limited to 20 registrations per hour per address.","operationId":"registerAnMCPClient","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"client_id":{"type":"string"},"client_id_issued_at":{"type":"integer"},"client_name":{"type":"string"},"redirect_uris":{"type":"array","items":{"type":"string"}},"grant_types":{"type":"array","items":{"type":"string"}},"response_types":{"type":"array","items":{"type":"string"}},"token_endpoint_auth_method":{"type":"string"}}}}}},"400":{"description":"`invalid_client_metadata` or `invalid_redirect_uri`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthError"}}}},"429":{"description":"Too many registrations","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthError"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"client_name":{"type":"string"},"client_uri":{"type":"string"},"redirect_uris":{"type":"array","items":{"type":"string"}},"grant_types":{"type":"array","items":{"type":"string","enum":["authorization_code","refresh_token"]}},"token_endpoint_auth_method":{"type":"string"}},"required":["redirect_uris"]}}}},"security":[]}},"/api/oauth/authorize":{"get":{"tags":["Authentication"],"summary":"Authorize an MCP client (browser)","description":"Browser navigation, not an API call. OAuth 2.1 authorization code with PKCE (S256 required). Sends the browser to the sign-in and consent page; the person picks read-only or read-and-change access. Errors after the client and redirect URI are verified redirect back with `error`.","operationId":"authorizeAnMCPClient","parameters":[{"name":"response_type","in":"query","required":true,"schema":{"type":"string","enum":["code"]}},{"name":"client_id","in":"query","required":true,"schema":{"type":"string"}},{"name":"redirect_uri","in":"query","required":false,"description":"One of the registered URIs.","schema":{"type":"string"}},{"name":"code_challenge","in":"query","required":true,"schema":{"type":"string"}},{"name":"code_challenge_method","in":"query","required":true,"schema":{"type":"string","enum":["S256"]}},{"name":"state","in":"query","required":false,"schema":{"type":"string"}},{"name":"scope","in":"query","required":false,"description":"`mcp:read` and/or `mcp:write`. Default: both (the person decides).","schema":{"type":"string"}},{"name":"resource","in":"query","required":false,"description":"The MCP server URL (RFC 8707).","schema":{"type":"string"}}],"responses":{"302":{"description":"To the consent page, or back to the client with an error"},"400":{"description":"Unknown client or redirect URI (HTML page)"}},"security":[]}},"/api/oauth/authorize/details":{"post":{"tags":["Authentication"],"summary":"Consent page details","description":"Used by the consent page. Session tokens only.","operationId":"consentPageDetails","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"request":{"type":"string"}},"required":["request"]}}}}}},"/api/oauth/authorize/decision":{"post":{"tags":["Authentication"],"summary":"Approve or deny an MCP client","description":"Used by the consent page. Session tokens only; not while using Sign in as user. Returns the client redirect URL with a one-time code (5 minutes) or `error=access_denied`.","operationId":"approveOrDenyAnMCPClient","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"redirectUrl":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"request":{"type":"string"},"approve":{"type":"boolean"},"allowWrites":{"type":"boolean","description":"Grant `mcp:write` when the organization allows changes."}},"required":["request","approve"]}}}}}},"/api/auth/sso/start":{"get":{"tags":["Authentication"],"summary":"Start single sign-on (browser)","description":"Browser navigation, not an API call: redirects to the organization’s OpenID Connect provider (Authorization Code + PKCE). Errors redirect to the sign-in page with `sso_error`.","operationId":"startSingleSignOn","parameters":[{"name":"tenant","in":"query","required":true,"description":"Tenant sign-in name, e.g. `acme`.","schema":{"type":"string"}},{"name":"returnTo","in":"query","required":false,"description":"A path in this app to open after sign-in.","schema":{"type":"string"}}],"responses":{"302":{"description":"Redirect to the identity provider"}},"security":[]}},"/api/auth/sso/callback":{"get":{"tags":["Authentication"],"summary":"SSO callback (identity provider redirect URI)","description":"Register this URL as the redirect URI at the identity provider. Validates the ID token and redirects to `/sso/complete#code=…` with a one-time code.","operationId":"ssoCallback","responses":{"302":{"description":"Redirect to the app (or back to sign-in with `sso_error`)"}},"security":[]}},"/api/auth/sso/exchange":{"post":{"tags":["Authentication"],"summary":"Exchange a one-time SSO code for a session","description":"The code works once, within 2 minutes.","operationId":"exchangeAOneTimeSSOCodeForASession","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string"},"user":{"$ref":"#/components/schemas/SessionUser"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"}},"required":["code"]}}}},"security":[]}},"/.well-known/oauth-authorization-server":{"get":{"tags":["Authentication"],"summary":"OAuth 2.0 server metadata (RFC 8414)","operationId":"oauth20ServerMetadata","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":true}}}}},"security":[]}},"/.well-known/oauth-protected-resource":{"get":{"tags":["Authentication"],"summary":"MCP protected resource metadata (RFC 9728)","operationId":"mcpProtectedResourceMetadata","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"resource":{"type":"string"},"authorization_servers":{"type":"array","items":{"type":"string"}},"scopes_supported":{"type":"array","items":{"type":"string"}},"bearer_methods_supported":{"type":"array","items":{"type":"string"}}}}}}}},"security":[]}},"/.well-known/oauth-protected-resource/api/mcp":{"get":{"tags":["Authentication"],"summary":"MCP protected resource metadata (path form)","operationId":"mcpProtectedResourceMetadata_","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"resource":{"type":"string"},"authorization_servers":{"type":"array","items":{"type":"string"}},"scopes_supported":{"type":"array","items":{"type":"string"}},"bearer_methods_supported":{"type":"array","items":{"type":"string"}}}}}}}},"security":[]}},"/api/cases":{"get":{"tags":["Cases"],"summary":"List cases","operationId":"listCases","parameters":[{"name":"status","in":"query","required":false,"description":"A Status value.","schema":{"type":"string"}},{"name":"statusCategory","in":"query","required":false,"description":"New, Working, Escalated, On Hold or Closed.","schema":{"type":"string"}},{"name":"open","in":"query","required":false,"description":"`true` = not in the Closed category.","schema":{"type":"string","enum":["true"]}},{"name":"queueId","in":"query","required":false,"description":"Queue UUID.","schema":{"type":"string"}},{"name":"assignedTo","in":"query","required":false,"description":"User UUID, or `none` for unassigned.","schema":{"type":"string"}},{"name":"accountId","in":"query","required":false,"description":"Account UUID.","schema":{"type":"string"}},{"name":"contactId","in":"query","required":false,"description":"Contact UUID.","schema":{"type":"string"}},{"name":"q","in":"query","required":false,"description":"Subject or contact name (contains), or a case number prefix.","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number, from 1.","schema":{"type":"integer","minimum":1,"default":1}},{"name":"pageSize","in":"query","required":false,"description":"Records per page (max 100).","schema":{"type":"integer","minimum":1,"maximum":100,"default":25}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"total":{"type":"integer","description":"Matching records."},"page":{"type":"integer"},"pageSize":{"type":"integer"},"cases":{"type":"array","items":{"$ref":"#/components/schemas/Case"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"}}},"post":{"tags":["Cases"],"summary":"Create case","description":"Runs assignment rules (unless a queue is given or `useAssignmentRules` is false), creates milestones, and emails the queue.","operationId":"createCase","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Case"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseCreate"}}}}}},"/api/cases/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"get":{"tags":["Cases"],"summary":"Get case","operationId":"getCase","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Case"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"tags":["Cases"],"summary":"Update case","description":"Send only the fields to change. Status and owner have their own endpoints. Changing priority recalculates open milestones.","operationId":"updateCase","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Case"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseCreate"}}}}}},"/api/cases/external/{externalId}":{"parameters":[{"name":"externalId","in":"path","required":true,"description":"The record’s External ID (case-sensitive; URL-encode `/` and spaces).","schema":{"type":"string"}}],"get":{"tags":["Cases"],"summary":"Get case by External ID","operationId":"getCaseByExternalID","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Case"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}},"put":{"tags":["Cases"],"summary":"Upsert case by External ID","description":"Updates the case with this External ID (as PATCH, **200**) or creates one with it (as POST, **201**). A body `externalId`, if sent, must match the URL.","operationId":"upsertCaseByExternalID","responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Case"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Case"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseCreate"}}}}}},"/api/cases/{id}/status":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"post":{"tags":["Cases"],"summary":"Change case status","description":"Moves follow the status categories’ allowed transitions. Reopening a closed case needs `reopenCases`.","operationId":"changeCaseStatus","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Case"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","description":"A Status value."}},"required":["status"]}}}}}},"/api/cases/{id}/assign":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"post":{"tags":["Cases"],"summary":"Assign or unassign a case","description":"Without `assignCases`, users can only take an unassigned case for themselves or release their own.","operationId":"assignOrUnassignACase","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Case"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":["string","null"],"format":"uuid","description":"User to assign; `null` unassigns."}}}}}}}},"/api/cases/{id}/comments":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"get":{"tags":["Cases"],"summary":"List comments","operationId":"listComments","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Comment"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}},"post":{"tags":["Cases"],"summary":"Add a comment","operationId":"addAComment","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Comment"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"body":{"type":"string"},"isInternal":{"type":"boolean","description":"Default true."},"externalId":{"type":["string","null"],"description":"Unique per organization and object; up to 255 characters. `\"\"` or `null` clears it.","maxLength":255}},"required":["body"]}}}}}},"/api/cases/import":{"post":{"tags":["Cases"],"summary":"Import cases (check or import)","description":"Takes already-mapped CSV rows. With `dryRun: true` (default) every row is validated and nothing is saved. Otherwise valid rows are inserted (a savepoint per row) and invalid ones reported. Max 1,000 rows per request; send large files in batches. Picklists match by value or label; `account` by name or ID; `owner` by email or name; `queue` by name; `contact` by email or ID.\n\n**Requires permission:** `importRecords`","operationId":"importCases","responses":{"200":{"description":"Check results (dry run)","content":{"application/json":{"schema":{"type":"object","properties":{"dryRun":{"type":"boolean"},"total":{"type":"integer"},"valid":{"type":"integer"},"created":{"type":"integer"},"failed":{"type":"integer"},"results":{"type":"array","items":{"type":"object","properties":{"line":{"type":"integer"},"errors":{"type":"array","items":{"type":"string"}},"warnings":{"type":"array","items":{"type":"string"}},"id":{"type":"string","format":"uuid"},"recordId":{"type":"string"},"caseNumber":{"type":"string"}}}}}}}}},"201":{"description":"Import results (same shape)"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"413":{"$ref":"#/components/responses/TooLarge"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"dryRun":{"type":"boolean","description":"Default true."},"useAssignmentRules":{"type":"boolean","description":"Route rows with no queue or owner. Default false."},"rows":{"type":"array","items":{"type":"object","properties":{"line":{"type":"integer","description":"Your row number, echoed in results."},"subject":{"type":"string"},"externalId":{"type":"string"},"description":{"type":"string"},"status":{"type":"string"},"priority":{"type":"string"},"origin":{"type":"string"},"contactName":{"type":"string"},"contactEmail":{"type":"string"},"contact":{"type":"string"},"account":{"type":"string"},"queue":{"type":"string"},"owner":{"type":"string"},"openedDate":{"type":"string","description":"YYYY-MM-DD, YYYY-MM-DD HH:MM or M/D/YYYY."},"closedDate":{"type":"string"},"customFields":{"type":"object","properties":{},"additionalProperties":{"type":"string"}}}}}},"required":["rows"]}}}}}},"/api/cases/{id}/activity":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"get":{"tags":["Case activity"],"summary":"Tasks, events and emails on a case","operationId":"tasksEventsAndEmailsOnACase","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"activities":{"type":"array","items":{"$ref":"#/components/schemas/Activity"}},"emails":{"type":"array","items":{"$ref":"#/components/schemas/Email"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/cases/{id}/emails":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"post":{"tags":["Case activity"],"summary":"Send an email from a case","description":"Adds a `[ref:<caseRecordId>]` token to the subject so replies attach to the case. Completes the case’s First Response milestone. Sent after the request commits; without SMTP configured the email is logged as `not_configured`.","operationId":"sendAnEmailFromACase","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Email"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"413":{"$ref":"#/components/responses/TooLarge"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"to":{"type":"string","description":"Comma-separated addresses."},"cc":{"type":"string","description":"Comma-separated addresses."},"subject":{"type":"string","maxLength":400},"body":{"type":"string","description":"Plain text."},"inReplyTo":{"type":"string","format":"uuid","description":"Id of a case email being replied to (threads the message)."},"attachmentIds":{"type":"array","items":{"type":"string","format":"uuid","description":"Case attachment ids to include."}}},"required":["to","subject","body"]}}}}}},"/api/cases/{id}/activities":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"post":{"tags":["Case activity"],"summary":"Create a task or event","operationId":"createATaskOrEvent","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Activity"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ActivityInput"}}}}}},"/api/activities/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"patch":{"tags":["Case activity"],"summary":"Update a task or event","operationId":"updateATaskOrEvent","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Activity"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ActivityInput"}}}}},"delete":{"tags":["Case activity"],"summary":"Delete a task or event","operationId":"deleteATaskOrEvent","responses":{"204":{"description":"Deleted"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/cases/{id}/milestones":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"get":{"tags":["Case activity"],"summary":"Milestones and escalation history","operationId":"milestonesAndEscalationHistory","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"milestones":{"type":"array","items":{"$ref":"#/components/schemas/Milestone"}},"escalations":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"ruleName":{"type":"string"},"actions":{"type":"object"},"escalatedAt":{"type":["string","null"],"format":"date-time"}}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/cases/{id}/milestones/{milestoneId}/complete":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}},{"name":"milestoneId","in":"path","required":true,"description":"Case milestone UUID.","schema":{"type":"string"}}],"post":{"tags":["Case activity"],"summary":"Complete a manual milestone","operationId":"completeAManualMilestone","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Milestone"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/cases/{id}/attachments":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"get":{"tags":["Case activity"],"summary":"List attachments","operationId":"listAttachments","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Attachment"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}},"post":{"tags":["Case activity"],"summary":"Upload an attachment","description":"The request body is the raw file (up to 4 MB). Send the file name in `X-Filename` (URL-encoded) and its type in `X-Content-Type`.","operationId":"uploadAnAttachment","parameters":[{"name":"X-Filename","in":"header","required":true,"schema":{"type":"string"},"description":"URL-encoded file name."},{"name":"X-Content-Type","in":"header","required":false,"schema":{"type":"string"},"description":"MIME type, e.g. `application/pdf`."}],"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Attachment"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"413":{"$ref":"#/components/responses/TooLarge"}},"requestBody":{"required":true,"content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}}}},"/api/attachments/{id}/download":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"get":{"tags":["Case activity"],"summary":"Download an attachment","description":"Always served as a download (`Content-Disposition: attachment`).","operationId":"downloadAnAttachment","responses":{"200":{"description":"The file","content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/attachments/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"delete":{"tags":["Case activity"],"summary":"Delete an attachment","operationId":"deleteAnAttachment","responses":{"204":{"description":"Deleted"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/accounts":{"get":{"tags":["Accounts"],"summary":"List accounts","operationId":"listAccounts","parameters":[{"name":"q","in":"query","required":false,"description":"Name contains.","schema":{"type":"string"}},{"name":"type","in":"query","required":false,"description":"An Account Type value.","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number, from 1.","schema":{"type":"integer","minimum":1,"default":1}},{"name":"pageSize","in":"query","required":false,"description":"Records per page (max 200).","schema":{"type":"integer","minimum":1,"maximum":200,"default":50}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"total":{"type":"integer","description":"Matching records."},"page":{"type":"integer"},"pageSize":{"type":"integer"},"accounts":{"type":"array","items":{"$ref":"#/components/schemas/Account"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"}}},"post":{"tags":["Accounts"],"summary":"Create account","operationId":"createAccount","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Account"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountInput"}}}}}},"/api/accounts/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"get":{"tags":["Accounts"],"summary":"Get account","operationId":"getAccount","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Account"},{"type":"object","properties":{"contacts":{"type":"array","items":{"$ref":"#/components/schemas/Contact"}},"cases":{"type":"array","items":{"$ref":"#/components/schemas/Case"}},"opportunities":{"type":"array","items":{"$ref":"#/components/schemas/Opportunity"}}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"tags":["Accounts"],"summary":"Update account","description":"Send only the fields to change.","operationId":"updateAccount","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Account"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountInput"}}}}}},"/api/accounts/external/{externalId}":{"parameters":[{"name":"externalId","in":"path","required":true,"description":"The record’s External ID (case-sensitive; URL-encode `/` and spaces).","schema":{"type":"string"}}],"get":{"tags":["Accounts"],"summary":"Get account by External ID","operationId":"getAccountByExternalID","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Account"},{"type":"object","properties":{"contacts":{"type":"array","items":{"$ref":"#/components/schemas/Contact"}},"cases":{"type":"array","items":{"$ref":"#/components/schemas/Case"}},"opportunities":{"type":"array","items":{"$ref":"#/components/schemas/Opportunity"}}}}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}},"put":{"tags":["Accounts"],"summary":"Upsert account by External ID","description":"Updates the account with this External ID (as PATCH, **200**) or creates one with it (as POST, **201**). A body `externalId`, if sent, must match the URL.","operationId":"upsertAccountByExternalID","responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Account"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Account"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountInput"}}}}}},"/api/contacts":{"get":{"tags":["Contacts"],"summary":"List contacts","operationId":"listContacts","parameters":[{"name":"q","in":"query","required":false,"description":"Name or email contains.","schema":{"type":"string"}},{"name":"accountId","in":"query","required":false,"description":"Account UUID.","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number, from 1.","schema":{"type":"integer","minimum":1,"default":1}},{"name":"pageSize","in":"query","required":false,"description":"Records per page (max 200).","schema":{"type":"integer","minimum":1,"maximum":200,"default":50}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"total":{"type":"integer","description":"Matching records."},"page":{"type":"integer"},"pageSize":{"type":"integer"},"contacts":{"type":"array","items":{"$ref":"#/components/schemas/Contact"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"}}},"post":{"tags":["Contacts"],"summary":"Create contact","operationId":"createContact","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Contact"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactInput"}}}}}},"/api/contacts/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"get":{"tags":["Contacts"],"summary":"Get contact","operationId":"getContact","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Contact"},{"type":"object","properties":{"cases":{"type":"array","items":{"$ref":"#/components/schemas/Case"}}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"tags":["Contacts"],"summary":"Update contact","description":"Send only the fields to change.","operationId":"updateContact","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Contact"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactInput"}}}}}},"/api/contacts/external/{externalId}":{"parameters":[{"name":"externalId","in":"path","required":true,"description":"The record’s External ID (case-sensitive; URL-encode `/` and spaces).","schema":{"type":"string"}}],"get":{"tags":["Contacts"],"summary":"Get contact by External ID","operationId":"getContactByExternalID","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Contact"},{"type":"object","properties":{"cases":{"type":"array","items":{"$ref":"#/components/schemas/Case"}}}}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}},"put":{"tags":["Contacts"],"summary":"Upsert contact by External ID","description":"Updates the contact with this External ID (as PATCH, **200**) or creates one with it (as POST, **201**). A body `externalId`, if sent, must match the URL.","operationId":"upsertContactByExternalID","responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Contact"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Contact"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactInput"}}}}}},"/api/leads":{"get":{"tags":["Leads"],"summary":"List leads","operationId":"listLeads","parameters":[{"name":"q","in":"query","required":false,"description":"Name, company or email contains.","schema":{"type":"string"}},{"name":"status","in":"query","required":false,"description":"A Lead Status value.","schema":{"type":"string"}},{"name":"statusCategory","in":"query","required":false,"description":"Open, Working, Converted or Unqualified.","schema":{"type":"string"}},{"name":"ownerId","in":"query","required":false,"description":"User UUID.","schema":{"type":"string"}},{"name":"open","in":"query","required":false,"description":"`true` = not converted or unqualified.","schema":{"type":"string","enum":["true"]}},{"name":"page","in":"query","required":false,"description":"Page number, from 1.","schema":{"type":"integer","minimum":1,"default":1}},{"name":"pageSize","in":"query","required":false,"description":"Records per page (max 200).","schema":{"type":"integer","minimum":1,"maximum":200,"default":50}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"total":{"type":"integer","description":"Matching records."},"page":{"type":"integer"},"pageSize":{"type":"integer"},"leads":{"type":"array","items":{"$ref":"#/components/schemas/Lead"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"}}},"post":{"tags":["Leads"],"summary":"Create lead","operationId":"createLead","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Lead"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadInput"}}}}}},"/api/leads/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"get":{"tags":["Leads"],"summary":"Get lead","operationId":"getLead","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Lead"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"tags":["Leads"],"summary":"Update lead","description":"Send only the fields to change. Converted leads are read-only.","operationId":"updateLead","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Lead"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadInput"}}}}},"delete":{"tags":["Leads"],"summary":"Delete lead","operationId":"deleteLead","responses":{"204":{"description":"Deleted"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/leads/external/{externalId}":{"parameters":[{"name":"externalId","in":"path","required":true,"description":"The record’s External ID (case-sensitive; URL-encode `/` and spaces).","schema":{"type":"string"}}],"get":{"tags":["Leads"],"summary":"Get lead by External ID","operationId":"getLeadByExternalID","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Lead"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}},"put":{"tags":["Leads"],"summary":"Upsert lead by External ID","description":"Updates the lead with this External ID (as PATCH, **200**) or creates one with it (as POST, **201**). A body `externalId`, if sent, must match the URL.","operationId":"upsertLeadByExternalID","responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Lead"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Lead"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadInput"}}}}}},"/api/leads/{id}/activity":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"get":{"tags":["Leads"],"summary":"Tasks, events and emails on a lead","operationId":"tasksEventsAndEmailsOnALead","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"activities":{"type":"array","items":{"$ref":"#/components/schemas/Activity"}},"emails":{"type":"array","items":{"$ref":"#/components/schemas/Email"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/leads/{id}/emails":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"post":{"tags":["Leads"],"summary":"Send an email from a lead","description":"Adds a `[ref:<recordId>]` token so replies attach to the lead (or, once converted, to its opportunity). No attachments.","operationId":"sendAnEmailFromALead","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Email"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"to":{"type":"string","description":"Comma-separated addresses."},"cc":{"type":"string"},"subject":{"type":"string","maxLength":400},"body":{"type":"string"},"inReplyTo":{"type":"string","format":"uuid"}},"required":["to","subject","body"]}}}}}},"/api/leads/{id}/activities":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"post":{"tags":["Leads"],"summary":"Create a task or event on a lead","operationId":"createATaskOrEventOnALead","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Activity"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ActivityInput"}}}}}},"/api/opportunities/{id}/activity":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"get":{"tags":["Opportunities"],"summary":"Tasks, events and emails on an opportunity","operationId":"tasksEventsAndEmailsOnAnOpportunity","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"activities":{"type":"array","items":{"$ref":"#/components/schemas/Activity"}},"emails":{"type":"array","items":{"$ref":"#/components/schemas/Email"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/opportunities/{id}/emails":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"post":{"tags":["Opportunities"],"summary":"Send an email from an opportunity","description":"Adds a `[ref:<recordId>]` token so replies attach to the opportunity. No attachments.","operationId":"sendAnEmailFromAnOpportunity","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Email"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"to":{"type":"string","description":"Comma-separated addresses."},"cc":{"type":"string"},"subject":{"type":"string","maxLength":400},"body":{"type":"string"},"inReplyTo":{"type":"string","format":"uuid"}},"required":["to","subject","body"]}}}}}},"/api/opportunities/{id}/activities":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"post":{"tags":["Opportunities"],"summary":"Create a task or event on an opportunity","operationId":"createATaskOrEventOnAnOpportunity","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Activity"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ActivityInput"}}}}}},"/api/leads/{id}/convert":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"post":{"tags":["Leads"],"summary":"Convert a lead","description":"Creates or links an account and contact, optionally creates an opportunity, and marks the lead converted, in one transaction. The lead’s tasks, events and emails move to the new opportunity.","operationId":"convertALead","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Lead"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadConvert"}}}}}},"/api/opportunities":{"get":{"tags":["Opportunities"],"summary":"List opportunities","operationId":"listOpportunities","parameters":[{"name":"q","in":"query","required":false,"description":"Name or account contains.","schema":{"type":"string"}},{"name":"stage","in":"query","required":false,"description":"A Stage value.","schema":{"type":"string"}},{"name":"stageCategory","in":"query","required":false,"description":"Open, Won or Lost.","schema":{"type":"string"}},{"name":"ownerId","in":"query","required":false,"description":"User UUID.","schema":{"type":"string"}},{"name":"accountId","in":"query","required":false,"description":"Account UUID.","schema":{"type":"string"}},{"name":"closing","in":"query","required":false,"description":"Close date window.","schema":{"type":"string","enum":["this_month","this_quarter","next_quarter"]}},{"name":"page","in":"query","required":false,"description":"Page number, from 1.","schema":{"type":"integer","minimum":1,"default":1}},{"name":"pageSize","in":"query","required":false,"description":"Records per page (max 500).","schema":{"type":"integer","minimum":1,"maximum":500,"default":50}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"total":{"type":"integer","description":"Matching records."},"page":{"type":"integer"},"pageSize":{"type":"integer"},"totalAmount":{"type":"number","description":"Sum of amounts of all matching opportunities."},"opportunities":{"type":"array","items":{"$ref":"#/components/schemas/Opportunity"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"}}},"post":{"tags":["Opportunities"],"summary":"Create opportunity","operationId":"createOpportunity","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Opportunity"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OpportunityInput"}}}}}},"/api/opportunities/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"get":{"tags":["Opportunities"],"summary":"Get opportunity","operationId":"getOpportunity","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Opportunity"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"tags":["Opportunities"],"summary":"Update opportunity","description":"Send only the fields to change.","operationId":"updateOpportunity","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Opportunity"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OpportunityInput"}}}}},"delete":{"tags":["Opportunities"],"summary":"Delete opportunity","operationId":"deleteOpportunity","responses":{"204":{"description":"Deleted"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/opportunities/external/{externalId}":{"parameters":[{"name":"externalId","in":"path","required":true,"description":"The record’s External ID (case-sensitive; URL-encode `/` and spaces).","schema":{"type":"string"}}],"get":{"tags":["Opportunities"],"summary":"Get opportunity by External ID","operationId":"getOpportunityByExternalID","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Opportunity"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}},"put":{"tags":["Opportunities"],"summary":"Upsert opportunity by External ID","description":"Updates the opportunity with this External ID (as PATCH, **200**) or creates one with it (as POST, **201**). A body `externalId`, if sent, must match the URL.","operationId":"upsertOpportunityByExternalID","responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Opportunity"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Opportunity"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OpportunityInput"}}}}}},"/api/products":{"get":{"tags":["Products & price lists"],"summary":"List products","operationId":"listProducts","parameters":[{"name":"q","in":"query","required":false,"description":"Name or product code contains.","schema":{"type":"string"}},{"name":"family","in":"query","required":false,"schema":{"type":"string"}},{"name":"active","in":"query","required":false,"schema":{"type":"string","enum":["true","false"]}},{"name":"page","in":"query","required":false,"description":"Page number, from 1.","schema":{"type":"integer","minimum":1,"default":1}},{"name":"pageSize","in":"query","required":false,"description":"Records per page (max 200).","schema":{"type":"integer","minimum":1,"maximum":200,"default":50}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"total":{"type":"integer","description":"Matching records."},"page":{"type":"integer"},"pageSize":{"type":"integer"},"families":{"type":"array","items":{"type":"string"}},"products":{"type":"array","items":{"$ref":"#/components/schemas/Product"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"}}},"post":{"tags":["Products & price lists"],"summary":"Create product","description":"Needs `managePriceBooks`.","operationId":"createProduct","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Product"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductInput"}}}}}},"/api/products/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"get":{"tags":["Products & price lists"],"summary":"Get product","operationId":"getProduct","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Product"},{"type":"object","properties":{"prices":{"type":"array","items":{"$ref":"#/components/schemas/PriceBookEntry"}}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"tags":["Products & price lists"],"summary":"Update product","description":"Needs `managePriceBooks`. Send only the fields to change.","operationId":"updateProduct","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Product"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductInput"}}}}},"delete":{"tags":["Products & price lists"],"summary":"Delete product","operationId":"deleteProduct","responses":{"204":{"description":"Deleted"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/products/external/{externalId}":{"parameters":[{"name":"externalId","in":"path","required":true,"description":"The record’s External ID (case-sensitive; URL-encode `/` and spaces).","schema":{"type":"string"}}],"get":{"tags":["Products & price lists"],"summary":"Get product by External ID","operationId":"getProductByExternalID","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Product"},{"type":"object","properties":{"prices":{"type":"array","items":{"$ref":"#/components/schemas/PriceBookEntry"}}}}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}},"put":{"tags":["Products & price lists"],"summary":"Upsert product by External ID","description":"Updates the product with this External ID (as PATCH, **200**) or creates one with it (as POST, **201**). A body `externalId`, if sent, must match the URL.","operationId":"upsertProductByExternalID","responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Product"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Product"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductInput"}}}}}},"/api/price-books":{"get":{"tags":["Products & price lists"],"summary":"List price lists","operationId":"listPriceLists","parameters":[{"name":"active","in":"query","required":false,"schema":{"type":"string","enum":["true"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PriceBook"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}},"post":{"tags":["Products & price lists"],"summary":"Create a custom price list","description":"**Requires permission:** `managePriceBooks`","operationId":"createACustomPriceList","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceBook"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":["string","null"]},"isActive":{"type":"boolean"}},"required":["name"]}}}}}},"/api/price-books/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"get":{"tags":["Products & price lists"],"summary":"Get a price list with its entries","operationId":"getAPriceListWithItsEntries","parameters":[{"name":"q","in":"query","required":false,"description":"Product name or code contains.","schema":{"type":"string"}},{"name":"active","in":"query","required":false,"description":"Only usable entries.","schema":{"type":"string","enum":["true"]}},{"name":"currency","in":"query","required":false,"description":"Only prices in this currency.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/PriceBook"},{"type":"object","properties":{"entries":{"type":"array","items":{"$ref":"#/components/schemas/PriceBookEntry"}}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"tags":["Products & price lists"],"summary":"Update a price list","description":"**Requires permission:** `managePriceBooks`","operationId":"updateAPriceList","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceBook"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":["string","null"]},"isActive":{"type":"boolean"}}}}}}},"delete":{"tags":["Products & price lists"],"summary":"Delete a custom, unused price list","description":"**Requires permission:** `managePriceBooks`","operationId":"deleteACustomUnusedPriceList","responses":{"204":{"description":"Deleted"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"}}}},"/api/price-books/{id}/entries":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"post":{"tags":["Products & price lists"],"summary":"Add a product to a price list","description":"A product needs a Standard Price List price in a currency before any custom price list can price it in that currency.\n\n**Requires permission:** `managePriceBooks`","operationId":"addAProductToAPriceList","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceBookEntry"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"productId":{"type":"string","description":"UUID or ID."},"unitPrice":{"type":"number","minimum":0},"currencyIsoCode":{"type":"string","description":"An active currency. Default: the corporate currency."},"isActive":{"type":"boolean"}},"required":["productId","unitPrice"]}}}}}},"/api/price-book-entries/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"patch":{"tags":["Products & price lists"],"summary":"Change a list price","description":"**Requires permission:** `managePriceBooks`","operationId":"changeAListPrice","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceBookEntry"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"unitPrice":{"type":"number","minimum":0},"isActive":{"type":"boolean"}}}}}}},"delete":{"tags":["Products & price lists"],"summary":"Remove a product from a price list","description":"Refused while opportunities use it, or (for a standard price) while the product is in custom price lists.\n\n**Requires permission:** `managePriceBooks`","operationId":"removeAProductFromAPriceList","responses":{"204":{"description":"Deleted"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"}}}},"/api/opportunities/{id}/products":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"get":{"tags":["Opportunities"],"summary":"An opportunity’s products","operationId":"anOpportunitySProducts","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OpportunityProducts"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}},"post":{"tags":["Opportunities"],"summary":"Add a product to an opportunity","description":"The first product sets the opportunity’s price list; the rest must come from it. The amount becomes the products’ total. Refused (409) while a quote syncs to the opportunity.","operationId":"addAProductToAnOpportunity","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OpportunityProducts"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"priceBookEntryId":{"type":"string","description":"UUID or ID."},"quantity":{"type":"number","description":"Default 1.","exclusiveMinimum":0},"unitPrice":{"type":"number","description":"Sales price; default the list price."},"discount":{"type":"number","description":"Percent, 0–100."},"description":{"type":"string"}},"required":["priceBookEntryId"]}}}}}},"/api/opportunities/{id}/price-book":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"put":{"tags":["Opportunities"],"summary":"Choose an opportunity’s price list","description":"Only while it has no products.","operationId":"chooseAnOpportunitySPriceList","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OpportunityProducts"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"priceBookId":{"type":"string"}},"required":["priceBookId"]}}}}}},"/api/opportunity-products/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"patch":{"tags":["Opportunities"],"summary":"Update an opportunity product","operationId":"updateAnOpportunityProduct","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OpportunityProducts"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"quantity":{"type":"number"},"unitPrice":{"type":"number"},"discount":{"type":"number"},"description":{"type":["string","null"]}}}}}}},"delete":{"tags":["Opportunities"],"summary":"Remove an opportunity product","operationId":"removeAnOpportunityProduct","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OpportunityProducts"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/quotes":{"get":{"tags":["Quotes"],"summary":"List quotes","operationId":"listQuotes","parameters":[{"name":"q","in":"query","required":false,"description":"Quote name, number, opportunity or account.","schema":{"type":"string"}},{"name":"status","in":"query","required":false,"schema":{"type":"string"}},{"name":"opportunityId","in":"query","required":false,"description":"UUID or ID.","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number, from 1.","schema":{"type":"integer","minimum":1,"default":1}},{"name":"pageSize","in":"query","required":false,"description":"Records per page (max 200).","schema":{"type":"integer","minimum":1,"maximum":200,"default":50}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"total":{"type":"integer"},"page":{"type":"integer"},"pageSize":{"type":"integer"},"quotes":{"type":"array","items":{"$ref":"#/components/schemas/Quote"}},"statuses":{"type":"array","items":{"type":"string"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}},"post":{"tags":["Quotes"],"summary":"Create a quote from an opportunity","description":"Copies the opportunity’s products (and price list) onto the quote. Name defaults to the opportunity’s; “Prepared for” to its contact.","operationId":"createAQuoteFromAnOpportunity","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Quote"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"opportunityId":{"type":"string","description":"UUID or ID."},"name":{"type":"string"},"expirationDate":{"type":"string","format":"date"},"contactId":{"type":["string","null"]},"description":{"type":"string"},"tax":{"type":"number"},"shipping":{"type":"number"}},"required":["opportunityId"]}}}}}},"/api/quotes/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"get":{"tags":["Quotes"],"summary":"Get a quote with its lines","operationId":"getAQuoteWithItsLines","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Quote"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"tags":["Quotes"],"summary":"Update a quote","operationId":"updateAQuote","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Quote"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"status":{"type":"string","enum":["Draft","Needs Review","Approved","Rejected","Presented","Accepted","Denied"]},"expirationDate":{"type":["string","null"]},"contactId":{"type":["string","null"]},"description":{"type":["string","null"]},"tax":{"type":"number"},"shipping":{"type":"number"}}}}}}},"delete":{"tags":["Quotes"],"summary":"Delete a quote","description":"A syncing quote stops syncing; the opportunity keeps its products.","operationId":"deleteAQuote","responses":{"204":{"description":"Deleted"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/quotes/{id}/lines":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"post":{"tags":["Quotes"],"summary":"Add a product to a quote","description":"From the quote’s price list. On a syncing quote the opportunity’s products update too.","operationId":"addAProductToAQuote","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Quote"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"priceBookEntryId":{"type":"string"},"quantity":{"type":"number"},"unitPrice":{"type":"number"},"discount":{"type":"number"},"description":{"type":"string"}},"required":["priceBookEntryId"]}}}}}},"/api/quotes/{id}/pdfs":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"get":{"tags":["Quotes"],"summary":"List a quote’s PDFs","description":"Newest version first.","operationId":"listAQuoteSPDFs","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"recordId":{"type":"string"},"quoteId":{"type":"string","format":"uuid"},"version":{"type":"integer"},"filename":{"type":"string"},"grandTotal":{"type":"number","description":"As on the PDF."},"currencyIsoCode":{"type":"string"},"sizeBytes":{"type":"integer"},"createdById":{"type":["string","null"],"format":"uuid"},"createdByName":{"type":["string","null"]},"createdAt":{"type":["string","null"],"format":"date-time"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}},"post":{"tags":["Quotes"],"summary":"Generate a quote PDF","description":"Renders the quote as it is now and saves it as the next version (v1, v2, …). Download it from `/api/quote-pdfs/{id}/download`.","operationId":"generateAQuotePDF","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"document":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"recordId":{"type":"string"},"quoteId":{"type":"string","format":"uuid"},"version":{"type":"integer"},"filename":{"type":"string"},"grandTotal":{"type":"number","description":"As on the PDF."},"currencyIsoCode":{"type":"string"},"sizeBytes":{"type":"integer"},"createdById":{"type":["string","null"],"format":"uuid"},"createdByName":{"type":["string","null"]},"createdAt":{"type":["string","null"],"format":"date-time"}}},"documents":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"recordId":{"type":"string"},"quoteId":{"type":"string","format":"uuid"},"version":{"type":"integer"},"filename":{"type":"string"},"grandTotal":{"type":"number","description":"As on the PDF."},"currencyIsoCode":{"type":"string"},"sizeBytes":{"type":"integer"},"createdById":{"type":["string","null"],"format":"uuid"},"createdByName":{"type":["string","null"]},"createdAt":{"type":["string","null"],"format":"date-time"}}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/quote-pdfs/{id}/download":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"get":{"tags":["Quotes"],"summary":"Download a quote PDF","operationId":"downloadAQuotePDF","parameters":[{"name":"inline","in":"query","required":false,"description":"`true` to display rather than download.","schema":{"type":"string","enum":["true"]}}],"responses":{"200":{"description":"The PDF","content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/quote-pdfs/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"delete":{"tags":["Quotes"],"summary":"Delete a quote PDF","operationId":"deleteAQuotePDF","responses":{"204":{"description":"Deleted"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/email-templates":{"get":{"tags":["Case activity"],"summary":"List email templates","operationId":"listEmailTemplates","parameters":[{"name":"object","in":"query","required":false,"description":"A record type: its templates plus ones for any record.","schema":{"type":"string","enum":["cases","leads","opportunities","any"]}},{"name":"active","in":"query","required":false,"description":"Only active ones.","schema":{"type":"string","enum":["true"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"recordId":{"type":"string"},"name":{"type":"string"},"description":{"type":["string","null"]},"relatedObject":{"type":"string","enum":["any","cases","leads","opportunities"]},"subject":{"type":"string"},"body":{"type":"string"},"isActive":{"type":"boolean"},"createdByName":{"type":["string","null"]},"updatedByName":{"type":["string","null"]},"createdAt":{"type":["string","null"],"format":"date-time"},"updatedAt":{"type":["string","null"],"format":"date-time"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"}}},"post":{"tags":["Case activity"],"summary":"Create an email template","description":"Unknown merge fields for the record type are rejected (400).\n\n**Requires permission:** `manageEmailTemplates`","operationId":"createAnEmailTemplate","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"recordId":{"type":"string"},"name":{"type":"string"},"description":{"type":["string","null"]},"relatedObject":{"type":"string","enum":["any","cases","leads","opportunities"]},"subject":{"type":"string"},"body":{"type":"string"},"isActive":{"type":"boolean"},"createdByName":{"type":["string","null"]},"updatedByName":{"type":["string","null"]},"createdAt":{"type":["string","null"],"format":"date-time"},"updatedAt":{"type":["string","null"],"format":"date-time"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":120},"description":{"type":["string","null"]},"relatedObject":{"type":"string","description":"Default any. Decides which merge fields it can use.","enum":["any","cases","leads","opportunities"]},"subject":{"type":"string","description":"Merge fields like `{{Case.CaseNumber}}`; `{{Contact.FirstName|there}}` has a fallback.","maxLength":400},"body":{"type":"string","maxLength":32000},"isActive":{"type":"boolean"}}}}}}}},"/api/email-templates/merge-fields":{"get":{"tags":["Case activity"],"summary":"Merge fields by record type","operationId":"mergeFieldsByRecordType","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","description":"For each record type: groups of { object, fields: [{ token, label }] }"}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/api/email-templates/preview":{"post":{"tags":["Case activity"],"summary":"Preview template text","description":"Fills unsaved subject and body from a record (default: the newest one of that type the caller can see).","operationId":"previewTemplateText","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"subject":{"type":"string"},"body":{"type":"string"},"recordLabel":{"type":["string","null"]}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"relatedObject":{"type":"string"},"subject":{"type":"string"},"body":{"type":"string"},"recordId":{"type":"string"}}}}}}}},"/api/email-templates/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"get":{"tags":["Case activity"],"summary":"Get an email template","operationId":"getAnEmailTemplate","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"recordId":{"type":"string"},"name":{"type":"string"},"description":{"type":["string","null"]},"relatedObject":{"type":"string","enum":["any","cases","leads","opportunities"]},"subject":{"type":"string"},"body":{"type":"string"},"isActive":{"type":"boolean"},"createdByName":{"type":["string","null"]},"updatedByName":{"type":["string","null"]},"createdAt":{"type":["string","null"],"format":"date-time"},"updatedAt":{"type":["string","null"],"format":"date-time"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"tags":["Case activity"],"summary":"Update an email template","description":"**Requires permission:** `manageEmailTemplates`","operationId":"updateAnEmailTemplate","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"recordId":{"type":"string"},"name":{"type":"string"},"description":{"type":["string","null"]},"relatedObject":{"type":"string","enum":["any","cases","leads","opportunities"]},"subject":{"type":"string"},"body":{"type":"string"},"isActive":{"type":"boolean"},"createdByName":{"type":["string","null"]},"updatedByName":{"type":["string","null"]},"createdAt":{"type":["string","null"],"format":"date-time"},"updatedAt":{"type":["string","null"],"format":"date-time"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":120},"description":{"type":["string","null"]},"relatedObject":{"type":"string","description":"Default any. Decides which merge fields it can use.","enum":["any","cases","leads","opportunities"]},"subject":{"type":"string","description":"Merge fields like `{{Case.CaseNumber}}`; `{{Contact.FirstName|there}}` has a fallback.","maxLength":400},"body":{"type":"string","maxLength":32000},"isActive":{"type":"boolean"}}}}}}},"delete":{"tags":["Case activity"],"summary":"Delete an email template","description":"**Requires permission:** `manageEmailTemplates`","operationId":"deleteAnEmailTemplate","responses":{"204":{"description":"Deleted"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/email-templates/{id}/render":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"post":{"tags":["Case activity"],"summary":"Fill a template from a record","description":"Returns the subject and body with merge fields filled from the record (as the caller sees it), the caller and the organization. Send it with the record’s `/emails` endpoint.","operationId":"fillATemplateFromARecord","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"subject":{"type":"string"},"body":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"object":{"type":"string","enum":["cases","leads","opportunities"]},"recordId":{"type":"string","description":"ID or UUID."}}}}}}}},"/api/quotes/{id}/approvals":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"get":{"tags":["Quotes"],"summary":"A quote’s approval history","description":"Newest first.","operationId":"aQuoteSApprovalHistory","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["pending","approved","rejected","recalled"]},"reasons":{"type":"array","items":{"type":"string"}},"approverNames":{"type":"array","items":{"type":"string"}},"grandTotal":{"type":"number"},"currencyIsoCode":{"type":"string"},"submittedByName":{"type":["string","null"]},"submittedAt":{"type":["string","null"],"format":"date-time"},"submitComment":{"type":["string","null"]},"decidedByName":{"type":["string","null"]},"decidedAt":{"type":["string","null"],"format":"date-time"},"decisionComment":{"type":["string","null"]}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/quotes/{id}/approval/submit":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"post":{"tags":["Quotes"],"summary":"Submit a quote for approval","description":"Only when approvals are on and the quote meets an entry criterion. The status becomes Needs Review, the quote is locked until a decision or a recall, and the approvers are emailed.","operationId":"submitAQuoteForApproval","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Quote"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"comment":{"type":"string","maxLength":2000}}}}}}}},"/api/quotes/{id}/approval/approve":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"post":{"tags":["Quotes"],"summary":"Approve a quote","description":"Approvers and admins; not the submitter. Status becomes Approved.","operationId":"approveAQuote","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Quote"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"comment":{"type":"string"}}}}}}}},"/api/quotes/{id}/approval/reject":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"post":{"tags":["Quotes"],"summary":"Reject a quote","description":"Approvers and admins. A comment is required. Status becomes Rejected; it can be changed and resubmitted.","operationId":"rejectAQuote","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Quote"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"comment":{"type":"string"}},"required":["comment"]}}}}}},"/api/quotes/{id}/approval/recall":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"post":{"tags":["Quotes"],"summary":"Recall an approval request","description":"The submitter or an admin. Status goes back to Draft.","operationId":"recallAnApprovalRequest","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Quote"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"}}}},"/api/quote-approvals/pending":{"get":{"tags":["Quotes"],"summary":"Items to approve","description":"Pending requests where the caller is an approver, oldest first.","operationId":"itemsToApprove","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"quoteRecordId":{"type":"string"},"quoteNumber":{"type":"string"},"quoteName":{"type":"string"},"opportunityName":{"type":"string"},"accountName":{"type":["string","null"]},"grandTotal":{"type":"number"},"currencyIsoCode":{"type":"string"},"reasons":{"type":"array","items":{"type":"string"}},"submittedByName":{"type":["string","null"]},"submittedAt":{"type":["string","null"],"format":"date-time"},"comment":{"type":["string","null"]}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/api/setup/quote-approvals":{"get":{"tags":["Quotes"],"summary":"Quote approval settings","operationId":"quoteApprovalSettings","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"},"maxDiscountPercent":{"type":["number","null"],"description":"The quote’s discount off list price, over which approval is needed."},"maxLineDiscountPercent":{"type":["number","null"],"description":"Any line’s discount off list price."},"minGrandTotal":{"type":["number","null"],"description":"In the corporate currency."},"approverMode":{"type":"string","enum":["user","team_manager"]},"approverUserId":{"type":["string","null"],"format":"uuid","description":"The approver (user mode) or the fallback (team_manager mode)."}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}},"put":{"tags":["Quotes"],"summary":"Save quote approval settings","description":"Signed-in admins only. When enabled, at least one criterion is required, and an approver in user mode.\n\n**Requires permission:** `manageUsers`","operationId":"saveQuoteApprovalSettings","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"},"maxDiscountPercent":{"type":["number","null"],"description":"The quote’s discount off list price, over which approval is needed."},"maxLineDiscountPercent":{"type":["number","null"],"description":"Any line’s discount off list price."},"minGrandTotal":{"type":["number","null"],"description":"In the corporate currency."},"approverMode":{"type":"string","enum":["user","team_manager"]},"approverUserId":{"type":["string","null"],"format":"uuid","description":"The approver (user mode) or the fallback (team_manager mode)."}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"},"maxDiscountPercent":{"type":["number","null"],"description":"The quote’s discount off list price, over which approval is needed."},"maxLineDiscountPercent":{"type":["number","null"],"description":"Any line’s discount off list price."},"minGrandTotal":{"type":["number","null"],"description":"In the corporate currency."},"approverMode":{"type":"string","enum":["user","team_manager"]},"approverUserId":{"type":["string","null"],"format":"uuid","description":"The approver (user mode) or the fallback (team_manager mode)."}}}}}}}},"/api/quotes/{id}/sync":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"post":{"tags":["Quotes"],"summary":"Start syncing a quote to its opportunity","description":"Replaces the opportunity’s products with the quote’s; from then on, quote line changes flow to the opportunity, and the opportunity’s own products can’t be edited (409). One syncing quote per opportunity.","operationId":"startSyncingAQuoteToItsOpportunity","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Quote"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/quotes/{id}/stop-sync":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"post":{"tags":["Quotes"],"summary":"Stop syncing","description":"The opportunity keeps its current products.","operationId":"stopSyncing","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Quote"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/quote-lines/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"patch":{"tags":["Quotes"],"summary":"Update a quote line","operationId":"updateAQuoteLine","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Quote"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"quantity":{"type":"number"},"unitPrice":{"type":"number"},"discount":{"type":"number"},"description":{"type":["string","null"]}}}}}}},"delete":{"tags":["Quotes"],"summary":"Remove a quote line","operationId":"removeAQuoteLine","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Quote"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/forecasts":{"get":{"tags":["Forecasts"],"summary":"Forecast for a quarter","description":"Opportunities closing in the quarter, by forecast category, in the corporate currency (converted at today’s rates). Figures are cumulative: `closed`; `commit` = Closed + Commit; `bestCase` = Commit + Best Case; `pipeline` = every open deal. Each is `{ amount, count }`. Includes a row per owner (with quota and attainment) and each month.","operationId":"forecastForAQuarter","parameters":[{"name":"period","in":"query","required":false,"description":"Quarter, e.g. `2026-Q4`. Default: this quarter.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","description":"period, totals, rows, months, canEditQuotas"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/api/forecasts/opportunities":{"get":{"tags":["Forecasts"],"summary":"The deals behind a forecast figure","operationId":"theDealsBehindAForecastFigure","parameters":[{"name":"period","in":"query","required":false,"schema":{"type":"string"}},{"name":"column","in":"query","required":true,"schema":{"type":"string","enum":["closed","commit","bestCase","pipeline"]}},{"name":"ownerId","in":"query","required":false,"description":"User UUID, or `none`.","schema":{"type":"string"}},{"name":"month","in":"query","required":false,"description":"YYYY-MM within the period.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object"}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/api/forecasts/quotas":{"put":{"tags":["Forecasts"],"summary":"Set a user’s quarterly quota","description":"**Requires permission:** `manageQuotas`","operationId":"setAUserSQuarterlyQuota","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string","format":"uuid"},"period":{"type":"string"},"amount":{"type":["number","null"]}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string","format":"uuid"},"period":{"type":"string","description":"e.g. `2026-Q4`."},"amount":{"type":["number","null"],"description":"`null` removes it.","minimum":0}},"required":["userId","period"]}}}}}},"/api/currencies":{"get":{"tags":["Currencies"],"summary":"List currencies","description":"The corporate currency and every currency set up, with conversion rates. Readable by everyone.","operationId":"listCurrencies","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"corporate":{"type":"string","description":"The corporate currency (rate 1)."},"currencies":{"type":"array","items":{"type":"object","properties":{"isoCode":{"type":"string"},"name":{"type":"string"},"conversionRate":{"type":"number","description":"Units of this currency per 1 unit of the corporate currency."},"isCorporate":{"type":"boolean"},"isActive":{"type":"boolean"},"opportunityCount":{"type":"integer"},"priceCount":{"type":"integer"},"updatedAt":{"type":["string","null"],"format":"date-time"}}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}},"post":{"tags":["Currencies"],"summary":"Add a currency","description":"**Requires permission:** `manageCompany`","operationId":"addACurrency","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"corporate":{"type":"string","description":"The corporate currency (rate 1)."},"currencies":{"type":"array","items":{"type":"object","properties":{"isoCode":{"type":"string"},"name":{"type":"string"},"conversionRate":{"type":"number","description":"Units of this currency per 1 unit of the corporate currency."},"isCorporate":{"type":"boolean"},"isActive":{"type":"boolean"},"opportunityCount":{"type":"integer"},"priceCount":{"type":"integer"},"updatedAt":{"type":["string","null"],"format":"date-time"}}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"isoCode":{"type":"string","description":"ISO 4217, e.g. `EUR`."},"conversionRate":{"type":"number","description":"Units of it per 1 unit of the corporate currency.","exclusiveMinimum":0}},"required":["isoCode","conversionRate"]}}}}}},"/api/currencies/{iso}":{"parameters":[{"name":"iso","in":"path","required":true,"description":"ISO 4217 currency code, e.g. `EUR`.","schema":{"type":"string"}}],"patch":{"tags":["Currencies"],"summary":"Change a rate, or (de)activate a currency","description":"Rates apply to every record (no dated rates). The corporate currency stays at 1 and active. Records in an inactive currency keep it, but new records can’t use it.\n\n**Requires permission:** `manageCompany`","operationId":"changeARateOrActivateACurrency","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"corporate":{"type":"string","description":"The corporate currency (rate 1)."},"currencies":{"type":"array","items":{"type":"object","properties":{"isoCode":{"type":"string"},"name":{"type":"string"},"conversionRate":{"type":"number","description":"Units of this currency per 1 unit of the corporate currency."},"isCorporate":{"type":"boolean"},"isActive":{"type":"boolean"},"opportunityCount":{"type":"integer"},"priceCount":{"type":"integer"},"updatedAt":{"type":["string","null"],"format":"date-time"}}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"conversionRate":{"type":"number","exclusiveMinimum":0},"isActive":{"type":"boolean"}}}}}}},"delete":{"tags":["Currencies"],"summary":"Delete an unused currency","description":"Only when no opportunity, quote or price uses it; otherwise deactivate it (409).\n\n**Requires permission:** `manageCompany`","operationId":"deleteAnUnusedCurrency","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"corporate":{"type":"string","description":"The corporate currency (rate 1)."},"currencies":{"type":"array","items":{"type":"object","properties":{"isoCode":{"type":"string"},"name":{"type":"string"},"conversionRate":{"type":"number","description":"Units of this currency per 1 unit of the corporate currency."},"isCorporate":{"type":"boolean"},"isActive":{"type":"boolean"},"opportunityCount":{"type":"integer"},"priceCount":{"type":"integer"},"updatedAt":{"type":["string","null"],"format":"date-time"}}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"}}}},"/api/currencies/{iso}/corporate":{"parameters":[{"name":"iso","in":"path","required":true,"description":"ISO 4217 currency code, e.g. `EUR`.","schema":{"type":"string"}}],"post":{"tags":["Currencies"],"summary":"Make it the corporate currency","description":"Every rate is re-based against the new corporate currency. Forecast quotas and the quarterly sales goal are converted into it; record amounts don’t change.\n\n**Requires permission:** `manageCompany`","operationId":"makeItTheCorporateCurrency","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"corporate":{"type":"string","description":"The corporate currency (rate 1)."},"currencies":{"type":"array","items":{"type":"object","properties":{"isoCode":{"type":"string"},"name":{"type":"string"},"conversionRate":{"type":"number","description":"Units of this currency per 1 unit of the corporate currency."},"isCorporate":{"type":"boolean"},"isActive":{"type":"boolean"},"opportunityCount":{"type":"integer"},"priceCount":{"type":"integer"},"updatedAt":{"type":["string","null"],"format":"date-time"}}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/setup/surveys":{"get":{"tags":["Case surveys"],"summary":"List surveys","description":"With sent and answered counts and the average rating.\n\n**Requires permission:** `customizeApplication`","operationId":"listSurveys","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Survey"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}},"post":{"tags":["Case surveys"],"summary":"Create a survey","description":"Questions default to a rating, a yes/no and a comment box. Setting `sendOnClose` turns it off on the other surveys.\n\n**Requires permission:** `customizeApplication`","operationId":"createASurvey","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Survey"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Survey"}}}}}},"/api/setup/surveys/defaults":{"get":{"tags":["Case surveys"],"summary":"Defaults for a new survey","description":"**Requires permission:** `customizeApplication`","operationId":"defaultsForANewSurvey","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"questions":{"type":"array","items":{"$ref":"#/components/schemas/SurveyQuestion"}},"emailSubject":{"type":"string"},"emailBody":{"type":"string"},"questionTypes":{"type":"object"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/api/setup/surveys/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"get":{"tags":["Case surveys"],"summary":"Get a survey","description":"**Requires permission:** `customizeApplication`","operationId":"getASurvey","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Survey"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"tags":["Case surveys"],"summary":"Update a survey","description":"**Requires permission:** `customizeApplication`","operationId":"updateASurvey","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Survey"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Survey"}}}}},"delete":{"tags":["Case surveys"],"summary":"Delete a survey","description":"Only a survey that was never sent (409 otherwise: deactivate it to keep its results).\n\n**Requires permission:** `customizeApplication`","operationId":"deleteASurvey","responses":{"204":{"description":"Deleted"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"}}}},"/api/surveys/active":{"get":{"tags":["Case surveys"],"summary":"Active surveys","operationId":"activeSurveys","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"sendOnClose":{"type":"boolean"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/api/surveys/results":{"get":{"tags":["Case surveys"],"summary":"Survey results","description":"Response rate, average rating, CSAT % (4–5 stars) and NPS (% promoters 9–10 minus % detractors 0–6) for invitations sent in the period, and the answers (or every invitation with `status=all`).\n\n**Requires permission:** `viewReports`","operationId":"surveyResults","parameters":[{"name":"days","in":"query","required":false,"description":"1–730, default 90.","schema":{"type":"string"}},{"name":"surveyId","in":"query","required":false,"schema":{"type":"string"}},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["completed","all"]}},{"name":"page","in":"query","required":false,"description":"Page number, from 1.","schema":{"type":"integer","minimum":1,"default":1}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"days":{"type":"integer"},"stats":{"type":"object","properties":{"sent":{"type":"integer"},"completed":{"type":"integer"},"responseRate":{"type":["integer","null"]},"csatAverage":{"type":["number","null"]},"csatPercent":{"type":["integer","null"]},"nps":{"type":["integer","null"]},"npsResponses":{"type":"integer"}}},"total":{"type":"integer"},"page":{"type":"integer"},"pageSize":{"type":"integer"},"responses":{"type":"array","items":{"$ref":"#/components/schemas/SurveyInvitation"}},"surveys":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/api/surveys/cases/{caseId}":{"parameters":[{"name":"caseId","in":"path","required":true,"description":"Case ID or UUID.","schema":{"type":"string"}}],"get":{"tags":["Case surveys"],"summary":"Surveys sent for a case","operationId":"surveysSentForACase","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SurveyInvitation"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/surveys/cases/{caseId}/send":{"parameters":[{"name":"caseId","in":"path","required":true,"description":"Case ID or UUID.","schema":{"type":"string"}}],"post":{"tags":["Case surveys"],"summary":"Send (or resend) a survey","description":"Emails the case’s contact a new link; an earlier unanswered link stops working. 409 when the case has no contact email or the survey was already answered.\n\n**Requires permission:** `workRecords`","operationId":"sendASurvey","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"email":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"surveyId":{"type":"string","format":"uuid"}},"required":["surveyId"]}}}}}},"/api/public/surveys/{token}":{"parameters":[{"name":"token","in":"path","required":true,"description":"From the survey link: `<orgId>.<secret>`.","schema":{"type":"string"}}],"get":{"tags":["Case surveys"],"summary":"Open a survey (public)","description":"Marks it opened. Questions are empty once it’s answered or expired.","operationId":"openASurvey","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"orgName":{"type":"string"},"surveyName":{"type":"string"},"introText":{"type":["string","null"]},"thankYouText":{"type":["string","null"]},"caseNumber":{"type":"string"},"caseSubject":{"type":"string"},"contactName":{"type":["string","null"]},"status":{"type":"string","enum":["sent","opened","completed","expired"]},"questions":{"type":"array","items":{"$ref":"#/components/schemas/SurveyQuestion"}}}}}}},"404":{"$ref":"#/components/responses/NotFound"}},"security":[]},"post":{"tags":["Case surveys"],"summary":"Answer a survey (public)","description":"Once only. Answers are keyed by question id: 1–5, 0–10, a choice, `yes`/`no` or text. A low score emails the case owner.","operationId":"answerASurvey","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"410":{"description":"The survey has closed"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"answers":{"type":"object","additionalProperties":true}},"required":["answers"]}}}},"security":[]}},"/api/setup/workflows/meta":{"get":{"tags":["Workflow rules"],"summary":"Objects, fields and operators for rules","description":"Each object’s fields (with types, operators, picklist values, and whether a field update may set them), the operator labels, email templates and merge fields.\n\n**Requires permission:** `customizeApplication`","operationId":"objectsFieldsAndOperatorsForRules","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/api/setup/workflows":{"get":{"tags":["Workflow rules"],"summary":"List workflow rules","description":"**Requires permission:** `customizeApplication`","operationId":"listWorkflowRules","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/WorkflowRule"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}},"post":{"tags":["Workflow rules"],"summary":"Create a workflow rule","description":"Validated in full: fields, operators and values, merge fields, recipients and templates. New rules are inactive unless `isActive` is true.\n\n**Requires permission:** `customizeApplication`","operationId":"createAWorkflowRule","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowRule"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowRule"}}}}}},"/api/setup/workflows/jobs":{"get":{"tags":["Workflow rules"],"summary":"Workflow history","description":"Every action run, newest first; kept 30 days.\n\n**Requires permission:** `customizeApplication`","operationId":"workflowHistory","parameters":[{"name":"ruleId","in":"query","required":false,"description":"UUID or ID.","schema":{"type":"string"}},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["pending","running","done","failed","cancelled"]}},{"name":"page","in":"query","required":false,"description":"Page number, from 1.","schema":{"type":"integer","minimum":1,"default":1}},{"name":"pageSize","in":"query","required":false,"description":"Records per page (max 200).","schema":{"type":"integer","minimum":1,"maximum":200,"default":50}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"total":{"type":"integer"},"page":{"type":"integer"},"pageSize":{"type":"integer"},"jobs":{"type":"array","items":{"$ref":"#/components/schemas/WorkflowJob"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/api/setup/workflows/jobs/{jobId}/retry":{"parameters":[{"name":"jobId","in":"path","required":true,"description":"Job UUID.","schema":{"type":"string"}}],"post":{"tags":["Workflow rules"],"summary":"Retry a failed action","description":"Emails, tasks and webhooks; runs it now.\n\n**Requires permission:** `customizeApplication`","operationId":"retryAFailedAction","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowJob"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"}}}},"/api/setup/workflows/order":{"put":{"tags":["Workflow rules"],"summary":"Set the run order","description":"**Requires permission:** `customizeApplication`","operationId":"setTheRunOrder","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"object":{"type":"string"},"ids":{"type":"array","items":{"type":"string","format":"uuid"}}},"required":["object","ids"]}}}}}},"/api/setup/workflows/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"get":{"tags":["Workflow rules"],"summary":"Get a workflow rule","description":"**Requires permission:** `customizeApplication`","operationId":"getAWorkflowRule","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowRule"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"tags":["Workflow rules"],"summary":"Update a workflow rule","description":"Only the fields sent change; send `isActive` alone to switch it on or off.\n\n**Requires permission:** `customizeApplication`","operationId":"updateAWorkflowRule","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowRule"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowRule"}}}}},"delete":{"tags":["Workflow rules"],"summary":"Delete a workflow rule","description":"Its waiting actions are cancelled.\n\n**Requires permission:** `customizeApplication`","operationId":"deleteAWorkflowRule","responses":{"204":{"description":"Deleted"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/setup/workflows/{id}/secret":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"post":{"tags":["Workflow rules"],"summary":"New webhook signing secret","description":"**Requires permission:** `customizeApplication`","operationId":"newWebhookSigningSecret","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"webhookSecret":{"type":"string"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/knowledge/categories":{"get":{"tags":["Knowledge"],"summary":"List article categories","operationId":"listArticleCategories","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"sortOrder":{"type":"integer"},"published":{"type":"integer","description":"Published articles."}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}},"post":{"tags":["Knowledge"],"summary":"Create a category","description":"**Requires permission:** `manageKnowledge`","operationId":"createACategory","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"sortOrder":{"type":"integer"},"published":{"type":"integer"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":80}},"required":["name"]}}}}}},"/api/knowledge/categories/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"Category UUID.","schema":{"type":"string"}}],"patch":{"tags":["Knowledge"],"summary":"Rename a category","description":"**Requires permission:** `manageKnowledge`","operationId":"renameACategory","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"sortOrder":{"type":"integer"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":80}},"required":["name"]}}}}},"delete":{"tags":["Knowledge"],"summary":"Delete a category","description":"Its articles become uncategorized.\n\n**Requires permission:** `manageKnowledge`","operationId":"deleteACategory","responses":{"204":{"description":"Deleted"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/knowledge/articles":{"get":{"tags":["Knowledge"],"summary":"List or search articles","description":"Without `manageKnowledge`, only published articles are returned. With `q`, every word must match (title counts most, then summary, then body) and results are ranked, with a `snippet`.","operationId":"listOrSearchArticles","parameters":[{"name":"q","in":"query","required":false,"description":"Search text.","schema":{"type":"string"}},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["draft","published","archived"]}},{"name":"categoryId","in":"query","required":false,"schema":{"type":"string"}},{"name":"visibility","in":"query","required":false,"schema":{"type":"string","enum":["internal","public"]}},{"name":"page","in":"query","required":false,"description":"Page number, from 1.","schema":{"type":"integer","minimum":1,"default":1}},{"name":"pageSize","in":"query","required":false,"description":"Records per page (max 100).","schema":{"type":"integer","minimum":1,"maximum":100,"default":25}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"total":{"type":"integer"},"page":{"type":"integer"},"pageSize":{"type":"integer"},"articles":{"type":"array","items":{"$ref":"#/components/schemas/KnowledgeArticle"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"}}},"post":{"tags":["Knowledge"],"summary":"Create an article (draft)","description":"The URL name defaults to the title, made unique with `-2`, `-3`, ….\n\n**Requires permission:** `manageKnowledge`","operationId":"createAnArticle","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KnowledgeArticle"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","maxLength":255},"summary":{"type":["string","null"],"maxLength":1000},"body":{"type":"string","description":"Markdown.","maxLength":100000},"categoryId":{"type":["string","null"],"format":"uuid"},"visibility":{"type":"string","description":"Default internal.","enum":["internal","public"]},"urlName":{"type":"string"}},"required":["title"]}}}}}},"/api/knowledge/articles/{key}":{"parameters":[{"name":"key","in":"path","required":true,"description":"ID, UUID or URL name.","schema":{"type":"string"}}],"get":{"tags":["Knowledge"],"summary":"Get an article","operationId":"getAnArticle","parameters":[{"name":"view","in":"query","required":false,"description":"`1` counts a view.","schema":{"type":"string","enum":["1"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KnowledgeArticle"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"tags":["Knowledge"],"summary":"Update an article","description":"Only the fields sent change. A published article stays published (republish to raise the version). Archived articles can’t be edited (409).\n\n**Requires permission:** `manageKnowledge`","operationId":"updateAnArticle","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KnowledgeArticle"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","maxLength":255},"summary":{"type":["string","null"]},"body":{"type":"string","maxLength":100000},"categoryId":{"type":["string","null"],"format":"uuid"},"visibility":{"type":"string","enum":["internal","public"]},"urlName":{"type":"string"}}}}}}},"delete":{"tags":["Knowledge"],"summary":"Delete an article","description":"Published articles must be archived or unpublished first (409).\n\n**Requires permission:** `manageKnowledge`","operationId":"deleteAnArticle","responses":{"204":{"description":"Deleted"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"}}}},"/api/knowledge/articles/{key}/publish":{"parameters":[{"name":"key","in":"path","required":true,"description":"ID, UUID or URL name.","schema":{"type":"string"}}],"post":{"tags":["Knowledge"],"summary":"Publish an article","description":"Makes it visible to agents (and in the help center when public) and raises the version. Needs a body.\n\n**Requires permission:** `manageKnowledge`","operationId":"publishAnArticle","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KnowledgeArticle"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"}}}},"/api/knowledge/articles/{key}/unpublish":{"parameters":[{"name":"key","in":"path","required":true,"description":"ID, UUID or URL name.","schema":{"type":"string"}}],"post":{"tags":["Knowledge"],"summary":"Return an article to draft","description":"**Requires permission:** `manageKnowledge`","operationId":"returnAnArticleToDraft","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KnowledgeArticle"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"}}}},"/api/knowledge/articles/{key}/archive":{"parameters":[{"name":"key","in":"path","required":true,"description":"ID, UUID or URL name.","schema":{"type":"string"}}],"post":{"tags":["Knowledge"],"summary":"Archive an article","description":"Hidden everywhere; stays attached to its cases.\n\n**Requires permission:** `manageKnowledge`","operationId":"archiveAnArticle","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KnowledgeArticle"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"}}}},"/api/knowledge/articles/{key}/restore":{"parameters":[{"name":"key","in":"path","required":true,"description":"ID, UUID or URL name.","schema":{"type":"string"}}],"post":{"tags":["Knowledge"],"summary":"Restore an archived article as a draft","description":"**Requires permission:** `manageKnowledge`","operationId":"restoreAnArchivedArticleAsADraft","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KnowledgeArticle"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"}}}},"/api/knowledge/articles/{key}/cases":{"parameters":[{"name":"key","in":"path","required":true,"description":"ID, UUID or URL name.","schema":{"type":"string"}}],"get":{"tags":["Knowledge"],"summary":"Cases an article is attached to","operationId":"casesAnArticleIsAttachedTo","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"recordId":{"type":"string"},"caseNumber":{"type":"string"},"subject":{"type":"string"},"status":{"type":"string"},"attachedAt":{"type":["string","null"],"format":"date-time"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/knowledge/articles/{key}/feedback":{"parameters":[{"name":"key","in":"path","required":true,"description":"ID, UUID or URL name.","schema":{"type":"string"}}],"post":{"tags":["Knowledge"],"summary":"Rate a published article","operationId":"rateAPublishedArticle","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"helpful":{"type":"boolean"}},"required":["helpful"]}}}}}},"/api/knowledge/cases/{caseId}/articles":{"parameters":[{"name":"caseId","in":"path","required":true,"description":"Case ID or UUID.","schema":{"type":"string"}}],"get":{"tags":["Knowledge"],"summary":"Articles on a case, and suggestions","description":"Suggestions: up to 5 published articles matching any word of the case subject and description.","operationId":"articlesOnACaseAndSuggestions","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"attached":{"type":"array","items":{"$ref":"#/components/schemas/KnowledgeArticle"}},"suggested":{"type":"array","items":{"$ref":"#/components/schemas/KnowledgeArticle"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}},"post":{"tags":["Knowledge"],"summary":"Attach an article to a case","operationId":"attachAnArticleToACase","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"articleId":{"type":"string","description":"A published article: ID, UUID or URL name."}},"required":["articleId"]}}}}}},"/api/knowledge/cases/{caseId}/articles/{articleId}":{"parameters":[{"name":"caseId","in":"path","required":true,"description":"Case ID or UUID.","schema":{"type":"string"}},{"name":"articleId","in":"path","required":true,"description":"Article UUID.","schema":{"type":"string"}}],"delete":{"tags":["Knowledge"],"summary":"Detach an article from a case","operationId":"detachAnArticleFromACase","responses":{"204":{"description":"Deleted"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/public/kb/{orgId}":{"parameters":[{"name":"orgId","in":"path","required":true,"description":"10-character Organization ID.","schema":{"type":"string"}}],"get":{"tags":["Knowledge"],"summary":"Help center (public)","description":"The organization name and categories that have public articles.","operationId":"helpCenter","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"orgId":{"type":"string"},"orgName":{"type":"string"},"categories":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"articles":{"type":"integer"}}}}}}}}},"404":{"$ref":"#/components/responses/NotFound"}},"security":[]}},"/api/public/kb/{orgId}/articles":{"parameters":[{"name":"orgId","in":"path","required":true,"description":"10-character Organization ID.","schema":{"type":"string"}}],"get":{"tags":["Knowledge"],"summary":"List or search public articles (public)","description":"Published, public articles only; up to 50. `suggest=1` matches any word and returns up to 5 (for “these might help” while someone types).","operationId":"listOrSearchPublicArticles","parameters":[{"name":"q","in":"query","required":false,"schema":{"type":"string"}},{"name":"categoryId","in":"query","required":false,"schema":{"type":"string"}},{"name":"suggest","in":"query","required":false,"schema":{"type":"string","enum":["1"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PublicArticle"}}}}},"404":{"$ref":"#/components/responses/NotFound"}},"security":[]}},"/api/public/kb/{orgId}/articles/{urlName}":{"parameters":[{"name":"orgId","in":"path","required":true,"description":"10-character Organization ID.","schema":{"type":"string"}},{"name":"urlName","in":"path","required":true,"description":"The article URL name.","schema":{"type":"string"}}],"get":{"tags":["Knowledge"],"summary":"Read a public article (public)","description":"Counts a view.","operationId":"readAPublicArticle","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicArticle"}}}},"404":{"$ref":"#/components/responses/NotFound"}},"security":[]}},"/api/public/kb/{orgId}/articles/{urlName}/feedback":{"parameters":[{"name":"orgId","in":"path","required":true,"description":"10-character Organization ID.","schema":{"type":"string"}},{"name":"urlName","in":"path","required":true,"description":"The article URL name.","schema":{"type":"string"}}],"post":{"tags":["Knowledge"],"summary":"Was this helpful? (public)","operationId":"wasThisHelpful","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"404":{"$ref":"#/components/responses/NotFound"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"helpful":{"type":"boolean"}},"required":["helpful"]}}}},"security":[]}},"/api/setup/audit-trail":{"get":{"tags":["Team-based access"],"summary":"Admin Activity Log","description":"Changes made in Settings and the Setup-level APIs, newest first (kept 180 days; entries can’t be edited). Signed-in admins only.\n\n**Requires permission:** `manageUsers`","operationId":"adminActivityLog","parameters":[{"name":"days","in":"query","required":false,"description":"1–180, default 30.","schema":{"type":"string"}},{"name":"section","in":"query","required":false,"schema":{"type":"string"}},{"name":"userId","in":"query","required":false,"description":"Changed by, or used Sign in as user.","schema":{"type":"string"}},{"name":"q","in":"query","required":false,"description":"Text in the action, details or name.","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"total":{"type":"integer"},"page":{"type":"integer"},"pageSize":{"type":"integer"},"entries":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"createdAt":{"type":["string","null"],"format":"date-time"},"userId":{"type":["string","null"],"format":"uuid"},"userName":{"type":["string","null"]},"impersonatorName":{"type":["string","null"],"description":"Sign in as user: the admin behind the change."},"via":{"type":"string","enum":["app","api_key","oauth_client","mcp_grant"]},"section":{"type":"string"},"action":{"type":"string"},"detail":{"type":["string","null"],"description":"The values sent; secrets masked."},"method":{"type":"string"},"path":{"type":"string"},"sourceIp":{"type":["string","null"]}}}},"sections":{"type":"array","items":{"type":"string"}},"people":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/api/history":{"get":{"tags":["Team-based access"],"summary":"Data Change Log","description":"Who created, changed and deleted cases, leads, opportunities, accounts and contacts, newest first, for the fields each object tracks (kept 18 months). Each change lists the field’s old and new value as displayed (dropdown labels, user and record names). `source` says how the change was made. `format=csv` downloads up to 10,000 entries, one line per changed field.\n\n**Requires permission:** `viewDataChangeLog`","operationId":"dataChangeLog","parameters":[{"name":"userId","in":"query","required":false,"description":"Changed by this user.","schema":{"type":"string"}},{"name":"object","in":"query","required":false,"description":"cases, leads, opportunities, accounts or contacts.","schema":{"type":"string"}},{"name":"action","in":"query","required":false,"description":"created, updated or deleted.","schema":{"type":"string"}},{"name":"source","in":"query","required":false,"description":"app, api, ai, import, workflow, support, login_as or system.","schema":{"type":"string"}},{"name":"from","in":"query","required":false,"description":"YYYY-MM-DD.","schema":{"type":"string"}},{"name":"to","in":"query","required":false,"description":"YYYY-MM-DD (inclusive).","schema":{"type":"string"}},{"name":"q","in":"query","required":false,"description":"Record name, or its 14-character ID.","schema":{"type":"string"}},{"name":"format","in":"query","required":false,"description":"`csv` to download.","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"total":{"type":"integer"},"page":{"type":"integer"},"pageSize":{"type":"integer"},"entries":{"type":"array","items":{"$ref":"#/components/schemas/HistoryEntry"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/api/history/{object}/{id}":{"parameters":[{"name":"object","in":"path","required":true,"description":"cases, leads, opportunities, accounts or contacts.","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"The record’s ID (or UUID).","schema":{"type":"string"}}],"get":{"tags":["Team-based access"],"summary":"A record’s field history","description":"The last 200 tracked changes to one record. Available to anyone who can see the record.","operationId":"aRecordSFieldHistory","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"},"entries":{"type":"array","items":{"$ref":"#/components/schemas/HistoryEntry"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/setup/objects/{name}/history":{"parameters":[{"name":"name","in":"path","required":true,"description":"cases, leads, opportunities, accounts or contacts.","schema":{"type":"string"}}],"put":{"tags":["Team-based access"],"summary":"Choose the tracked fields","description":"Turns field history on or off for an object and sets the tracked fields (column names; custom fields by API name). System and formula fields can’t be tracked. The object’s `history` in `GET /api/setup/objects/{name}` lists what can be.\n\n**Requires permission:** `customizeApplication`","operationId":"chooseTheTrackedFields","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"},"fields":{"type":"array","items":{"type":"string"}}},"required":["enabled","fields"]}}}}},"delete":{"tags":["Team-based access"],"summary":"Go back to the default tracked fields","description":"**Requires permission:** `customizeApplication`","operationId":"goBackToTheDefaultTrackedFields","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/setup/audit-trail/export.csv":{"get":{"tags":["Team-based access"],"summary":"Download the Admin Activity Log (CSV)","description":"**Requires permission:** `manageUsers`","operationId":"downloadTheAdminActivityLog","parameters":[{"name":"days","in":"query","required":false,"description":"1–180, default 30.","schema":{"type":"string"}},{"name":"section","in":"query","required":false,"schema":{"type":"string"}},{"name":"userId","in":"query","required":false,"description":"Changed by, or used Sign in as user.","schema":{"type":"string"}},{"name":"q","in":"query","required":false,"description":"Text in the action, details or name.","schema":{"type":"string"}}],"responses":{"200":{"description":"CSV, up to 10,000 rows","content":{"text/csv":{"schema":{"type":"string"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/api/setup/sharing":{"get":{"tags":["Team-based access"],"summary":"Sharing settings","description":"Who can see leads and opportunities: `public` (everyone), `team` (owners and their team-mates) or `private` (owners, plus managers of the owner’s teams). Admins see everything; unowned records are visible to all. Enforced by the database for every query.","operationId":"sharingSettings","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"settings":{"type":"array","items":{"type":"object","properties":{"object":{"type":"string","enum":["leads","opportunities"]},"label":{"type":"string"},"access":{"type":"string","enum":["public","team","private"]},"updatedAt":{"type":["string","null"],"format":"date-time"}}}},"levels":{"type":"object"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}},"put":{"tags":["Team-based access"],"summary":"Change sharing settings","description":"**Requires permission:** `manageUsers`","operationId":"changeSharingSettings","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"leads":{"type":"string","enum":["public","team","private"]},"opportunities":{"type":"string","enum":["public","team","private"]}}}}}}}},"/api/sales-teams":{"get":{"tags":["Team-based access"],"summary":"List sales teams","description":"Includes `myRole`, the caller’s role on each team.","operationId":"listSalesTeams","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}},"post":{"tags":["Team-based access"],"summary":"Create a sales team","description":"**Requires permission:** `manageUsers`","operationId":"createASalesTeam","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":["string","null"]}},"required":["name"]}}}}}},"/api/sales-teams/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"get":{"tags":["Team-based access"],"summary":"Get a sales team with its members","operationId":"getASalesTeamWithItsMembers","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"tags":["Team-based access"],"summary":"Rename or describe a team","description":"**Requires permission:** `manageUsers`","operationId":"renameOrDescribeATeam","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":["string","null"]}}}}}}},"delete":{"tags":["Team-based access"],"summary":"Delete a team","description":"**Requires permission:** `manageUsers`","operationId":"deleteATeam","responses":{"204":{"description":"Deleted"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/sales-teams/{id}/members":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"post":{"tags":["Team-based access"],"summary":"Add (or re-role) a member","description":"**Requires permission:** `manageUsers`","operationId":"addAMember","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string","description":"UUID or ID."},"teamRole":{"type":"string","description":"Default `member`.","enum":["member","manager"]}},"required":["userId"]}}}}}},"/api/sales-teams/{id}/members/{userId}":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}},{"name":"userId","in":"path","required":true,"description":"User UUID.","schema":{"type":"string"}}],"patch":{"tags":["Team-based access"],"summary":"Change a member’s team role","description":"**Requires permission:** `manageUsers`","operationId":"changeAMemberSTeamRole","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"teamRole":{"type":"string","enum":["member","manager"]}},"required":["teamRole"]}}}}},"delete":{"tags":["Team-based access"],"summary":"Remove a member","description":"**Requires permission:** `manageUsers`","operationId":"removeAMember","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/queues":{"get":{"tags":["Support teams"],"summary":"List queues","operationId":"listQueues","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Queue"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}},"post":{"tags":["Support teams"],"summary":"Create a queue","description":"**Requires permission:** `manageQueues`","operationId":"createAQueue","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Queue"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"email":{"type":["string","null"]},"notifyMembers":{"type":"boolean"}},"required":["name"]}}}}}},"/api/queues/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"get":{"tags":["Support teams"],"summary":"Get a queue with members","operationId":"getAQueueWithMembers","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Queue"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"tags":["Support teams"],"summary":"Update a queue","description":"**Requires permission:** `manageQueues`","operationId":"updateAQueue","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Queue"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"email":{"type":["string","null"]},"notifyMembers":{"type":"boolean"}}}}}}},"delete":{"tags":["Support teams"],"summary":"Delete a queue","description":"Cases in the queue are left with no queue. Refused while an assignment rule or origin default uses it.\n\n**Requires permission:** `manageQueues`","operationId":"deleteAQueue","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"casesCleared":{"type":"integer"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"}}}},"/api/queues/{id}/members":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"post":{"tags":["Support teams"],"summary":"Add a member","description":"**Requires permission:** `manageQueues`","operationId":"addAMember_","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Queue"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string","format":"uuid"}},"required":["userId"]}}}}}},"/api/queues/{id}/members/{userId}":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}},{"name":"userId","in":"path","required":true,"description":"User UUID.","schema":{"type":"string"}}],"delete":{"tags":["Support teams"],"summary":"Remove a member","description":"**Requires permission:** `manageQueues`","operationId":"removeAMember_","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Queue"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/users":{"get":{"tags":["Users & profiles"],"summary":"List users","description":"Active users first.","operationId":"listUsers","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/User"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}},"post":{"tags":["Users & profiles"],"summary":"Create a user","description":"**Requires permission:** `manageUsers`","operationId":"createAUser","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"fullName":{"type":"string"},"email":{"type":"string"},"role":{"type":"string","description":"Default `agent`.","enum":["agent","manager","admin"]},"password":{"type":"string","description":"At least 8 characters.","minLength":8},"externalId":{"type":["string","null"],"description":"Unique per organization and object; up to 255 characters. `\"\"` or `null` clears it.","maxLength":255}},"required":["fullName","email","password"]}}}}}},"/api/users/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"get":{"tags":["Users & profiles"],"summary":"Get a user","description":"Includes linked single sign-on identities. Users can read their own record; others need `manageUsers`.","operationId":"getAUser","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/User"},{"type":"object","properties":{"ssoIdentities":{"type":"array","items":{"type":"object","properties":{"issuer":{"type":"string"},"email":{"type":["string","null"]},"linkedAt":{"type":["string","null"],"format":"date-time"},"lastLoginAt":{"type":["string","null"],"format":"date-time"}}}}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"tags":["Users & profiles"],"summary":"Update a user","description":"Users can’t be deleted; set `isActive: false`. You can’t change your own profile or deactivate yourself, and an organization keeps at least one active admin.\n\n**Requires permission:** `manageUsers`","operationId":"updateAUser","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"fullName":{"type":"string"},"email":{"type":"string"},"role":{"type":"string","enum":["agent","manager","admin"]},"isActive":{"type":"boolean"},"externalId":{"type":["string","null"],"description":"Unique per organization and object; up to 255 characters. `\"\"` or `null` clears it.","maxLength":255}}}}}}}},"/api/users/{id}/login-as":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"post":{"tags":["Users & profiles"],"summary":"Sign in as a user","description":"Returns a session for an active Agent or Manager, valid for up to an hour, that carries the admin’s identity (`impersonatedBy`). Signed-in admins only: not API keys, OAuth tokens or another Sign in as user session, and not for admins or yourself. Recorded in the user’s login history. Every request re-checks that the admin is still active with `manageUsers`.\n\n**Requires permission:** `manageUsers`","operationId":"signInAsAUser","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string"},"user":{"allOf":[{"$ref":"#/components/schemas/SessionUser"},{"type":"object","properties":{"impersonatedBy":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"fullName":{"type":"string"}}}}}]},"expiresAt":{"type":["string","null"],"format":"date-time"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/users/{id}/login-history":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"get":{"tags":["Users & profiles"],"summary":"A user’s login history","description":"Every sign-in attempt for this user in the last 6 months, newest first: password, SSO and OAuth client-credentials token requests (for apps running as this user), successful or not. API key calls aren’t logins and aren’t listed. Users can read their own; others need `manageUsers`.","operationId":"aUserSLoginHistory","parameters":[{"name":"type","in":"query","required":false,"schema":{"type":"string","enum":["password","sso","oauth_client_credentials","login_as"]}},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["success","failed"]}},{"name":"page","in":"query","required":false,"description":"Page number, from 1.","schema":{"type":"integer","minimum":1,"default":1}},{"name":"pageSize","in":"query","required":false,"description":"Records per page (max 100).","schema":{"type":"integer","minimum":1,"maximum":100,"default":25}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"total":{"type":"integer"},"page":{"type":"integer"},"pageSize":{"type":"integer"},"entries":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"loginAt":{"type":["string","null"],"format":"date-time"},"type":{"type":"string","enum":["password","sso","oauth_client_credentials","login_as"]},"typeLabel":{"type":"string"},"status":{"type":"string","enum":["success","invalid_password","user_inactive","sso_required","sso_failed","invalid_client_secret"]},"statusLabel":{"type":"string"},"success":{"type":"boolean"},"sourceIp":{"type":["string","null"]},"browser":{"type":["string","null"]},"platform":{"type":["string","null"]},"userAgent":{"type":["string","null"]},"detail":{"type":["string","null"],"description":"Identity provider, or connected app name."}}}},"types":{"type":"object","additionalProperties":{"type":"string"}},"statuses":{"type":"object","additionalProperties":{"type":"string"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/api/users/{id}/password":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"post":{"tags":["Users & profiles"],"summary":"Set a user’s password","description":"**Requires permission:** `manageUsers`","operationId":"setAUserSPassword","responses":{"204":{"description":"Password set"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"password":{"type":"string","minLength":8}},"required":["password"]}}}}}},"/api/profiles":{"get":{"tags":["Users & profiles"],"summary":"Profiles and permissions","description":"The three standard profiles (fixed) and what each permission allows.","operationId":"profilesAndPermissions","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"permissions":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"description":{"type":"string"}}}},"profiles":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"permissions":{"type":"array","items":{"type":"string"}},"activeUsers":{"type":"integer"}}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/api/search":{"get":{"tags":["Reports & search"],"summary":"Global search","description":"Up to a few matches per object. Queries shorter than 2 characters return empty lists.","operationId":"globalSearch","parameters":[{"name":"q","in":"query","required":false,"description":"Search text.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"cases":{"type":"array","items":{"type":"object"}},"accounts":{"type":"array","items":{"type":"object"}},"contacts":{"type":"array","items":{"type":"object"}},"leads":{"type":"array","items":{"type":"object"}},"opportunities":{"type":"array","items":{"type":"object"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/api/notifications":{"get":{"tags":["Reports & search"],"summary":"Recent notifications for the caller","operationId":"recentNotificationsForTheCaller","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","description":"assigned, escalated, comment, milestone, escalation or email."},"caseId":{"type":"string","format":"uuid"},"caseRecordId":{"type":"string"},"caseNumber":{"type":"string"},"subject":{"type":"string"},"actor":{"type":["string","null"]},"at":{"type":["string","null"],"format":"date-time"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/api/reports/summary":{"get":{"tags":["Reports & search"],"summary":"Service dashboard data","description":"Totals, groupings and a 30-day created/closed series.","operationId":"serviceDashboardData","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/api/reports/sales-summary":{"get":{"tags":["Reports & search"],"summary":"Sales dashboard data","description":"Pipeline, quarter performance and lead groupings.","operationId":"salesDashboardData","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/api/reports/{key}/records":{"parameters":[{"name":"key","in":"path","required":true,"description":"Report key.","schema":{"type":"string","enum":["casesByStatus","casesByPriority","casesByOrigin","openCasesByQueue","openCasesByOwner","casesByAccount","accountsByType","accountsByIndustry","opportunitiesByStage","pipelineByMonth","wonByOwner","leadsByStatus","leadsBySource"]}}],"get":{"tags":["Reports & search"],"summary":"Report records (filter, sort, page)","description":"Filters use `f.<column>` query parameters, where columns come from the response’s `columns`: `f.<col>=<value>` for picklist/lookup (`none` = empty), `f.<col>=<text>` for text (contains), and `f.<col>.from` / `f.<col>.to` for dates (YYYY-MM-DD, inclusive) and numbers.","operationId":"reportRecords","parameters":[{"name":"sort","in":"query","required":false,"description":"Column key.","schema":{"type":"string"}},{"name":"dir","in":"query","required":false,"schema":{"type":"string","enum":["asc","desc"]}},{"name":"page","in":"query","required":false,"description":"Page number, from 1.","schema":{"type":"integer","minimum":1,"default":1}},{"name":"pageSize","in":"query","required":false,"description":"Records per page (max 200).","schema":{"type":"integer","minimum":1,"maximum":200,"default":50}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","description":"columns, filters, groups, records, total, page…"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/reports/{key}/export.csv":{"parameters":[{"name":"key","in":"path","required":true,"description":"Report key (see records).","schema":{"type":"string"}}],"get":{"tags":["Reports & search"],"summary":"Export report records as CSV","description":"Same filters and sort as `/records`, all pages. UTF-8 with BOM; cells that look like formulas are escaped.","operationId":"exportReportRecordsAsCSV","responses":{"200":{"description":"CSV","content":{"text/csv":{"schema":{"type":"string"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/email-log":{"get":{"tags":["Reports & search"],"summary":"Email log","description":"**Requires permission:** `manageQueues`","operationId":"emailLog","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":500,"default":100}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"configured":{"type":"boolean","description":"Whether SMTP is set up."},"messages":{"type":"array","items":{"type":"object"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/api/picklists":{"get":{"tags":["Dropdown values"],"summary":"All picklist values","description":"Every standard picklist for the organization, keyed like `cases.status`, `cases.priority`, `cases.origin`, `accounts.type`, `leads.status`, `leads.source`, `leads.rating`, `opportunities.stage`, `opportunities.type`.","operationId":"allPicklistValues","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"array","items":{"$ref":"#/components/schemas/PicklistValue"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/api/setup/picklists/{object}/{field}":{"parameters":[{"name":"object","in":"path","required":true,"description":"e.g. `cases`.","schema":{"type":"string"}},{"name":"field","in":"path","required":true,"description":"e.g. `status`.","schema":{"type":"string"}}],"get":{"tags":["Dropdown values"],"summary":"Picklist values with usage counts","operationId":"picklistValuesWithUsageCounts","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}},"post":{"tags":["Dropdown values"],"summary":"Add a value","description":"**Requires permission:** `customizeApplication`","operationId":"addAValue","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PicklistValue"}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"type":"string"},"apiName":{"type":"string","description":"Default: the label."},"category":{"type":"string","description":"Required for categorized picklists."},"probability":{"type":"integer","description":"Stage only."},"isDefault":{"type":"boolean"}},"required":["label"]}}}}}},"/api/setup/picklists/{object}/{field}/order":{"parameters":[{"name":"object","in":"path","required":true,"description":"","schema":{"type":"string"}},{"name":"field","in":"path","required":true,"description":"","schema":{"type":"string"}}],"put":{"tags":["Dropdown values"],"summary":"Reorder values","description":"**Requires permission:** `customizeApplication`","operationId":"reorderValues","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PicklistValue"}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"order":{"type":"array","items":{"type":"string","description":"apiName"}}},"required":["order"]}}}}}},"/api/setup/picklists/{object}/{field}/{value}":{"parameters":[{"name":"object","in":"path","required":true,"description":"","schema":{"type":"string"}},{"name":"field","in":"path","required":true,"description":"","schema":{"type":"string"}},{"name":"value","in":"path","required":true,"description":"The value’s apiName (URL-encoded).","schema":{"type":"string"}}],"patch":{"tags":["Dropdown values"],"summary":"Update a value","description":"**Requires permission:** `customizeApplication`","operationId":"updateAValue","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PicklistValue"}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"type":"string"},"isActive":{"type":"boolean"},"isDefault":{"type":"boolean"},"category":{"type":"string"},"probability":{"type":"integer"}}}}}}},"delete":{"tags":["Dropdown values"],"summary":"Delete an unused value","description":"**Requires permission:** `customizeApplication`","operationId":"deleteAnUnusedValue","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PicklistValue"}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"}}}},"/api/setup/picklists/{object}/{field}/{value}/replace":{"parameters":[{"name":"object","in":"path","required":true,"description":"","schema":{"type":"string"}},{"name":"field","in":"path","required":true,"description":"","schema":{"type":"string"}},{"name":"value","in":"path","required":true,"description":"Value to replace.","schema":{"type":"string"}}],"post":{"tags":["Dropdown values"],"summary":"Replace a value on every record","description":"**Requires permission:** `customizeApplication`","operationId":"replaceAValueOnEveryRecord","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"replaced":{"type":"integer"},"values":{"type":"array","items":{"$ref":"#/components/schemas/PicklistValue"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"with":{"type":"string","description":"apiName of an active value."}},"required":["with"]}}}}}},"/api/setup/objects":{"get":{"tags":["Data Model"],"summary":"List objects","operationId":"listObjects","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/api/setup/objects/{name}":{"parameters":[{"name":"name","in":"path","required":true,"description":"Object API name, e.g. `cases`.","schema":{"type":"string"}}],"get":{"tags":["Data Model"],"summary":"Describe an object","description":"Fields (with types, indexes, lookups, picklist values), custom fields and child relationships.","operationId":"describeAnObject","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/setup/custom-fields":{"get":{"tags":["Data Model"],"summary":"Custom field definitions for an object","operationId":"customFieldDefinitionsForAnObject","parameters":[{"name":"object","in":"query","required":true,"schema":{"type":"string","enum":["accounts","contacts","cases","leads","opportunities"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/CustomFieldDefinition"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/setup/objects/{name}/fields":{"parameters":[{"name":"name","in":"path","required":true,"description":"accounts, contacts, cases, leads or opportunities.","schema":{"type":"string"}}],"post":{"tags":["Data Model"],"summary":"Create a custom field","description":"**Requires permission:** `customizeApplication`","operationId":"createACustomField","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomFieldDefinition"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomFieldInput"}}}}}},"/api/setup/objects/{name}/fields/{apiName}":{"parameters":[{"name":"name","in":"path","required":true,"description":"","schema":{"type":"string"}},{"name":"apiName","in":"path","required":true,"description":"Custom field API name.","schema":{"type":"string"}}],"patch":{"tags":["Data Model"],"summary":"Update a custom field","description":"**Requires permission:** `customizeApplication`","operationId":"updateACustomField","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomFieldDefinition"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomFieldInput"}}}}},"delete":{"tags":["Data Model"],"summary":"Delete a custom field (and its values)","description":"Refused (409) while a formula field, validation rule or workflow rule uses it.\n\n**Requires permission:** `customizeApplication`","operationId":"deleteACustomField","responses":{"204":{"description":"Deleted"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"}}}},"/api/setup/objects/{name}/validation-rules":{"parameters":[{"name":"name","in":"path","required":true,"description":"cases, leads, opportunities, accounts or contacts.","schema":{"type":"string"}}],"get":{"tags":["Data Model"],"summary":"List validation rules","description":"**Requires permission:** `customizeApplication`","operationId":"listValidationRules","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ValidationRule"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}},"post":{"tags":["Data Model"],"summary":"Create a validation rule","description":"Active rules check every save by a signed-in user or integration (app, API, MCP, imports) after workflow field updates and formula fields are applied. A failing save gets 400 with the messages and `details.validationErrors: [{ rule, field, message }]`. Records created by web forms, email and chat, and automation, aren’t blocked.\n\n**Requires permission:** `customizeApplication`","operationId":"createAValidationRule","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationRule"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationRule"}}}}}},"/api/setup/objects/{name}/validation-rules/{ruleId}":{"parameters":[{"name":"name","in":"path","required":true,"description":"","schema":{"type":"string"}},{"name":"ruleId","in":"path","required":true,"description":"UUID or ID.","schema":{"type":"string"}}],"get":{"tags":["Data Model"],"summary":"Get a validation rule","description":"**Requires permission:** `customizeApplication`","operationId":"getAValidationRule","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationRule"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"tags":["Data Model"],"summary":"Update a validation rule","description":"**Requires permission:** `customizeApplication`","operationId":"updateAValidationRule","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationRule"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationRule"}}}}},"delete":{"tags":["Data Model"],"summary":"Delete a validation rule","description":"**Requires permission:** `customizeApplication`","operationId":"deleteAValidationRule","responses":{"204":{"description":"Deleted"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/setup/formulas/reference":{"get":{"tags":["Data Model"],"summary":"Formula fields and functions","description":"**Requires permission:** `customizeApplication`","operationId":"formulaFieldsAndFunctions","parameters":[{"name":"object","in":"query","required":false,"description":"cases, leads, opportunities, accounts or contacts.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"fields":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"label":{"type":"string"},"type":{"type":"string"},"custom":{"type":"boolean"},"formula":{"type":"boolean"}}}},"functions":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"category":{"type":"string"},"syntax":{"type":"string"},"description":{"type":"string"}}}},"operators":{"type":"array","items":{"type":"string"}},"globals":{"type":"array","items":{"type":"string"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/setup/formulas/check":{"post":{"tags":["Data Model"],"summary":"Check a formula","description":"Parses and type-checks a formula, then tries it on a record (the one given, else the most recently updated). Syntax problems come back as `ok: false` with a message and position, not an error status.\n\n**Requires permission:** `customizeApplication`","operationId":"checkAFormula","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"error":{"type":"string"},"position":{"type":["integer","null"]},"type":{"type":"string"},"references":{"type":"array","items":{"type":"string"}},"usesToday":{"type":"boolean"},"sample":{"type":["object","null"],"properties":{"recordId":{"type":"string"},"label":{"type":["string","null"]},"value":{},"error":{"type":["string","null"]}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"object":{"type":"string"},"formula":{"type":"string"},"kind":{"type":"string","enum":["field","validation"]},"returnType":{"type":"string","description":"kind field.","enum":["Text","Number","Currency","Percent","Date","Checkbox"]},"decimals":{"type":"integer"},"apiName":{"type":"string","description":"The formula field being edited (can’t refer to itself)."},"recordId":{"type":"string"}},"required":["object","formula"]}}}}}},"/api/setup/case-settings":{"get":{"tags":["Case settings"],"summary":"All case settings","description":"Origin defaults, assignment rules, milestone types, escalation rules and reference data.","operationId":"allCaseSettings","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/api/setup/case-settings/origin-defaults/{origin}":{"parameters":[{"name":"origin","in":"path","required":true,"description":"An Origin value.","schema":{"type":"string"}}],"put":{"tags":["Case settings"],"summary":"Set the default owner for an origin","description":"**Requires permission:** `customizeApplication`","operationId":"setTheDefaultOwnerForAnOrigin","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object"}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"ownerType":{"type":["string","null"],"description":"`user`, `queue`, or null to clear.","enum":["user","queue",null]},"ownerId":{"type":["string","null"],"format":"uuid"}}}}}}}},"/api/setup/case-settings/rules":{"post":{"tags":["Case settings"],"summary":"Add an assignment rule","description":"Rules run in order; the first match assigns the case. A rule with no conditions matches everything.\n\n**Requires permission:** `customizeApplication`","operationId":"addAnAssignmentRule","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"array","items":{"type":"object"}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"isActive":{"type":"boolean"},"matchType":{"type":"string","description":"Default `all`.","enum":["all","any"]},"conditions":{"type":"array","items":{"$ref":"#/components/schemas/RuleCondition"}},"ownerType":{"type":"string","enum":["user","queue"]},"ownerId":{"type":"string","format":"uuid"}},"required":["name","ownerType","ownerId"]}}}}}},"/api/setup/case-settings/rules/order":{"put":{"tags":["Case settings"],"summary":"Reorder assignment rules","description":"**Requires permission:** `customizeApplication`","operationId":"reorderAssignmentRules","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object"}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"order":{"type":"array","items":{"type":"string","format":"uuid"}}},"required":["order"]}}}}}},"/api/setup/case-settings/rules/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"patch":{"tags":["Case settings"],"summary":"Update an assignment rule","description":"**Requires permission:** `customizeApplication`","operationId":"updateAnAssignmentRule","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object"}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"isActive":{"type":"boolean"},"matchType":{"type":"string","enum":["all","any"]},"conditions":{"type":"array","items":{"$ref":"#/components/schemas/RuleCondition"}},"ownerType":{"type":"string","enum":["user","queue"]},"ownerId":{"type":"string","format":"uuid"}}}}}}},"delete":{"tags":["Case settings"],"summary":"Delete an assignment rule","description":"**Requires permission:** `customizeApplication`","operationId":"deleteAnAssignmentRule","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/setup/case-settings/milestones":{"post":{"tags":["Case settings"],"summary":"Add a milestone type","description":"**Requires permission:** `customizeApplication`","operationId":"addAMilestoneType","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"array","items":{"type":"object"}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"completionEvent":{"type":"string","enum":["first_response","case_closed","manual"]},"defaultMinutes":{"type":"integer","description":"Target in minutes.","minimum":1},"targets":{"type":"object","additionalProperties":{"type":"integer"},"description":"Minutes per Priority value, e.g. `{\"High\": 60}`."},"isActive":{"type":"boolean"}},"required":["name","completionEvent","defaultMinutes"]}}}}}},"/api/setup/case-settings/milestones/{milestoneId}":{"parameters":[{"name":"milestoneId","in":"path","required":true,"description":"ID or UUID.","schema":{"type":"string"}}],"patch":{"tags":["Case settings"],"summary":"Update a milestone type","description":"**Requires permission:** `customizeApplication`","operationId":"updateAMilestoneType","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object"}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"}}}}},"delete":{"tags":["Case settings"],"summary":"Delete a milestone type","description":"Refused while an escalation rule uses it.\n\n**Requires permission:** `customizeApplication`","operationId":"deleteAMilestoneType","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"}}}},"/api/setup/case-settings/escalations":{"post":{"tags":["Case settings"],"summary":"Add an escalation rule","description":"**Requires permission:** `customizeApplication`","operationId":"addAnEscalationRule","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"array","items":{"type":"object"}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"isActive":{"type":"boolean"},"matchType":{"type":"string","enum":["all","any"]},"conditions":{"type":"array","items":{"$ref":"#/components/schemas/RuleCondition"}},"triggerType":{"type":"string","enum":["age","milestone_violated"]},"ageHours":{"type":"number","description":"For `age`: hours after the case was created."},"milestoneTypeId":{"type":"string","format":"uuid","description":"For `milestone_violated`."},"setEscalated":{"type":"boolean","description":"Move the case to an Escalated status."},"reassignType":{"type":["string","null"],"enum":["user","queue",null]},"reassignId":{"type":["string","null"],"format":"uuid"},"notifyUserId":{"type":["string","null"],"format":"uuid"},"notifyEmail":{"type":["string","null"]}},"required":["name","triggerType"]}}}}}},"/api/setup/case-settings/escalations/order":{"put":{"tags":["Case settings"],"summary":"Reorder escalation rules","description":"**Requires permission:** `customizeApplication`","operationId":"reorderEscalationRules","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object"}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"order":{"type":"array","items":{"type":"string","format":"uuid"}}},"required":["order"]}}}}}},"/api/setup/case-settings/escalations/{escalationId}":{"parameters":[{"name":"escalationId","in":"path","required":true,"description":"ID or UUID.","schema":{"type":"string"}}],"patch":{"tags":["Case settings"],"summary":"Update an escalation rule","description":"**Requires permission:** `customizeApplication`","operationId":"updateAnEscalationRule","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object"}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"}}}}},"delete":{"tags":["Case settings"],"summary":"Delete an escalation rule","description":"**Requires permission:** `customizeApplication`","operationId":"deleteAnEscalationRule","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/setup/case-settings/escalations/run":{"post":{"tags":["Case settings"],"summary":"Run the escalation sweep now","description":"**Requires permission:** `customizeApplication`","operationId":"runTheEscalationSweepNow","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"violated":{"type":"integer"},"escalated":{"type":"integer"},"lastRun":{"type":"object"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/api/organization":{"get":{"tags":["Organization"],"summary":"Company information","operationId":"companyInformation","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Organization"}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}},"patch":{"tags":["Organization"],"summary":"Update company information","description":"**Requires permission:** `manageCompany`","operationId":"updateCompanyInformation","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Organization"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":120},"primaryContactName":{"type":["string","null"]},"primaryContactEmail":{"type":["string","null"]},"primaryContactPhone":{"type":["string","null"]},"quarterlySalesGoal":{"type":["number","null"]}}}}}}}},"/api/organization/licence":{"get":{"tags":["Organization"],"summary":"CRMSix plan and user licences","description":"The organization’s subscription: plan, price per user per month, billing cycle (monthly or annual), licences bought and in use. `subscription` is null when the organization has no plan (no licence limit). Needs Manage users or Manage company information; `invoices` is included only with Manage company information (otherwise null).","operationId":"crmsixPlanAndUserLicences","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"activeUsers":{"type":"integer"},"subscription":{"type":["object","null"]},"plan":{"type":["object","null"]},"invoices":{"type":["array","null"],"items":{"type":"object"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/api/web-to-case":{"post":{"tags":["Support Form"],"summary":"Submit a case from a website (public)","description":"No authentication: identified by `orgid`. Works only when enabled in Settings → Support Form. Accepts an HTML form post (responds with a page or a redirect to the return URL) or JSON (responds with JSON). CORS allows any origin. Limits: 5 submissions per visitor per 10 minutes and the organization’s daily limit. Leave `company_website` empty (spam trap).","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"orgid":{"type":"string","description":"10-character Organization ID."},"name":{"type":"string","maxLength":120},"email":{"type":"string","maxLength":255},"phone":{"type":"string","maxLength":40},"company":{"type":"string","maxLength":255},"subject":{"type":"string","maxLength":255},"description":{"type":"string","maxLength":32000},"priority":{"type":"string","description":"Optional Priority value or label."},"company_website":{"type":"string","description":"Spam trap: must be empty."}},"required":["orgid","email","subject"]}},"application/x-www-form-urlencoded":{"schema":{"type":"object","properties":{"orgid":{"type":"string","description":"10-character Organization ID."},"name":{"type":"string","maxLength":120},"email":{"type":"string","maxLength":255},"phone":{"type":"string","maxLength":40},"company":{"type":"string","maxLength":255},"subject":{"type":"string","maxLength":255},"description":{"type":"string","maxLength":32000},"priority":{"type":"string","description":"Optional Priority value or label."},"company_website":{"type":"string","description":"Spam trap: must be empty."}},"required":["orgid","email","subject"]}}}},"responses":{"200":{"description":"Thank-you page (form post)","content":{"text/html":{"schema":{"type":"string"}}}},"201":{"description":"Case created (JSON)","content":{"application/json":{"schema":{"type":"object","properties":{"caseNumber":{"type":"string"},"message":{"type":"string"},"returnUrl":{"type":["string","null"]}}}}}},"303":{"description":"Redirect to the configured return URL (form post)"},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"description":"Support Form is not enabled","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooMany"}},"operationId":"submitACaseFromAWebsite"}},"/api/web-to-case/{orgId}/form":{"parameters":[{"name":"orgId","in":"path","required":true,"description":"Organization ID.","schema":{"type":"string"}}],"get":{"tags":["Support Form"],"summary":"Hosted form configuration (public)","operationId":"hostedFormConfiguration","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"orgId":{"type":"string"},"orgName":{"type":"string"},"enabled":{"type":"boolean"},"honeypotField":{"type":"string"}}}}}},"404":{"$ref":"#/components/responses/NotFound"}},"security":[]}},"/api/setup/web-to-case":{"get":{"tags":["Support Form"],"summary":"Support Form settings","description":"**Requires permission:** `customizeApplication`","operationId":"supportFormSettings","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WebToCaseSettings"},{"type":"object","properties":{"orgId":{"type":"string"},"orgName":{"type":"string"},"endpoint":{"type":"string"},"hostedFormUrl":{"type":"string"},"honeypotField":{"type":"string"},"submissionsToday":{"type":"integer"},"emailConfigured":{"type":"boolean"}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}},"put":{"tags":["Support Form"],"summary":"Save Support Form settings","description":"**Requires permission:** `customizeApplication`","operationId":"saveSupportFormSettings","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebToCaseSettings"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebToCaseSettings"}}}}}},"/api/chat/public/{orgId}/config":{"parameters":[{"name":"orgId","in":"path","required":true,"description":"Organization ID.","schema":{"type":"string"}}],"get":{"tags":["Live chat"],"summary":"Chat availability (public)","operationId":"chatAvailability","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"orgId":{"type":"string"},"orgName":{"type":"string"},"enabled":{"type":"boolean"},"available":{"type":"boolean","description":"Someone is online to take a chat."},"welcomeMessage":{"type":"string"},"offlineMessage":{"type":"string"},"open":{"type":"boolean","description":"Within business hours."},"honeypotField":{"type":"string"}}}}}},"404":{"$ref":"#/components/responses/NotFound"}},"security":[]}},"/api/chat/public/{orgId}/sessions":{"parameters":[{"name":"orgId","in":"path","required":true,"description":"Organization ID.","schema":{"type":"string"}}],"post":{"tags":["Live chat"],"summary":"Start a chat (public)","description":"Returns a visitor token for this chat only (12 hours); send it as `Authorization: Bearer` to the /api/chat/visitor endpoints. 5 chats per visitor per 10 minutes.","operationId":"startAChat","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string"},"sessionId":{"type":"string","format":"uuid"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooMany"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"},"question":{"type":"string"},"pageUrl":{"type":"string"},"company_website":{"type":"string","description":"Spam trap: must be empty."}},"required":["name"]}}}},"security":[]}},"/api/chat/public/{orgId}/offline":{"parameters":[{"name":"orgId","in":"path","required":true,"description":"Organization ID.","schema":{"type":"string"}}],"post":{"tags":["Live chat"],"summary":"Leave a message when no one is online (public)","description":"Becomes a Chat-origin case.","operationId":"leaveAMessageWhenNoOneIsOnline","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooMany"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"},"message":{"type":"string"}},"required":["name","email","message"]}}}},"security":[]}},"/api/chat/visitor/state":{"get":{"tags":["Live chat"],"summary":"Poll the visitor’s chat","operationId":"pollTheVisitorSChat","parameters":[{"name":"after","in":"query","required":false,"description":"Return messages after this message ID.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"agentName":{"type":["string","null"]},"position":{"type":["integer","null"],"description":"Place in line while waiting."},"messages":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"sender":{"type":"string","enum":["visitor","agent","system"]},"body":{"type":"string"},"agentName":{"type":["string","null"]},"createdAt":{"type":["string","null"],"format":"date-time"}}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}},"security":[{"visitorToken":[]}]}},"/api/chat/visitor/messages":{"post":{"tags":["Live chat"],"summary":"Send a visitor message","operationId":"sendAVisitorMessage","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"body":{"type":"string","maxLength":4000}},"required":["body"]}}}},"security":[{"visitorToken":[]}]}},"/api/chat/visitor/end":{"post":{"tags":["Live chat"],"summary":"End the chat (visitor)","operationId":"endTheChat","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}},"security":[{"visitorToken":[]}]}},"/api/chat/visitor/leave-message":{"post":{"tags":["Live chat"],"summary":"Stop waiting and leave a message","description":"While no agent has joined. The chat so far and the message become a case.","operationId":"stopWaitingAndLeaveAMessage","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"email":{"type":"string","description":"Required if not given when starting."}},"required":["message"]}}}},"security":[{"visitorToken":[]}]}},"/api/chat/visitor/files":{"post":{"tags":["Live chat"],"summary":"Send a file (visitor)","description":"Raw file body (`Content-Type: application/octet-stream`) with `X-Filename` (URI-encoded). Up to 4 MB and 25 files per chat; allowed types: pdf, png, jpg, jpeg, gif, webp, heic, txt, csv, log, doc, docx, xls, xlsx, ppt, pptx, odt, ods, rtf, zip, eml (the type is taken from the extension). The file is sent as a chat message and copied to the chat’s case when it’s saved to one. Only when the organization allows visitor files.","operationId":"sendAFile","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"messageId":{"type":"integer"},"file":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"filename":{"type":"string"},"contentType":{"type":"string"},"size":{"type":"integer"}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"},"413":{"$ref":"#/components/responses/TooLarge"},"415":{"description":"That kind of file isn’t allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"visitorToken":[]}]}},"/api/chat/visitor/files/{fileId}":{"parameters":[{"name":"fileId","in":"path","required":true,"description":"File UUID.","schema":{"type":"string"}}],"get":{"tags":["Live chat"],"summary":"Download a file from the visitor’s chat","operationId":"downloadAFileFromTheVisitorSChat","responses":{"200":{"description":"The file (always as an attachment)","content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}},"security":[{"visitorToken":[]}]}},"/api/chat/sessions/{id}/files":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"post":{"tags":["Live chat"],"summary":"Send a file (agent)","description":"Raw file body (`Content-Type: application/octet-stream`) with `X-Filename` (URI-encoded). Up to 4 MB and 25 files per chat; allowed types: pdf, png, jpg, jpeg, gif, webp, heic, txt, csv, log, doc, docx, xls, xlsx, ppt, pptx, odt, ods, rtf, zip, eml (the type is taken from the extension). The file is sent as a chat message and copied to the chat’s case when it’s saved to one.\n\n**Requires permission:** `workRecords`","operationId":"sendAFile_","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"messageId":{"type":"integer"},"file":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"filename":{"type":"string"},"contentType":{"type":"string"},"size":{"type":"integer"}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"},"413":{"$ref":"#/components/responses/TooLarge"},"415":{"description":"That kind of file isn’t allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/chat/agent/files/{fileId}":{"parameters":[{"name":"fileId","in":"path","required":true,"description":"File UUID.","schema":{"type":"string"}}],"get":{"tags":["Live chat"],"summary":"Download a chat file","description":"**Requires permission:** `workRecords`","operationId":"downloadAChatFile","responses":{"200":{"description":"The file (always as an attachment)","content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/chat/visitor/typing":{"post":{"tags":["Live chat"],"summary":"Visitor is typing","description":"Call every few seconds while typing; the agent sees it for 6 seconds.","operationId":"visitorIsTyping","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}},"security":[{"visitorToken":[]}]}},"/api/chat/visitor/rating":{"post":{"tags":["Live chat"],"summary":"Rate the chat","description":"Once, after a chat an agent answered has ended.","operationId":"rateTheChat","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"rating":{"type":"integer","minimum":1,"maximum":5},"comment":{"type":"string","maxLength":1000}},"required":["rating"]}}}},"security":[{"visitorToken":[]}]}},"/api/chat/agent/history":{"get":{"tags":["Live chat"],"summary":"Chat history","description":"**Requires permission:** `workRecords`","operationId":"chatHistory","parameters":[{"name":"days","in":"query","required":false,"description":"1–365, default 30.","schema":{"type":"string"}},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["waiting","offered","active","ended","missed"]}},{"name":"agentId","in":"query","required":false,"schema":{"type":"string"}},{"name":"page","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"total":{"type":"integer"},"page":{"type":"integer"},"pageSize":{"type":"integer"},"chats":{"type":"array","items":{"type":"object"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/api/chat/agent/stats":{"get":{"tags":["Live chat"],"summary":"Chat statistics","description":"Chats, answered, missed, average wait and handle time, average rating; totals and per agent.\n\n**Requires permission:** `workRecords`","operationId":"chatStatistics","parameters":[{"name":"days","in":"query","required":false,"description":"1–365, default 7.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/api/chat/agent/transfer-targets":{"get":{"tags":["Live chat"],"summary":"Agents and queues to transfer to","description":"**Requires permission:** `workRecords`","operationId":"agentsAndQueuesToTransferTo","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"agents":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"load":{"type":"integer"}}}},"queues":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/api/chat/agent/quick-replies":{"get":{"tags":["Live chat"],"summary":"Quick replies","description":"**Requires permission:** `workRecords`","operationId":"quickReplies","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"body":{"type":"string"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/api/chat/agent/inbox":{"get":{"tags":["Live chat"],"summary":"Agent chat inbox (poll)","description":"Signed-in agents only. Refreshes the agent’s presence, routes waiting chats, and returns offers to accept and the agent’s chats.\n\n**Requires permission:** `workRecords`","operationId":"agentChatInbox","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"},"presence":{"type":"string"},"maxChats":{"type":"integer"},"acceptTimeoutSeconds":{"type":"integer"},"waitingCount":{"type":"integer"},"offers":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"recordId":{"type":"string"},"status":{"type":"string","enum":["waiting","offered","active","ended","missed"]},"visitorName":{"type":"string"},"visitorEmail":{"type":["string","null"]},"question":{"type":["string","null"]},"pageUrl":{"type":["string","null"]},"contactRecordId":{"type":["string","null"]},"contactName":{"type":["string","null"]},"accountRecordId":{"type":["string","null"]},"accountName":{"type":["string","null"]},"agentId":{"type":["string","null"],"format":"uuid"},"agentName":{"type":["string","null"]},"offeredAt":{"type":["string","null"],"format":"date-time"},"caseId":{"type":["string","null"],"format":"uuid"},"caseRecordId":{"type":["string","null"]},"caseNumber":{"type":["string","null"]},"createdAt":{"type":["string","null"],"format":"date-time"},"acceptedAt":{"type":["string","null"],"format":"date-time"},"endedAt":{"type":["string","null"],"format":"date-time"}}}},"chats":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"recordId":{"type":"string"},"status":{"type":"string","enum":["waiting","offered","active","ended","missed"]},"visitorName":{"type":"string"},"visitorEmail":{"type":["string","null"]},"question":{"type":["string","null"]},"pageUrl":{"type":["string","null"]},"contactRecordId":{"type":["string","null"]},"contactName":{"type":["string","null"]},"accountRecordId":{"type":["string","null"]},"accountName":{"type":["string","null"]},"agentId":{"type":["string","null"],"format":"uuid"},"agentName":{"type":["string","null"]},"offeredAt":{"type":["string","null"],"format":"date-time"},"caseId":{"type":["string","null"],"format":"uuid"},"caseRecordId":{"type":["string","null"]},"caseNumber":{"type":["string","null"]},"createdAt":{"type":["string","null"],"format":"date-time"},"acceptedAt":{"type":["string","null"],"format":"date-time"},"endedAt":{"type":["string","null"],"format":"date-time"}}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/api/chat/agent/presence":{"put":{"tags":["Live chat"],"summary":"Set chat presence","description":"Only Online agents get chats. Going Busy or Offline hands back chats offered to you.\n\n**Requires permission:** `workRecords`","operationId":"setChatPresence","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["online","busy","offline"]}},"required":["status"]}}}}}},"/api/chat/sessions/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"get":{"tags":["Live chat"],"summary":"A chat and its new messages","description":"**Requires permission:** `workRecords`","operationId":"aChatAndItsNewMessages","parameters":[{"name":"after","in":"query","required":false,"description":"Messages after this ID.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"recordId":{"type":"string"},"status":{"type":"string","enum":["waiting","offered","active","ended","missed"]},"visitorName":{"type":"string"},"visitorEmail":{"type":["string","null"]},"question":{"type":["string","null"]},"pageUrl":{"type":["string","null"]},"contactRecordId":{"type":["string","null"]},"contactName":{"type":["string","null"]},"accountRecordId":{"type":["string","null"]},"accountName":{"type":["string","null"]},"agentId":{"type":["string","null"],"format":"uuid"},"agentName":{"type":["string","null"]},"offeredAt":{"type":["string","null"],"format":"date-time"},"caseId":{"type":["string","null"],"format":"uuid"},"caseRecordId":{"type":["string","null"]},"caseNumber":{"type":["string","null"]},"createdAt":{"type":["string","null"],"format":"date-time"},"acceptedAt":{"type":["string","null"],"format":"date-time"},"endedAt":{"type":["string","null"],"format":"date-time"}}},{"type":"object","properties":{"messages":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"sender":{"type":"string","enum":["visitor","agent","system"]},"body":{"type":"string"},"agentName":{"type":["string","null"]},"createdAt":{"type":["string","null"],"format":"date-time"}}}}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/chat/sessions/{id}/accept":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"post":{"tags":["Live chat"],"summary":"Accept an offered chat","description":"**Requires permission:** `workRecords`","operationId":"acceptAnOfferedChat","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"recordId":{"type":"string"},"status":{"type":"string","enum":["waiting","offered","active","ended","missed"]},"visitorName":{"type":"string"},"visitorEmail":{"type":["string","null"]},"question":{"type":["string","null"]},"pageUrl":{"type":["string","null"]},"contactRecordId":{"type":["string","null"]},"contactName":{"type":["string","null"]},"accountRecordId":{"type":["string","null"]},"accountName":{"type":["string","null"]},"agentId":{"type":["string","null"],"format":"uuid"},"agentName":{"type":["string","null"]},"offeredAt":{"type":["string","null"],"format":"date-time"},"caseId":{"type":["string","null"],"format":"uuid"},"caseRecordId":{"type":["string","null"]},"caseNumber":{"type":["string","null"]},"createdAt":{"type":["string","null"],"format":"date-time"},"acceptedAt":{"type":["string","null"],"format":"date-time"},"endedAt":{"type":["string","null"],"format":"date-time"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"}}}},"/api/chat/sessions/{id}/decline":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"post":{"tags":["Live chat"],"summary":"Decline an offered chat","description":"It’s offered to the next available agent.\n\n**Requires permission:** `workRecords`","operationId":"declineAnOfferedChat","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/api/chat/sessions/{id}/messages":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"post":{"tags":["Live chat"],"summary":"Send an agent message","description":"**Requires permission:** `workRecords`","operationId":"sendAnAgentMessage","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"body":{"type":"string"}},"required":["body"]}}}}}},"/api/chat/sessions/{id}/end":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"post":{"tags":["Live chat"],"summary":"End a chat (agent)","description":"Saves the transcript to a case when that’s on, or to the chat’s case.\n\n**Requires permission:** `workRecords`","operationId":"endAChat","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"recordId":{"type":"string"},"status":{"type":"string","enum":["waiting","offered","active","ended","missed"]},"visitorName":{"type":"string"},"visitorEmail":{"type":["string","null"]},"question":{"type":["string","null"]},"pageUrl":{"type":["string","null"]},"contactRecordId":{"type":["string","null"]},"contactName":{"type":["string","null"]},"accountRecordId":{"type":["string","null"]},"accountName":{"type":["string","null"]},"agentId":{"type":["string","null"],"format":"uuid"},"agentName":{"type":["string","null"]},"offeredAt":{"type":["string","null"],"format":"date-time"},"caseId":{"type":["string","null"],"format":"uuid"},"caseRecordId":{"type":["string","null"]},"caseNumber":{"type":["string","null"]},"createdAt":{"type":["string","null"],"format":"date-time"},"acceptedAt":{"type":["string","null"],"format":"date-time"},"endedAt":{"type":["string","null"],"format":"date-time"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/api/chat/sessions/{id}/case":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"post":{"tags":["Live chat"],"summary":"Save a chat to a case now","description":"**Requires permission:** `workRecords`","operationId":"saveAChatToACaseNow","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"recordId":{"type":"string"},"status":{"type":"string","enum":["waiting","offered","active","ended","missed"]},"visitorName":{"type":"string"},"visitorEmail":{"type":["string","null"]},"question":{"type":["string","null"]},"pageUrl":{"type":["string","null"]},"contactRecordId":{"type":["string","null"]},"contactName":{"type":["string","null"]},"accountRecordId":{"type":["string","null"]},"accountName":{"type":["string","null"]},"agentId":{"type":["string","null"],"format":"uuid"},"agentName":{"type":["string","null"]},"offeredAt":{"type":["string","null"],"format":"date-time"},"caseId":{"type":["string","null"],"format":"uuid"},"caseRecordId":{"type":["string","null"]},"caseNumber":{"type":["string","null"]},"createdAt":{"type":["string","null"],"format":"date-time"},"acceptedAt":{"type":["string","null"],"format":"date-time"},"endedAt":{"type":["string","null"],"format":"date-time"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"}}}},"/api/chat/sessions/{id}/typing":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"post":{"tags":["Live chat"],"summary":"Agent is typing","description":"**Requires permission:** `workRecords`","operationId":"agentIsTyping","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/api/chat/sessions/{id}/transfer":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"post":{"tags":["Live chat"],"summary":"Transfer a chat","description":"`toUserId`: offered to that agent (they must be available). `toQueueId`: routed to the queue’s next available member. The transferring agent is skipped.\n\n**Requires permission:** `workRecords`","operationId":"transferAChat","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"toUserId":{"type":"string","format":"uuid"},"toQueueId":{"type":"string","format":"uuid"}}}}}}}},"/api/setup/chat/quick-replies":{"post":{"tags":["Live chat"],"summary":"Add a quick reply","description":"`{{Visitor.Name}}`, `{{Agent.Name}}` and `{{Organization.Name}}` are filled in when used.\n\n**Requires permission:** `customizeApplication`","operationId":"addAQuickReply","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"body":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":80},"body":{"type":"string","maxLength":2000}},"required":["name","body"]}}}}}},"/api/setup/chat/quick-replies/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"Quick reply UUID.","schema":{"type":"string"}}],"patch":{"tags":["Live chat"],"summary":"Update a quick reply","description":"**Requires permission:** `customizeApplication`","operationId":"updateAQuickReply","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"body":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"body":{"type":"string"}},"required":["name","body"]}}}}},"delete":{"tags":["Live chat"],"summary":"Delete a quick reply","description":"**Requires permission:** `customizeApplication`","operationId":"deleteAQuickReply","responses":{"204":{"description":"Deleted"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/chat/supervisor/board":{"get":{"tags":["Live chat"],"summary":"Supervisor board","description":"Every active user’s chat presence (and whether they’ve gone away), load and current chats, flagging visitors waiting for a reply; the waiting line; today’s totals. Also routes waiting chats, like an agent’s poll.\n\n**Requires permission:** `superviseChats`","operationId":"supervisorBoard","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","description":"enabled, open, maxChats, now, waiting[], agents[], today"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/api/chat/supervisor/sessions/{id}/assign":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"post":{"tags":["Live chat"],"summary":"Assign a waiting chat","description":"Offers it to that agent, who must be Online.\n\n**Requires permission:** `superviseChats`","operationId":"assignAWaitingChat","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string","format":"uuid"}},"required":["userId"]}}}}}},"/api/chat/supervisor/agents/{userId}/presence":{"parameters":[{"name":"userId","in":"path","required":true,"description":"User UUID.","schema":{"type":"string"}}],"put":{"tags":["Live chat"],"summary":"Set an agent’s chat presence","description":"E.g. Offline for someone who left; chats offered to them go back to the queue.\n\n**Requires permission:** `superviseChats`","operationId":"setAnAgentSChatPresence","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["online","busy","offline"]}},"required":["status"]}}}}}},"/api/setup/chat":{"get":{"tags":["Live chat"],"summary":"Live chat settings","operationId":"liveChatSettings","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"type":"object","properties":{"enabled":{"type":"boolean"},"queueId":{"type":["string","null"],"format":"uuid","description":"Only members of this queue get chats."},"welcomeMessage":{"type":"string"},"offlineMessage":{"type":"string"},"maxChatsPerAgent":{"type":"integer","minimum":1,"maximum":10},"acceptTimeoutSeconds":{"type":"integer","minimum":15,"maximum":300},"autoCreateCase":{"type":"boolean"},"visitorFiles":{"type":"boolean","description":"Visitors may send files."},"sendTranscript":{"type":"boolean","description":"Email the visitor a transcript when the chat ends."},"askRating":{"type":"boolean","description":"Ask for a 1–5 rating."},"businessHours":{"type":["object","null"],"properties":{"timezone":{"type":"string","description":"IANA, e.g. Asia/Kolkata."},"days":{"type":"object","description":"mon…sun: { start: \"09:00\", end: \"17:00\" }; a missing day is closed."}}}}},{"type":"object","properties":{"orgId":{"type":"string"},"agentsAvailable":{"type":"integer"},"open":{"type":"boolean","description":"Within business hours now."},"quickReplies":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"body":{"type":"string"}}}},"stats":{"type":"object","properties":{"answered":{"type":"integer"},"missed":{"type":"integer"},"waiting":{"type":"integer"}}}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}},"put":{"tags":["Live chat"],"summary":"Save live chat settings","description":"**Requires permission:** `customizeApplication`","operationId":"saveLiveChatSettings","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"},"queueId":{"type":["string","null"],"format":"uuid","description":"Only members of this queue get chats."},"welcomeMessage":{"type":"string"},"offlineMessage":{"type":"string"},"maxChatsPerAgent":{"type":"integer","minimum":1,"maximum":10},"acceptTimeoutSeconds":{"type":"integer","minimum":15,"maximum":300},"autoCreateCase":{"type":"boolean"},"visitorFiles":{"type":"boolean","description":"Visitors may send files."},"sendTranscript":{"type":"boolean","description":"Email the visitor a transcript when the chat ends."},"askRating":{"type":"boolean","description":"Ask for a 1–5 rating."},"businessHours":{"type":["object","null"],"properties":{"timezone":{"type":"string","description":"IANA, e.g. Asia/Kolkata."},"days":{"type":"object","description":"mon…sun: { start: \"09:00\", end: \"17:00\" }; a missing day is closed."}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"},"queueId":{"type":["string","null"],"format":"uuid","description":"Only members of this queue get chats."},"welcomeMessage":{"type":"string"},"offlineMessage":{"type":"string"},"maxChatsPerAgent":{"type":"integer","minimum":1,"maximum":10},"acceptTimeoutSeconds":{"type":"integer","minimum":15,"maximum":300},"autoCreateCase":{"type":"boolean"},"visitorFiles":{"type":"boolean","description":"Visitors may send files."},"sendTranscript":{"type":"boolean","description":"Email the visitor a transcript when the chat ends."},"askRating":{"type":"boolean","description":"Ask for a 1–5 rating."},"businessHours":{"type":["object","null"],"properties":{"timezone":{"type":"string","description":"IANA, e.g. Asia/Kolkata."},"days":{"type":"object","description":"mon…sun: { start: \"09:00\", end: \"17:00\" }; a missing day is closed."}}}}}}}}}},"/api/web-to-lead":{"post":{"tags":["Lead Capture Form"],"summary":"Submit a lead from a website (public)","description":"No authentication: identified by `orgid`. Works only when enabled in Settings → Lead Capture Form. Creates a lead (source Web unless `lead_source` names an active value), assigns its owner, and can email the owner and the prospect. Accepts an HTML form post (responds with a page or a redirect to the return URL) or JSON (responds with JSON); fields may also be camelCase (`firstName`). CORS allows any origin. Limits: 5 submissions per visitor per 10 minutes and the organization’s daily limit. Leave `company_website` empty (spam trap).","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"orgid":{"type":"string","description":"10-character Organization ID."},"first_name":{"type":"string","maxLength":120},"last_name":{"type":"string","maxLength":120},"email":{"type":"string","maxLength":255},"company":{"type":"string","description":"Blank = \"[not provided]\".","maxLength":255},"title":{"type":"string","maxLength":120},"phone":{"type":"string","maxLength":40},"industry":{"type":"string","maxLength":120},"description":{"type":"string","maxLength":32000},"lead_source":{"type":"string","description":"Optional Lead Source value or label."},"company_website":{"type":"string","description":"Spam trap: must be empty."}},"required":["orgid","last_name","email"]}},"application/x-www-form-urlencoded":{"schema":{"type":"object","properties":{"orgid":{"type":"string","description":"10-character Organization ID."},"first_name":{"type":"string","maxLength":120},"last_name":{"type":"string","maxLength":120},"email":{"type":"string","maxLength":255},"company":{"type":"string","description":"Blank = \"[not provided]\".","maxLength":255},"title":{"type":"string","maxLength":120},"phone":{"type":"string","maxLength":40},"industry":{"type":"string","maxLength":120},"description":{"type":"string","maxLength":32000},"lead_source":{"type":"string","description":"Optional Lead Source value or label."},"company_website":{"type":"string","description":"Spam trap: must be empty."}},"required":["orgid","last_name","email"]}}}},"responses":{"200":{"description":"Thank-you page (form post)","content":{"text/html":{"schema":{"type":"string"}}}},"201":{"description":"Lead created (JSON)","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"returnUrl":{"type":["string","null"]}}}}}},"303":{"description":"Redirect to the configured return URL (form post)"},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"description":"Lead Capture Form is not enabled","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooMany"}},"operationId":"submitALeadFromAWebsite"}},"/api/web-to-lead/{orgId}/form":{"parameters":[{"name":"orgId","in":"path","required":true,"description":"Organization ID.","schema":{"type":"string"}}],"get":{"tags":["Lead Capture Form"],"summary":"Hosted form configuration (public)","operationId":"hostedFormConfiguration_","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"orgId":{"type":"string"},"orgName":{"type":"string"},"enabled":{"type":"boolean"},"honeypotField":{"type":"string"}}}}}},"404":{"$ref":"#/components/responses/NotFound"}},"security":[]}},"/api/setup/web-to-lead":{"get":{"tags":["Lead Capture Form"],"summary":"Lead Capture Form settings","description":"**Requires permission:** `customizeApplication`","operationId":"leadCaptureFormSettings","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WebToLeadSettings"},{"type":"object","properties":{"orgId":{"type":"string"},"orgName":{"type":"string"},"endpoint":{"type":"string"},"hostedFormUrl":{"type":"string"},"honeypotField":{"type":"string"},"submissionsToday":{"type":"integer"},"teams":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"activeMembers":{"type":"integer"}}}},"emailConfigured":{"type":"boolean"}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}},"put":{"tags":["Lead Capture Form"],"summary":"Save Lead Capture Form settings","description":"**Requires permission:** `customizeApplication`","operationId":"saveLeadCaptureFormSettings","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebToLeadSettings"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebToLeadSettings"}}}}}},"/api/setup/sso":{"get":{"tags":["Integrations setup"],"summary":"Single sign-on settings","description":"Signed-in users only. The client secret is never returned (`hasClientSecret`).\n\n**Requires permission:** `manageUsers`","operationId":"singleSignOnSettings","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SsoSettings"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}},"put":{"tags":["Integrations setup"],"summary":"Save single sign-on settings","description":"Enabling checks the provider’s discovery document first. `requireSso` blocks password sign-in for everyone but admins.\n\n**Requires permission:** `manageUsers`","operationId":"saveSingleSignOnSettings","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SsoSettings"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"},"issuer":{"type":"string","description":"OpenID Connect issuer URL (https)."},"clientId":{"type":"string"},"clientSecret":{"type":"string","description":"Blank keeps the stored secret."},"tokenAuthMethod":{"type":"string","enum":["client_secret_basic","client_secret_post"]},"jitEnabled":{"type":"boolean","description":"Create users on first sign-in."},"jitRole":{"type":"string","enum":["agent","manager"]},"allowedDomains":{"type":"array","items":{"type":"string"}},"requireSso":{"type":"boolean"}},"required":["enabled","issuer","clientId","jitEnabled","jitRole","requireSso"]}}}}}},"/api/setup/sso/test":{"post":{"tags":["Integrations setup"],"summary":"Check an issuer’s discovery document","description":"**Requires permission:** `manageUsers`","operationId":"checkAnIssuerSDiscoveryDocument","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"issuer":{"type":"string"},"authorizationEndpoint":{"type":"string"},"tokenEndpoint":{"type":"string"},"supportsPkce":{"type":"boolean"},"scopes":{"type":["array","null"],"items":{"type":"string"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"issuer":{"type":"string"}},"required":["issuer"]}}}}}},"/api/setup/api-keys":{"get":{"tags":["Integrations setup"],"summary":"List API keys","description":"Signed-in users only: API keys and OAuth tokens are refused.\n\n**Requires permission:** `manageUsers`","operationId":"listAPIKeys","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ApiKey"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}},"post":{"tags":["Integrations setup"],"summary":"Create an API key","description":"The full `key` is returned only in this response. Signed-in users only.\n\n**Requires permission:** `manageUsers`","operationId":"createAnAPIKey","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ApiKey"},{"type":"object","properties":{"key":{"type":"string","description":"`scl_<orgId>_<secret>` — shown once."}}}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":80},"runAsUserId":{"type":"string","format":"uuid"},"expiresInDays":{"type":["integer","null"],"description":"Blank = never.","enum":[30,90,180,365,null]},"readOnly":{"type":"boolean","description":"Read-only: GET requests only, and read tools only over MCP."}},"required":["name","runAsUserId"]}}}}}},"/api/setup/api-keys/{id}/revoke":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"post":{"tags":["Integrations setup"],"summary":"Revoke an API key","description":"**Requires permission:** `manageUsers`","operationId":"revokeAnAPIKey","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKey"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/mcp":{"post":{"tags":["Integrations setup"],"summary":"MCP server (Model Context Protocol)","description":"JSON-RPC 2.0 over Streamable HTTP (stateless; JSON responses) for AI clients such as Claude Code and claude.ai connectors. Authenticate with an MCP sign-in token (OAuth authorization code + PKCE; discovery at `/.well-known/oauth-protected-resource/api/mcp`, and a 401 carries `WWW-Authenticate` with `resource_metadata`), or like the rest of the API: `X-API-Key`, or a bearer OAuth or session token. Must be enabled in Settings → MCP Server. Tools (`tools/list`) run the regular API as the caller, so permissions and sharing apply. Write tools are listed only when the organization allows changes and the key or app isn’t read-only. `GET` and `DELETE` return 405.","operationId":"mcpServer","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","description":"JSON-RPC response"}}}},"202":{"description":"Notification accepted"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"jsonrpc":{"type":"string","enum":["2.0"]},"id":{"type":["string","integer"]},"method":{"type":"string","description":"e.g. `initialize`, `tools/list`, `tools/call`."},"params":{"type":"object"}},"required":["jsonrpc","method"]}}}}}},"/api/setup/mcp/grants":{"get":{"tags":["Integrations setup"],"summary":"Connected AI apps","description":"People’s approvals of MCP clients (OAuth sign-in), newest first, active ones first.\n\n**Requires permission:** `manageUsers`","operationId":"connectedAIApps","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"clientName":{"type":"string"},"userId":{"type":"string","format":"uuid"},"userName":{"type":"string"},"userEmail":{"type":"string"},"scope":{"type":"string"},"access":{"type":"string"},"createdAt":{"type":["string","null"],"format":"date-time"},"lastUsedAt":{"type":["string","null"],"format":"date-time"},"revokedAt":{"type":["string","null"],"format":"date-time"},"revokedByName":{"type":["string","null"]}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/api/setup/mcp/grants/{id}/revoke":{"parameters":[{"name":"id","in":"path","required":true,"description":"Grant UUID.","schema":{"type":"string"}}],"post":{"tags":["Integrations setup"],"summary":"Disconnect an AI app","description":"Its access and refresh tokens stop working at once.\n\n**Requires permission:** `manageUsers`","operationId":"disconnectAnAIApp","responses":{"204":{"description":"Deleted"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/setup/mcp":{"get":{"tags":["Integrations setup"],"summary":"MCP server settings","operationId":"mcpServerSettings","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"},"allowWrites":{"type":"boolean"},"updatedAt":{"type":["string","null"],"format":"date-time"},"endpoint":{"type":"string"},"tools":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"write":{"type":"boolean"}}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}},"put":{"tags":["Integrations setup"],"summary":"Save MCP server settings","description":"**Requires permission:** `manageUsers`","operationId":"saveMCPServerSettings","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"},"allowWrites":{"type":"boolean","description":"Offer write tools (never to read-only keys or apps)."}},"required":["enabled","allowWrites"]}}}}}},"/api/setup/connected-apps":{"get":{"tags":["Integrations setup"],"summary":"List connected apps (OAuth clients)","description":"**Requires permission:** `manageUsers`","operationId":"listConnectedApps","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"apps":{"type":"array","items":{"$ref":"#/components/schemas/ConnectedApp"}},"tokenEndpoint":{"type":"string"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}},"post":{"tags":["Integrations setup"],"summary":"Create a connected app","description":"The `clientSecret` is returned only in this response. Signed-in users only.\n\n**Requires permission:** `manageUsers`","operationId":"createAConnectedApp","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ConnectedApp"},{"type":"object","properties":{"clientSecret":{"type":"string","description":"Shown once."}}}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":80},"runAsUserId":{"type":"string","format":"uuid"},"tokenTtlSeconds":{"type":"integer","description":"Default 3600.","enum":[900,3600,28800,86400]},"readOnly":{"type":"boolean","description":"Read-only: GET requests only, and read tools only over MCP."}},"required":["name","runAsUserId"]}}}}}},"/api/setup/connected-apps/{id}/reset-secret":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"post":{"tags":["Integrations setup"],"summary":"Reset a client secret","description":"Returns a new secret (shown once). The old secret and every token issued with it stop working immediately.\n\n**Requires permission:** `manageUsers`","operationId":"resetAClientSecret","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ConnectedApp"},{"type":"object","properties":{"clientSecret":{"type":"string"}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/setup/connected-apps/{id}/revoke":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"post":{"tags":["Integrations setup"],"summary":"Revoke a connected app","description":"Its tokens stop working immediately.\n\n**Requires permission:** `manageUsers`","operationId":"revokeAConnectedApp","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConnectedApp"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/health":{"get":{"tags":["System"],"summary":"Health check","operationId":"healthCheck","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"}}}}}}},"security":[]}},"/api/openapi.json":{"get":{"tags":["System"],"summary":"This API description (OpenAPI 3.1)","operationId":"thisAPIDescription","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}}},"security":[]}},"/api/cron/escalations":{"get":{"tags":["System"],"summary":"Daily escalation sweep (internal)","description":"Called by the Vercel cron with `Authorization: Bearer <CRON_SECRET>`. Not for integrations; use `POST /api/setup/case-settings/escalations/run` instead.","operationId":"dailyEscalationSweep","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"$ref":"#/components/responses/Unauthorized"}},"security":[{"cronSecret":[]}]}},"/api/setup/email-routing":{"get":{"tags":["Integrations setup"],"summary":"Support Inbox / Sales Inbox routing addresses","description":"**Requires permission:** `customizeApplication`","operationId":"supportInboxSalesInboxRoutingAddresses","parameters":[{"name":"kind","in":"query","required":false,"schema":{"type":"string","enum":["case","lead"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"addresses":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"recordId":{"type":"string"},"kind":{"type":"string","enum":["case","lead"]},"name":{"type":"string"},"emailAddress":{"type":["string","null"]},"forwardTo":{"type":["string","null"],"description":"Where to forward mail; null until INBOUND_EMAIL_ADDRESS is set."},"token":{"type":"string"},"isActive":{"type":"boolean"},"autoResponse":{"type":"boolean"},"caseOrigin":{"type":["string","null"]},"casePriority":{"type":["string","null"]},"useAssignmentRules":{"type":"boolean"},"queueId":{"type":["string","null"],"format":"uuid"},"leadSource":{"type":["string","null"]},"leadStatus":{"type":["string","null"]},"ownerUserId":{"type":["string","null"],"format":"uuid"},"ownerTeamId":{"type":["string","null"],"format":"uuid"},"notifyOwner":{"type":"boolean"},"addToOpenLead":{"type":"boolean"},"received30Days":{"type":"integer"}}}},"inboundConfigured":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}},"post":{"tags":["Integrations setup"],"summary":"Add a routing address","description":"**Requires permission:** `customizeApplication`","operationId":"addARoutingAddress","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"recordId":{"type":"string"},"kind":{"type":"string","enum":["case","lead"]},"name":{"type":"string"},"emailAddress":{"type":["string","null"]},"forwardTo":{"type":["string","null"],"description":"Where to forward mail; null until INBOUND_EMAIL_ADDRESS is set."},"token":{"type":"string"},"isActive":{"type":"boolean"},"autoResponse":{"type":"boolean"},"caseOrigin":{"type":["string","null"]},"casePriority":{"type":["string","null"]},"useAssignmentRules":{"type":"boolean"},"queueId":{"type":["string","null"],"format":"uuid"},"leadSource":{"type":["string","null"]},"leadStatus":{"type":["string","null"]},"ownerUserId":{"type":["string","null"],"format":"uuid"},"ownerTeamId":{"type":["string","null"],"format":"uuid"},"notifyOwner":{"type":"boolean"},"addToOpenLead":{"type":"boolean"},"received30Days":{"type":"integer"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","description":"Create only.","enum":["case","lead"]},"name":{"type":"string"},"emailAddress":{"type":["string","null"]},"isActive":{"type":"boolean"},"autoResponse":{"type":"boolean"},"caseOrigin":{"type":["string","null"]},"casePriority":{"type":["string","null"]},"useAssignmentRules":{"type":"boolean"},"queueId":{"type":["string","null"],"format":"uuid","description":"Overrides assignment rules."},"leadSource":{"type":["string","null"]},"leadStatus":{"type":["string","null"]},"ownerUserId":{"type":["string","null"],"format":"uuid"},"ownerTeamId":{"type":["string","null"],"format":"uuid","description":"Round robin across its active members."},"notifyOwner":{"type":"boolean"},"addToOpenLead":{"type":"boolean"}}}}}}}},"/api/setup/email-routing/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"14-character ID (e.g. `ow9tvD1IHrTsge`) or the internal UUID.","schema":{"type":"string"}}],"patch":{"tags":["Integrations setup"],"summary":"Update a routing address","description":"**Requires permission:** `customizeApplication`","operationId":"updateARoutingAddress","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"recordId":{"type":"string"},"kind":{"type":"string","enum":["case","lead"]},"name":{"type":"string"},"emailAddress":{"type":["string","null"]},"forwardTo":{"type":["string","null"],"description":"Where to forward mail; null until INBOUND_EMAIL_ADDRESS is set."},"token":{"type":"string"},"isActive":{"type":"boolean"},"autoResponse":{"type":"boolean"},"caseOrigin":{"type":["string","null"]},"casePriority":{"type":["string","null"]},"useAssignmentRules":{"type":"boolean"},"queueId":{"type":["string","null"],"format":"uuid"},"leadSource":{"type":["string","null"]},"leadStatus":{"type":["string","null"]},"ownerUserId":{"type":["string","null"],"format":"uuid"},"ownerTeamId":{"type":["string","null"],"format":"uuid"},"notifyOwner":{"type":"boolean"},"addToOpenLead":{"type":"boolean"},"received30Days":{"type":"integer"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","description":"Create only.","enum":["case","lead"]},"name":{"type":"string"},"emailAddress":{"type":["string","null"]},"isActive":{"type":"boolean"},"autoResponse":{"type":"boolean"},"caseOrigin":{"type":["string","null"]},"casePriority":{"type":["string","null"]},"useAssignmentRules":{"type":"boolean"},"queueId":{"type":["string","null"],"format":"uuid","description":"Overrides assignment rules."},"leadSource":{"type":["string","null"]},"leadStatus":{"type":["string","null"]},"ownerUserId":{"type":["string","null"],"format":"uuid"},"ownerTeamId":{"type":["string","null"],"format":"uuid","description":"Round robin across its active members."},"notifyOwner":{"type":"boolean"},"addToOpenLead":{"type":"boolean"}}}}}}},"delete":{"tags":["Integrations setup"],"summary":"Delete a routing address","description":"**Requires permission:** `customizeApplication`","operationId":"deleteARoutingAddress","responses":{"204":{"description":"Deleted"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/inbound-email":{"post":{"tags":["System"],"summary":"Inbound email webhook","description":"For an inbound-email provider (Postmark, Mailgun, SendGrid Inbound Parse, Cloudflare Email Workers…). Authenticated by `INBOUND_EMAIL_SECRET` in the `X-Inbound-Secret` header or `?secret=`. Replies are matched to their case, lead or opportunity by the `[ref:<recordId>]` subject token or In-Reply-To / References. Other mail sent to an Support Inbox or Sales Inbox routing address (its token in a recipient, e.g. `inbound+<token>@…`, or Postmark’s `MailboxHash`) creates a case or lead; auto-replies, bounces and bulk mail are ignored, and more than 5 messages per sender per address in 10 minutes are held back. JSON shape: `{ from, to, cc, subject, text, html, messageId, inReplyTo, references, attachments: [{ filename, contentType, content (base64) }] }`; Postmark and Mailgun field names also work.","operationId":"inboundEmailWebhook","responses":{"201":{"description":"Attached to a record, or a case or lead created","content":{"application/json":{"schema":{"type":"object","properties":{"matched":{"type":"boolean"},"object":{"type":"string"},"recordId":{"type":"string"},"caseRecordId":{"type":"string"},"created":{"type":["string","null"],"description":"case or lead, for new mail to a routing address."},"addedTo":{"type":"string","description":"lead: added to the sender’s open lead."},"caseNumber":{"type":"string"},"routingAddress":{"type":"string"},"duplicate":{"type":"boolean","description":"Already received (same Message-ID)."},"attachments":{"type":"integer","description":"Files saved."}}}}}},"202":{"description":"Accepted but not placed (unknown, automatic, duplicate or held back)","content":{"application/json":{"schema":{"type":"object","properties":{"matched":{"type":"boolean"},"reason":{"type":"string"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"503":{"description":"Inbound email not configured"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"security":[{"inboundSecret":[]}]}}},"components":{"securitySchemes":{"oauth2":{"type":"oauth2","description":"Client credentials from Settings → Connected Apps.","flows":{"clientCredentials":{"tokenUrl":"https://crmsix.com/api/oauth/token","scopes":{}}}},"apiKey":{"type":"apiKey","in":"header","name":"X-API-Key","description":"From Settings → API Keys."},"bearer":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"A session token from /api/auth/login, an OAuth access token, or an API key."},"inboundSecret":{"type":"apiKey","in":"header","name":"X-Inbound-Secret"},"visitorToken":{"type":"http","scheme":"bearer","description":"The token from POST /api/chat/public/{orgId}/sessions, for that chat only."},"cronSecret":{"type":"http","scheme":"bearer","description":"CRON_SECRET (Vercel cron only)."}},"schemas":{"WorkflowRule":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"recordId":{"type":"string"},"name":{"type":"string"},"description":{"type":["string","null"]},"objectName":{"type":"string","description":"Fixed once created.","enum":["cases","leads","opportunities","accounts","contacts"]},"timing":{"type":"string","description":"`before_save`: field updates only. `after_save`: send_email, create_task, webhook.","enum":["before_save","after_save"]},"triggerOn":{"type":"string","enum":["create","update","create_or_update"]},"runWhen":{"type":"string","description":"`became_true`: only when the record didn’t meet the criteria before this save.","enum":["every_time","became_true"]},"matchType":{"type":"string","enum":["all","any","custom"]},"customLogic":{"type":["string","null"],"description":"With matchType custom, e.g. `1 AND (2 OR 3)`; every condition must be used."},"conditions":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string","description":"A field name from /meta (custom fields end in `__c`)."},"operator":{"type":"string","enum":["equals","not_equals","contains","not_contains","starts_with","greater_than","less_than","greater_or_equal","less_or_equal","is_blank","is_not_blank","changed"]},"value":{"description":"Text, number, boolean, a date (YYYY-MM-DD or TODAY±N), a user/queue id (`CURRENT_USER` for the saving user) or, for picklists, an array of values (any of)."}}}},"actions":{"type":"array","items":{"type":"object","description":"`field_update` { field, mode: value|blank|current_user|today|days_from_today, value?, days? } · `send_email` { recipients: { recordEmail, owner, userIds, addresses }, templateId? | subject + body (merge fields), delayMinutes } · `create_task` { subject, description?, dueInDays?, priority: Normal|High, assignTo: owner|triggering_user|user, userId?, delayMinutes } (cases, leads, opportunities) · `webhook` { url (https), delayMinutes }. delayMinutes: 0 to 43,200."}},"isActive":{"type":"boolean"},"sortOrder":{"type":"integer","description":"Run order within the object; later field updates win."},"firedCount":{"type":"integer"},"lastFiredAt":{"type":["string","null"],"format":"date-time"},"webhookSecret":{"type":["string","null"],"description":"Single rule only. Signs webhook calls: `X-SCL-Signature: t=<unix time>,v1=<hex HMAC-SHA256 of \"<t>.<body>\">`."},"createdById":{"type":["string","null"],"format":"uuid","description":"User who created the record."},"createdByName":{"type":["string","null"]},"updatedById":{"type":["string","null"],"format":"uuid","description":"User who last changed the record."},"updatedByName":{"type":["string","null"]},"createdAt":{"type":["string","null"],"format":"date-time"},"updatedAt":{"type":["string","null"],"format":"date-time"}}},"SurveyQuestion":{"type":"object","properties":{"id":{"type":"string","description":"Kept when edited, so answers stay matched."},"type":{"type":"string","enum":["csat","nps","choice","yesno","text"]},"label":{"type":"string","maxLength":300},"required":{"type":"boolean"},"options":{"type":"array","items":{"type":"string","description":"choice only: 2–12 options"}}},"required":["type","label"]},"Survey":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"recordId":{"type":"string"},"name":{"type":"string","maxLength":120},"introText":{"type":["string","null"]},"thankYouText":{"type":["string","null"]},"emailSubject":{"type":"string","description":"Case merge fields allowed."},"emailBody":{"type":"string","description":"Must include `{{Survey.Link}}`."},"questions":{"type":"array","items":{"$ref":"#/components/schemas/SurveyQuestion"}},"isActive":{"type":"boolean"},"sendOnClose":{"type":"boolean","description":"Sent to the contact when a case closes (one survey per organization)."},"lowScoreAlert":{"type":"boolean","description":"Email the case owner on 1–2 stars or NPS 0–6."},"expiresDays":{"type":"integer","description":"1–365, default 30."},"stats":{"type":"object","properties":{"sent":{"type":"integer"},"completed":{"type":"integer"},"csatAverage":{"type":["number","null"]}}},"createdById":{"type":["string","null"],"format":"uuid","description":"User who created the record."},"createdByName":{"type":["string","null"]},"updatedById":{"type":["string","null"],"format":"uuid","description":"User who last changed the record."},"updatedByName":{"type":["string","null"]},"createdAt":{"type":["string","null"],"format":"date-time"},"updatedAt":{"type":["string","null"],"format":"date-time"}}},"SurveyInvitation":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"surveyId":{"type":"string","format":"uuid"},"surveyName":{"type":"string"},"caseId":{"type":"string","format":"uuid"},"caseRecordId":{"type":"string"},"caseNumber":{"type":"string"},"caseSubject":{"type":"string"},"email":{"type":"string"},"contactName":{"type":["string","null"]},"status":{"type":"string","enum":["sent","opened","completed","expired"]},"sentAt":{"type":["string","null"],"format":"date-time"},"sentByName":{"type":["string","null"],"description":"Null when sent automatically."},"expiresAt":{"type":["string","null"],"format":"date-time"},"openedAt":{"type":["string","null"],"format":"date-time"},"completedAt":{"type":["string","null"],"format":"date-time"},"csat":{"type":["integer","null"]},"nps":{"type":["integer","null"]},"comment":{"type":["string","null"]},"answers":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"label":{"type":"string"},"value":{}}}}}},"WorkflowJob":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"ruleId":{"type":["string","null"],"format":"uuid"},"ruleRecordId":{"type":["string","null"]},"ruleName":{"type":"string"},"objectName":{"type":"string"},"recordId":{"type":["string","null"]},"recordLabel":{"type":["string","null"]},"event":{"type":"string","enum":["created","updated"]},"actionType":{"type":"string","enum":["field_update","send_email","create_task","webhook"]},"status":{"type":"string","enum":["pending","running","done","failed","cancelled"]},"attempts":{"type":"integer"},"runAfter":{"type":["string","null"],"format":"date-time"},"finishedAt":{"type":["string","null"],"format":"date-time"},"result":{"type":["string","null"]},"error":{"type":["string","null"]},"triggeredByName":{"type":["string","null"]},"createdAt":{"type":["string","null"],"format":"date-time"}}},"KnowledgeArticle":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"recordId":{"type":"string"},"articleNumber":{"type":"string","description":"Per organization, e.g. `KA-00001`."},"title":{"type":"string"},"urlName":{"type":"string","description":"Unique per organization; the help center address."},"summary":{"type":["string","null"]},"body":{"type":"string","description":"Markdown. Left out of lists."},"categoryId":{"type":["string","null"],"format":"uuid"},"categoryName":{"type":["string","null"]},"status":{"type":"string","enum":["draft","published","archived"]},"visibility":{"type":"string","description":"`public` articles also appear in the help center.","enum":["internal","public"]},"version":{"type":"integer","description":"Times published."},"publishedAt":{"type":["string","null"],"format":"date-time"},"views":{"type":"integer"},"helpfulYes":{"type":"integer"},"helpfulNo":{"type":"integer"},"caseCount":{"type":"integer","description":"Cases it is attached to."},"snippet":{"type":"string","description":"Searches only: matching text, with matches in `[[ ]]`."},"createdById":{"type":["string","null"],"format":"uuid","description":"User who created the record."},"createdByName":{"type":["string","null"]},"updatedById":{"type":["string","null"],"format":"uuid","description":"User who last changed the record."},"updatedByName":{"type":["string","null"]},"createdAt":{"type":["string","null"],"format":"date-time"},"updatedAt":{"type":["string","null"],"format":"date-time"}}},"PublicArticle":{"type":"object","properties":{"articleNumber":{"type":"string"},"title":{"type":"string"},"urlName":{"type":"string"},"summary":{"type":["string","null"]},"body":{"type":"string","description":"Markdown. Single article only."},"categoryId":{"type":["string","null"],"format":"uuid"},"categoryName":{"type":["string","null"]},"publishedAt":{"type":["string","null"],"format":"date-time"},"snippet":{"type":"string","description":"Searches only; matches in `[[ ]]`."}}},"Error":{"type":"object","properties":{"error":{"type":"string","description":"What went wrong, in plain words."},"details":{"description":"Extra detail, when available."}},"required":["error"]},"SessionUser":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"recordId":{"type":"string"},"email":{"type":"string"},"fullName":{"type":"string"},"role":{"type":"string","description":"Profile key: `agent`, `manager` or `admin`."},"profileName":{"type":"string"},"permissions":{"type":"array","items":{"type":"string"}},"tenantId":{"type":"string","format":"uuid"},"tenantName":{"type":"string"},"orgId":{"type":"string","description":"10-character Organization ID."},"impersonatedBy":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"fullName":{"type":"string"}},"description":"Set during a Sign in as user session: the admin behind it."}}},"Case":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Internal id."},"recordId":{"type":"string","description":"14-character ID; the last 4 characters are the organization code."},"externalId":{"type":["string","null"],"description":"Key from another system; unique per organization and object."},"caseNumber":{"type":"string","description":"10 random digits."},"legacyCaseNumber":{"type":["integer","null"]},"subject":{"type":"string"},"description":{"type":["string","null"]},"status":{"type":"string"},"statusCategory":{"type":"string","description":"New, Working, Escalated, On Hold or Closed."},"priority":{"type":"string"},"origin":{"type":"string"},"contactName":{"type":["string","null"]},"contactEmail":{"type":["string","null"]},"suppliedPhone":{"type":["string","null"],"description":"Phone entered on the Support Form."},"suppliedCompany":{"type":["string","null"],"description":"Company entered on the Support Form."},"contactId":{"type":["string","null"],"format":"uuid"},"contactRecordId":{"type":["string","null"]},"accountId":{"type":["string","null"],"format":"uuid"},"accountRecordId":{"type":["string","null"]},"accountName":{"type":["string","null"]},"queueId":{"type":["string","null"],"format":"uuid"},"queueName":{"type":["string","null"]},"assignedTo":{"type":["string","null"],"format":"uuid"},"assignedToName":{"type":["string","null"]},"assignmentSource":{"type":["string","null"],"description":"Why it was routed where it was, e.g. `Assignment rule: VIP`."},"customFields":{"type":"object","additionalProperties":true,"description":"Custom field values keyed by API name (e.g. `region__c`). On update, only the keys sent are changed."},"createdById":{"type":["string","null"],"format":"uuid","description":"User who created the record."},"createdByName":{"type":["string","null"]},"updatedById":{"type":["string","null"],"format":"uuid","description":"User who last changed the record."},"updatedByName":{"type":["string","null"]},"createdAt":{"type":["string","null"],"format":"date-time"},"updatedAt":{"type":["string","null"],"format":"date-time"},"closedAt":{"type":["string","null"],"format":"date-time"}}},"CaseCreate":{"type":"object","properties":{"subject":{"type":"string","maxLength":255},"description":{"type":["string","null"]},"priority":{"type":"string","description":"A value of the organization’s **Case Priority** picklist (see `GET /api/picklists`). Blank uses the default."},"origin":{"type":"string","description":"A value of the organization’s **Case Origin** picklist (see `GET /api/picklists`). Blank uses the default."},"contactName":{"type":["string","null"]},"contactEmail":{"type":["string","null"]},"queueId":{"type":["string","null"],"format":"uuid","description":"Putting it in a queue skips assignment rules."},"accountId":{"type":["string","null"],"format":"uuid"},"contactId":{"type":["string","null"],"format":"uuid","description":"Fills in the contact’s account, name and email when not given."},"accountExternalId":{"type":["string","null"],"description":"Instead of accountId: the account’s External ID."},"contactExternalId":{"type":["string","null"],"description":"Instead of contactId: the contact’s External ID."},"externalId":{"type":["string","null"],"description":"Unique per organization and object; up to 255 characters. `\"\"` or `null` clears it.","maxLength":255},"customFields":{"type":"object","additionalProperties":true,"description":"Custom field values keyed by API name (e.g. `region__c`). On update, only the keys sent are changed."},"useAssignmentRules":{"type":"boolean","description":"Run assignment rules when no queue is given (default true)."}},"required":["subject"]},"CaseUpdate":{"type":"object","properties":{"subject":{"type":"string"},"description":{"type":["string","null"]},"priority":{"type":"string"},"origin":{"type":"string"},"contactName":{"type":["string","null"]},"contactEmail":{"type":["string","null"]},"queueId":{"type":["string","null"],"format":"uuid","description":"Moving to a queue emails it."},"accountId":{"type":["string","null"],"format":"uuid"},"contactId":{"type":["string","null"],"format":"uuid"},"accountExternalId":{"type":["string","null"]},"contactExternalId":{"type":["string","null"]},"externalId":{"type":["string","null"],"description":"Unique per organization and object; up to 255 characters. `\"\"` or `null` clears it.","maxLength":255},"customFields":{"type":"object","additionalProperties":true,"description":"Custom field values keyed by API name (e.g. `region__c`). On update, only the keys sent are changed."}},"description":"Send only the fields to change. Status and owner have their own endpoints."},"Comment":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"recordId":{"type":"string"},"externalId":{"type":["string","null"]},"body":{"type":"string"},"isInternal":{"type":"boolean"},"authorName":{"type":["string","null"]},"createdById":{"type":["string","null"],"format":"uuid","description":"User who created the record."},"createdByName":{"type":["string","null"]},"updatedById":{"type":["string","null"],"format":"uuid","description":"User who last changed the record."},"updatedByName":{"type":["string","null"]},"createdAt":{"type":["string","null"],"format":"date-time"}}},"Account":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Internal id."},"recordId":{"type":"string","description":"14-character ID; the last 4 characters are the organization code."},"externalId":{"type":["string","null"],"description":"Key from another system; unique per organization and object."},"name":{"type":"string"},"type":{"type":["string","null"]},"industry":{"type":["string","null"]},"phone":{"type":["string","null"]},"website":{"type":["string","null"]},"billingCity":{"type":["string","null"]},"billingCountry":{"type":["string","null"]},"ownerId":{"type":["string","null"],"format":"uuid"},"ownerName":{"type":["string","null"]},"contactCount":{"type":"integer"},"openCaseCount":{"type":"integer"},"customFields":{"type":"object","additionalProperties":true,"description":"Custom field values keyed by API name (e.g. `region__c`). On update, only the keys sent are changed."},"createdById":{"type":["string","null"],"format":"uuid","description":"User who created the record."},"createdByName":{"type":["string","null"]},"updatedById":{"type":["string","null"],"format":"uuid","description":"User who last changed the record."},"updatedByName":{"type":["string","null"]},"createdAt":{"type":["string","null"],"format":"date-time"},"updatedAt":{"type":["string","null"],"format":"date-time"}}},"AccountInput":{"type":"object","properties":{"name":{"type":"string","description":"Required on create."},"type":{"type":"string","description":"A value of the organization’s **Account Type** picklist (see `GET /api/picklists`). Blank uses the default."},"industry":{"type":["string","null"]},"phone":{"type":["string","null"]},"website":{"type":["string","null"]},"billingCity":{"type":["string","null"]},"billingCountry":{"type":["string","null"]},"ownerId":{"type":["string","null"],"format":"uuid","description":"Defaults to the caller on create."},"ownerExternalId":{"type":["string","null"],"description":"Instead of ownerId: the user’s External ID."},"externalId":{"type":["string","null"],"description":"Unique per organization and object; up to 255 characters. `\"\"` or `null` clears it.","maxLength":255},"customFields":{"type":"object","additionalProperties":true,"description":"Custom field values keyed by API name (e.g. `region__c`). On update, only the keys sent are changed."}}},"Contact":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Internal id."},"recordId":{"type":"string","description":"14-character ID; the last 4 characters are the organization code."},"externalId":{"type":["string","null"],"description":"Key from another system; unique per organization and object."},"firstName":{"type":["string","null"]},"lastName":{"type":"string"},"fullName":{"type":"string"},"title":{"type":["string","null"]},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"source":{"type":["string","null"],"description":"A Lead Source value."},"address":{"type":["string","null"]},"city":{"type":["string","null"]},"state":{"type":["string","null"]},"country":{"type":["string","null"]},"zipcode":{"type":["string","null"]},"accountId":{"type":["string","null"],"format":"uuid"},"accountName":{"type":["string","null"]},"accountRecordId":{"type":["string","null"]},"customFields":{"type":"object","additionalProperties":true,"description":"Custom field values keyed by API name (e.g. `region__c`). On update, only the keys sent are changed."},"createdById":{"type":["string","null"],"format":"uuid","description":"User who created the record."},"createdByName":{"type":["string","null"]},"updatedById":{"type":["string","null"],"format":"uuid","description":"User who last changed the record."},"updatedByName":{"type":["string","null"]},"createdAt":{"type":["string","null"],"format":"date-time"},"updatedAt":{"type":["string","null"],"format":"date-time"}}},"ContactInput":{"type":"object","properties":{"firstName":{"type":["string","null"]},"lastName":{"type":"string","description":"Required on create."},"title":{"type":["string","null"]},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"source":{"type":["string","null"],"description":"Optional; one of the organization’s Lead Source values. `\"\"` clears it."},"address":{"type":["string","null"],"maxLength":1000},"city":{"type":["string","null"],"maxLength":120},"state":{"type":["string","null"],"maxLength":120},"country":{"type":["string","null"],"maxLength":120},"zipcode":{"type":["string","null"],"maxLength":20},"accountId":{"type":["string","null"],"format":"uuid"},"accountExternalId":{"type":["string","null"],"description":"Instead of accountId: the account’s External ID."},"externalId":{"type":["string","null"],"description":"Unique per organization and object; up to 255 characters. `\"\"` or `null` clears it.","maxLength":255},"customFields":{"type":"object","additionalProperties":true,"description":"Custom field values keyed by API name (e.g. `region__c`). On update, only the keys sent are changed."}}},"Lead":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Internal id."},"recordId":{"type":"string","description":"14-character ID; the last 4 characters are the organization code."},"externalId":{"type":["string","null"],"description":"Key from another system; unique per organization and object."},"firstName":{"type":["string","null"]},"lastName":{"type":"string"},"fullName":{"type":"string"},"company":{"type":"string"},"title":{"type":["string","null"]},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"status":{"type":"string"},"statusCategory":{"type":"string","description":"Open, Working, Converted or Unqualified."},"source":{"type":["string","null"]},"rating":{"type":["string","null"]},"industry":{"type":["string","null"]},"description":{"type":["string","null"]},"ownerId":{"type":["string","null"],"format":"uuid"},"ownerName":{"type":["string","null"]},"convertedAt":{"type":["string","null"],"format":"date-time"},"convertedAccount":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"recordId":{"type":"string"},"name":{"type":"string"}}},"convertedContact":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"recordId":{"type":"string"},"name":{"type":"string"}}},"convertedOpportunity":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"recordId":{"type":"string"},"name":{"type":"string"}}},"customFields":{"type":"object","additionalProperties":true,"description":"Custom field values keyed by API name (e.g. `region__c`). On update, only the keys sent are changed."},"createdById":{"type":["string","null"],"format":"uuid","description":"User who created the record."},"createdByName":{"type":["string","null"]},"updatedById":{"type":["string","null"],"format":"uuid","description":"User who last changed the record."},"updatedByName":{"type":["string","null"]},"createdAt":{"type":["string","null"],"format":"date-time"},"updatedAt":{"type":["string","null"],"format":"date-time"}}},"LeadInput":{"type":"object","properties":{"firstName":{"type":["string","null"],"maxLength":120},"lastName":{"type":"string","description":"Required on create.","maxLength":120},"company":{"type":"string","description":"Required on create.","maxLength":255},"title":{"type":["string","null"]},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"status":{"type":"string","description":"A value of the organization’s **Lead Status** picklist (see `GET /api/picklists`). Blank uses the default. Converted values are only reachable through /convert."},"source":{"type":["string","null"],"description":"A value of the organization’s **Lead Source** picklist (see `GET /api/picklists`). Blank uses the default."},"rating":{"type":["string","null"]},"industry":{"type":["string","null"]},"description":{"type":["string","null"]},"ownerId":{"type":["string","null"],"format":"uuid","description":"Defaults to the caller on create."},"ownerExternalId":{"type":["string","null"]},"externalId":{"type":["string","null"],"description":"Unique per organization and object; up to 255 characters. `\"\"` or `null` clears it.","maxLength":255},"customFields":{"type":"object","additionalProperties":true,"description":"Custom field values keyed by API name (e.g. `region__c`). On update, only the keys sent are changed."}}},"LeadConvert":{"type":"object","properties":{"account":{"type":"object","properties":{"mode":{"type":"string","description":"`new` (default) or `existing`.","enum":["new","existing"]},"id":{"type":"string","format":"uuid","description":"For `existing`."},"name":{"type":"string","description":"For `new`; defaults to the lead’s company."}}},"contact":{"type":"object","properties":{"mode":{"type":"string","enum":["new","existing"]},"id":{"type":"string","format":"uuid","description":"For `existing`."}}},"opportunity":{"type":"object","properties":{"create":{"type":"boolean","description":"Default true."},"name":{"type":"string"},"amount":{"type":"number"},"closeDate":{"type":"string","description":"YYYY-MM-DD; default in 30 days.","format":"date"},"stage":{"type":"string"}}},"ownerId":{"type":"string","format":"uuid","description":"Owner of the new records; default the lead’s owner."},"status":{"type":"string","description":"A Lead Status in the Converted category; default the first one."}}},"Opportunity":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Internal id."},"recordId":{"type":"string","description":"14-character ID; the last 4 characters are the organization code."},"externalId":{"type":["string","null"],"description":"Key from another system; unique per organization and object."},"name":{"type":"string"},"accountId":{"type":["string","null"],"format":"uuid"},"accountRecordId":{"type":["string","null"]},"accountName":{"type":["string","null"]},"contactId":{"type":["string","null"],"format":"uuid"},"contactRecordId":{"type":["string","null"]},"contactName":{"type":["string","null"]},"amount":{"type":["number","null"],"description":"In `currencyIsoCode`."},"currencyIsoCode":{"type":"string","description":"ISO 4217 code of the amount (and of its products and quotes)."},"amountConverted":{"type":["number","null"],"description":"The amount in the corporate currency, at today’s rate."},"closeDate":{"type":"string","description":"YYYY-MM-DD.","format":"date"},"stage":{"type":"string"},"stageCategory":{"type":"string","description":"Open, Won or Lost."},"probability":{"type":["integer","null"]},"forecastCategory":{"type":"string","description":"Pipeline, Best Case, Commit, Closed (Won deals) or Omitted (Lost deals, or by choice).","enum":["Pipeline","Best Case","Commit","Closed","Omitted"]},"type":{"type":["string","null"]},"leadSource":{"type":["string","null"]},"nextStep":{"type":["string","null"]},"description":{"type":["string","null"]},"ownerId":{"type":["string","null"],"format":"uuid"},"ownerName":{"type":["string","null"]},"closedAt":{"type":["string","null"],"format":"date-time"},"priceBookId":{"type":["string","null"],"format":"uuid"},"priceBookName":{"type":["string","null"]},"productCount":{"type":"integer","description":"With products, amount is their total and can’t be set directly."},"quoteCount":{"type":"integer"},"customFields":{"type":"object","additionalProperties":true,"description":"Custom field values keyed by API name (e.g. `region__c`). On update, only the keys sent are changed."},"createdById":{"type":["string","null"],"format":"uuid","description":"User who created the record."},"createdByName":{"type":["string","null"]},"updatedById":{"type":["string","null"],"format":"uuid","description":"User who last changed the record."},"updatedByName":{"type":["string","null"]},"createdAt":{"type":["string","null"],"format":"date-time"},"updatedAt":{"type":["string","null"],"format":"date-time"}}},"OpportunityInput":{"type":"object","properties":{"name":{"type":"string","description":"Required on create.","maxLength":255},"amount":{"type":["number","null"],"minimum":0},"currencyIsoCode":{"type":"string","description":"An active currency (default: the corporate currency). Fixed once the opportunity has products or quotes."},"closeDate":{"type":"string","description":"Required on create. YYYY-MM-DD.","format":"date"},"stage":{"type":"string","description":"A value of the organization’s **Stage** picklist (see `GET /api/picklists`). Blank uses the default."},"probability":{"type":["integer","null"],"description":"0–100. Blank uses the stage’s default.","minimum":0,"maximum":100},"forecastCategory":{"type":"string","description":"Open deals only: overrides the stage’s default. Changing the stage resets it to the new stage’s default.","enum":["Pipeline","Best Case","Commit","Omitted"]},"type":{"type":["string","null"]},"leadSource":{"type":["string","null"]},"nextStep":{"type":["string","null"]},"description":{"type":["string","null"]},"accountId":{"type":["string","null"],"format":"uuid"},"contactId":{"type":["string","null"],"format":"uuid"},"ownerId":{"type":["string","null"],"format":"uuid","description":"Defaults to the caller on create."},"accountExternalId":{"type":["string","null"]},"contactExternalId":{"type":["string","null"]},"ownerExternalId":{"type":["string","null"]},"externalId":{"type":["string","null"],"description":"Unique per organization and object; up to 255 characters. `\"\"` or `null` clears it.","maxLength":255},"customFields":{"type":"object","additionalProperties":true,"description":"Custom field values keyed by API name (e.g. `region__c`). On update, only the keys sent are changed."}}},"User":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"recordId":{"type":"string"},"externalId":{"type":["string","null"]},"email":{"type":"string"},"fullName":{"type":"string"},"role":{"type":"string","description":"`agent`, `manager` or `admin`."},"profileName":{"type":"string"},"isActive":{"type":"boolean"},"lastLoginAt":{"type":["string","null"],"format":"date-time"},"createdById":{"type":["string","null"],"format":"uuid","description":"User who created the record."},"createdByName":{"type":["string","null"]},"updatedById":{"type":["string","null"],"format":"uuid","description":"User who last changed the record."},"updatedByName":{"type":["string","null"]},"createdAt":{"type":["string","null"],"format":"date-time"}}},"Queue":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"recordId":{"type":"string"},"name":{"type":"string"},"email":{"type":["string","null"],"description":"Emailed when a case is assigned to the queue."},"notifyMembers":{"type":"boolean","description":"Also email each member."},"openCases":{"type":"integer"},"memberCount":{"type":"integer"},"createdById":{"type":["string","null"],"format":"uuid"},"createdByName":{"type":["string","null"]},"updatedById":{"type":["string","null"],"format":"uuid"},"updatedByName":{"type":["string","null"]},"members":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"recordId":{"type":"string"},"fullName":{"type":"string"},"email":{"type":"string"},"role":{"type":"string"},"isActive":{"type":"boolean"},"addedAt":{"type":["string","null"],"format":"date-time"}}}}}},"Email":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"recordId":{"type":["string","null"]},"direction":{"type":"string","enum":["outbound","inbound"]},"reason":{"type":"string","description":"`case_email`, `record_email` (lead/opportunity), `inbound` or `auto_response` (Support Form confirmation)."},"from":{"type":["string","null"]},"to":{"type":"string"},"cc":{"type":["string","null"]},"subject":{"type":"string"},"body":{"type":"string"},"status":{"type":"string","description":"`pending`, `sent`, `failed`, `not_configured` or `received`."},"error":{"type":["string","null"]},"sentByName":{"type":["string","null"]},"createdAt":{"type":["string","null"],"format":"date-time"},"sentAt":{"type":["string","null"],"format":"date-time"},"attachments":{"type":"array","items":{"$ref":"#/components/schemas/Attachment"}}}},"Activity":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"recordId":{"type":"string"},"type":{"type":"string","enum":["task","event"]},"subject":{"type":"string"},"description":{"type":["string","null"]},"dueDate":{"type":["string","null"],"description":"Tasks. YYYY-MM-DD."},"status":{"type":["string","null"],"description":"Tasks: Not Started, In Progress or Completed."},"priority":{"type":["string","null"],"description":"Tasks: Normal or High."},"completedAt":{"type":["string","null"],"format":"date-time"},"startAt":{"type":["string","null"],"format":"date-time","description":"Events."},"endAt":{"type":["string","null"],"format":"date-time","description":"Events."},"location":{"type":["string","null"],"description":"Events."},"assignedTo":{"type":["string","null"],"format":"uuid"},"assignedToName":{"type":["string","null"]},"createdByName":{"type":["string","null"]},"createdAt":{"type":["string","null"],"format":"date-time"}}},"ActivityInput":{"type":"object","properties":{"type":{"type":"string","description":"Create only.","enum":["task","event"]},"subject":{"type":"string","maxLength":255},"description":{"type":["string","null"]},"assignedTo":{"type":["string","null"],"format":"uuid","description":"Defaults to the caller."},"dueDate":{"type":["string","null"],"description":"Tasks.","format":"date"},"status":{"type":"string","description":"Tasks.","enum":["Not Started","In Progress","Completed"]},"priority":{"type":"string","description":"Tasks.","enum":["Normal","High"]},"startAt":{"type":"string","description":"Events. ISO 8601.","format":"date-time"},"endAt":{"type":"string","description":"Events. ISO 8601.","format":"date-time"},"location":{"type":["string","null"],"description":"Events."}}},"Attachment":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"recordId":{"type":"string"},"filename":{"type":"string"},"contentType":{"type":"string"},"size":{"type":"integer","description":"Bytes."},"emailId":{"type":["string","null"],"format":"uuid"},"uploadedByName":{"type":["string","null"]},"createdAt":{"type":["string","null"],"format":"date-time"}}},"Milestone":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"completionEvent":{"type":"string","enum":["first_response","case_closed","manual"]},"startAt":{"type":["string","null"],"format":"date-time"},"targetAt":{"type":["string","null"],"format":"date-time"},"completedAt":{"type":["string","null"],"format":"date-time"},"violatedAt":{"type":["string","null"],"format":"date-time"},"status":{"type":"string","description":"e.g. open, due_soon, violated, completed."}}},"PicklistValue":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"recordId":{"type":"string"},"apiName":{"type":"string","description":"Stored on records."},"label":{"type":"string"},"sortOrder":{"type":"integer"},"isActive":{"type":"boolean"},"isDefault":{"type":"boolean"},"category":{"type":["string","null"],"description":"For Case Status, Lead Status and Stage."},"probability":{"type":["integer","null"],"description":"Stage only."},"forecastCategory":{"type":["string","null"],"description":"Stage only: the default forecast category."},"recordCount":{"type":"integer","description":"Setup endpoints only: records using the value."}}},"CustomFieldDefinition":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"recordId":{"type":"string"},"objectName":{"type":"string"},"apiName":{"type":"string","description":"Ends in `__c`."},"label":{"type":"string"},"type":{"type":"string","enum":["Text","TextArea","Number","Checkbox","Date","Email","Phone","URL","Picklist","Formula"]},"required":{"type":"boolean"},"visibleInUi":{"type":"boolean"},"picklistValues":{"type":["array","null"],"items":{"type":"string"}},"defaultValue":{"type":["string","null"]},"helpText":{"type":["string","null"]},"formula":{"type":["string","null"],"description":"Formula fields: the formula (see POST /api/setup/formulas/check)."},"returnType":{"type":["string","null"],"enum":["Text","Number","Currency","Percent","Date","Checkbox",null]},"decimals":{"type":["integer","null"],"description":"Number, Currency and Percent formulas: 0 to 6."},"recalculating":{"type":"boolean","description":"Formula values for existing records are still being recalculated."},"createdAt":{"type":["string","null"],"format":"date-time"},"updatedAt":{"type":["string","null"],"format":"date-time"}}},"CustomFieldInput":{"type":"object","properties":{"label":{"type":"string","description":"Required on create.","maxLength":80},"type":{"type":"string","description":"Create only.","enum":["Text","TextArea","Number","Checkbox","Date","Email","Phone","URL","Picklist","Formula"]},"apiName":{"type":"string","description":"Create only; derived from the label when omitted. Lowercase, ends in `__c`."},"required":{"type":"boolean"},"visibleInUi":{"type":"boolean"},"picklistValues":{"type":["array","null"],"items":{"type":"string"}},"defaultValue":{"type":["string","null"]},"helpText":{"type":["string","null"],"maxLength":255},"formula":{"type":"string","description":"Type Formula: fields by API name, functions such as IF, CASE, TEXT, TODAY, ISBLANK. Calculated on every save and stored in customFields; values sent for formula fields are ignored.","maxLength":3900},"returnType":{"type":"string","description":"Type Formula.","enum":["Text","Number","Currency","Percent","Date","Checkbox"]},"decimals":{"type":"integer","description":"Type Formula, numeric return types. Default 2.","minimum":0,"maximum":6}}},"ValidationRule":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"recordId":{"type":"string"},"objectName":{"type":"string"},"name":{"type":"string","maxLength":80},"description":{"type":["string","null"]},"formula":{"type":"string","description":"Error condition: when it’s true, the save is blocked. ISNEW(), ISCHANGED(field) and PRIORVALUE(field) see what the save changes."},"errorMessage":{"type":"string","maxLength":255},"errorField":{"type":["string","null"],"description":"Field the message is shown with (prefixed with its label)."},"isActive":{"type":"boolean"},"createdById":{"type":["string","null"],"format":"uuid","description":"User who created the record."},"createdByName":{"type":["string","null"]},"updatedById":{"type":["string","null"],"format":"uuid","description":"User who last changed the record."},"updatedByName":{"type":["string","null"]},"createdAt":{"type":["string","null"],"format":"date-time"},"updatedAt":{"type":["string","null"],"format":"date-time"}}},"RuleCondition":{"type":"object","properties":{"field":{"type":"string","enum":["priority","origin","accountType","accountId","subject","description","contactEmail"]},"operator":{"type":"string","description":"Picklist/lookup fields: equals, not_equals. Text fields also: contains, not_contains, starts_with, ends_with.","enum":["equals","not_equals","contains","not_contains","starts_with","ends_with"]},"value":{"type":"string","description":"Picklist fields: the stored value; accountId: the account UUID; text: case-insensitive."}},"required":["field","operator","value"]},"ApiKey":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"recordId":{"type":"string"},"name":{"type":"string"},"prefix":{"type":"string","description":"Start of the key, to recognize it."},"runAsUserId":{"type":"string","format":"uuid"},"runAsUserName":{"type":"string"},"runAsUserActive":{"type":"boolean"},"runAsProfile":{"type":"string"},"readOnly":{"type":"boolean","description":"Read-only: GET requests only, and read tools only over MCP."},"createdByName":{"type":["string","null"]},"createdAt":{"type":["string","null"],"format":"date-time"},"expiresAt":{"type":["string","null"],"format":"date-time"},"lastUsedAt":{"type":["string","null"],"format":"date-time"},"revokedAt":{"type":["string","null"],"format":"date-time"},"revokedByName":{"type":["string","null"]},"status":{"type":"string","enum":["active","expired","revoked"]}}},"ConnectedApp":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"recordId":{"type":"string"},"name":{"type":"string"},"clientId":{"type":"string"},"secretPrefix":{"type":"string"},"runAsUserId":{"type":"string","format":"uuid"},"runAsUserName":{"type":"string"},"runAsUserActive":{"type":"boolean"},"tokenTtlSeconds":{"type":"integer","enum":[900,3600,28800,86400]},"readOnly":{"type":"boolean","description":"Read-only: GET requests only, and read tools only over MCP."},"createdByName":{"type":["string","null"]},"createdAt":{"type":["string","null"],"format":"date-time"},"secretResetAt":{"type":["string","null"],"format":"date-time"},"lastTokenAt":{"type":["string","null"],"format":"date-time"},"revokedAt":{"type":["string","null"],"format":"date-time"},"revokedByName":{"type":["string","null"]},"status":{"type":"string","enum":["active","revoked"]}}},"WebToCaseSettings":{"type":"object","properties":{"enabled":{"type":"boolean"},"defaultOrigin":{"type":["string","null"],"description":"Blank = \"Web\" if the organization has it, else the default origin."},"defaultPriority":{"type":["string","null"]},"useAssignmentRules":{"type":"boolean"},"autoResponse":{"type":"boolean","description":"Email the customer a confirmation."},"returnUrl":{"type":["string","null"],"description":"Where the HTML form redirects after a submission."},"dailyLimit":{"type":"integer","minimum":1,"maximum":5000}}},"WebToLeadSettings":{"type":"object","properties":{"enabled":{"type":"boolean"},"defaultSource":{"type":["string","null"],"description":"Blank = \"Web\" if the organization has it, else the default Lead Source."},"defaultStatus":{"type":["string","null"],"description":"Blank = the default Lead Status. Can’t be a Converted status."},"ownerUserId":{"type":["string","null"],"format":"uuid","description":"Every web lead goes to this active user."},"ownerTeamId":{"type":["string","null"],"format":"uuid","description":"Round robin across this sales team’s active members. Set at most one of ownerUserId and ownerTeamId; neither = unassigned."},"notifyOwner":{"type":"boolean","description":"Email the owner about each new lead."},"autoResponse":{"type":"boolean","description":"Email the prospect a thank-you (added to the lead’s activity)."},"returnUrl":{"type":["string","null"],"description":"Where the HTML form redirects after a submission."},"dailyLimit":{"type":"integer","minimum":1,"maximum":5000}}},"HistoryEntry":{"type":"object","properties":{"id":{"type":"string"},"createdAt":{"type":["string","null"],"format":"date-time"},"action":{"type":"string","enum":["created","updated","deleted"]},"object":{"type":"string"},"objectLabel":{"type":"string"},"recordId":{"type":["string","null"],"description":"14 characters."},"recordName":{"type":["string","null"],"description":"As it was at the time."},"path":{"type":["string","null"],"description":"The record’s page in the app."},"user":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}}},"source":{"type":"string","enum":["app","api","ai","import","workflow","support","login_as","system"]},"sourceLabel":{"type":"string"},"sourceDetail":{"type":["string","null"],"description":"e.g. the API key, workflow rule or CRMSix admin."},"changes":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"label":{"type":"string"},"type":{"type":"string"},"old":{"type":["string","null"]},"new":{"type":["string","null"]}}}}}},"Organization":{"type":"object","properties":{"orgId":{"type":"string","description":"10 characters."},"orgCode":{"type":"string","description":"4 characters; the suffix of every ID."},"name":{"type":"string"},"slug":{"type":"string","description":"Used to sign in."},"primaryContactName":{"type":["string","null"]},"primaryContactEmail":{"type":["string","null"]},"primaryContactPhone":{"type":["string","null"]},"quarterlySalesGoal":{"type":["number","null"]},"createdAt":{"type":["string","null"],"format":"date-time"},"activeUsers":{"type":"integer"}}},"Product":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Internal id."},"recordId":{"type":"string","description":"14-character ID; the last 4 characters are the organization code."},"externalId":{"type":["string","null"],"description":"Key from another system; unique per organization and object."},"name":{"type":"string"},"productCode":{"type":["string","null"]},"family":{"type":["string","null"]},"description":{"type":["string","null"]},"isActive":{"type":"boolean"},"standardPrice":{"type":["number","null"],"description":"List price in the Standard Price List."},"createdById":{"type":["string","null"],"format":"uuid","description":"User who created the record."},"createdByName":{"type":["string","null"]},"updatedById":{"type":["string","null"],"format":"uuid","description":"User who last changed the record."},"updatedByName":{"type":["string","null"]},"createdAt":{"type":["string","null"],"format":"date-time"},"updatedAt":{"type":["string","null"],"format":"date-time"}}},"ProductInput":{"type":"object","properties":{"name":{"type":"string","description":"Required on create.","maxLength":255},"productCode":{"type":["string","null"],"description":"Unique per organization (case-insensitive).","maxLength":100},"family":{"type":["string","null"],"maxLength":120},"description":{"type":["string","null"]},"isActive":{"type":"boolean"},"externalId":{"type":["string","null"],"description":"Unique per organization and object; up to 255 characters. `\"\"` or `null` clears it.","maxLength":255},"standardPrice":{"type":"number","description":"Create only: adds the product to the Standard Price List at this price.","minimum":0}}},"PriceBook":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"recordId":{"type":"string"},"name":{"type":"string"},"description":{"type":["string","null"]},"isStandard":{"type":"boolean","description":"One per organization; can’t be deleted or deactivated."},"isActive":{"type":"boolean"},"entryCount":{"type":"integer"},"opportunityCount":{"type":"integer"},"createdById":{"type":["string","null"],"format":"uuid","description":"User who created the record."},"createdByName":{"type":["string","null"]},"updatedById":{"type":["string","null"],"format":"uuid","description":"User who last changed the record."},"updatedByName":{"type":["string","null"]},"createdAt":{"type":["string","null"],"format":"date-time"},"updatedAt":{"type":["string","null"],"format":"date-time"}}},"PriceBookEntry":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"recordId":{"type":"string"},"priceBookId":{"type":"string","format":"uuid"},"priceBookName":{"type":"string"},"isStandard":{"type":"boolean"},"productId":{"type":"string","format":"uuid"},"productName":{"type":"string"},"productCode":{"type":["string","null"]},"productFamily":{"type":["string","null"]},"productActive":{"type":"boolean"},"unitPrice":{"type":"number","description":"List price, in `currencyIsoCode`."},"currencyIsoCode":{"type":"string","description":"A product has at most one price per currency in each price list."},"isActive":{"type":"boolean"},"usable":{"type":"boolean","description":"Active entry, product and price list: can be added to opportunities."},"createdAt":{"type":["string","null"],"format":"date-time"}}},"OpportunityProducts":{"type":"object","properties":{"currencyIsoCode":{"type":"string","description":"The opportunity’s currency: every line uses a price in it."},"priceBook":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"recordId":{"type":"string"},"name":{"type":"string"},"isActive":{"type":"boolean"}}},"lines":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"recordId":{"type":"string"},"productId":{"type":"string","format":"uuid"},"productName":{"type":"string"},"productCode":{"type":["string","null"]},"priceBookEntryId":{"type":"string","format":"uuid"},"quantity":{"type":"number"},"listPrice":{"type":"number"},"unitPrice":{"type":"number","description":"Sales price."},"discount":{"type":"number","description":"Percent."},"totalPrice":{"type":"number","description":"quantity × sales price × (1 − discount%)."},"description":{"type":["string","null"]},"sortOrder":{"type":"integer"}}}},"total":{"type":["number","null"],"description":"The opportunity’s amount while it has products."}}},"QuoteLine":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"recordId":{"type":"string"},"productId":{"type":"string","format":"uuid"},"productName":{"type":"string"},"productCode":{"type":["string","null"]},"priceBookEntryId":{"type":"string","format":"uuid"},"quantity":{"type":"number"},"listPrice":{"type":"number"},"unitPrice":{"type":"number","description":"Sales price."},"discount":{"type":"number","description":"Percent."},"subtotal":{"type":"number","description":"quantity × sales price."},"totalPrice":{"type":"number","description":"After the discount."},"description":{"type":["string","null"]},"sortOrder":{"type":"integer"}}},"Quote":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"recordId":{"type":"string"},"quoteNumber":{"type":"string","description":"Q-00001, Q-00002, … per organization."},"name":{"type":"string"},"status":{"type":"string","enum":["Draft","Needs Review","Approved","Rejected","Presented","Accepted","Denied"]},"opportunityId":{"type":"string","format":"uuid"},"opportunityName":{"type":"string"},"accountId":{"type":["string","null"],"format":"uuid"},"accountName":{"type":["string","null"]},"contactId":{"type":["string","null"],"format":"uuid","description":"Prepared for."},"contactName":{"type":["string","null"]},"contactEmail":{"type":["string","null"]},"priceBookId":{"type":"string","format":"uuid"},"priceBookName":{"type":"string"},"currencyIsoCode":{"type":"string","description":"The opportunity’s currency."},"expirationDate":{"type":["string","null"],"description":"YYYY-MM-DD.","format":"date"},"description":{"type":["string","null"]},"subtotal":{"type":"number"},"discount":{"type":"number","description":"Subtotal − total price."},"totalPrice":{"type":"number"},"tax":{"type":"number"},"shipping":{"type":"number"},"grandTotal":{"type":"number","description":"Total price + tax + shipping."},"isSyncing":{"type":"boolean","description":"The opportunity’s products and amount follow this quote."},"approval":{"type":"object","properties":{"enabled":{"type":"boolean","description":"Quote approvals are on (Settings → Quote Approvals)."},"required":{"type":"boolean","description":"The quote meets an entry criterion."},"reasons":{"type":"array","items":{"type":"string"}},"canSubmit":{"type":"boolean"},"pending":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"submittedByName":{"type":"string"},"submittedAt":{"type":["string","null"],"format":"date-time"},"comment":{"type":["string","null"]},"reasons":{"type":"array","items":{"type":"string"}},"approverNames":{"type":"array","items":{"type":"string"}},"canDecide":{"type":"boolean"},"canRecall":{"type":"boolean"}}}}},"lineCount":{"type":"integer"},"ownerId":{"type":["string","null"],"format":"uuid"},"ownerName":{"type":["string","null"]},"createdById":{"type":["string","null"],"format":"uuid","description":"User who created the record."},"createdByName":{"type":["string","null"]},"updatedById":{"type":["string","null"],"format":"uuid","description":"User who last changed the record."},"updatedByName":{"type":["string","null"]},"createdAt":{"type":["string","null"],"format":"date-time"},"updatedAt":{"type":["string","null"],"format":"date-time"},"lines":{"type":"array","items":{"$ref":"#/components/schemas/QuoteLine"}}}},"SsoSettings":{"type":"object","properties":{"configured":{"type":"boolean"},"enabled":{"type":"boolean"},"issuer":{"type":"string"},"clientId":{"type":"string"},"hasClientSecret":{"type":"boolean"},"tokenAuthMethod":{"type":"string","enum":["client_secret_basic","client_secret_post"]},"jitEnabled":{"type":"boolean"},"jitRole":{"type":"string"},"allowedDomains":{"type":"array","items":{"type":"string"}},"requireSso":{"type":"boolean"},"updatedAt":{"type":["string","null"],"format":"date-time"},"redirectUri":{"type":"string","description":"Register this at the identity provider."},"loginUrl":{"type":"string","description":"Starts SSO for this organization."},"tenantSlug":{"type":"string"}}},"OAuthToken":{"type":"object","properties":{"access_token":{"type":"string","description":"A JWT; send it as `Authorization: Bearer …`."},"token_type":{"type":"string","enum":["Bearer"]},"expires_in":{"type":"integer","description":"Seconds."}},"required":["access_token","token_type","expires_in"]},"OAuthError":{"type":"object","properties":{"error":{"type":"string","enum":["invalid_request","invalid_client","unsupported_grant_type"]},"error_description":{"type":"string"}}}},"responses":{"BadRequest":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Unauthorized":{"description":"Missing, invalid, expired or revoked credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Forbidden":{"description":"The profile doesn’t allow this","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"NotFound":{"description":"Not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Conflict":{"description":"Conflict, e.g. a duplicate External ID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"TooLarge":{"description":"Request too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"TooMany":{"description":"Rate limit reached","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}