{"openapi":"3.0.0","paths":{"/api/v1/tags":{"get":{"description":"Returns all tags for the authenticated user","operationId":"TagsController_list","parameters":[],"responses":{"200":{"description":"Tags retrieved successfully"}},"security":[{"api-key":[]}],"summary":"List tags","tags":["Contact Tags"],"x-required-scope":"tags:read"},"post":{"description":"Creates a new tag definition that can then be added to contacts.","operationId":"TagsController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTagDto"}}}},"responses":{"201":{"description":"Tag created successfully"},"409":{"description":"Tag name already exists"}},"security":[{"api-key":[]}],"summary":"Create tag","tags":["Contact Tags"],"x-mcp":{"destructive":false},"x-required-scope":"tags:write"}},"/api/v1/tags/{id}":{"patch":{"description":"Renames or recolors an existing tag; contacts that have it keep it.","operationId":"TagsController_update","parameters":[{"name":"id","required":true,"in":"path","description":"Tag ID","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateTagDto"}}}},"responses":{"200":{"description":"Tag updated successfully"},"404":{"description":"Tag not found"},"409":{"description":"Tag name already exists"}},"security":[{"api-key":[]}],"summary":"Update tag","tags":["Contact Tags"],"x-required-scope":"tags:write"},"delete":{"description":"Deletes a tag and removes it from all contacts","operationId":"TagsController_delete","parameters":[{"name":"id","required":true,"in":"path","description":"Tag ID","schema":{"type":"number"}}],"responses":{"204":{"description":"Tag deleted successfully"},"404":{"description":"Tag not found"}},"security":[{"api-key":[]}],"summary":"Delete tag","tags":["Contact Tags"],"x-required-scope":"tags:write"}},"/api/v1/contacts/tags/bulk":{"post":{"description":"Applies tags to up to 1000 contacts in a single call. Tags are auto-created if they do not exist. Triggers associated workflows. Use this instead of calling \"Add tags to contact\" once per contact.","operationId":"ContactTagsController_bulkAddTags","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkAddContactTagsDto"}}}},"responses":{"201":{"description":"Tags applied. Returns how many contacts were affected.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkAddContactTagsRes"}}}},"404":{"description":"One or more contacts not found"}},"security":[{"api-key":[]}],"summary":"Add tags to many contacts","tags":["Contact Tags"],"x-mcp":{"destructive":false,"openWorld":true},"x-required-scope":"tags:write"}},"/api/v1/contacts/tags/bulk-remove":{"post":{"description":"Removes tags from up to 1000 contacts in a single call. Use this instead of calling \"Remove tag from contact\" once per contact.","operationId":"ContactTagsController_bulkRemoveTags","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkRemoveContactTagsDto"}}}},"responses":{"201":{"description":"Tags removed. Returns how many contacts were affected.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkRemoveContactTagsRes"}}}},"404":{"description":"One or more contacts or tags not found"}},"security":[{"api-key":[]}],"summary":"Remove tags from many contacts","tags":["Contact Tags"],"x-required-scope":"tags:write"}},"/api/v1/contacts/{uuid}/tags":{"post":{"description":"Adds tags to a single contact. Tags are auto-created if they do not exist. Triggers associated workflows. To tag multiple contacts, use \"Add tags to many contacts\" instead.","operationId":"ContactTagsController_addTags","parameters":[{"name":"uuid","required":true,"in":"path","description":"Contact UUID","schema":{"format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddContactTagsDto"}}}},"responses":{"201":{"description":"Tags added successfully. Returns updated tag list."},"404":{"description":"Contact not found"}},"security":[{"api-key":[]}],"summary":"Add tags to contact","tags":["Contact Tags"],"x-mcp":{"destructive":false,"openWorld":true},"x-required-scope":"tags:write"}},"/api/v1/contacts/{uuid}/tags/{tagId}":{"delete":{"description":"Removes a tag from a single contact. The contact stays in any workflow the tag started. To untag multiple contacts, use \"Remove tags from many contacts\" instead.","operationId":"ContactTagsController_removeTag","parameters":[{"name":"tagId","required":true,"in":"path","description":"Tag ID","schema":{"type":"number"}},{"name":"uuid","required":true,"in":"path","description":"Contact UUID","schema":{"format":"uuid"}}],"responses":{"204":{"description":"Tag removed successfully"},"404":{"description":"Contact or tag not found"}},"security":[{"api-key":[]}],"summary":"Remove tag from contact","tags":["Contact Tags"],"x-required-scope":"tags:write"}},"/api/v1/custom-fields":{"get":{"description":"Returns all custom field definitions for the authenticated user","operationId":"ContactCustomFieldsController_list","parameters":[],"responses":{"200":{"description":"Custom fields retrieved successfully"}},"security":[{"api-key":[]}],"summary":"List custom fields","tags":["Contact Custom Fields"],"x-required-scope":"custom-fields:read"},"post":{"description":"Creates a new custom field definition that contacts can then store a value in.","operationId":"ContactCustomFieldsController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCustomFieldDto"}}}},"responses":{"201":{"description":"Custom field created successfully"},"409":{"description":"Custom field name already exists"}},"security":[{"api-key":[]}],"summary":"Create custom field","tags":["Contact Custom Fields"],"x-mcp":{"destructive":false},"x-required-scope":"custom-fields:write"}},"/api/v1/custom-fields/{id}":{"delete":{"description":"Deletes a custom field definition and all associated values","operationId":"ContactCustomFieldsController_delete","parameters":[{"name":"id","required":true,"in":"path","description":"Custom field ID","schema":{"type":"number"}}],"responses":{"204":{"description":"Custom field deleted successfully"},"404":{"description":"Custom field not found"}},"security":[{"api-key":[]}],"summary":"Delete custom field","tags":["Contact Custom Fields"],"x-required-scope":"custom-fields:write"}},"/api/v1/contacts":{"get":{"description":"Returns a paginated list of contacts with optional filtering, the same results as the dashboard contact list. Results are eventually consistent: a contact just created or changed may take a few seconds to appear or update in this list. GET /v1/contacts/{uuid} reflects writes immediately. Searches shorter than 3 characters are ignored.","operationId":"ContactsController_list","parameters":[{"name":"page","required":false,"in":"query","description":"Page number","schema":{"example":"1","type":"string"}},{"name":"take","required":false,"in":"query","description":"Items per page (at most 500)","schema":{"example":"20","type":"string"}},{"name":"search","required":false,"in":"query","description":"Search term, matched like the dashboard contact search (name, phone number, email). Terms shorter than 3 characters are ignored.","schema":{"type":"string"}},{"name":"order","required":false,"in":"query","description":"Sort order","schema":{"example":"createdAt:DESC","type":"string"}},{"name":"tags","required":false,"in":"query","description":"Filter by tag IDs or tag names. Accepts repeated `tags=` params, comma-separated string, or `tags[]=` syntax.","schema":{"type":"array","items":{"type":"string"}}},{"name":"optedOut","required":false,"in":"query","description":"Filter by opted-out status","schema":{"type":"boolean"}},{"name":"starred","required":false,"in":"query","description":"Filter by starred status","schema":{"type":"boolean"}},{"name":"folderId","required":false,"in":"query","description":"Filter by folder ID. Not supported on accounts using search indexing: there it matches no contacts.","schema":{"type":"string"}},{"name":"listId","required":false,"in":"query","description":"Filter by list ID","schema":{"type":"string"}},{"name":"createdAfter","required":false,"in":"query","description":"Filter contacts created after this date (ISO 8601)","schema":{"example":"2024-01-01T00:00:00Z","type":"string"}},{"name":"createdBefore","required":false,"in":"query","description":"Filter contacts created before this date (ISO 8601)","schema":{"example":"2024-12-31T23:59:59Z","type":"string"}}],"responses":{"200":{"description":"Contacts retrieved successfully"},"401":{"description":"Invalid or missing API key"},"403":{"description":"Insufficient permissions (requires contacts:read)"}},"security":[{"api-key":[]}],"summary":"List contacts","tags":["Contacts"],"x-mcp":{"maxResultChars":200000,"description":"Returns a paginated list of contacts with optional filtering, the same results as the dashboard contact list. Results are eventually consistent: a contact just created or changed may take a few seconds to appear or update in this list. contacts_get reflects writes immediately. Searches shorter than 3 characters are ignored."},"x-required-scope":"contacts:read"},"post":{"description":"Creates a contact with optional tags and custom fields. Idempotent on the phone number: posting one that already belongs to a contact returns that contact with a 200 instead of failing, so a sync can re-push a lead safely. Set `updateExisting` to merge the payload into it.","operationId":"ContactsController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateContactDto"}}}},"responses":{"200":{"description":"Phone number already existed; the existing contact is returned"},"201":{"description":"Contact created successfully"},"400":{"description":"Invalid request body or phone number format"}},"security":[{"api-key":[]}],"summary":"Create contact","tags":["Contacts"],"x-required-scope":"contacts:write"}},"/api/v1/contacts/batch":{"post":{"description":"Retrieves multiple contacts by UUIDs in a single request","operationId":"ContactsController_batchGet","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchGetContactsDto"}}}},"responses":{"201":{"description":"Contacts retrieved successfully"}},"security":[{"api-key":[]}],"summary":"Batch get contacts","tags":["Contacts"],"x-mcp":{"readOnly":true},"x-required-scope":"contacts:read"}},"/api/v1/contacts/deleted":{"get":{"description":"Returns a paginated list of the deleted contacts that can still be restored, newest deletion first, the same list as the Deleted tab of the dashboard. A deleted contact can be restored for 7 days after its deletion. Contacts removed by phone verification or risk rules are not listed and cannot be restored. metadata.totalItems stops at 10000. Restore them with POST /v1/contacts/restore (contacts_restore).","operationId":"ContactsController_listDeleted","parameters":[{"name":"page","required":false,"in":"query","description":"Page number, 1 to 1000","schema":{"minimum":1,"maximum":1000,"example":1,"type":"number"}},{"name":"take","required":false,"in":"query","description":"Items per page, 1 to 200 (default 20)","schema":{"minimum":1,"maximum":200,"example":20,"type":"number"}},{"name":"sort","required":false,"in":"query","description":"Order by deletion time: desc (newest first, the default) or asc","schema":{"type":"string","enum":["desc","asc"]}},{"name":"from","required":false,"in":"query","description":"Only contacts deleted at or after this instant (ISO 8601)","schema":{"example":"2026-11-24T00:00:00.000Z","type":"string"}},{"name":"to","required":false,"in":"query","description":"Only contacts deleted before this instant (ISO 8601)","schema":{"example":"2026-11-25T00:00:00.000Z","type":"string"}}],"responses":{"200":{"description":"Deleted contacts retrieved successfully: rows of { uuid, firstName, lastName, phoneNumber, email, deletedAt } and the page metadata"},"400":{"description":"Invalid query parameter"},"403":{"description":"Insufficient permissions (requires contacts:read)"}},"security":[{"api-key":[]}],"summary":"List deleted contacts","tags":["Contacts"],"x-required-scope":"contacts:read"}},"/api/v1/contacts/restore":{"post":{"description":"Restores deleted contacts in a background job: send ids (contact UUIDs) or all: true, optionally with the deletion range from and to. Each contact comes back with its tags, custom fields, conversations and message history. It is not added back to its old lists, campaigns or workflows; addToList puts the restored contacts in a new list. The answer is a bulk_contact_restore operationId; GET /v1/async-operations/:operationId (async_operations_api_get_operation), which needs the async-operations:read scope, reports the progress and, when it completes, the result { restoredCount, skippedCount, listId }. A contact deleted again or purged while the job runs is skipped. A deleted contact can be restored for 7 days after its deletion. Contacts removed by phone verification or risk rules are not listed and cannot be restored. GET /v1/contacts/deleted (contacts_list_deleted) lists them.","operationId":"ContactsController_restore","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RestoreDeletedContactsDto"}}}},"responses":{"202":{"description":"The restore, accepted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RestoreDeletedContactsRes"}}}},"400":{"description":"Invalid body: both or neither of ids and all, from or to without all, from not before to, a list name the account already has, or no selected contact can be restored"},"403":{"description":"Insufficient permissions (requires contacts:write)"},"409":{"description":"Refused while a contact import, a bulk delete or another restore of the account is running"}},"security":[{"api-key":[]}],"summary":"Restore deleted contacts","tags":["Contacts"],"x-mcp":{"destructive":false},"x-required-scope":"contacts:write"}},"/api/v1/contacts/{uuid}":{"get":{"description":"Retrieves a single contact by UUID","operationId":"ContactsController_get","parameters":[{"name":"uuid","required":true,"in":"path","description":"Contact UUID","schema":{"format":"uuid"}}],"responses":{"200":{"description":"Contact retrieved successfully"},"404":{"description":"Contact not found"}},"security":[{"api-key":[]}],"summary":"Get contact","tags":["Contacts"],"x-required-scope":"contacts:read"},"patch":{"description":"Updates an existing contact. Tags are replaced, custom fields are merged.","operationId":"ContactsController_update","parameters":[{"name":"uuid","required":true,"in":"path","description":"Contact UUID","schema":{"format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateContactDto"}}}},"responses":{"200":{"description":"Contact updated successfully"},"404":{"description":"Contact not found"}},"security":[{"api-key":[]}],"summary":"Update contact","tags":["Contacts"],"x-required-scope":"contacts:write"},"delete":{"description":"Deletes a contact. It can be restored for 7 days with POST /v1/contacts/restore (contacts_restore); GET /v1/contacts/deleted (contacts_list_deleted) lists the deleted contacts.","operationId":"ContactsController_delete","parameters":[{"name":"uuid","required":true,"in":"path","description":"Contact UUID","schema":{"format":"uuid"}}],"responses":{"204":{"description":"Contact deleted successfully"},"404":{"description":"Contact not found"}},"security":[{"api-key":[]}],"summary":"Delete contact","tags":["Contacts"],"x-required-scope":"contacts:write"}},"/api/v1/contacts/{uuid}/messages":{"get":{"description":"Returns the paginated message history for a contact, newest first. Equivalent to GET /v1/messages?contactUuid={uuid}. Requires the messages:read scope.","operationId":"ContactsController_listMessages","parameters":[{"name":"page","required":false,"in":"query","description":"Page number","schema":{"example":"1","type":"string"}},{"name":"take","required":false,"in":"query","description":"Items per page (max 500)","schema":{"example":"20","type":"string"}},{"name":"search","required":false,"in":"query","description":"Search in message content","schema":{"type":"string"}},{"name":"direction","required":false,"in":"query","description":"Filter by message direction: outbound = sent by the account, inbound = received by it","schema":{"type":"string","enum":["inbound","outbound"]}},{"name":"status","required":false,"in":"query","description":"Filter by the message's current status (the same status each row reports), not by any earlier status it passed through","schema":{"type":"string","enum":["sending","sent","delivered","failed","undelivered","received","scheduled"]}},{"name":"createdAfter","required":false,"in":"query","description":"Filter messages created after this date (ISO 8601)","schema":{"example":"2024-01-01T00:00:00Z","type":"string"}},{"name":"createdBefore","required":false,"in":"query","description":"Filter messages created before this date (ISO 8601)","schema":{"example":"2024-12-31T23:59:59Z","type":"string"}},{"name":"uuid","required":true,"in":"path","description":"Contact UUID","schema":{"format":"uuid"}}],"responses":{"200":{"description":"Messages retrieved successfully"},"400":{"description":"Invalid contact UUID"},"403":{"description":"Insufficient permissions (requires messages:read)"},"404":{"description":"Contact not found"}},"security":[{"api-key":[]}],"summary":"List contact messages","tags":["Contacts"],"x-mcp":{"maxResultChars":200000,"description":"Returns the paginated message history for a contact, newest first. Same as messages_list filtered by contactUuid. Requires the messages:read scope."},"x-required-scope":"messages:read"}},"/api/v1/contacts/bulk":{"post":{"description":"Import up to 1000 contacts asynchronously. Returns a job ID for tracking progress.","operationId":"ContactsController_bulkCreate","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkCreateContactsDto"}}}},"responses":{"201":{"description":"Import job queued successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkJobResponseDto"}}}},"400":{"description":"Invalid request body"},"404":{"description":"List not found (if addToList specified)"}},"security":[{"api-key":[]}],"summary":"Bulk create/update contacts","tags":["Contacts"],"x-required-scope":"contacts:write"}},"/api/v1/contacts/export":{"post":{"description":"Start an async export of contacts matching the specified filters. Returns a job ID for tracking progress.","operationId":"ContactsController_exportContacts","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExportContactsDto"}}}},"responses":{"201":{"description":"Export job queued successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkJobResponseDto"}}}},"404":{"description":"List not found (if listId specified)"}},"security":[{"api-key":[]}],"summary":"Export contacts to CSV","tags":["Contacts"],"x-mcp":{"readOnly":true,"title":"Start a contacts CSV export"},"x-required-scope":"contacts:read"}},"/api/v1/contacts/jobs/{id}":{"get":{"description":"Check the status and progress of a bulk import or export job. For completed exports, returns a download URL.","operationId":"ContactsController_getJobStatus","parameters":[{"name":"id","required":true,"in":"path","description":"Job ID (UUID)","schema":{"format":"uuid"}}],"responses":{"200":{"description":"Job status retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobStatusResponseDto"}}}},"400":{"description":"Invalid job id"},"404":{"description":"Job not found"}},"security":[{"api-key":[]}],"summary":"Get job status","tags":["Contacts"],"x-required-scope":"contacts:read"}},"/api/v1/contacts/{uuid}/metadata":{"get":{"description":"Returns the opaque metadata text stored for this contact by your integration, or null if none. Metadata is never included in contact responses, exports or webhooks; this endpoint is the only way to read it.","operationId":"ContactMetadataController_get","parameters":[{"name":"uuid","required":true,"in":"path","description":"Contact UUID","schema":{"format":"uuid"}}],"responses":{"200":{"description":"Metadata retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactMetadataResponseDto"}}}},"400":{"description":"Invalid contact UUID"},"404":{"description":"Contact not found"}},"security":[{"api-key":[]}],"summary":"Get contact metadata","tags":["Contacts"],"x-required-scope":"contacts:read"},"put":{"description":"Replaces the metadata text for this contact (full overwrite, last write wins). To add to existing metadata, GET it first, append, then PUT the merged text. Limit: 10,000 characters. Store whatever format you like; plain text or YAML uses the space better than JSON. Use this for your own system's state about a contact instead of custom fields, which are limited to 200 characters and reject JSON.","operationId":"ContactMetadataController_set","parameters":[{"name":"uuid","required":true,"in":"path","description":"Contact UUID","schema":{"format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetContactMetadataDto"}}}},"responses":{"200":{"description":"Metadata stored successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactMetadataResponseDto"}}}},"400":{"description":"Invalid contact UUID, metadata is not a string, or metadata exceeds 10,000 characters (code CONTACT_METADATA_TOO_LONG)"},"404":{"description":"Contact not found"}},"security":[{"api-key":[]}],"summary":"Set contact metadata","tags":["Contacts"],"x-required-scope":"contacts:write"},"delete":{"description":"Removes the metadata text stored for this contact. Succeeds even when none was stored.","operationId":"ContactMetadataController_remove","parameters":[{"name":"uuid","required":true,"in":"path","description":"Contact UUID","schema":{"format":"uuid"}}],"responses":{"204":{"description":"Metadata deleted"},"400":{"description":"Invalid contact UUID"},"404":{"description":"Contact not found"}},"security":[{"api-key":[]}],"summary":"Delete contact metadata","tags":["Contacts"],"x-required-scope":"contacts:write"}},"/api/v1/contact-lists":{"get":{"description":"Returns all contact lists for the authenticated user","operationId":"ContactListsController_list","parameters":[],"responses":{"200":{"description":"Contact lists retrieved successfully"}},"security":[{"api-key":[]}],"summary":"List contact lists","tags":["Contact Lists"],"x-required-scope":"contact-lists:read"},"post":{"description":"Creates a new, empty contact list with a name and an optional description.","operationId":"ContactListsController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateContactListDto"}}}},"responses":{"201":{"description":"Contact list created successfully"},"409":{"description":"Contact list name already exists"}},"security":[{"api-key":[]}],"summary":"Create contact list","tags":["Contact Lists"],"x-mcp":{"destructive":false},"x-required-scope":"contact-lists:write"}},"/api/v1/contact-lists/{id}":{"get":{"description":"Returns a contact list by ID. Use includeContacts=true to include contact IDs.","operationId":"ContactListsController_getById","parameters":[{"name":"id","required":true,"in":"path","description":"Contact list ID","schema":{"type":"number"}},{"name":"includeContacts","required":false,"in":"query","description":"Include contact IDs in the response","schema":{"example":"true","type":"string"}}],"responses":{"200":{"description":"Contact list retrieved successfully"},"404":{"description":"Contact list not found"}},"security":[{"api-key":[]}],"summary":"Get contact list","tags":["Contact Lists"],"x-required-scope":"contact-lists:read"},"patch":{"description":"Updates a contact list name and/or description","operationId":"ContactListsController_update","parameters":[{"name":"id","required":true,"in":"path","description":"Contact list ID","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateContactListDto"}}}},"responses":{"200":{"description":"Contact list updated successfully"},"404":{"description":"Contact list not found"},"409":{"description":"Contact list name already exists"}},"security":[{"api-key":[]}],"summary":"Update contact list","tags":["Contact Lists"],"x-required-scope":"contact-lists:write"},"delete":{"description":"Deletes the contact list and detaches it from any campaigns. The contacts on it are kept.","operationId":"ContactListsController_delete","parameters":[{"name":"id","required":true,"in":"path","description":"Contact list ID","schema":{"type":"number"}}],"responses":{"204":{"description":"Contact list deleted successfully"},"404":{"description":"Contact list not found"}},"security":[{"api-key":[]}],"summary":"Delete contact list","tags":["Contact Lists"],"x-required-scope":"contact-lists:write"}},"/api/v1/contact-lists/{id}/contacts":{"post":{"description":"Adds contacts to a list by their IDs. Duplicates, deleted contacts and IDs that are not your contacts are ignored.","operationId":"ContactListsController_addContacts","parameters":[{"name":"id","required":true,"in":"path","description":"Contact list ID","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddContactsToListDto"}}}},"responses":{"201":{"description":"Contacts added successfully"},"404":{"description":"Contact list not found"}},"security":[{"api-key":[]}],"summary":"Add contacts to list","tags":["Contact Lists"],"x-mcp":{"destructive":false},"x-required-scope":"contact-lists:write"},"delete":{"description":"Removes contacts from a list by their IDs","operationId":"ContactListsController_removeContacts","parameters":[{"name":"id","required":true,"in":"path","description":"Contact list ID","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RemoveContactsFromListDto"}}}},"responses":{"200":{"description":"Contacts removed successfully"},"404":{"description":"Contact list not found"}},"security":[{"api-key":[]}],"summary":"Remove contacts from list","tags":["Contact Lists"],"x-required-scope":"contact-lists:write"}},"/api/v1/opt-outs":{"get":{"description":"Returns a paginated list of contacts who have opted out","operationId":"ContactOptOutsController_list","parameters":[{"name":"page","required":false,"in":"query","description":"Page number","schema":{"example":"1","type":"string"}},{"name":"take","required":false,"in":"query","description":"Items per page","schema":{"example":"20","type":"string"}},{"name":"optedOutAfter","required":false,"in":"query","description":"Filter by opted out after this date (ISO 8601)","schema":{"type":"string"}},{"name":"optedOutBefore","required":false,"in":"query","description":"Filter by opted out before this date (ISO 8601)","schema":{"type":"string"}}],"responses":{"200":{"description":"Opted-out contacts retrieved successfully"}},"security":[{"api-key":[]}],"summary":"List opted-out contacts","tags":["Contact Opt-Outs"],"x-required-scope":"opt-outs:read"}},"/api/v1/contacts/{uuid}/opt-out":{"post":{"description":"Opts out a contact from receiving messages. Removes contact from all active workflows.","operationId":"ContactOptOutActionsController_optOut","parameters":[{"name":"uuid","required":true,"in":"path","description":"Contact UUID","schema":{"format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OptOutContactDto"}}}},"responses":{"201":{"description":"Contact opted out successfully"},"404":{"description":"Contact not found"}},"security":[{"api-key":[]}],"summary":"Opt out contact","tags":["Contact Opt-Outs"],"x-mcp":{"destructive":true,"idempotent":true},"x-required-scope":"opt-outs:write"}},"/api/v1/contacts/{uuid}/opt-in":{"post":{"description":"Opts in a contact to receive messages. Requires explicit consent confirmation for TCPA compliance. Also clears the carrier-side opt-out block for the number the contact was last messaged from.","operationId":"ContactOptOutActionsController_optIn","parameters":[{"name":"uuid","required":true,"in":"path","description":"Contact UUID","schema":{"format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OptInContactDto"}}}},"responses":{"201":{"description":"Contact opted in successfully"},"400":{"description":"consentConfirmed must be true"},"404":{"description":"Contact not found"}},"security":[{"api-key":[]}],"summary":"Opt in contact","tags":["Contact Opt-Outs"],"x-mcp":{"destructive":true,"idempotent":true},"x-required-scope":"opt-outs:write"}},"/api/v1/scrubs/eligible-workflows":{"get":{"description":"The account's active and paused workflows, each with id, name, status and contactCount (every enrollment of the workflow, whatever its state). A convenience for picking workflowIds: a scrub of a workflow covers its contacts whose enrollment is active or paused, and any workflow id of the account is accepted, listed here or not.","operationId":"ScrubsController_listEligibleWorkflows","parameters":[],"responses":{"200":{"description":"Every active or paused workflow","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ScrubEligibleWorkflowRes"}},"example":{"status":true,"message":"Ok","data":[{"id":42,"name":"New lead nurture","status":"active","contactCount":318},{"id":57,"name":"Re-engagement","status":"paused","contactCount":91}]}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"example":{"statusCode":401,"error":"Unauthorized","message":"Invalid API key"}}}},"403":{"description":"The key lacks the scope this call needs, or scrubs are not enabled for the account (\"This feature is unavailable at the moment.\"). Reads, preview and the results file need scrubs:read; start, stop, retry and remove need scrubs:write, which does not include scrubs:read. A missing scope answers message and errorCode only.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"examples":{"missingScope":{"summary":"The key lacks the scope","value":{"message":"Missing required permissions: scrubs:write","errorCode":"missing_scope"}},"notEnabled":{"summary":"Scrubs are not enabled for the account","value":{"statusCode":403,"error":"Forbidden","message":"This feature is unavailable at the moment."}}}}}},"429":{"description":"Rate limit exceeded; retryAfter is in seconds","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"example":{"statusCode":429,"message":"Too many requests","error":"TOO_MANY_REQUESTS","retryAfter":12,"limit":120,"remaining":0,"reset":12}}}}},"security":[{"api-key":[]}],"summary":"List workflows a scrub can target","tags":["Scrubs"],"x-mcp":{"maxResultChars":200000},"x-required-scope":"scrubs:read"}},"/api/v1/scrubs/eligible-campaigns":{"get":{"description":"The account's campaigns that are not completed and have contacts, each with id, name, status, contactCount and pendingContacts. A convenience for picking campaignIds: a scrub of a campaign covers its contacts not yet processed, and any campaign id of the account is accepted, listed here or not.","operationId":"ScrubsController_listEligibleCampaigns","parameters":[],"responses":{"200":{"description":"Every campaign not completed that has contacts","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ScrubEligibleCampaignRes"}},"example":{"status":true,"message":"Ok","data":[{"id":12,"name":"November promo","status":"in_progress","contactCount":2400,"pendingContacts":1650}]}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"example":{"statusCode":401,"error":"Unauthorized","message":"Invalid API key"}}}},"403":{"description":"The key lacks the scope this call needs, or scrubs are not enabled for the account (\"This feature is unavailable at the moment.\"). Reads, preview and the results file need scrubs:read; start, stop, retry and remove need scrubs:write, which does not include scrubs:read. A missing scope answers message and errorCode only.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"examples":{"missingScope":{"summary":"The key lacks the scope","value":{"message":"Missing required permissions: scrubs:write","errorCode":"missing_scope"}},"notEnabled":{"summary":"Scrubs are not enabled for the account","value":{"statusCode":403,"error":"Forbidden","message":"This feature is unavailable at the moment."}}}}}},"429":{"description":"Rate limit exceeded; retryAfter is in seconds","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"example":{"statusCode":429,"message":"Too many requests","error":"TOO_MANY_REQUESTS","retryAfter":12,"limit":120,"remaining":0,"reset":12}}}}},"security":[{"api-key":[]}],"summary":"List campaigns a scrub can target","tags":["Scrubs"],"x-mcp":{"maxResultChars":200000},"x-required-scope":"scrubs:read"}},"/api/v1/scrubs/preview":{"post":{"description":"Counts what POST /v1/scrubs (scrubs_start) would act on, without starting anything or spending credits: totalContacts, alreadyScrubbed (numbers this account already scrubbed, free) and creditsRequired. Name exactly one target: contactUuids, filter, allContacts, workflowIds or campaignIds. contactUuids, workflowIds and campaignIds answer exact counts (estimated false). filter answers estimated true with alreadyScrubbed 0 and creditsRequired counting every match; allContacts answers estimated true with the split at this moment. A target with no contacts answers zeros. The exact cost is known when the scrub runs.","operationId":"ScrubsController_preview","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PreviewScrubDto"},"examples":{"contacts":{"summary":"Two contacts by uuid","value":{"contactUuids":["550e8400-e29b-41d4-a716-446655440000","6ba7b810-9dad-41d1-80b4-00c04fd430c8"]}},"taggedContacts":{"summary":"Contacts tagged \"new-leads\" created since November 1","value":{"filter":{"tags":["new-leads"],"createdAfter":"2026-11-01T00:00:00Z"}}},"workflows":{"summary":"The contacts of two workflows","value":{"workflowIds":[42,57]}},"campaign":{"summary":"The contacts a campaign has not processed yet","value":{"campaignIds":[12]}},"everyContact":{"summary":"Every contact of the account","value":{"allContacts":true}}}}}},"responses":{"200":{"description":"What a start would act on","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubPreviewRes"},"examples":{"exact":{"summary":"contactUuids, workflowIds or campaignIds: exact","value":{"status":true,"message":"Ok","data":{"totalContacts":2,"alreadyScrubbed":1,"newToScrub":1,"creditsRequired":1,"estimated":false}}},"filter":{"summary":"filter: every match counted as new","value":{"status":true,"message":"Ok","data":{"totalContacts":1500,"alreadyScrubbed":0,"newToScrub":1500,"creditsRequired":1500,"estimated":true}}},"allContacts":{"summary":"allContacts: the split at this moment","value":{"status":true,"message":"Ok","data":{"totalContacts":8200,"alreadyScrubbed":6100,"newToScrub":2100,"creditsRequired":2100,"estimated":true}}}}}}},"400":{"description":"Refused: INVALID_SCRUB_TARGET (no target, more than one, or a filter with no condition, targets listing the keys given; or a filter whose only condition is a search under 3 characters, with no targets), NO_CONTACTS_FOUND (none of the contactUuids is a contact of the account; an empty workflow, campaign, list or filter answers zeros instead), UNSUPPORTED_FILTER_FIELDS (a filter the account's contact search cannot apply; fields names it), SCRUB_TARGET_TOO_LARGE (the workflows or campaigns hold more than 250,000 contacts; max says so). A malformed body answers the status text \"Bad Request\" with every problem in message[].","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"examples":{"twoTargets":{"summary":"Two targets in one request","value":{"statusCode":400,"error":"INVALID_SCRUB_TARGET","message":"Name the contacts with one target only; this request names contactUuids and allContacts.","targets":["contactUuids","allContacts"]}},"emptyFilter":{"summary":"A filter with no condition","value":{"statusCode":400,"error":"INVALID_SCRUB_TARGET","message":"filter names no condition. To scrub every contact, send allContacts: true.","targets":["filter"]}},"shortSearch":{"summary":"A filter whose only condition is a search under 3 characters","value":{"statusCode":400,"error":"INVALID_SCRUB_TARGET","message":"filter names no condition: search needs at least 3 characters. To scrub every contact, send allContacts: true."}},"noContacts":{"summary":"None of the contactUuids is a contact of the account","value":{"statusCode":400,"error":"NO_CONTACTS_FOUND","message":"None of the contactUuids is a contact of this account."}},"tooLarge":{"summary":"Workflows holding more than 250,000 contacts","value":{"statusCode":400,"error":"SCRUB_TARGET_TOO_LARGE","message":"This selection has more than 250,000 contacts. Scrub it with a contact filter instead.","max":250000}},"malformed":{"summary":"A malformed body","value":{"statusCode":400,"error":"Bad Request","message":["each value in contactUuids must be a UUID"]}}}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"example":{"statusCode":401,"error":"Unauthorized","message":"Invalid API key"}}}},"403":{"description":"The key lacks the scope this call needs, or scrubs are not enabled for the account (\"This feature is unavailable at the moment.\"). Reads, preview and the results file need scrubs:read; start, stop, retry and remove need scrubs:write, which does not include scrubs:read. A missing scope answers message and errorCode only.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"examples":{"missingScope":{"summary":"The key lacks the scope","value":{"message":"Missing required permissions: scrubs:write","errorCode":"missing_scope"}},"notEnabled":{"summary":"Scrubs are not enabled for the account","value":{"statusCode":403,"error":"Forbidden","message":"This feature is unavailable at the moment."}}}}}},"404":{"description":"Refused: WORKFLOW_NOT_FOUND or CAMPAIGN_NOT_FOUND (an id that is not the account's; workflowIds or campaignIds lists them), IMPORT_NOT_FOUND (filter.importJobId names no import of the account that has started). A filter.listId that is not one of the account's lists answers the status text \"Not Found\".","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"examples":{"workflow":{"summary":"A workflow id that is not the account’s","value":{"statusCode":404,"error":"WORKFLOW_NOT_FOUND","message":"Workflow not found","workflowIds":[99]}},"importJob":{"summary":"An importJobId that names no import of the account","value":{"statusCode":404,"error":"IMPORT_NOT_FOUND","message":"Import not found"}},"list":{"summary":"A filter.listId that is not one of the account’s lists","value":{"statusCode":404,"error":"Not Found","message":"Contact list not found"}}}}}},"429":{"description":"Rate limit exceeded; retryAfter is in seconds","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"example":{"statusCode":429,"message":"Too many requests","error":"TOO_MANY_REQUESTS","retryAfter":12,"limit":120,"remaining":0,"reset":12}}}}},"security":[{"api-key":[]}],"summary":"Preview a scrub's cost","tags":["Scrubs"],"x-mcp":{"readOnly":true},"x-required-scope":"scrubs:read"}},"/api/v1/scrubs":{"post":{"description":"Starts a phone scrub: each number is checked for line type, carrier, and do-not-call and litigator lists. It spends one verification credit per contact whose number this account has not scrubbed before; POST /v1/scrubs/preview (scrubs_preview) gives the cost for free. autoRemoveBadLines has no default: true deletes, as results arrive, the contacts whose number is a landline, a VoIP line or has no line; false keeps every contact. Name exactly one target: contactUuids, filter, allContacts, workflowIds or campaignIds. One scrub runs per account at a time. Answers the scrub in status pending; poll GET /v1/scrubs/:scrubId (scrubs_get) until it is completed or failed.","operationId":"ScrubsController_start","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StartScrubDto"},"examples":{"contacts":{"summary":"Two contacts, keeping every contact","value":{"contactUuids":["550e8400-e29b-41d4-a716-446655440000","6ba7b810-9dad-41d1-80b4-00c04fd430c8"],"autoRemoveBadLines":false}},"taggedContacts":{"summary":"Every contact tagged \"new-leads\", deleting bad lines","value":{"filter":{"tags":["new-leads"]},"autoRemoveBadLines":true}},"importedContacts":{"summary":"The contacts one import created, deleting bad lines","value":{"filter":{"importJobId":"3f2c9a4e-8b1d-4c6e-9a7f-2d5b8e1c0a93"},"autoRemoveBadLines":true}},"workflow":{"summary":"The contacts of one workflow","value":{"workflowIds":[42],"autoRemoveBadLines":false}},"campaign":{"summary":"The contacts a campaign has not processed yet","value":{"campaignIds":[12],"autoRemoveBadLines":false}},"everyContact":{"summary":"Every contact of the account","value":{"allContacts":true,"autoRemoveBadLines":false}}}}}},"responses":{"202":{"description":"The scrub, accepted: pending and not charged yet","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubRes"},"example":{"status":true,"message":"Ok","data":{"id":"0b7f6c1e-5d1c-4a55-9f0e-3c2a7d9e4b10","status":"pending","failureCode":null,"autoRemoveBadLines":true,"counts":{"total":1500,"processed":0,"lineTypes":{"mobile":0,"landline":0,"voip":0,"unknown":0},"doNotCall":{"clean":0,"flagged":0,"unknown":0},"lists":null,"failed":0,"removed":0},"credits":{"charged":0,"returned":0},"createdAt":"2026-11-17T15:01:48.000Z","completedAt":null}}}}},"400":{"description":"Refused: INVALID_SCRUB_TARGET (no target, more than one, or a filter with no condition, targets listing the keys given; or a filter whose only condition is a search under 3 characters, with no targets), NO_CONTACTS_FOUND (the target holds no contact with a phone number), UNSUPPORTED_FILTER_FIELDS (a filter the account's contact search cannot apply; fields names it), SCRUB_TARGET_TOO_LARGE (the workflows or campaigns hold more than 250,000 contacts; max says so). A malformed body answers the status text \"Bad Request\" with every problem in message[].","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"examples":{"twoTargets":{"summary":"Two targets in one request","value":{"statusCode":400,"error":"INVALID_SCRUB_TARGET","message":"Name the contacts with one target only; this request names contactUuids and allContacts.","targets":["contactUuids","allContacts"]}},"emptyFilter":{"summary":"A filter with no condition","value":{"statusCode":400,"error":"INVALID_SCRUB_TARGET","message":"filter names no condition. To scrub every contact, send allContacts: true.","targets":["filter"]}},"shortSearch":{"summary":"A filter whose only condition is a search under 3 characters","value":{"statusCode":400,"error":"INVALID_SCRUB_TARGET","message":"filter names no condition: search needs at least 3 characters. To scrub every contact, send allContacts: true."}},"noContacts":{"summary":"None of the contactUuids is a contact of the account","value":{"statusCode":400,"error":"NO_CONTACTS_FOUND","message":"None of the contactUuids is a contact of this account."}},"tooLarge":{"summary":"Workflows holding more than 250,000 contacts","value":{"statusCode":400,"error":"SCRUB_TARGET_TOO_LARGE","message":"This selection has more than 250,000 contacts. Scrub it with a contact filter instead.","max":250000}},"malformed":{"summary":"autoRemoveBadLines left out","value":{"statusCode":400,"error":"Bad Request","message":["autoRemoveBadLines must be a boolean value"]}}}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"example":{"statusCode":401,"error":"Unauthorized","message":"Invalid API key"}}}},"402":{"description":"Refused: INSUFFICIENT_VERIFICATION_CREDITS (for contactUuids, workflowIds and campaignIds the balance is short of the exact cost; for filter and allContacts it is zero. required, available and shortfall say by how much; with no verification credits at all only available 0 is given). Nothing is charged by this call: the charge happens when the scrub runs, so any start can still end failed with failureCode insufficient_credits or spend_cap_reached.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"examples":{"shortfall":{"summary":"The balance is short of the cost","value":{"statusCode":402,"error":"INSUFFICIENT_VERIFICATION_CREDITS","message":"Not enough verification credits: 1,380 needed, 300 available.","required":1380,"available":300,"shortfall":1080}},"noCredits":{"summary":"The account has no verification credits","value":{"statusCode":402,"error":"INSUFFICIENT_VERIFICATION_CREDITS","message":"Not enough verification credits: none are available.","available":0}}}}}},"403":{"description":"The key lacks the scope this call needs, or scrubs are not enabled for the account (\"This feature is unavailable at the moment.\"). Reads, preview and the results file need scrubs:read; start, stop, retry and remove need scrubs:write, which does not include scrubs:read. A missing scope answers message and errorCode only.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"examples":{"missingScope":{"summary":"The key lacks the scope","value":{"message":"Missing required permissions: scrubs:write","errorCode":"missing_scope"}},"notEnabled":{"summary":"Scrubs are not enabled for the account","value":{"statusCode":403,"error":"Forbidden","message":"This feature is unavailable at the moment."}}}}}},"404":{"description":"Refused: WORKFLOW_NOT_FOUND or CAMPAIGN_NOT_FOUND (an id that is not the account's; workflowIds or campaignIds lists them), IMPORT_NOT_FOUND (filter.importJobId names no import of the account that has started). A filter.listId that is not one of the account's lists answers the status text \"Not Found\".","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"examples":{"workflow":{"summary":"A workflow id that is not the account’s","value":{"statusCode":404,"error":"WORKFLOW_NOT_FOUND","message":"Workflow not found","workflowIds":[99]}},"importJob":{"summary":"An importJobId that names no import of the account","value":{"statusCode":404,"error":"IMPORT_NOT_FOUND","message":"Import not found"}},"list":{"summary":"A filter.listId that is not one of the account’s lists","value":{"statusCode":404,"error":"Not Found","message":"Contact list not found"}}}}}},"409":{"description":"Refused: SCRUB_IN_PROGRESS (another scrub of the account is pending or in progress: scrubId, status and the message name it when it is found; retryable is true when another start is being accepted at this moment; neither is given while another start is still being set up).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"examples":{"running":{"summary":"Another scrub of the account is running","value":{"statusCode":409,"error":"SCRUB_IN_PROGRESS","message":"A scrub is already running for this account (id 0b7f6c1e-5d1c-4a55-9f0e-3c2a7d9e4b10). Wait for it to finish, or stop it, before starting another.","scrubId":"0b7f6c1e-5d1c-4a55-9f0e-3c2a7d9e4b10","status":"in_progress"}},"starting":{"summary":"Another start is being accepted at this moment","value":{"statusCode":409,"error":"SCRUB_IN_PROGRESS","message":"Another scrub is being started for this account. Try again in a moment.","retryable":true}}}}}},"429":{"description":"Rate limit exceeded; retryAfter is in seconds","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"example":{"statusCode":429,"message":"Too many requests","error":"TOO_MANY_REQUESTS","retryAfter":12,"limit":120,"remaining":0,"reset":12}}}}},"security":[{"api-key":[]}],"summary":"Start a phone scrub","tags":["Scrubs"],"x-mcp":{"title":"Start a phone scrub (uses verification credits, can delete contacts)","destructive":true},"x-required-scope":"scrubs:write"},"get":{"description":"The account's scrubs, newest first, each with its status, failureCode, counts and credits, the body of GET /v1/scrubs/:scrubId (scrubs_get); the breakdown is in GET /v1/scrubs/:scrubId/summary (scrubs_get_summary). Answers rows plus metadata (currentPage, itemsPerPage, totalItems, totalPages); take is 1 to 100, default 20. Scrubs started in the app and by contact imports are listed too. Use it to find the scrub id every other scrubs call takes.","operationId":"ScrubsController_list","parameters":[{"name":"page","required":false,"in":"query","description":"Page number (from 1)","schema":{"example":"1","type":"string"}},{"name":"take","required":false,"in":"query","description":"Scrubs per page (max 100, default 20)","schema":{"example":"20","type":"string"}}],"responses":{"200":{"description":"A page of scrubs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubListRes"},"example":{"status":true,"message":"Ok","data":{"rows":[{"id":"0b7f6c1e-5d1c-4a55-9f0e-3c2a7d9e4b10","status":"completed","failureCode":null,"autoRemoveBadLines":true,"counts":{"total":1500,"processed":1500,"lineTypes":{"mobile":1210,"landline":190,"voip":62,"unknown":26},"doNotCall":{"clean":1391,"flagged":97,"unknown":0},"lists":{"tcpa":12,"federal_dnc":81,"state_dnc":9},"failed":12,"removed":258},"credits":{"charged":1380,"returned":12},"createdAt":"2026-11-17T15:01:48.000Z","completedAt":"2026-11-17T15:09:40.101Z"}],"metadata":{"currentPage":1,"itemsPerPage":20,"totalItems":1,"totalPages":1}}}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"example":{"statusCode":401,"error":"Unauthorized","message":"Invalid API key"}}}},"403":{"description":"The key lacks the scope this call needs, or scrubs are not enabled for the account (\"This feature is unavailable at the moment.\"). Reads, preview and the results file need scrubs:read; start, stop, retry and remove need scrubs:write, which does not include scrubs:read. A missing scope answers message and errorCode only.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"examples":{"missingScope":{"summary":"The key lacks the scope","value":{"message":"Missing required permissions: scrubs:write","errorCode":"missing_scope"}},"notEnabled":{"summary":"Scrubs are not enabled for the account","value":{"statusCode":403,"error":"Forbidden","message":"This feature is unavailable at the moment."}}}}}},"429":{"description":"Rate limit exceeded; retryAfter is in seconds","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"example":{"statusCode":429,"message":"Too many requests","error":"TOO_MANY_REQUESTS","retryAfter":12,"limit":120,"remaining":0,"reset":12}}}}},"security":[{"api-key":[]}],"summary":"List scrubs","tags":["Scrubs"],"x-required-scope":"scrubs:read"}},"/api/v1/scrubs/{scrubId}":{"get":{"description":"The scrub record: status (pending, in_progress, completed, failed), failureCode when failed (stopped, worker_lost, insufficient_credits, spend_cap_reached, no_contacts, error), credits, counts and timestamps, the same body as data in the scrub.* webhooks. counts is the permanent record of the run; the live breakdown per category, with the body of POST /v1/scrubs/:scrubId/remove (scrubs_remove_results) for each, is in GET /v1/scrubs/:scrubId/summary (scrubs_get_summary). Poll it after a start or a retry until status is completed or failed.","operationId":"ScrubsController_get","parameters":[{"name":"scrubId","required":true,"in":"path","description":"Scrub id, from GET /v1/scrubs (scrubs_list) or POST /v1/scrubs (scrubs_start)","schema":{"format":"uuid","example":"0b7f6c1e-5d1c-4a55-9f0e-3c2a7d9e4b10","type":"string"}}],"responses":{"200":{"description":"The scrub","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubRes"},"examples":{"completed":{"summary":"Completed, with autoRemoveBadLines","value":{"status":true,"message":"Ok","data":{"id":"0b7f6c1e-5d1c-4a55-9f0e-3c2a7d9e4b10","status":"completed","failureCode":null,"autoRemoveBadLines":true,"counts":{"total":1500,"processed":1500,"lineTypes":{"mobile":1210,"landline":190,"voip":62,"unknown":26},"doNotCall":{"clean":1391,"flagged":97,"unknown":0},"lists":{"tcpa":12,"federal_dnc":81,"state_dnc":9},"failed":12,"removed":258},"credits":{"charged":1380,"returned":12},"createdAt":"2026-11-17T15:01:48.000Z","completedAt":"2026-11-17T15:09:40.101Z"}}},"pending":{"summary":"Pending, right after the start","value":{"status":true,"message":"Ok","data":{"id":"0b7f6c1e-5d1c-4a55-9f0e-3c2a7d9e4b10","status":"pending","failureCode":null,"autoRemoveBadLines":true,"counts":{"total":1500,"processed":0,"lineTypes":{"mobile":0,"landline":0,"voip":0,"unknown":0},"doNotCall":{"clean":0,"flagged":0,"unknown":0},"lists":null,"failed":0,"removed":0},"credits":{"charged":0,"returned":0},"createdAt":"2026-11-17T15:01:48.000Z","completedAt":null}}}}}}},"400":{"description":"A scrubId that is not a uuid answers the status text \"Bad Request\" before anything is read.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"examples":{"badId":{"summary":"scrubId is not a uuid","value":{"statusCode":400,"error":"Bad Request","message":"Invalid UUID format for parameter: scrubId"}}}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"example":{"statusCode":401,"error":"Unauthorized","message":"Invalid API key"}}}},"403":{"description":"The key lacks the scope this call needs, or scrubs are not enabled for the account (\"This feature is unavailable at the moment.\"). Reads, preview and the results file need scrubs:read; start, stop, retry and remove need scrubs:write, which does not include scrubs:read. A missing scope answers message and errorCode only.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"examples":{"missingScope":{"summary":"The key lacks the scope","value":{"message":"Missing required permissions: scrubs:write","errorCode":"missing_scope"}},"notEnabled":{"summary":"Scrubs are not enabled for the account","value":{"statusCode":403,"error":"Forbidden","message":"This feature is unavailable at the moment."}}}}}},"404":{"description":"Refused: SCRUB_NOT_FOUND (no scrub of the account has this id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"examples":{"notFound":{"summary":"No scrub of the account has this id","value":{"statusCode":404,"error":"SCRUB_NOT_FOUND","message":"Scrub not found"}}}}}},"429":{"description":"Rate limit exceeded; retryAfter is in seconds","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"example":{"statusCode":429,"message":"Too many requests","error":"TOO_MANY_REQUESTS","retryAfter":12,"limit":120,"remaining":0,"reset":12}}}}},"security":[{"api-key":[]}],"summary":"Get a scrub","tags":["Scrubs"],"x-required-scope":"scrubs:read"}},"/api/v1/scrubs/{scrubId}/summary":{"get":{"description":"The one call that shows a scrub's breakdown: totals and one row per result category in display order, zeros included. Each row has key, label, group, count, remaining and remove, the exact body of POST /v1/scrubs/:scrubId/remove (scrubs_remove_results) that deletes the remaining contacts of that category; several keys go in one remove. totals.flagged counts a contact once, and overlap is true when the list counts add up to more. Counts are live, removes included, over the contacts whose most recent scrub is this one; while it runs a contact checked again can count under its earlier result. status is the scrub's, so this call also follows a run.","operationId":"ScrubsController_getSummary","parameters":[{"name":"scrubId","required":true,"in":"path","description":"Scrub id, from GET /v1/scrubs (scrubs_list) or POST /v1/scrubs (scrubs_start)","schema":{"format":"uuid","example":"0b7f6c1e-5d1c-4a55-9f0e-3c2a7d9e4b10","type":"string"}}],"responses":{"200":{"description":"The summary","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubSummaryRes"},"example":{"status":true,"message":"Ok","data":{"scrubId":"0b7f6c1e-5d1c-4a55-9f0e-3c2a7d9e4b10","status":"completed","totals":{"contacts":1500,"checked":1488,"clean":1113,"flagged":97,"badLines":278,"failed":12,"pending":0,"removed":258},"categories":[{"key":"tcpa","label":"TCPA litigators","group":"flagged","count":12,"remaining":12,"remove":{"categories":["tcpa"]}},{"key":"troll","label":"TCPA trolls","group":"flagged","count":0,"remaining":0,"remove":{"categories":["troll"]}},{"key":"federal_dnc","label":"National Do Not Call Registry","group":"flagged","count":81,"remaining":81,"remove":{"categories":["federal_dnc"]}},{"key":"state_dnc","label":"State Do Not Call lists","group":"flagged","count":9,"remaining":9,"remove":{"categories":["state_dnc"]}},{"key":"dnc_complainers","label":"Known complainers","group":"flagged","count":0,"remaining":0,"remove":{"categories":["dnc_complainers"]}},{"key":"nra","label":"Additional do-not-contact list","group":"flagged","count":0,"remaining":0,"remove":{"categories":["nra"]}},{"key":"other","label":"Other flagged list","group":"flagged","count":0,"remaining":0,"remove":{"categories":["other"]}},{"key":"legacy","label":"Do Not Call (litigators included)","group":"flagged","count":0,"remaining":0,"remove":{"categories":["legacy"]}},{"key":"landline","label":"Landlines","group":"kept","count":190,"remaining":0,"remove":{"categories":["landline"]}},{"key":"voip","label":"VoIP numbers","group":"kept","count":62,"remaining":0,"remove":{"categories":["voip"]}},{"key":"unknown","label":"No line or unconfirmed","group":"kept","count":26,"remaining":20,"remove":{"categories":["unknown"]}},{"key":"failed","label":"Could not be checked","group":"failed","count":12,"remaining":12,"remove":{"categories":["failed"]}}],"overlap":true}}}}},"400":{"description":"A scrubId that is not a uuid answers the status text \"Bad Request\" before anything is read.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"examples":{"badId":{"summary":"scrubId is not a uuid","value":{"statusCode":400,"error":"Bad Request","message":"Invalid UUID format for parameter: scrubId"}}}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"example":{"statusCode":401,"error":"Unauthorized","message":"Invalid API key"}}}},"403":{"description":"The key lacks the scope this call needs, or scrubs are not enabled for the account (\"This feature is unavailable at the moment.\"). Reads, preview and the results file need scrubs:read; start, stop, retry and remove need scrubs:write, which does not include scrubs:read. A missing scope answers message and errorCode only.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"examples":{"missingScope":{"summary":"The key lacks the scope","value":{"message":"Missing required permissions: scrubs:write","errorCode":"missing_scope"}},"notEnabled":{"summary":"Scrubs are not enabled for the account","value":{"statusCode":403,"error":"Forbidden","message":"This feature is unavailable at the moment."}}}}}},"404":{"description":"Refused: SCRUB_NOT_FOUND (no scrub of the account has this id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"examples":{"notFound":{"summary":"No scrub of the account has this id","value":{"statusCode":404,"error":"SCRUB_NOT_FOUND","message":"Scrub not found"}}}}}},"429":{"description":"Rate limit exceeded; retryAfter is in seconds","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"example":{"statusCode":429,"message":"Too many requests","error":"TOO_MANY_REQUESTS","retryAfter":12,"limit":120,"remaining":0,"reset":12}}}}},"security":[{"api-key":[]}],"summary":"Get a scrub's results summary","tags":["Scrubs"],"x-mcp":{"readOnly":true,"title":"Get a scrub's results summary"},"x-required-scope":"scrubs:read"}},"/api/v1/scrubs/{scrubId}/stop":{"post":{"description":"Stops a pending or in-progress scrub: numbers not checked yet are marked failed and the credits charged for them are given back (a pending scrub has not been charged, so it gives back none); contacts already deleted stay deleted. POST /v1/scrubs/:scrubId/retry (scrubs_retry) checks the failed numbers later. A scrub that already finished is left as it is and answers stopped false. Answers the scrub as it is after the stop.","operationId":"ScrubsController_stop","parameters":[{"name":"scrubId","required":true,"in":"path","description":"Scrub id, from GET /v1/scrubs (scrubs_list) or POST /v1/scrubs (scrubs_start)","schema":{"format":"uuid","example":"0b7f6c1e-5d1c-4a55-9f0e-3c2a7d9e4b10","type":"string"}}],"responses":{"200":{"description":"The stop outcome","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubStopRes"},"examples":{"stopped":{"summary":"Stopped part-way: the unchecked numbers failed and were refunded","value":{"status":true,"message":"Ok","data":{"stopped":true,"creditsReturned":920,"scrub":{"id":"0b7f6c1e-5d1c-4a55-9f0e-3c2a7d9e4b10","status":"failed","failureCode":"stopped","autoRemoveBadLines":true,"counts":{"total":1500,"processed":1500,"lineTypes":{"mobile":410,"landline":61,"voip":22,"unknown":7},"doNotCall":{"clean":468,"flagged":32,"unknown":0},"lists":{"tcpa":4,"federal_dnc":28},"failed":1000,"removed":85},"credits":{"charged":1380,"returned":920},"createdAt":"2026-11-17T15:01:48.000Z","completedAt":null}}}},"alreadyFinished":{"summary":"Already finished: nothing changed","value":{"status":true,"message":"Ok","data":{"stopped":false,"creditsReturned":0,"scrub":{"id":"0b7f6c1e-5d1c-4a55-9f0e-3c2a7d9e4b10","status":"completed","failureCode":null,"autoRemoveBadLines":true,"counts":{"total":1500,"processed":1500,"lineTypes":{"mobile":1210,"landline":190,"voip":62,"unknown":26},"doNotCall":{"clean":1391,"flagged":97,"unknown":0},"lists":{"tcpa":12,"federal_dnc":81,"state_dnc":9},"failed":12,"removed":258},"credits":{"charged":1380,"returned":12},"createdAt":"2026-11-17T15:01:48.000Z","completedAt":"2026-11-17T15:09:40.101Z"}}}}}}}},"400":{"description":"A scrubId that is not a uuid answers the status text \"Bad Request\" before anything is read.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"examples":{"badId":{"summary":"scrubId is not a uuid","value":{"statusCode":400,"error":"Bad Request","message":"Invalid UUID format for parameter: scrubId"}}}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"example":{"statusCode":401,"error":"Unauthorized","message":"Invalid API key"}}}},"403":{"description":"The key lacks the scope this call needs, or scrubs are not enabled for the account (\"This feature is unavailable at the moment.\"). Reads, preview and the results file need scrubs:read; start, stop, retry and remove need scrubs:write, which does not include scrubs:read. A missing scope answers message and errorCode only.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"examples":{"missingScope":{"summary":"The key lacks the scope","value":{"message":"Missing required permissions: scrubs:write","errorCode":"missing_scope"}},"notEnabled":{"summary":"Scrubs are not enabled for the account","value":{"statusCode":403,"error":"Forbidden","message":"This feature is unavailable at the moment."}}}}}},"404":{"description":"Refused: SCRUB_NOT_FOUND (no scrub of the account has this id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"examples":{"notFound":{"summary":"No scrub of the account has this id","value":{"statusCode":404,"error":"SCRUB_NOT_FOUND","message":"Scrub not found"}}}}}},"429":{"description":"Rate limit exceeded; retryAfter is in seconds","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"example":{"statusCode":429,"message":"Too many requests","error":"TOO_MANY_REQUESTS","retryAfter":12,"limit":120,"remaining":0,"reset":12}}}}},"security":[{"api-key":[]}],"summary":"Stop a scrub","tags":["Scrubs"],"x-mcp":{"destructive":false,"idempotent":true},"x-required-scope":"scrubs:write"}},"/api/v1/scrubs/{scrubId}/retry":{"post":{"description":"Checks every failed number of a completed or failed scrub again, in the same scrub. It spends one verification credit per failed contact whose number this account has not scrubbed before, charged in this call, and keeps the scrub's autoRemoveBadLines: when true, bad lines found now are deleted. Answers at once with retriedCount and creditsCharged; poll GET /v1/scrubs/:scrubId (scrubs_get) until status is completed or failed. One scrub runs per account at a time.","operationId":"ScrubsController_retry","parameters":[{"name":"scrubId","required":true,"in":"path","description":"Scrub id, from GET /v1/scrubs (scrubs_list) or POST /v1/scrubs (scrubs_start)","schema":{"format":"uuid","example":"0b7f6c1e-5d1c-4a55-9f0e-3c2a7d9e4b10","type":"string"}}],"responses":{"202":{"description":"The retry, accepted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubRetryRes"},"example":{"status":true,"message":"Ok","data":{"scrubId":"0b7f6c1e-5d1c-4a55-9f0e-3c2a7d9e4b10","retriedCount":12,"creditsCharged":4}}}}},"400":{"description":"Refused: NO_FAILED_CONTACTS (the scrub has no failed contact left; checked before whether the scrub finished), CREDIT_DEDUCTION_FAILED (the charge failed for another reason). A scrubId that is not a uuid answers the status text \"Bad Request\" before anything is read.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"examples":{"noFailed":{"summary":"The scrub has no failed contact left","value":{"statusCode":400,"error":"NO_FAILED_CONTACTS","message":"No failed contacts to retry"}},"badId":{"summary":"scrubId is not a uuid","value":{"statusCode":400,"error":"Bad Request","message":"Invalid UUID format for parameter: scrubId"}}}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"example":{"statusCode":401,"error":"Unauthorized","message":"Invalid API key"}}}},"402":{"description":"Refused: INSUFFICIENT_VERIFICATION_CREDITS (the balance is short of the retry cost; required, available and shortfall say by how much when the balance check refuses, only message when the charge itself does), ACCOUNT_SPEND_CAP_REACHED (the account's spending policy refused the charge). The retry is charged in this call, so nothing was reopened.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"examples":{"shortfall":{"summary":"The balance is short of the retry cost","value":{"statusCode":402,"error":"INSUFFICIENT_VERIFICATION_CREDITS","message":"Not enough verification credits: 4 needed, 1 available.","required":4,"available":1,"shortfall":3}},"spendCap":{"summary":"The account’s spending policy refused the charge","value":{"statusCode":402,"error":"ACCOUNT_SPEND_CAP_REACHED","message":"This account has reached its spending limit for the current period (Verification credits). Requested 4 but only 1 remains."}}}}}},"403":{"description":"The key lacks the scope this call needs, or scrubs are not enabled for the account (\"This feature is unavailable at the moment.\"). Reads, preview and the results file need scrubs:read; start, stop, retry and remove need scrubs:write, which does not include scrubs:read. A missing scope answers message and errorCode only.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"examples":{"missingScope":{"summary":"The key lacks the scope","value":{"message":"Missing required permissions: scrubs:write","errorCode":"missing_scope"}},"notEnabled":{"summary":"Scrubs are not enabled for the account","value":{"statusCode":403,"error":"Forbidden","message":"This feature is unavailable at the moment."}}}}}},"404":{"description":"Refused: SCRUB_NOT_FOUND (no scrub of the account has this id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"examples":{"notFound":{"summary":"No scrub of the account has this id","value":{"statusCode":404,"error":"SCRUB_NOT_FOUND","message":"Scrub not found"}}}}}},"409":{"description":"Refused: SCRUB_NOT_FINISHED (this scrub is still pending or in progress; scrubId names it), SCRUB_IN_PROGRESS (another scrub of the account is running and scrubId names it, or retryable is true while another start is being accepted).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"examples":{"notFinished":{"summary":"This scrub is still pending or in progress","value":{"statusCode":409,"error":"SCRUB_NOT_FINISHED","message":"This verification is still running. Wait for it to finish before retrying.","scrubId":"0b7f6c1e-5d1c-4a55-9f0e-3c2a7d9e4b10"}},"running":{"summary":"Another scrub of the account is running","value":{"statusCode":409,"error":"SCRUB_IN_PROGRESS","message":"A scrub is already running for this account (id 0b7f6c1e-5d1c-4a55-9f0e-3c2a7d9e4b10). Wait for it to finish, or stop it, before starting another.","scrubId":"0b7f6c1e-5d1c-4a55-9f0e-3c2a7d9e4b10","status":"in_progress"}}}}}},"429":{"description":"Rate limit exceeded; retryAfter is in seconds","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"example":{"statusCode":429,"message":"Too many requests","error":"TOO_MANY_REQUESTS","retryAfter":12,"limit":120,"remaining":0,"reset":12}}}}},"security":[{"api-key":[]}],"summary":"Retry a scrub's failed numbers","tags":["Scrubs"],"x-mcp":{"title":"Retry failed numbers of a scrub (uses verification credits)","destructive":true},"x-required-scope":"scrubs:write"}},"/api/v1/scrubs/{scrubId}/results":{"get":{"description":"The contacts of a scrub, one page at a time, each with contactUuid, phoneNumber, status, group, lineType, carrier, doNotCall, flaggedLists, verifiedAt and removed. group and list narrow the page to one result group or list. A category of GET /v1/scrubs/:scrubId/summary (scrubs_get_summary) is its group plus its key as list: state_dnc is flagged and state_dnc, landline is kept and landline; failed has no list. nextCursor goes back as cursor until it is null; take is at most 500. Lists the contacts whose most recent scrub is this one; deleted contacts stay listed with removed true. A pending contact can show the group, lineType and doNotCall of an earlier scrub until this one checks it.","operationId":"ScrubsController_listResults","parameters":[{"name":"cursor","required":false,"in":"query","description":"nextCursor of the previous page; omitted for the first page","schema":{"example":"c3IxOjEwMjQ0","type":"string"}},{"name":"take","required":false,"in":"query","description":"Contacts per page (max 500, default 100)","schema":{"example":"100","type":"string"}},{"name":"group","required":false,"in":"query","description":"Only the contacts of one result group","schema":{"type":"string","enum":["clean","flagged","kept","failed"]}},{"name":"list","required":false,"in":"query","description":"Only one list of the group, which then must be flagged or kept: for flagged a list key (tcpa, troll, dnc_complainers, federal_dnc, state_dnc, nra, other) or legacy, and a key it does not know matches no contact; for kept landline, voip or unknown.","schema":{"maxLength":64,"example":"federal_dnc","type":"string"}},{"name":"scrubId","required":true,"in":"path","description":"Scrub id, from GET /v1/scrubs (scrubs_list) or POST /v1/scrubs (scrubs_start)","schema":{"format":"uuid","example":"0b7f6c1e-5d1c-4a55-9f0e-3c2a7d9e4b10","type":"string"}}],"responses":{"200":{"description":"A page of contacts","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubContactResultPageRes"},"example":{"status":true,"message":"Ok","data":{"rows":[{"contactUuid":"550e8400-e29b-41d4-a716-446655440000","phoneNumber":"+15125550143","status":"completed","group":"kept","lineType":"landline","carrier":"AT&T","doNotCall":"clean","flaggedLists":[],"failureReason":null,"verifiedAt":"2026-11-17T15:04:02.118Z","removed":true,"removedAt":"2026-11-17T15:04:02.530Z"},{"contactUuid":"6ba7b810-9dad-41d1-80b4-00c04fd430c8","phoneNumber":"+13105550188","status":"completed","group":"flagged","lineType":"mobile","carrier":"Verizon","doNotCall":"flagged","flaggedLists":["tcpa","federal_dnc"],"failureReason":null,"verifiedAt":"2026-11-17T15:04:02.118Z","removed":false,"removedAt":null},{"contactUuid":"9a1e2b3c-4d5e-4f60-8a7b-1c2d3e4f5a6b","phoneNumber":"+14155550101","status":"failed","group":"failed","lineType":null,"carrier":null,"doNotCall":null,"flaggedLists":[],"failureReason":"stopped","verifiedAt":null,"removed":false,"removedAt":null}],"nextCursor":"c3IxOjEwMjQ0"}}}}},"400":{"description":"Refused: INVALID_CURSOR (a cursor this endpoint did not answer; checked before the scrub is looked up), INVALID_SCRUB_RESULT_SCOPE (a list with no group or with clean or failed; otherwise kept takes landline, voip or unknown, failed takes none, and flagged accepts any list key (one it does not know matches no contact)). A group outside clean, flagged, kept and failed answers the status text \"Bad Request\". A scrubId that is not a uuid answers the status text \"Bad Request\" before anything is read.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"examples":{"badCursor":{"summary":"A cursor this endpoint did not answer","value":{"statusCode":400,"error":"INVALID_CURSOR","message":"cursor is not a nextCursor this endpoint answered."}},"badList":{"summary":"A list the group does not have","value":{"statusCode":400,"error":"INVALID_SCRUB_RESULT_SCOPE","message":"Invalid scrubResultScope: the failed group has no lists"}},"badId":{"summary":"scrubId is not a uuid","value":{"statusCode":400,"error":"Bad Request","message":"Invalid UUID format for parameter: scrubId"}}}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"example":{"statusCode":401,"error":"Unauthorized","message":"Invalid API key"}}}},"403":{"description":"The key lacks the scope this call needs, or scrubs are not enabled for the account (\"This feature is unavailable at the moment.\"). Reads, preview and the results file need scrubs:read; start, stop, retry and remove need scrubs:write, which does not include scrubs:read. A missing scope answers message and errorCode only.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"examples":{"missingScope":{"summary":"The key lacks the scope","value":{"message":"Missing required permissions: scrubs:write","errorCode":"missing_scope"}},"notEnabled":{"summary":"Scrubs are not enabled for the account","value":{"statusCode":403,"error":"Forbidden","message":"This feature is unavailable at the moment."}}}}}},"404":{"description":"Refused: SCRUB_NOT_FOUND (no scrub of the account has this id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"examples":{"notFound":{"summary":"No scrub of the account has this id","value":{"statusCode":404,"error":"SCRUB_NOT_FOUND","message":"Scrub not found"}}}}}},"429":{"description":"Rate limit exceeded; retryAfter is in seconds","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"example":{"statusCode":429,"message":"Too many requests","error":"TOO_MANY_REQUESTS","retryAfter":12,"limit":120,"remaining":0,"reset":12}}}}},"security":[{"api-key":[]}],"summary":"List a scrub's contacts and results","tags":["Scrubs"],"x-mcp":{"maxResultChars":200000},"x-required-scope":"scrubs:read"}},"/api/v1/scrubs/{scrubId}/results-file":{"post":{"description":"Starts building a CSV of a completed or failed scrub's contacts: contactId, phoneNumber, status, group, lineType, carrier, doNotCall, flaggedLists, verifiedAt, removed, removedAt; no names. Answers the file state; poll GET /v1/scrubs/:scrubId/results-file (scrubs_get_results_file) until status is completed for the download link, valid one hour. A file still being built, or one finished within the last 10 minutes with no change to the scrub since, is answered again instead of a new one (a finished one already completed, with a new link).","operationId":"ScrubsController_requestResultsFile","parameters":[{"name":"scrubId","required":true,"in":"path","description":"Scrub id, from GET /v1/scrubs (scrubs_list) or POST /v1/scrubs (scrubs_start)","schema":{"format":"uuid","example":"0b7f6c1e-5d1c-4a55-9f0e-3c2a7d9e4b10","type":"string"}}],"responses":{"202":{"description":"The file state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubResultsFileRes"},"examples":{"started":{"summary":"A new file, queued","value":{"status":true,"message":"Ok","data":{"scrubId":"0b7f6c1e-5d1c-4a55-9f0e-3c2a7d9e4b10","status":"pending","progress":{"total":1500,"processed":0,"percentage":0},"requestedAt":"2026-11-17T15:12:00.000Z","generatedAt":null,"download":null,"error":null}}},"reused":{"summary":"A file finished within the last 10 minutes, answered again","value":{"status":true,"message":"Ok","data":{"scrubId":"0b7f6c1e-5d1c-4a55-9f0e-3c2a7d9e4b10","status":"completed","progress":{"total":1500,"processed":1500,"percentage":100},"requestedAt":"2026-11-17T15:12:00.000Z","generatedAt":"2026-11-17T15:12:41.902Z","download":{"downloadUrl":"https://files.example.com/exports/scrub_results_2026-11-17.csv?expires=3600&signature=4f9c2e","expiresAt":"2026-11-17T16:20:05.000Z","expiresIn":3600,"filename":"scrub_results_2026-11-17.csv","fileSize":142381,"rowCount":1488},"error":null}}}}}}},"400":{"description":"A scrubId that is not a uuid answers the status text \"Bad Request\" before anything is read.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"examples":{"badId":{"summary":"scrubId is not a uuid","value":{"statusCode":400,"error":"Bad Request","message":"Invalid UUID format for parameter: scrubId"}}}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"example":{"statusCode":401,"error":"Unauthorized","message":"Invalid API key"}}}},"403":{"description":"The key lacks the scope this call needs, or scrubs are not enabled for the account (\"This feature is unavailable at the moment.\"). Reads, preview and the results file need scrubs:read; start, stop, retry and remove need scrubs:write, which does not include scrubs:read. A missing scope answers message and errorCode only.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"examples":{"missingScope":{"summary":"The key lacks the scope","value":{"message":"Missing required permissions: scrubs:write","errorCode":"missing_scope"}},"notEnabled":{"summary":"Scrubs are not enabled for the account","value":{"statusCode":403,"error":"Forbidden","message":"This feature is unavailable at the moment."}}}}}},"404":{"description":"Refused: SCRUB_NOT_FOUND (no scrub of the account has this id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"examples":{"notFound":{"summary":"No scrub of the account has this id","value":{"statusCode":404,"error":"SCRUB_NOT_FOUND","message":"Scrub not found"}}}}}},"409":{"description":"Refused: SCRUB_NOT_FINISHED (the scrub is still pending or in progress).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"examples":{"notFinished":{"summary":"The scrub is still pending or in progress","value":{"statusCode":409,"error":"SCRUB_NOT_FINISHED","message":"The scrub has not finished. Request the results file once it is completed or failed."}}}}}},"429":{"description":"Rate limit exceeded; retryAfter is in seconds","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"example":{"statusCode":429,"message":"Too many requests","error":"TOO_MANY_REQUESTS","retryAfter":12,"limit":120,"remaining":0,"reset":12}}}}},"security":[{"api-key":[]}],"summary":"Request a scrub's results file","tags":["Scrubs"],"x-mcp":{"readOnly":true,"title":"Start a scrub results file"},"x-required-scope":"scrubs:read"},"get":{"description":"The current results file of the scrub: status (pending, in_progress, completed, failed), progress, and once completed a download link valid one hour from this answer (every read signs a new one). A file is requested with POST /v1/scrubs/:scrubId/results-file (scrubs_request_results_file); old files can expire, and the scrub then answers as if none was requested.","operationId":"ScrubsController_getResultsFile","parameters":[{"name":"scrubId","required":true,"in":"path","description":"Scrub id, from GET /v1/scrubs (scrubs_list) or POST /v1/scrubs (scrubs_start)","schema":{"format":"uuid","example":"0b7f6c1e-5d1c-4a55-9f0e-3c2a7d9e4b10","type":"string"}}],"responses":{"200":{"description":"The file state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubResultsFileRes"},"examples":{"completed":{"summary":"Completed, with a fresh link","value":{"status":true,"message":"Ok","data":{"scrubId":"0b7f6c1e-5d1c-4a55-9f0e-3c2a7d9e4b10","status":"completed","progress":{"total":1500,"processed":1500,"percentage":100},"requestedAt":"2026-11-17T15:12:00.000Z","generatedAt":"2026-11-17T15:12:41.902Z","download":{"downloadUrl":"https://files.example.com/exports/scrub_results_2026-11-17.csv?expires=3600&signature=4f9c2e","expiresAt":"2026-11-17T16:20:05.000Z","expiresIn":3600,"filename":"scrub_results_2026-11-17.csv","fileSize":142381,"rowCount":1488},"error":null}}},"inProgress":{"summary":"Still being written","value":{"status":true,"message":"Ok","data":{"scrubId":"0b7f6c1e-5d1c-4a55-9f0e-3c2a7d9e4b10","status":"in_progress","progress":{"total":1500,"processed":500,"percentage":33},"requestedAt":"2026-11-17T15:12:00.000Z","generatedAt":null,"download":null,"error":null}}}}}}},"400":{"description":"A scrubId that is not a uuid answers the status text \"Bad Request\" before anything is read.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"examples":{"badId":{"summary":"scrubId is not a uuid","value":{"statusCode":400,"error":"Bad Request","message":"Invalid UUID format for parameter: scrubId"}}}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"example":{"statusCode":401,"error":"Unauthorized","message":"Invalid API key"}}}},"403":{"description":"The key lacks the scope this call needs, or scrubs are not enabled for the account (\"This feature is unavailable at the moment.\"). Reads, preview and the results file need scrubs:read; start, stop, retry and remove need scrubs:write, which does not include scrubs:read. A missing scope answers message and errorCode only.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"examples":{"missingScope":{"summary":"The key lacks the scope","value":{"message":"Missing required permissions: scrubs:write","errorCode":"missing_scope"}},"notEnabled":{"summary":"Scrubs are not enabled for the account","value":{"statusCode":403,"error":"Forbidden","message":"This feature is unavailable at the moment."}}}}}},"404":{"description":"Refused: SCRUB_NOT_FOUND (no scrub of the account has this id), RESULTS_FILE_NOT_REQUESTED (no file was requested for this scrub yet).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"examples":{"notFound":{"summary":"No scrub of the account has this id","value":{"statusCode":404,"error":"SCRUB_NOT_FOUND","message":"Scrub not found"}},"notRequested":{"summary":"No file was requested for this scrub yet","value":{"message":"No results file was requested for this scrub. Request one first; it is built in the background.","error":"RESULTS_FILE_NOT_REQUESTED","scrubId":"0b7f6c1e-5d1c-4a55-9f0e-3c2a7d9e4b10","statusCode":404}}}}}},"429":{"description":"Rate limit exceeded; retryAfter is in seconds","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"example":{"statusCode":429,"message":"Too many requests","error":"TOO_MANY_REQUESTS","retryAfter":12,"limit":120,"remaining":0,"reset":12}}}}},"security":[{"api-key":[]}],"summary":"Get a scrub's results file","tags":["Scrubs"],"x-required-scope":"scrubs:read"}},"/api/v1/scrubs/{scrubId}/remove":{"post":{"description":"Deletes the remaining contacts of a scrub in the categories named, any mix of groups in one background job: categories takes the keys of GET /v1/scrubs/:scrubId/summary (scrubs_get_summary), whose rows carry this exact body; other covers every list outside the named keys. The older form { group, list } deletes one result group or one list of it; clean contacts are never deleted. The answer is always totalContacts 0 and initializing true with an operationId; GET /v1/async-operations/:operationId (async_operations_api_get_operation), which needs the async-operations:read scope, reports the count and progress. Each call starts a new deletion; deleted contacts stay listed with removed true.","operationId":"ScrubsController_removeResults","parameters":[{"name":"scrubId","required":true,"in":"path","description":"Scrub id, from GET /v1/scrubs (scrubs_list) or POST /v1/scrubs (scrubs_start)","schema":{"format":"uuid","example":"0b7f6c1e-5d1c-4a55-9f0e-3c2a7d9e4b10","type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubRemoveDto"},"examples":{"oneCategory":{"summary":"One category: the state do-not-call lists","value":{"categories":["state_dnc"]}},"severalCategories":{"summary":"Several lists of the flagged group in one job","value":{"categories":["federal_dnc","state_dnc","tcpa"]}},"mixedCategories":{"summary":"Categories of different groups in one job","value":{"categories":["tcpa","landline","voip"]}},"flagged":{"summary":"Older form: every flagged contact","value":{"group":"flagged"}},"federalDnc":{"summary":"Older form: flagged contacts on the federal do-not-call list","value":{"group":"flagged","list":"federal_dnc"}},"landlines":{"summary":"Older form: landline numbers (group kept, list landline)","value":{"group":"kept","list":"landline"}},"failed":{"summary":"Older form: contacts whose check failed","value":{"group":"failed"}}}}}},"responses":{"202":{"description":"The deletion, accepted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubRemoveRes"},"example":{"status":true,"message":"Ok","data":{"operationId":"7f3c2a10-4b5e-4d6f-8a9b-0c1d2e3f4a5b","totalContacts":0,"initializing":true}}}}},"400":{"description":"Refused: INVALID_SCRUB_RESULT_SCOPE (categories together with group or list, neither of them, a list with no group, or a list the group does not have: kept takes landline, voip or unknown, failed takes none, and flagged accepts any list key (one it does not know matches no contact)). A group outside flagged, kept and failed, or categories empty, over 12 keys, repeating a key or naming one that is not a category, is a malformed body. A malformed body answers the status text \"Bad Request\" with every problem in message[]. A scrubId that is not a uuid answers the status text \"Bad Request\" before anything is read.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"examples":{"badList":{"summary":"A list the group does not have","value":{"statusCode":400,"error":"INVALID_SCRUB_RESULT_SCOPE","message":"Invalid scrubResultScope: unknown kept list \"mobile\""}},"badGroup":{"summary":"A group that cannot be removed (clean)","value":{"statusCode":400,"error":"Bad Request","message":["group must be one of the following values: flagged, kept, failed"]}},"bothForms":{"summary":"categories together with group or list","value":{"statusCode":400,"error":"INVALID_SCRUB_RESULT_SCOPE","message":"Name the contacts to remove with categories, or with group and list, not both."}},"neitherForm":{"summary":"Neither categories nor group","value":{"statusCode":400,"error":"INVALID_SCRUB_RESULT_SCOPE","message":"Name the contacts to remove with categories, or with group and list."}},"listWithoutGroup":{"summary":"A list with no group","value":{"statusCode":400,"error":"INVALID_SCRUB_RESULT_SCOPE","message":"list needs a group."}},"badCategory":{"summary":"A categories entry that is not a category key","value":{"statusCode":400,"error":"Bad Request","message":["each value in categories must be one of the following values: tcpa, troll, federal_dnc, state_dnc, dnc_complainers, nra, other, legacy, landline, voip, unknown, failed"]}},"badId":{"summary":"scrubId is not a uuid","value":{"statusCode":400,"error":"Bad Request","message":"Invalid UUID format for parameter: scrubId"}}}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"example":{"statusCode":401,"error":"Unauthorized","message":"Invalid API key"}}}},"403":{"description":"The key lacks the scope this call needs, or scrubs are not enabled for the account (\"This feature is unavailable at the moment.\"). Reads, preview and the results file need scrubs:read; start, stop, retry and remove need scrubs:write, which does not include scrubs:read. A missing scope answers message and errorCode only.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"examples":{"missingScope":{"summary":"The key lacks the scope","value":{"message":"Missing required permissions: scrubs:write","errorCode":"missing_scope"}},"notEnabled":{"summary":"Scrubs are not enabled for the account","value":{"statusCode":403,"error":"Forbidden","message":"This feature is unavailable at the moment."}}}}}},"404":{"description":"Refused: SCRUB_NOT_FOUND (no scrub of the account has this id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"examples":{"notFound":{"summary":"No scrub of the account has this id","value":{"statusCode":404,"error":"SCRUB_NOT_FOUND","message":"Scrub not found"}}}}}},"409":{"description":"Refused while a contact import of the account is running (status text \"Conflict\").","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"examples":{"importRunning":{"summary":"A contact import of the account is running","value":{"statusCode":409,"error":"Conflict","message":"An import is currently running. Wait for it to finish before deleting contacts."}}}}}},"429":{"description":"Rate limit exceeded; retryAfter is in seconds","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"example":{"statusCode":429,"message":"Too many requests","error":"TOO_MANY_REQUESTS","retryAfter":12,"limit":120,"remaining":0,"reset":12}}}},"503":{"description":"Contact deletion is unavailable for a moment (status text \"Service Unavailable\"); nothing was deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrubsApiErrorRes"},"examples":{"unavailable":{"summary":"Deletion is unavailable for a moment; nothing was deleted","value":{"statusCode":503,"error":"Service Unavailable","message":"Contact deletion is temporarily unavailable — nothing was deleted. Please try again shortly."}}}}}}},"security":[{"api-key":[]}],"summary":"Delete a scrub's contacts by category","tags":["Scrubs"],"x-mcp":{"title":"Delete the contacts of scrub result categories","destructive":true},"x-required-scope":"scrubs:write"}},"/api/v1/messages":{"get":{"description":"Returns paginated list of messages. Either conversationId or contactUuid must be provided to narrow the query.","operationId":"MessagesController_list","parameters":[{"name":"page","required":false,"in":"query","description":"Page number","schema":{"example":"1","type":"string"}},{"name":"take","required":false,"in":"query","description":"Items per page (max 500)","schema":{"example":"20","type":"string"}},{"name":"search","required":false,"in":"query","description":"Search in message content","schema":{"type":"string"}},{"name":"conversationId","required":false,"in":"query","description":"Filter by conversation ID (required if contactUuid is not provided)","schema":{"type":"string"}},{"name":"contactUuid","required":false,"in":"query","description":"Filter by contact UUID (required if conversationId is not provided)","schema":{"type":"string"}},{"name":"direction","required":false,"in":"query","description":"Filter by message direction: outbound = sent by the account, inbound = received by it","schema":{"type":"string","enum":["inbound","outbound"]}},{"name":"status","required":false,"in":"query","description":"Filter by the message's current status (the same status each row reports), not by any earlier status it passed through","schema":{"type":"string","enum":["sending","sent","delivered","failed","undelivered","received","scheduled"]}},{"name":"createdAfter","required":false,"in":"query","description":"Filter messages created after this date (ISO 8601)","schema":{"example":"2024-01-01T00:00:00Z","type":"string"}},{"name":"createdBefore","required":false,"in":"query","description":"Filter messages created before this date (ISO 8601)","schema":{"example":"2024-12-31T23:59:59Z","type":"string"}}],"responses":{"200":{"description":"Messages retrieved successfully"},"400":{"description":"Missing required filter (conversationId or contactUuid)"},"401":{"description":"Invalid or missing API key"},"403":{"description":"Insufficient permissions (requires messages:read)"}},"security":[{"api-key":[]}],"summary":"List messages","tags":["Messages"],"x-required-scope":"messages:read"},"post":{"deprecated":true,"description":"Deprecated: use `POST /v2/messages`, which accepts the message immediately (202) and is idempotent, so a retried request never sends twice. This endpoint waits for the carrier and is not idempotent. It remains for `scheduledFor`, which v2 does not take yet. Sends a single message to a contact identified by contactUuid or toNumber (E.164). Creates conversation if needed. Deducts credits. With a future scheduledFor the message is queued instead: the response reports status \"scheduled\" and creditsDeducted null, and credits are charged when it is sent.","operationId":"MessagesController_send","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendMessageDto"}}}},"responses":{"201":{"description":"Message sent successfully"},"400":{"description":"Invalid request body, contact opted out, number in your blocked list, or invalid phone format"},"402":{"description":"Insufficient credits"},"403":{"description":"No active subscription (errorCode `subscription_required`), phone number not owned by user, or insufficient permissions"},"404":{"description":"Contact not found"}},"security":[{"api-key":[]}],"summary":"Send message V1","tags":["Messages"],"x-mcp":{"title":"Send an SMS, v1 (uses credits)","destructive":true,"openWorld":true,"description":"Deprecated: use messages_v2_send, which accepts the message immediately and is idempotent, so a retried call never sends twice. This tool waits for the carrier and is not idempotent. It remains for scheduledFor, which messages_v2_send does not take yet. Sends a single message to a contact identified by contactUuid or toNumber (E.164). Creates the conversation if needed. Deducts credits. With a future scheduledFor the message is queued instead: the response reports status \"scheduled\" and creditsDeducted null, and credits are charged when it is sent."},"x-required-scope":"messages:write"}},"/api/v1/messages/{id}":{"get":{"description":"Retrieves a single message by ID","operationId":"MessagesController_get","parameters":[{"name":"id","required":true,"in":"path","description":"Message ID","schema":{"type":"integer"}}],"responses":{"200":{"description":"Message retrieved successfully"},"404":{"description":"Message not found"}},"security":[{"api-key":[]}],"summary":"Get message","tags":["Messages"],"x-required-scope":"messages:read"}},"/api/v2/messages":{"post":{"description":"Accepts a single message for a contact identified by contactUuid or toNumber (E.164) and sends it in the background. Requires an idempotency key, sent as the `Idempotency-Key` header or as the `idempotencyKey` body field (8-255 chars of letters, digits, \".\", \"_\", \":\" or \"-\"): repeating a request with the same key returns the same message (202 with `Idempotent-Replayed: true`) instead of sending twice; the same key with a different recipient, sender or content is refused with 422. The response reports status \"sending\" and creditsDeducted null; credits are charged when the message is sent. Poll GET /v2/messages/:id (MCP tool `messages_v2_get`) or /v2/messages/by-key/:key (`messages_v2_get_by_key`), or use the message.sent / message.failed webhooks, for the final status. scheduledFor is not supported; use POST /v1/messages.","operationId":"MessagesV2Controller_send","parameters":[{"name":"Idempotency-Key","in":"header","description":"Client-generated key that identifies this send; a UUID is a good choice. Required unless `idempotencyKey` is sent in the body.","required":false,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendMessageV2Dto"}}}},"responses":{"202":{"description":"Message accepted for sending. `Idempotent-Replayed: true` when a previous request with this key was already accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendMessageV2Res"}}}},"400":{"description":"Missing or malformed Idempotency-Key, invalid request body, scheduledFor present, contact opted out, number in your blocked list, or account paused"},"402":{"description":"Insufficient credits"},"403":{"description":"No active subscription (errorCode `subscription_required`), phone number not owned by the account, or insufficient permissions"},"404":{"description":"Contact not found"},"422":{"description":"Idempotency-Key already used for a different request"}},"security":[{"api-key":[]}],"summary":"Send message V2","tags":["Messages"],"x-mcp":{"title":"Send an SMS (uses credits)","destructive":true,"idempotent":true,"openWorld":true,"description":"Accepts a single message for a contact identified by contactUuid or toNumber (E.164) and sends it in the background. Requires idempotencyKey (8-255 chars of letters, digits, \".\", \"_\", \":\" or \"-\"): repeating a call with the same key returns the same message instead of sending twice; the same key with a different recipient, sender or content is refused. The response reports status \"sending\" and creditsDeducted null; credits are charged when the message is sent. Poll messages_v2_get or messages_v2_get_by_key, or use the message.sent / message.failed webhooks, for the final status. scheduledFor is not supported; to schedule a message use messages_send."},"x-required-scope":"messages:write"}},"/api/v2/messages/by-key/{key}":{"get":{"description":"Retrieves the message accepted under an Idempotency-Key of this account. Keys are kept for 24 hours after the send finishes; after that use GET /v2/messages/:id.","operationId":"MessagesV2Controller_getByKey","parameters":[{"name":"key","required":true,"in":"path","description":"The Idempotency-Key the send was accepted under","schema":{"type":"string"}}],"responses":{"200":{"description":"Message retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageRes"}}}},"400":{"description":"Malformed Idempotency-Key"},"404":{"description":"No message accepted under this key"}},"security":[{"api-key":[]}],"summary":"Get message V2 by Idempotency-Key","tags":["Messages"],"x-mcp":{"title":"Get a sent message by idempotency key","description":"Retrieves the message accepted under an idempotency key of this account. Keys are kept for 24 hours after the send finishes; after that use messages_v2_get."},"x-required-scope":"messages:read"}},"/api/v2/messages/{id}":{"get":{"description":"Retrieves a single message by ID","operationId":"MessagesV2Controller_get","parameters":[{"name":"id","required":true,"in":"path","description":"Message ID","schema":{"type":"integer"}}],"responses":{"200":{"description":"Message retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageRes"}}}},"404":{"description":"Message not found"}},"security":[{"api-key":[]}],"summary":"Get message V2","tags":["Messages"],"x-mcp":{"title":"Get a sent message"},"x-required-scope":"messages:read"}},"/api/v1/conversations":{"get":{"description":"Returns paginated list of conversations with optional filtering","operationId":"ConversationsController_list","parameters":[{"name":"page","required":false,"in":"query","description":"Page number","schema":{"example":"1","type":"string"}},{"name":"take","required":false,"in":"query","description":"Items per page (max 500)","schema":{"example":"20","type":"string"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive word-prefix match on lastMessageContent (e.g. \"our prop\" finds \"Is our property available?\"), or a phone number: a complete number (formatting ignored) matches fromNumber exactly, 4+ digits match part of it. Does not search contact names.","schema":{"type":"string"}},{"name":"isArchived","required":false,"in":"query","description":"Filter by archived status","schema":{"type":"boolean"}},{"name":"isRead","required":false,"in":"query","description":"Filter by read status","schema":{"type":"boolean"}},{"name":"starred","required":false,"in":"query","description":"Filter to conversations whose contact is starred/favorited","schema":{"type":"boolean"}},{"name":"contactUuid","required":false,"in":"query","description":"Filter by contact UUID","schema":{"type":"string"}}],"responses":{"200":{"description":"Conversations retrieved successfully"},"401":{"description":"Invalid or missing API key"},"403":{"description":"Insufficient permissions (requires conversations:read)"}},"security":[{"api-key":[]}],"summary":"List conversations","tags":["Conversations"],"x-required-scope":"conversations:read"}},"/api/v1/conversations/{id}":{"get":{"description":"Retrieves a single conversation by its integer ID. Not the contactUuid. To find a contact's conversation, list conversations filtered by contactUuid.","operationId":"ConversationsController_get","parameters":[{"name":"id","required":true,"in":"path","description":"Conversation ID (integer; the \"id\" field of a conversation). Not the contactUuid. To find a contact's conversation, list conversations filtered by contactUuid.","schema":{"type":"integer"}}],"responses":{"200":{"description":"Conversation retrieved successfully"},"400":{"description":"id is not an integer"},"404":{"description":"Conversation not found"}},"security":[{"api-key":[]}],"summary":"Get conversation","tags":["Conversations"],"x-required-scope":"conversations:read"},"patch":{"description":"Update conversation archived or read status","operationId":"ConversationsController_update","parameters":[{"name":"id","required":true,"in":"path","description":"Conversation ID (integer; the \"id\" field of a conversation). Not the contactUuid. To find a contact's conversation, list conversations filtered by contactUuid.","schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateConversationDto"}}}},"responses":{"200":{"description":"Conversation updated successfully"},"400":{"description":"Invalid request body or non-integer id"},"404":{"description":"Conversation not found"}},"security":[{"api-key":[]}],"summary":"Update conversation","tags":["Conversations"],"x-required-scope":"conversations:write"}},"/api/v1/conversations/{id}/messages":{"get":{"description":"Retrieves paginated messages for a conversation by its integer ID. Not the contactUuid. To find a contact's conversation, list conversations filtered by contactUuid.","operationId":"ConversationsController_getMessages","parameters":[{"name":"id","required":true,"in":"path","description":"Conversation ID (integer; the \"id\" field of a conversation). Not the contactUuid. To find a contact's conversation, list conversations filtered by contactUuid.","schema":{"type":"integer"}},{"name":"page","required":false,"in":"query","description":"Page number","schema":{"example":"1","type":"string"}},{"name":"take","required":false,"in":"query","description":"Items per page (max 500)","schema":{"example":"20","type":"string"}},{"name":"status","required":false,"in":"query","description":"Filter by message status","schema":{"type":"string"}}],"responses":{"200":{"description":"Messages retrieved successfully"},"400":{"description":"id is not an integer"},"404":{"description":"Conversation not found"}},"security":[{"api-key":[]}],"summary":"Get conversation messages","tags":["Conversations"],"x-mcp":{"maxResultChars":200000},"x-required-scope":"conversations:read"}},"/api/v1/conversations/bulk":{"post":{"description":"Perform bulk operations (archive, unarchive, read, unread) on multiple conversations","operationId":"ConversationsController_bulkUpdate","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkUpdateConversationsDto"}}}},"responses":{"200":{"description":"Bulk operation completed successfully"},"400":{"description":"Invalid request body"}},"security":[{"api-key":[]}],"summary":"Bulk update conversations","tags":["Conversations"],"x-required-scope":"conversations:write"}},"/api/v1/campaigns":{"get":{"description":"Returns paginated list of campaigns with optional filtering","operationId":"CampaignsController_list","parameters":[{"name":"page","required":false,"in":"query","description":"Page number","schema":{"example":"1","type":"string"}},{"name":"take","required":false,"in":"query","description":"Items per page (max 500)","schema":{"example":"20","type":"string"}},{"name":"search","required":false,"in":"query","description":"Search by campaign name","schema":{"type":"string"}},{"name":"status","required":false,"in":"query","description":"Filter by campaign status","schema":{"type":"string","enum":["not_started","scheduled","in_progress","paused","completed","cancelled","failed"]}},{"name":"type","required":false,"in":"query","description":"Filter by campaign type","schema":{"type":"string","enum":["sms","workflow"]}}],"responses":{"200":{"description":"Campaigns retrieved successfully"}},"security":[{"api-key":[]}],"summary":"List campaigns","tags":["Campaigns"],"x-required-scope":"campaigns:read"},"post":{"description":"Creates a new campaign. Add contacts separately via POST /:id/contacts. The message of an SMS campaign is checked at once and never refused here: the reply carries the result in compliance. A message that fails is refused later, at the first start.","operationId":"CampaignsController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCampaignDto"}}}},"responses":{"201":{"description":"Campaign created successfully"},"400":{"description":"Refused: MESSAGE_NOT_FOR_WORKFLOW_CAMPAIGN (a message with text on a workflow campaign, which sends the text steps of its workflow); or an invalid request body."}},"security":[{"api-key":[]}],"summary":"Create campaign","tags":["Campaigns"],"x-mcp":{"destructive":false,"title":"Create a draft campaign (sends nothing)","description":"Creates a new campaign. Add contacts separately with campaigns_add_contacts. Read compliance in the reply: status issues means campaigns_start will be refused until the message is fixed. Read mergeFieldWarnings for merge fields that will not be filled. A workflow campaign takes no message."},"x-required-scope":"campaigns:write"}},"/api/v1/campaigns/{id}":{"get":{"description":"Retrieves a single campaign by ID with stats","operationId":"CampaignsController_get","parameters":[{"name":"id","required":true,"in":"path","description":"Campaign ID","schema":{"type":"number"}}],"responses":{"200":{"description":"Campaign retrieved successfully"},"404":{"description":"Campaign not found"}},"security":[{"api-key":[]}],"summary":"Get campaign","tags":["Campaigns"],"x-required-scope":"campaigns:read"},"patch":{"description":"Updates a campaign. A scheduled campaign starting within a minute cannot be edited, and an in-progress campaign only accepts message changes. A message change is refused with MESSAGE_NOT_COMPLIANT (422) only when the campaign has been started (status scheduled, in_progress, paused, completed or failed) and the new message fails the check; on a not_started campaign it is saved and the result is in compliance. A workflow campaign takes no message.","operationId":"CampaignsController_update","parameters":[{"name":"id","required":true,"in":"path","description":"Campaign ID","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCampaignDto"}}}},"responses":{"200":{"description":"Campaign updated successfully"},"400":{"description":"Refused: MESSAGE_NOT_FOR_WORKFLOW_CAMPAIGN (a message with text on a workflow campaign, which sends the text steps of its workflow); or an invalid request body. Also when the campaign cannot be updated in its current state."},"404":{"description":"Campaign not found"},"422":{"description":"Refused: MESSAGE_NOT_COMPLIANT (the message, or a variant, does not name the brand or give opt-out wording; message lists every issue and how to fix it; test a text first with compliance_check), BRAND_REQUIRED (the account has no 10DLC brand, so the message cannot be checked). Only when the campaign has been started (status scheduled, in_progress, paused, completed or failed) and this update changes its message. A not_started campaign is saved; read compliance in the reply."},"503":{"description":"COMPLIANCE_UNAVAILABLE: only on the updates that can answer 422 (a started campaign whose message changes): the check could not run, so nothing was saved. Safe to retry in a few minutes."}},"security":[{"api-key":[]}],"summary":"Update campaign","tags":["Campaigns"],"x-required-scope":"campaigns:write"},"delete":{"description":"Permanently deletes a campaign and all associated data","operationId":"CampaignsController_delete","parameters":[{"name":"id","required":true,"in":"path","description":"Campaign ID","schema":{"type":"number"}}],"responses":{"204":{"description":"Campaign deleted successfully"},"404":{"description":"Campaign not found"}},"security":[{"api-key":[]}],"summary":"Delete campaign","tags":["Campaigns"],"x-required-scope":"campaigns:write"}},"/api/v1/campaigns/{id}/start":{"post":{"description":"Starts a campaign. A campaign with no contacts yet can be started.","operationId":"CampaignsController_start","parameters":[{"name":"id","required":true,"in":"path","description":"Campaign ID","schema":{"type":"number"}}],"responses":{"200":{"description":"Campaign started successfully"},"400":{"description":"Campaign cannot be started"},"402":{"description":"Insufficient credits"},"403":{"description":"subscription_required, campaign_start_blocked (onboarding) or account_paused (system pause)"},"404":{"description":"Campaign not found"},"422":{"description":"Refused: MESSAGE_NOT_COMPLIANT (the message, or a variant, does not name the brand or give opt-out wording; message lists every issue and how to fix it; test a text first with compliance_check), BRAND_REQUIRED (the account has no 10DLC brand, so the message cannot be checked). Checked on the first start only (status not_started); a resume or a restart is not checked."},"503":{"description":"COMPLIANCE_UNAVAILABLE: the compliance check could not run, so nothing was saved or started. Safe to retry in a few minutes."}},"security":[{"api-key":[]}],"summary":"Start campaign","tags":["Campaigns"],"x-mcp":{"title":"Start a campaign (sends SMS, uses credits)","destructive":true,"openWorld":true},"x-required-scope":"campaigns:write"}},"/api/v1/campaigns/{id}/pause":{"post":{"description":"Pauses an in-progress or scheduled campaign","operationId":"CampaignsController_pause","parameters":[{"name":"id","required":true,"in":"path","description":"Campaign ID","schema":{"type":"number"}}],"responses":{"200":{"description":"Campaign paused successfully"},"400":{"description":"Campaign cannot be paused"},"404":{"description":"Campaign not found"}},"security":[{"api-key":[]}],"summary":"Pause campaign","tags":["Campaigns"],"x-mcp":{"destructive":false,"idempotent":true},"x-required-scope":"campaigns:write"}},"/api/v1/campaigns/{id}/resume":{"post":{"description":"Resumes a paused campaign, which continues sending SMS to its remaining contacts and uses credits.","operationId":"CampaignsController_resume","parameters":[{"name":"id","required":true,"in":"path","description":"Campaign ID","schema":{"type":"number"}}],"responses":{"200":{"description":"Campaign resumed successfully"},"400":{"description":"Campaign cannot be resumed"},"402":{"description":"Insufficient credits"},"403":{"description":"subscription_required, campaign_start_blocked (onboarding) or account_paused (system pause)"},"404":{"description":"Campaign not found"}},"security":[{"api-key":[]}],"summary":"Resume campaign","tags":["Campaigns"],"x-mcp":{"title":"Resume a campaign (sends SMS, uses credits)","destructive":true,"openWorld":true},"x-required-scope":"campaigns:write"}},"/api/v1/campaigns/{id}/contacts":{"get":{"description":"Returns paginated list of contacts in a campaign with status","operationId":"CampaignsController_listContacts","parameters":[{"name":"id","required":true,"in":"path","description":"Campaign ID","schema":{"type":"number"}},{"name":"page","required":false,"in":"query","description":"Page number","schema":{"example":"1","type":"string"}},{"name":"take","required":false,"in":"query","description":"Items per page (max 500)","schema":{"example":"20","type":"string"}},{"name":"status","required":false,"in":"query","description":"Filter by campaign contact status","schema":{"type":"string","enum":["pending","processed","succeeded","failed"]}}],"responses":{"200":{"description":"Campaign contacts retrieved successfully"},"404":{"description":"Campaign not found"}},"security":[{"api-key":[]}],"summary":"List campaign contacts","tags":["Campaigns"],"x-required-scope":"campaigns:read"},"post":{"description":"Adds contacts to a campaign by their UUIDs, in any status. Contacts who opted out within 30 days refuse the whole request with 400 HIGH_RISK_CONTACTS. Contacts that cannot be added are counted in filtered, and filteredReasons says why: notFound, alreadyInCampaign, optedOut, undelivered, activeEnrollment or reentryBlocked.","operationId":"CampaignsController_addContacts","parameters":[{"name":"id","required":true,"in":"path","description":"Campaign ID","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddContactsToCampaignDto"}}}},"responses":{"201":{"description":"Contacts added successfully"},"400":{"description":"Invalid request, or HIGH_RISK_CONTACTS"},"404":{"description":"Campaign not found"}},"security":[{"api-key":[]}],"summary":"Add contacts to campaign","tags":["Campaigns"],"x-mcp":{"title":"Add contacts to a campaign (may send SMS)","destructive":true,"openWorld":true},"x-required-scope":"campaigns:write"}},"/api/v1/phone-numbers":{"get":{"description":"Returns a paginated list of the phone numbers owned by the account, including each number's 10DLC compliance-campaign attachment and labels.","operationId":"PhoneNumbersController_list","parameters":[{"name":"page","required":false,"in":"query","description":"Page number","schema":{"example":"1","type":"string"}},{"name":"take","required":false,"in":"query","description":"Items per page (max 500)","schema":{"example":"20","type":"string"}}],"responses":{"200":{"description":"Phone numbers retrieved successfully"}},"security":[{"api-key":[]}],"summary":"List phone numbers","tags":["Phone Numbers"],"x-required-scope":"phone-numbers:read"}},"/api/v1/phone-numbers/forwarding/bulk":{"post":{"description":"Applies a forwarding change to a selection of numbers. Pass `forwardTo: null` or an empty string to clear forwarding. Numbers are processed sequentially and a number that cannot be updated does not stop the rest, so a partial failure still returns 200 — inspect `failures`.","operationId":"PhoneNumbersController_setForwardingBulk","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkForwardingDto"}}}},"responses":{"200":{"description":"Count of updated numbers plus any per-number failures"},"400":{"description":"Invalid destination or selection"}},"security":[{"api-key":[]}],"summary":"Set or clear call forwarding in bulk","tags":["Phone Numbers"],"x-mcp":{"openWorld":true},"x-required-scope":"phone-numbers:write"}},"/api/v1/phone-numbers/{id}":{"get":{"description":"Retrieves a single phone number by ID with its 10DLC compliance-campaign attachment and labels.","operationId":"PhoneNumbersController_get","parameters":[{"name":"id","required":true,"in":"path","description":"Phone number ID","schema":{"type":"number"}}],"responses":{"200":{"description":"Phone number retrieved successfully"},"404":{"description":"Phone number not found"}},"security":[{"api-key":[]}],"summary":"Get phone number","tags":["Phone Numbers"],"x-required-scope":"phone-numbers:read"}},"/api/v1/phone-numbers/{id}/forwarding":{"put":{"description":"Forwards inbound calls on this number to another destination. Only default-provider numbers support forwarding.","operationId":"PhoneNumbersController_setForwarding","parameters":[{"name":"id","required":true,"in":"path","description":"Phone number ID","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetForwardingDto"}}}},"responses":{"200":{"description":"Forwarding state after the change"},"400":{"description":"Invalid destination, self-forward, unprovisioned number, or unsupported provider"},"404":{"description":"Phone number not found"},"502":{"description":"The provider rejected the change"}},"security":[{"api-key":[]}],"summary":"Set call forwarding","tags":["Phone Numbers"],"x-mcp":{"openWorld":true},"x-required-scope":"phone-numbers:write"},"delete":{"description":"Stops forwarding inbound calls on this number. On a number that cannot forward calls this only removes any forwarding data stored for it, and always succeeds.","operationId":"PhoneNumbersController_clearForwarding","parameters":[{"name":"id","required":true,"in":"path","description":"Phone number ID","schema":{"type":"number"}}],"responses":{"200":{"description":"Forwarding state after the change"},"400":{"description":"Unprovisioned number"},"404":{"description":"Phone number not found"},"502":{"description":"The provider rejected the change"}},"security":[{"api-key":[]}],"summary":"Clear call forwarding","tags":["Phone Numbers"],"x-required-scope":"phone-numbers:write"}},"/api/v1/workflows":{"get":{"description":"The account's workflows, newest first, each with its trigger, settings, sending numbers and stats but without its steps (GET /v1/workflows/:id (workflows_get) has them). status filters on the effective status (draft, active, paused, completed, failed); search matches the name. Answers a page: rows of workflow summaries plus pagination (page, limit, totalItems). Use it to find the workflow id every other workflows call takes.","operationId":"WorkflowsController_list","parameters":[{"name":"page","required":false,"in":"query","description":"Page number","schema":{"example":"1","type":"string"}},{"name":"take","required":false,"in":"query","description":"Items per page (max 500)","schema":{"example":"20","type":"string"}},{"name":"search","required":false,"in":"query","description":"Search by workflow name","schema":{"type":"string"}},{"name":"status","required":false,"in":"query","description":"Filter by workflow status","schema":{"type":"string","enum":["draft","active","paused","completed","failed"]}}],"responses":{"200":{"description":"A page of workflows","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowListRes"}}}},"400":{"description":"Refused: an unknown status filter.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"403":{"description":"The key lacks the workflows scope, or the account has no active plan","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"List workflows (one page; filter by status or name search)","tags":["Workflows"],"x-required-scope":"workflows:read"},"post":{"description":"Creates a workflow from a required trigger, an ordered steps list of text (sendSms), wait and tag steps, each { type, name?, config }, plus optional settings (sending hours, timezone) and phoneConfig (sending numbers). Answers the workflow detail with every step's permanent nodeId. A draft unless status is \"active\"; no steps is a valid draft. Tag ids come from tags_list, number ids from phone_numbers_list. Rules as in the app: a tag starts at most one workflow per account, a tag step needs a tag, tags and numbers must be the account's, and publishing needs a usable sending number and no opt-out cooldown.","operationId":"WorkflowsController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateWorkflowDto"},"examples":{"tagTrigger":{"summary":"Started by a tag, with a text, a wait and a tag step","value":{"name":"New lead follow-up","trigger":{"type":"tag_applied","tagId":12},"steps":[{"type":"sendSms","name":"Welcome","config":{"message":"Hi {firstName}, thanks for reaching out! Reply STOP to opt out.","followUpMessage":"Hi again {firstName}, just checking in.","useFollowUpForExistingConversations":true,"cancelOnReply":true}},{"type":"wait","config":{"waitAmount":2,"waitUnit":"days"}},{"type":"tag","config":{"addTagIds":[12]}}],"settings":{"timeZone":"America/New_York","timeWindow":{"enabled":true,"startTime":"09:00","endTime":"18:00"}},"phoneConfig":{"mode":"single","defaultPhoneNumberId":3}}},"manualPool":{"summary":"Enrolled by hand or API, sending from a pool, published at once","value":{"name":"Re-engagement","status":"active","trigger":{"type":"manual"},"steps":[{"type":"sendSms","config":{"variants":[{"letter":"A","body":"Hi {firstName}, still interested?"},{"letter":"B","body":"Hello {firstName}, can we help?"}]}}],"phoneConfig":{"mode":"pool","poolPhoneNumberIds":[3,4]}}},"starred":{"summary":"Started when a contact is starred (no trigger setting)","value":{"name":"Starred contacts","trigger":{"type":"contact_starred"},"steps":[{"type":"sendSms","name":"Welcome","config":{"message":"Hi {firstName}, thanks for reaching out! Reply STOP to opt out.","followUpMessage":"Hi again {firstName}, just checking in.","useFollowUpForExistingConversations":true,"cancelOnReply":true}}]}},"unstarred":{"summary":"Started when a contact is unstarred (no trigger setting)","value":{"name":"Unstarred contacts","trigger":{"type":"contact_unstarred"},"steps":[{"type":"tag","config":{"addTagIds":[12]}}]}},"noShow":{"summary":"Started by an appointment no-show (no trigger setting)","value":{"name":"No-show follow-up","trigger":{"type":"appointment_no_show"},"steps":[{"type":"sendSms","name":"Welcome","config":{"message":"Hi {firstName}, thanks for reaching out! Reply STOP to opt out.","followUpMessage":"Hi again {firstName}, just checking in.","useFollowUpForExistingConversations":true,"cancelOnReply":true}},{"type":"wait","config":{"waitAmount":2,"waitUnit":"days"}},{"type":"sendSms","name":"Welcome","config":{"message":"Hi {firstName}, thanks for reaching out! Reply STOP to opt out.","followUpMessage":"Hi again {firstName}, just checking in.","useFollowUpForExistingConversations":true,"cancelOnReply":true}}]}},"sentimentTrigger":{"summary":"Started by a negative reply (accounts with the feature)","value":{"name":"Save the deal","trigger":{"type":"message_sentiment","sentiment":"negative","minConfidence":70},"steps":[{"type":"tag","config":{"addTagIds":[12]}}]}}}}}},"responses":{"201":{"description":"The workflow as GET answers it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowWriteRes"}}}},"400":{"description":"Refused: STEP_CONFIG_INVALID (a config fails the rules of its step type), FIELD_NOT_FOR_STEP_TYPE (a config key of another step type), TAG_STEP_INVALID (a tag step with no tag, or a tag both added and removed), TRIGGER_INVALID (a trigger setting missing or foreign), UNKNOWN_STEP (a nodeId on create), DUPLICATE_TAG_TRIGGER (the tag already starts another workflow), TAG_NOT_OWNED (a tag that is not the account's), WORKFLOW_PHONE_NUMBER_INVALID (a number that is not usable or not the account's), TIME_WINDOW_INVALID (sending hours), PHONE_CONFIG_UNSATISFIABLE (publishing without a usable sending number), SENTIMENT_TRIGGER_NOT_ENABLED (the account lacks the feature). A malformed body answers the status text \"Bad Request\" with every problem in message[].","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"403":{"description":"Refused: OPT_OUT_SUSPENDED (publishing or resuming while the account is on cooldown because of a high opt-out rate); or no active plan (subscription_required).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"422":{"description":"Refused: MESSAGE_NOT_COMPLIANT (the first text step does not name the brand or give opt-out wording; message lists every issue and how to fix it; test a text first with compliance_check), BRAND_REQUIRED (the account has no 10DLC brand, so the first text cannot be checked).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"503":{"description":"COMPLIANCE_UNAVAILABLE: the compliance check could not run, so nothing was saved or started. Safe to retry in a few minutes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Create workflow (trigger + steps + settings + numbers); draft unless status active","tags":["Workflows"],"x-mcp":{"title":"Create a workflow (draft unless status is active)","openWorld":true},"x-required-scope":"workflows:write"}},"/api/v1/workflows/{id}":{"get":{"description":"One workflow in full: its trigger, every step in running order with its permanent nodeId, settings, sending numbers and stats. steps[0] is the trigger (type \"trigger\"), not a step; the real steps follow. This is where the nodeIds for editing, removing, inserting after and reordering steps come from. The body sent back unchanged as PATCH /v1/workflows/:id (workflows_update) is a no-op. lifecycleState pausing/resuming means a pause or resume is still finishing: poll until it leaves.","operationId":"WorkflowsController_get","parameters":[{"name":"id","required":true,"in":"path","description":"Workflow ID","schema":{"type":"number"}}],"responses":{"200":{"description":"The workflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowDetailRes"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"403":{"description":"The key lacks the workflows scope, or the account has no active plan","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"404":{"description":"Refused: the workflow is not found or belongs to another account.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Get workflow (trigger, steps with nodeIds in running order, settings, numbers)","tags":["Workflows"],"x-required-scope":"workflows:read"},"patch":{"description":"Changes any of name, description, status, trigger, steps, settings and phoneConfig; keys left out stay. With steps, the chain becomes exactly that list: a step sent with its nodeId (from workflows_get) keeps its contacts and unchanged fields, one without a nodeId is new, a stored step not listed is deleted. status \"active\" publishes a draft, \"draft\" unpublishes; pausing is workflows_pause. A read body sent back unchanged is a no-op. Step changes apply to contacts who enter afterwards; a message text change applies to everyone.","operationId":"WorkflowsController_update","parameters":[{"name":"id","required":true,"in":"path","description":"Workflow ID","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateWorkflowDto"},"examples":{"publish":{"summary":"Publish a draft","value":{"status":"active"}},"unpublish":{"summary":"Take a published workflow back to draft (pauses its contacts)","value":{"status":"draft"}},"replaceChain":{"summary":"Replace the chain: keep the first text step by id, add a wait","value":{"steps":[{"type":"sendSms","nodeId":"0f2b7a3e-1111-4222-8333-444455556666","config":{"message":"New wording"}},{"type":"wait","config":{"waitAmount":2,"waitUnit":"days"}}]}},"sendingHours":{"summary":"Weekday sending hours in Central time","value":{"settings":{"timeZone":"America/Chicago","timeWindow":{"enabled":true,"startTime":"09:00","endTime":"17:00","days":["monday","tuesday","wednesday","thursday","friday"]}}}},"pool":{"summary":"Send from a pool of two numbers","value":{"phoneConfig":{"mode":"pool","poolPhoneNumberIds":[3,4]}}},"trigger":{"summary":"Change the starting tag; every step keeps its nodeId","value":{"trigger":{"type":"tag_applied","tagId":15}}},"clearDescription":{"summary":"Clear the description","value":{"description":null}}}}}},"responses":{"200":{"description":"The workflow as GET answers it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowWriteRes"}}}},"400":{"description":"Refused: UNKNOWN_STEP (a nodeId in steps that is not a step of this workflow; field names it), DUPLICATE_STEP (a nodeId listed twice), STEP_TYPE_MISMATCH (a kept step sent with another type), STATUS_NOT_SETTABLE (status \"paused\" on a workflow that is not paused), STEP_CONFIG_INVALID (a config fails the rules of its step type), FIELD_NOT_FOR_STEP_TYPE (a config key of another step type), TAG_STEP_INVALID (a tag step with no tag, or a tag both added and removed), TRIGGER_INVALID (a trigger setting missing or foreign), DUPLICATE_TAG_TRIGGER (the tag already starts another workflow), TAG_NOT_OWNED (a tag that is not the account's), WORKFLOW_PHONE_NUMBER_INVALID (a number that is not usable or not the account's), TIME_WINDOW_INVALID (sending hours), PHONE_CONFIG_UNSATISFIABLE (publishing without a usable sending number), SENTIMENT_TRIGGER_NOT_ENABLED (the account lacks the feature); or an unknown or archived variant id. A malformed body answers the status text \"Bad Request\" with every problem in message[].","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"403":{"description":"Refused: OPT_OUT_SUSPENDED (publishing or resuming while the account is on cooldown because of a high opt-out rate); or no active plan (subscription_required).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"404":{"description":"Refused: the workflow is not found or belongs to another account.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"409":{"description":"Refused: WORKFLOW_LIFECYCLE_IN_FLIGHT (taking a published workflow back to draft while a pause or resume is still in progress).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"422":{"description":"Refused: MESSAGE_NOT_COMPLIANT (the first text step does not name the brand or give opt-out wording; message lists every issue and how to fix it; test a text first with compliance_check), BRAND_REQUIRED (the account has no 10DLC brand, so the first text cannot be checked).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"503":{"description":"COMPLIANCE_UNAVAILABLE: the compliance check could not run, so nothing was saved or started. Safe to retry in a few minutes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Update workflow (steps change only when steps is sent; unlisted steps are deleted)","tags":["Workflows"],"x-mcp":{"title":"Update a workflow (unlisted steps are deleted)","openWorld":true},"x-required-scope":"workflows:write"},"delete":{"description":"Permanently deletes the workflow with its steps and enrollment history; this cannot be undone. Answers no body. Refused while a campaign still uses the workflow (the refusal lists the campaigns). To stop a workflow without deleting it, use POST /v1/workflows/:id/pause (workflows_pause) or PATCH /v1/workflows/:id (workflows_update) { \"status\": \"draft\" }.","operationId":"WorkflowsController_delete","parameters":[{"name":"id","required":true,"in":"path","description":"Workflow ID","schema":{"type":"number"}}],"responses":{"204":{"description":"Workflow deleted"},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"403":{"description":"The key lacks the workflows scope, or the account has no active plan","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"404":{"description":"Refused: the workflow is not found or belongs to another account.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"409":{"description":"Refused: CAMPAIGNS_ATTACHED (a campaign still uses the workflow; campaigns lists them).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Delete workflow permanently (refused while a campaign uses it)","tags":["Workflows"],"x-required-scope":"workflows:write"}},"/api/v1/workflows/{id}/steps":{"post":{"description":"Adds one step { type, name?, config } and keeps every other step. Position: last when afterNodeId is omitted, after the step afterNodeId names, or first when afterNodeId is the trigger's nodeId. The trigger is steps[0] of GET /v1/workflows/:id (workflows_get) with type \"trigger\"; it is not a step. Answers the new step with its permanent nodeId. Tag ids come from GET /v1/tags (tags_list). Each call is one whole save of the workflow; to change several steps at once use PATCH /v1/workflows/:id (workflows_update) with steps. Step changes apply to contacts who enter afterwards; a contact already in the workflow may finish on the steps that were there when they entered.","operationId":"WorkflowsController_insertStep","parameters":[{"name":"id","required":true,"in":"path","description":"Workflow ID","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InsertWorkflowStepDto"},"examples":{"text":{"summary":"A text step at the end","value":{"type":"sendSms","name":"Welcome","config":{"message":"Hi {firstName}, thanks for reaching out! Reply STOP to opt out.","followUpMessage":"Hi again {firstName}, just checking in.","useFollowUpForExistingConversations":true,"cancelOnReply":true}}},"waitAfter":{"summary":"A wait after a given step","value":{"type":"wait","config":{"waitAmount":2,"waitUnit":"days"},"afterNodeId":"0f2b7a3e-1111-4222-8333-444455556666"}},"tag":{"summary":"A tag step","value":{"type":"tag","config":{"addTagIds":[12]}}}}}}},"responses":{"201":{"description":"The new step","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowStepWriteRes"}}}},"400":{"description":"Refused: UNKNOWN_STEP (afterNodeId is not a step of this workflow; field is afterNodeId), STEP_CONFIG_INVALID (a config fails the rules of its step type), FIELD_NOT_FOR_STEP_TYPE (a config key of another step type), TAG_STEP_INVALID (a tag step with no tag, or a tag both added and removed), TAG_NOT_OWNED (a tag that is not the account's). A malformed body answers the status text \"Bad Request\" with every problem in message[].","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"403":{"description":"Refused: no active plan (subscription_required).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"404":{"description":"Refused: the workflow is not found or belongs to another account.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"422":{"description":"Refused: MESSAGE_NOT_COMPLIANT (the first text step does not name the brand or give opt-out wording; message lists every issue and how to fix it; test a text first with compliance_check), BRAND_REQUIRED (the account has no 10DLC brand, so the first text cannot be checked). Only when the workflow is not a draft and this call changes its first text; a draft is never refused.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"503":{"description":"COMPLIANCE_UNAVAILABLE: the compliance check could not run, so nothing was saved or started. Safe to retry in a few minutes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Insert one step (others kept): last, after afterNodeId, or first","tags":["Workflows"],"x-required-scope":"workflows:write"}},"/api/v1/workflows/{id}/steps/reorder":{"post":{"description":"Puts the steps in the order of nodeIds, which must list every step of the workflow exactly once (nodeIds from GET /v1/workflows/:id (workflows_get); the trigger stays first and is not listed). Answers the workflow detail as a read would. Each call is one whole save of the workflow; to change several steps at once use PATCH /v1/workflows/:id (workflows_update) with steps. Step changes apply to contacts who enter afterwards; a contact already in the workflow may finish on the steps that were there when they entered. Changing a message text applies to everyone.","operationId":"WorkflowsController_reorderSteps","parameters":[{"name":"id","required":true,"in":"path","description":"Workflow ID","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReorderWorkflowStepsDto"},"examples":{"swap":{"summary":"Two steps, swapped","value":{"nodeIds":["9a8b7c6d-2222-4333-8444-555566667777","0f2b7a3e-1111-4222-8333-444455556666"]}}}}}},"responses":{"200":{"description":"The workflow as GET answers it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowDetailRes"}}}},"400":{"description":"Refused: REORDER_NOT_A_PERMUTATION (nodeIds is not every step exactly once; missing, extra and duplicates say which). A malformed body answers the status text \"Bad Request\" with every problem in message[].","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"403":{"description":"Refused: no active plan (subscription_required).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"404":{"description":"Refused: the workflow is not found or belongs to another account.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"422":{"description":"Refused: MESSAGE_NOT_COMPLIANT (the first text step does not name the brand or give opt-out wording; message lists every issue and how to fix it; test a text first with compliance_check), BRAND_REQUIRED (the account has no 10DLC brand, so the first text cannot be checked). Only when the workflow is not a draft and this call changes its first text; a draft is never refused.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"503":{"description":"COMPLIANCE_UNAVAILABLE: the compliance check could not run, so nothing was saved or started. Safe to retry in a few minutes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Reorder steps (nodeIds must list every step exactly once)","tags":["Workflows"],"x-required-scope":"workflows:write"}},"/api/v1/workflows/{id}/steps/{nodeId}":{"patch":{"description":"Changes the given fields of one step, named by its nodeId from GET /v1/workflows/:id (workflows_get): name, and the config keys sent (the rest is kept). The keys must fit the step's type, which cannot change. On a text step, config.message alone rewrites variant A; a variants list replaces the active set (ids sent are kept). Answers the step. Each call is one whole save of the workflow; to change several steps at once use PATCH /v1/workflows/:id (workflows_update) with steps. A text change applies to everyone in the workflow; other changes apply to contacts who enter afterwards. Refused with MESSAGE_NOT_COMPLIANT only when the workflow is not a draft and the edit changes its first text.","operationId":"WorkflowsController_updateStep","parameters":[{"name":"id","required":true,"in":"path","description":"Workflow ID","schema":{"type":"number"}},{"name":"nodeId","required":true,"in":"path","description":"Step nodeId (from GET)","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateWorkflowStepDto"},"examples":{"wording":{"summary":"New wording","value":{"config":{"message":"Hi {firstName}, new wording."}}},"wait":{"summary":"A longer wait","value":{"config":{"waitAmount":3}}},"rename":{"summary":"Rename the step","value":{"name":"Second nudge"}}}}}},"responses":{"200":{"description":"The step after the save","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowStepWriteRes"}}}},"400":{"description":"Refused: TRIGGER_IS_NOT_A_STEP (the path names the trigger; change it with the trigger key of workflows_update), STEP_CONFIG_INVALID (a config fails the rules of its step type), FIELD_NOT_FOR_STEP_TYPE (a config key of another step type), TAG_STEP_INVALID (a tag step with no tag, or a tag both added and removed), TAG_NOT_OWNED (a tag that is not the account's). A body with type or nodeId, or a malformed one, answers the status text \"Bad Request\".","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"403":{"description":"Refused: no active plan (subscription_required).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"404":{"description":"Refused: STEP_NOT_FOUND (nodeId in the path names no step of this workflow); or the workflow is not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"422":{"description":"Refused: MESSAGE_NOT_COMPLIANT (the first text step does not name the brand or give opt-out wording; message lists every issue and how to fix it; test a text first with compliance_check), BRAND_REQUIRED (the account has no 10DLC brand, so the first text cannot be checked). Only when the workflow is not a draft and this call changes its first text; a draft is never refused.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"503":{"description":"COMPLIANCE_UNAVAILABLE: the compliance check could not run, so nothing was saved or started. Safe to retry in a few minutes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Edit one step (name and/or config only; type and position are fixed)","tags":["Workflows"],"x-required-scope":"workflows:write"},"delete":{"description":"Removes the step named by its nodeId from GET /v1/workflows/:id (workflows_get) and joins its neighbours; every other step is kept. The trigger is not a step and cannot be removed: change it with trigger on PATCH /v1/workflows/:id (workflows_update). Answers no body. A contact currently on the removed step ends their run with the reason \"step removed\". Each call is one whole save of the workflow; to change several steps at once use PATCH /v1/workflows/:id (workflows_update) with steps.","operationId":"WorkflowsController_removeStep","parameters":[{"name":"id","required":true,"in":"path","description":"Workflow ID","schema":{"type":"number"}},{"name":"nodeId","required":true,"in":"path","description":"Step nodeId (from GET)","schema":{"type":"string"}}],"responses":{"204":{"description":"Step removed"},"400":{"description":"Refused: TRIGGER_IS_NOT_A_STEP (the path names the trigger; change it with the trigger key of workflows_update).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"403":{"description":"Refused: no active plan (subscription_required).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"404":{"description":"Refused: STEP_NOT_FOUND (nodeId in the path names no step of this workflow); or the workflow is not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"422":{"description":"Refused: MESSAGE_NOT_COMPLIANT (the first text step does not name the brand or give opt-out wording; message lists every issue and how to fix it; test a text first with compliance_check), BRAND_REQUIRED (the account has no 10DLC brand, so the first text cannot be checked). Only when the workflow is not a draft and this call changes its first text; a draft is never refused.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"503":{"description":"COMPLIANCE_UNAVAILABLE: the compliance check could not run, so nothing was saved or started. Safe to retry in a few minutes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Remove one step (its neighbours are joined; others kept)","tags":["Workflows"],"x-required-scope":"workflows:write"}},"/api/v1/workflows/{id}/resume":{"post":{"description":"Resumes a workflow that is paused: contacts paused in it continue. Only a paused workflow can be resumed. A draft is published with PATCH /v1/workflows/:id (workflows_update) { \"status\": \"active\" }. Accepted at once and finished in the background: the answer is the workflow with lifecycleState and operationId; poll GET /v1/workflows/:id (workflows_get) until lifecycleState leaves pausing/resuming before the next pause, resume or status change. Needs at least 50 credits and a usable sending number.","operationId":"WorkflowsController_resume","parameters":[{"name":"id","required":true,"in":"path","description":"Workflow ID","schema":{"type":"number"}}],"responses":{"201":{"description":"Resume accepted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowRes"}}}},"400":{"description":"Refused: WORKFLOW_NOT_PAUSED (the workflow is a draft, active, completed or failed; status says which), PHONE_CONFIG_UNSATISFIABLE (no usable sending number; problem says why).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"402":{"description":"Refused: fewer than 50 credits remaining (insufficient_credits).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"403":{"description":"Refused: OPT_OUT_SUSPENDED (publishing or resuming while the account is on cooldown because of a high opt-out rate); or no active plan (subscription_required).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"404":{"description":"Refused: the workflow is not found or belongs to another account.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"409":{"description":"Refused: WORKFLOW_LIFECYCLE_IN_FLIGHT (a pause or resume is still in progress; operationId names it).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"422":{"description":"Refused: MESSAGE_NOT_COMPLIANT (the first text step does not name the brand or give opt-out wording; message lists every issue and how to fix it; test a text first with compliance_check), BRAND_REQUIRED (the account has no 10DLC brand, so the first text cannot be checked).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"503":{"description":"COMPLIANCE_UNAVAILABLE: the compliance check could not run, so nothing was saved or started. Safe to retry in a few minutes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Resume paused workflow (finishes in the background)","tags":["Workflows"],"x-mcp":{"title":"Resume a workflow (may send SMS)","destructive":true,"openWorld":true},"x-required-scope":"workflows:write"}},"/api/v1/workflows/{id}/activate":{"post":{"deprecated":true,"description":"Deprecated alias of POST /v1/workflows/:id/resume (workflows_resume), kept for existing integrations: resumes a paused workflow and nothing else. Use the resume call. A draft is published with PATCH /v1/workflows/:id (workflows_update) { \"status\": \"active\" }.","operationId":"WorkflowsController_activate","parameters":[{"name":"id","required":true,"in":"path","description":"Workflow ID","schema":{"type":"number"}}],"responses":{"201":{"description":"Resume accepted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowRes"}}}},"400":{"description":"Refused: WORKFLOW_NOT_PAUSED (the workflow is a draft, active, completed or failed; status says which), PHONE_CONFIG_UNSATISFIABLE (no usable sending number; problem says why).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"402":{"description":"Refused: fewer than 50 credits remaining (insufficient_credits).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"403":{"description":"Refused: OPT_OUT_SUSPENDED (publishing or resuming while the account is on cooldown because of a high opt-out rate); or no active plan (subscription_required).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"404":{"description":"Refused: the workflow is not found or belongs to another account.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"409":{"description":"Refused: WORKFLOW_LIFECYCLE_IN_FLIGHT (a pause or resume is still in progress; operationId names it).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"422":{"description":"Refused: MESSAGE_NOT_COMPLIANT (the first text step does not name the brand or give opt-out wording; message lists every issue and how to fix it; test a text first with compliance_check), BRAND_REQUIRED (the account has no 10DLC brand, so the first text cannot be checked).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"503":{"description":"COMPLIANCE_UNAVAILABLE: the compliance check could not run, so nothing was saved or started. Safe to retry in a few minutes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Activate workflow (deprecated: use workflows_resume)","tags":["Workflows"],"x-mcp":{"title":"Activate a workflow (may send SMS)","destructive":true,"openWorld":true},"x-required-scope":"workflows:write"}},"/api/v1/workflows/{id}/pause":{"post":{"description":"Pauses an active workflow: contacts in it stop advancing and messages not yet sent wait until POST /v1/workflows/:id/resume (workflows_resume). Accepted at once and finished in the background: the answer is the workflow with lifecycleState and operationId; poll GET /v1/workflows/:id (workflows_get) until lifecycleState leaves pausing/resuming before the next pause, resume or status change. The workflow stays published; to take it back to draft use PATCH /v1/workflows/:id (workflows_update) { \"status\": \"draft\" }.","operationId":"WorkflowsController_pause","parameters":[{"name":"id","required":true,"in":"path","description":"Workflow ID","schema":{"type":"number"}}],"responses":{"201":{"description":"Pause accepted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowRes"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"403":{"description":"The key lacks the workflows scope, or the account has no active plan","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"404":{"description":"Refused: the workflow is not found or belongs to another account.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"409":{"description":"Refused: WORKFLOW_ALREADY_PAUSED (the workflow is already paused), WORKFLOW_LIFECYCLE_IN_FLIGHT (a pause or resume is still in progress; operationId names it).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Pause workflow (finishes in the background)","tags":["Workflows"],"x-mcp":{"destructive":false,"idempotent":true},"x-required-scope":"workflows:write"}},"/api/v1/workflows/{id}/enrollments":{"get":{"description":"The contacts enrolled in the workflow, one page at a time, each with its enrollment id, contact uuid, name and phone number, status (active, paused, completed, failed, removed), current step nodeId and dates. status filters on one enrollment status. Answers rows plus pagination. The enrollment id is what removing one enrollment takes.","operationId":"WorkflowsController_listEnrollments","parameters":[{"name":"id","required":true,"in":"path","description":"Workflow ID","schema":{"type":"number"}},{"name":"page","required":false,"in":"query","description":"Page number","schema":{"example":"1","type":"string"}},{"name":"take","required":false,"in":"query","description":"Items per page (max 500)","schema":{"example":"20","type":"string"}},{"name":"status","required":false,"in":"query","description":"Filter by enrollment status","schema":{"type":"string","enum":["active","paused","completed","failed","removed"]}}],"responses":{"200":{"description":"A page of enrollments","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowEnrollmentListRes"}}}},"400":{"description":"Refused: an unknown status filter.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"403":{"description":"The key lacks the workflows scope, or the account has no active plan","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"404":{"description":"Refused: the workflow is not found or belongs to another account.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"List workflow enrollments (one page; filter by status)","tags":["Workflows"],"x-required-scope":"workflows:read"},"delete":{"description":"Removes every active and paused enrollment of the workflow at once; finished enrollments stay in the history. Answers no body. This cannot be undone; to stop the workflow for a while use POST /v1/workflows/:id/pause (workflows_pause) instead.","operationId":"WorkflowsController_clearEnrollments","parameters":[{"name":"id","required":true,"in":"path","description":"Workflow ID","schema":{"type":"number"}}],"responses":{"204":{"description":"Enrollments cleared"},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"403":{"description":"The key lacks the workflows scope, or the account has no active plan","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"404":{"description":"Refused: the workflow is not found or belongs to another account.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Clear all enrollments (every active and paused contact leaves)","tags":["Workflows"],"x-required-scope":"workflows:write"}},"/api/v1/workflows/{id}/enroll":{"post":{"description":"Enrolls one existing contact of the account in the workflow, named by exactly one of contactUuid or phoneNumber (E.164). No contact is created: find or create it with GET or POST /v1/contacts (contacts_list, contacts_create) first. Answers the outcome: enrolled 1 with the new enrollmentId, or skipped 1 with the reason in errors[] (already in the workflow, with that enrollmentId; the workflow is a draft; re-entry not allowed). A skip answers 201, not an error. A contact who opted out within the last 30 days is refused.","operationId":"WorkflowsController_enroll","parameters":[{"name":"id","required":true,"in":"path","description":"Workflow ID","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnrollContactDto"},"examples":{"byUuid":{"summary":"By contact UUID","value":{"contactUuid":"550e8400-e29b-41d4-a716-446655440000"}},"byPhoneNumber":{"summary":"By phone number","value":{"phoneNumber":"+15551234567"}}}}}},"responses":{"201":{"description":"The enrollment outcome (a skip is not an error)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnrollContactsResultRes"}}}},"400":{"description":"Refused: HIGH_RISK_CONTACT (the contact opted out within the last 30 days). Both or neither of contactUuid and phoneNumber, or a phone number that is not valid, answers the status text \"Bad Request\".","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"403":{"description":"Refused: no active plan (subscription_required).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"404":{"description":"Refused: the workflow is not found, or no live contact of the account has that uuid or phone number.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Enroll one contact (by contactUuid or phoneNumber; a skip is not an error)","tags":["Workflows"],"x-mcp":{"title":"Enroll a contact in a workflow (may send SMS)","destructive":true,"openWorld":true},"x-required-scope":"workflows:write"}},"/api/v1/workflows/{id}/enroll/bulk":{"post":{"description":"Enrolls up to 10,000 existing contacts of the account, named by contactUuids, in the workflow in one call, run to completion before answering. Contact uuids come from GET or POST /v1/contacts (contacts_list, contacts_create). Answers counts of enrolled and skipped contacts with every skip reason in errors[] (already in the workflow, the workflow is a draft, re-entry not allowed); a uuid that is not a live contact of the account is counted as skipped, not refused. Refused as a whole, enrolling nobody, when any contact in the list opted out within the last 30 days.","operationId":"WorkflowsController_bulkEnroll","parameters":[{"name":"id","required":true,"in":"path","description":"Workflow ID","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkEnrollContactsDto"},"examples":{"twoContacts":{"summary":"Two contacts by uuid","value":{"contactUuids":["550e8400-e29b-41d4-a716-446655440000","6ba7b810-9dad-11d1-80b4-00c04fd430c8"]}}}}}},"responses":{"201":{"description":"Counts of enrolled and skipped contacts, with every skip reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnrollContactsResultRes"}}}},"400":{"description":"Refused: HIGH_RISK_CONTACTS (a contact in the list opted out within the last 30 days; nobody is enrolled). A malformed body answers the status text \"Bad Request\" with every problem in message[].","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"403":{"description":"Refused: no active plan (subscription_required).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"404":{"description":"Refused: the workflow is not found or belongs to another account.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Enroll many contacts (up to 10,000 contactUuids; skips reported per reason)","tags":["Workflows"],"x-mcp":{"title":"Enroll contacts in a workflow (may send SMS)","destructive":true,"openWorld":true},"x-required-scope":"workflows:write"}},"/api/v1/workflows/{id}/enrollments/{enrollmentId}":{"delete":{"description":"Takes one contact out of the workflow by enrollment id, from GET /v1/workflows/:id/enrollments (workflows_list_enrollments) or the enroll answer: the enrollment is marked removed and nothing more is sent to the contact from this workflow. Answers no body. An enrollment that already finished is left as it is and still answers success.","operationId":"WorkflowsController_removeEnrollment","parameters":[{"name":"id","required":true,"in":"path","description":"Workflow ID","schema":{"type":"number"}},{"name":"enrollmentId","required":true,"in":"path","description":"Enrollment ID","schema":{"type":"number"}}],"responses":{"204":{"description":"Enrollment removed"},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"403":{"description":"The key lacks the workflows scope, or the account has no active plan","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"404":{"description":"Refused: the workflow is not found, or the enrollment is not one of its own.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Remove one enrollment (the contact leaves the workflow)","tags":["Workflows"],"x-required-scope":"workflows:write"}},"/api/v1/organisation-library/workflows":{"get":{"description":"The library of the organization that owns this account, newest share first: each share with its workflow summary, who shared it (a person or an API key), the note, how many accounts copied it and whether this account already holds a copy. The share id is what the other workflow_organisation_library tools take.","operationId":"WorkflowOrganisationLibraryController_list","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/OrganisationSharedWorkflowRes"}}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"403":{"description":"Refused: ACCOUNT_NOT_IN_ORGANISATION (this account is personal, so it has no organization library); the share is not one this key may manage (an account key reads the copies of, and withdraws, only shares of this account or that it made); or the credential is an integration access token rather than an API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"List the workflows shared in this account's organization","tags":["Workflows"],"x-required-scope":"workflows:read"},"post":{"description":"Publishes one of this account's workflows to everyone in the organization that owns the account, attributed to this API key; workflow ids come from workflows_list. One share per workflow: sharing it again is refused. Copies made later stay when the share is withdrawn.","operationId":"WorkflowOrganisationLibraryController_share","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShareWorkflowWithOrganisationReq"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationSharedWorkflowRes"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"403":{"description":"Refused: ACCOUNT_NOT_IN_ORGANISATION (this account is personal, so it has no organization library); the share is not one this key may manage (an account key reads the copies of, and withdraws, only shares of this account or that it made); or the credential is an integration access token rather than an API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"404":{"description":"Refused: the workflow is not found or is not this account's.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"409":{"description":"Refused: WORKFLOW_ALREADY_SHARED (the workflow is already in the library).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Share one of this account's workflows with its organization","tags":["Workflows"],"x-mcp":{"destructive":false},"x-required-scope":"workflows:write"}},"/api/v1/organisation-library/workflows/{shareId}":{"get":{"operationId":"WorkflowOrganisationLibraryController_get","parameters":[{"name":"shareId","required":true,"in":"path","description":"Share id, from workflow_organisation_library_list","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationSharedWorkflowRes"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"403":{"description":"Refused: ACCOUNT_NOT_IN_ORGANISATION (this account is personal, so it has no organization library); the share is not one this key may manage (an account key reads the copies of, and withdraws, only shares of this account or that it made); or the credential is an integration access token rather than an API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"404":{"description":"Refused: WORKFLOW_SHARE_NOT_FOUND (no share with this id that you can see).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Get one workflow shared in this account's organization","tags":["Workflows"],"x-required-scope":"workflows:read"},"delete":{"description":"Removes one of this account's workflows from the organization library. The workflow and every copy already made stay as they are; nobody can copy it again until it is shared again.","operationId":"WorkflowOrganisationLibraryController_withdraw","parameters":[{"name":"shareId","required":true,"in":"path","description":"Share id, from workflow_organisation_library_list","schema":{"type":"number"}}],"responses":{"204":{"description":""},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"403":{"description":"Refused: ACCOUNT_NOT_IN_ORGANISATION (this account is personal, so it has no organization library); the share is not one this key may manage (an account key reads the copies of, and withdraws, only shares of this account or that it made); or the credential is an integration access token rather than an API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"404":{"description":"Refused: WORKFLOW_SHARE_NOT_FOUND (no share with this id that you can see).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Withdraw a share of this account's workflow","tags":["Workflows"],"x-required-scope":"workflows:write"}},"/api/v1/organisation-library/workflows/{shareId}/copy":{"post":{"description":"Clones the shared workflow into this account as a new draft, carrying its tags over by name (tags tells which were created, matched or dropped). Idempotent: when this account already holds a copy of the share, that copy is answered with alreadyExisted true and nothing is cloned. Read the copy with workflows_get.","operationId":"WorkflowOrganisationLibraryController_copy","parameters":[{"name":"shareId","required":true,"in":"path","description":"Share id, from workflow_organisation_library_list","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CopySharedWorkflowReq"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationWorkflowCopyRes"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"403":{"description":"Refused: ACCOUNT_NOT_IN_ORGANISATION (this account is personal, so it has no organization library); the share is not one this key may manage (an account key reads the copies of, and withdraws, only shares of this account or that it made); or the credential is an integration access token rather than an API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"404":{"description":"Refused: WORKFLOW_SHARE_NOT_FOUND (no share with this id that you can see).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Copy a shared workflow into this account","tags":["Workflows"],"x-mcp":{"destructive":false,"idempotent":true},"x-required-scope":"workflows:write"}},"/api/v1/organisation-library/workflows/{shareId}/stats":{"get":{"description":"Every account that copied the share, newest first, with who copied it (a person or an API key) and the copy. Answered for shares this key made or whose workflow is this account’s.","operationId":"WorkflowOrganisationLibraryController_stats","parameters":[{"name":"shareId","required":true,"in":"path","description":"Share id, from workflow_organisation_library_list","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationWorkflowShareStatsRes"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"403":{"description":"Refused: ACCOUNT_NOT_IN_ORGANISATION (this account is personal, so it has no organization library); the share is not one this key may manage (an account key reads the copies of, and withdraws, only shares of this account or that it made); or the credential is an integration access token rather than an API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"404":{"description":"Refused: WORKFLOW_SHARE_NOT_FOUND (no share with this id that you can see).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"List who copied a shared workflow","tags":["Workflows"],"x-required-scope":"workflows:read"}},"/api/v1/agents":{"get":{"description":"Returns the account's AI agents (the assistants that answer contacts by SMS), newest change first: id, name, kind, status (draft = never published, active, archived), whether a version is published and which, whether the draft has unpublished changes, the on/off switch and how many phone numbers, workflows and campaigns each answers on. Archived agents are left out unless includeArchived is true. Paginated with page and take (default 50, max 100). Use the id with agents_get for the full configuration, or as agentId in agent_sessions_list for the conversations an agent handled. Agent, session and conversation ids are integers; contacts are identified by uuid.","operationId":"AgentsController_list","parameters":[{"name":"includeArchived","required":false,"in":"query","description":"Also list archived agents (left out by default)","schema":{"default":false,"type":"boolean"}},{"name":"page","required":false,"in":"query","description":"Page number (1-based)","schema":{"example":"1","type":"string"}},{"name":"take","required":false,"in":"query","description":"Items per page (default 50, max 100)","schema":{"example":"50","type":"string"}}],"responses":{"200":{"description":"A page of agents","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentListApiRes"}}}},"400":{"description":"includeArchived is not a boolean","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"401":{"description":"Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"403":{"description":"The key lacks the scope the operation needs (agents:read, agents:write or agents:publish), or AI agents are not available on this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"List agents","tags":["AI Agents"],"x-required-scope":"agents:read"},"post":{"description":"Creates an appointment-booking agent as a DRAFT: it answers nobody until agents_set_channels gives it a channel and agents_publish publishes it. agents_get_build_guide describes how one is built, and agents_preview shows the same fields as a proposal first, creating nothing. Only name is required; every other field has the name agents_get returns it under and can be set later with agents_update. agents_get_setup_options lists the calendars, channels, ids and limits. The response is the saved agent: summary.headline says where it stands, nextSteps what is left, readiness.gaps what blocks publishing and warnings caveats about the text. Nothing is sent to any contact.","operationId":"AgentsController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAgentApiDto"}}}},"responses":{"201":{"description":"The agent that was created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentCreatedApiRes"}}}},"400":{"description":"Refused: CONFIG_INVALID (a field is out of range or not valid for this agent; issues lists each field by its name and what is wrong), or a body that is not well formed (message lists the fields).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"401":{"description":"Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"403":{"description":"The key lacks agents:write, AI agents are not available on this account, or TEMPLATE_NOT_AVAILABLE (agents cannot be created from that template)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"409":{"description":"Refused: AGENT_LIMIT_REACHED (the account holds as many agents as it may; archive one with agents_archive first).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Create agent (draft)","tags":["AI Agents"],"x-mcp":{"title":"Create an AI agent (draft, answers nobody yet)","destructive":false},"x-required-scope":"agents:write"}},"/api/v1/agents/build-guide":{"get":{"description":"Returns how an AI agent is built with a user, as data: the steps in order with the tools of each, the seven brief items to settle with the user one at a time (each with why it matters, how to ask and preset answers, the recommended one first), the single offer of the optional advanced settings, every setting in plain words with its default and when a change takes effect, the rules for writing the persona, instructions and questions, and what is never done. It is the place to start when building or editing an agent for someone. It is the same for every account and reads nothing from it: agents_get_setup_options does that, and agents_preview shows a setup before agents_create saves it.","operationId":"AgentsController_getBuildGuide","parameters":[],"responses":{"200":{"description":"The build guide","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentBuildGuideApiRes"}}}},"401":{"description":"Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"403":{"description":"The key lacks the scope the operation needs (agents:read, agents:write or agents:publish), or AI agents are not available on this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Get build guide","tags":["AI Agents"],"x-required-scope":"agents:read"}},"/api/v1/agents/preview":{"post":{"description":"Shows what agents_create would do with these fields and creates nothing. status says whether the creation would be accepted; not_creatable lists each field in issues, and a preview that finds problems still answers normally. proposal holds the setup as rows, the questions and the follow-ups in the words of the app. warnings holds what still blocks publishing, a channel that would move from another agent, caveats about the text. text is the whole proposal as plain text to show the user. phoneNumberIds, workflowIds and campaignIds are only named and checked. Once the user agrees, createArguments goes to agents_create unchanged and afterCreate to agents_set_channels. Limited to 60 a minute.","operationId":"AgentsController_preview","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PreviewAgentApiDto"}}}},"responses":{"200":{"description":"The proposal, whether or not it could be created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentPreviewApiRes"}}}},"400":{"description":"A body that is not well formed (message lists the fields).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"401":{"description":"Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"403":{"description":"The key lacks agents:read, AI agents are not available on this account, or TEMPLATE_NOT_AVAILABLE (agents cannot be created from that template)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Preview agent","tags":["AI Agents"],"x-mcp":{"readOnly":true,"title":"Preview an AI agent (creates nothing)"},"x-required-scope":"agents:read"}},"/api/v1/agents/setup-options":{"get":{"description":"Returns what the account has for an appointment-booking agent: the connected calendars, the active Calendly event types (the id is what calendlyEventTypeId takes), the phone numbers, workflows and SMS campaigns an agent can answer on with the agent that holds each today, timezones, reply languages, field limits and templates. summary says it in one line. A calendar is connected by a person in the app at connectCalendarUrl, never through the API: share that link when none is connected. Lists named in unavailable could not be read: empty there means unknown, not none. agents_get_build_guide gives the build steps; agents_preview shows a setup before it is created. Limited to 60 a minute.","operationId":"AgentsController_getSetupOptions","parameters":[],"responses":{"200":{"description":"The setup options","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentSetupOptionsApiRes"}}}},"401":{"description":"Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"403":{"description":"The key lacks the scope the operation needs (agents:read, agents:write or agents:publish), or AI agents are not available on this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Get setup options","tags":["AI Agents"],"x-required-scope":"agents:read"}},"/api/v1/agents/{id}":{"get":{"description":"Returns one agent as a single flat object: its DRAFT configuration (what an edit changes; contacts are answered with publishedVersion until the draft is published, and hasUnpublishedChanges says whether they differ) plus the settings that apply at once without a publish (enabled, reply hours, channels). Booking fields are null unless kind is \"booking\". readiness.gaps lists everything that still blocks publishing, such as a calendar that is not connected or no channel; readiness.ready is true when nothing does. summary says where the agent stands and nextSteps what is left. The id comes from agents_list. Agent, session and conversation ids are integers; contacts are identified by uuid.","operationId":"AgentsController_get","parameters":[{"name":"id","required":true,"in":"path","description":"Agent ID (integer; the \"id\" field of an agent from agents_list). Not a uuid or a name.","schema":{"type":"integer"}}],"responses":{"200":{"description":"The agent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentDetailApiRes"}}}},"400":{"description":"Refused: AGENT_ID_INVALID (id is not an integer).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"401":{"description":"Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"403":{"description":"The key lacks the scope the operation needs (agents:read, agents:write or agents:publish), or AI agents are not available on this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"404":{"description":"Refused: AGENT_NOT_FOUND (no agent with this id on the account the key acts in).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Get agent","tags":["AI Agents"],"x-required-scope":"agents:read"},"patch":{"description":"Changes only the fields sent: a field left out is untouched, null clears a nullable one, and a list (qualifyingQuestions, knowledgeCollectionIds) replaces the whole list. name, description, timezone, enabled, requirePositiveSentiment, humanPacing, replyHours, idleExpiryDays and idleExpiryTag apply at once, also on an agent that is answering. Every other field changes the draft and reaches contacts only after agents_publish; publishRequired says whether a publish is pending and changedFields what this call changed. The read-only fields of agents_get are ignored, so a whole agents_get result can be sent back. Channels are set with agents_set_channels.","operationId":"AgentsController_update","parameters":[{"name":"id","required":true,"in":"path","description":"Agent ID (integer; the \"id\" field of an agent from agents_list). Not a uuid or a name.","schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAgentApiDto"}}}},"responses":{"200":{"description":"The agent after the change","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentUpdatedApiRes"}}}},"400":{"description":"Refused: CONFIG_INVALID (a field is out of range or not valid for this agent; issues lists each field by its name and what is wrong), or a body that is not well formed (message lists the fields), or AGENT_ID_INVALID (id is not an integer).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"401":{"description":"Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"403":{"description":"The key lacks the scope the operation needs (agents:read, agents:write or agents:publish), or AI agents are not available on this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"404":{"description":"Refused: AGENT_NOT_FOUND (no agent with this id on the account the key acts in).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"409":{"description":"Refused: DRAFT_CONFLICT (the draft is no longer the one named by expectedDraftId, or it was published meanwhile; read the agent again), or AGENT_ARCHIVED (an archived agent cannot be changed).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Update agent","tags":["AI Agents"],"x-required-scope":"agents:write"},"delete":{"description":"Retires an agent: it stops answering at once, every phone number, workflow and campaign it held is released for other agents, and it stops being the account default agent if it was. An archived agent cannot be edited or published again, and agents_list leaves it out unless includeArchived is true. Its past conversations stay readable through agent_sessions_list. Archiving an archived agent changes nothing.","operationId":"AgentsController_archive","parameters":[{"name":"id","required":true,"in":"path","description":"Agent ID (integer; the \"id\" field of an agent from agents_list). Not a uuid or a name.","schema":{"type":"integer"}}],"responses":{"200":{"description":"The archived agent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentArchivedApiRes"}}}},"400":{"description":"Refused: AGENT_ID_INVALID (id is not an integer).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"401":{"description":"Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"403":{"description":"The key lacks the scope the operation needs (agents:read, agents:write or agents:publish), or AI agents are not available on this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"404":{"description":"Refused: AGENT_NOT_FOUND (no agent with this id on the account the key acts in).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Archive agent","tags":["AI Agents"],"x-required-scope":"agents:write"}},"/api/v1/agents/{id}/versions":{"get":{"description":"Returns the newest versions of one agent, newest first (take sets how many: default 50, max 100): id, versionNumber, publishedAt, the changelog note written at publish, and isDraft. Exactly one version is the draft (isDraft true, publishedAt null): the one edits change and agents_get returns. Every other version was published at some point and can no longer change; the one contacts are answered with today is publishedVersion in agents_get. Use it to see when an agent last went live and what changed. Only the history is returned, not the configuration of each version. The id comes from agents_list.","operationId":"AgentsController_listVersions","parameters":[{"name":"id","required":true,"in":"path","description":"Agent ID (integer; the \"id\" field of an agent from agents_list). Not a uuid or a name.","schema":{"type":"integer"}},{"name":"take","required":false,"in":"query","description":"How many of the newest versions to return (default 50, max 100)","schema":{"example":"50","type":"string"}}],"responses":{"200":{"description":"The versions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentVersionListApiRes"}}}},"400":{"description":"Refused: AGENT_ID_INVALID (id is not an integer).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"401":{"description":"Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"403":{"description":"The key lacks the scope the operation needs (agents:read, agents:write or agents:publish), or AI agents are not available on this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"404":{"description":"Refused: AGENT_NOT_FOUND (no agent with this id on the account the key acts in).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"List agent versions","tags":["AI Agents"],"x-required-scope":"agents:read"}},"/api/v1/agents/{id}/duplicate":{"post":{"description":"Creates a new draft agent with the same settings as this one, named with a \"(copy)\" suffix. Its channels are not copied (a number, workflow or campaign belongs to one agent), so the copy answers nobody until agents_set_channels gives it channels and agents_publish publishes it. The source agent is not changed. The response is the new agent; its id differs from the source.","operationId":"AgentsController_duplicate","parameters":[{"name":"id","required":true,"in":"path","description":"Agent ID (integer; the \"id\" field of an agent from agents_list). Not a uuid or a name.","schema":{"type":"integer"}}],"responses":{"201":{"description":"The copy","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentCreatedApiRes"}}}},"400":{"description":"Refused: AGENT_ID_INVALID (id is not an integer).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"401":{"description":"Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"403":{"description":"The key lacks agents:write, AI agents are not available on this account, or TEMPLATE_NOT_AVAILABLE (agents of this kind cannot be created)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"404":{"description":"Refused: AGENT_NOT_FOUND (no agent with this id on the account the key acts in).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"409":{"description":"Refused: AGENT_LIMIT_REACHED (the account holds as many agents as it may).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Duplicate agent","tags":["AI Agents"],"x-mcp":{"destructive":false},"x-required-scope":"agents:write"}},"/api/v1/agents/{id}/channels":{"get":{"description":"Returns the phone numbers, workflows and SMS campaigns one agent answers on, with their names, and whether it answers right now. heldByOtherAgents lists every number, workflow and campaign of the account that another agent answers on (a channel belongs to one agent at a time), so a conflict is visible before agents_set_channels is used. Ids of channels to add come from phone_numbers_list, workflows_list and campaigns_list.","operationId":"AgentsController_getChannels","parameters":[{"name":"id","required":true,"in":"path","description":"Agent ID (integer; the \"id\" field of an agent from agents_list). Not a uuid or a name.","schema":{"type":"integer"}}],"responses":{"200":{"description":"The channels","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentChannelsDetailApiRes"}}}},"400":{"description":"Refused: AGENT_ID_INVALID (id is not an integer).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"401":{"description":"Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"403":{"description":"The key lacks the scope the operation needs (agents:read, agents:write or agents:publish), or AI agents are not available on this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"404":{"description":"Refused: AGENT_NOT_FOUND (no agent with this id on the account the key acts in).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Get agent channels","tags":["AI Agents"],"x-required-scope":"agents:read"},"put":{"description":"Sets the channels of an agent. Each list given (phoneNumberIds, workflowIds, campaignIds) replaces that kind of channel; a list left out is kept and an empty list removes them all. It applies at once, without a publish: a published, switched-on agent starts answering contacts who text those numbers or reply to those workflows and campaigns. A channel another agent holds is refused with who holds it, unless takeOver is true, which moves it to this agent. Ids come from phone_numbers_list, workflows_list and campaigns_list; agents_get_channels shows the current state. Limited to 10 a minute.","operationId":"AgentsController_setChannels","parameters":[{"name":"id","required":true,"in":"path","description":"Agent ID (integer; the \"id\" field of an agent from agents_list). Not a uuid or a name.","schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetAgentChannelsApiDto"}}}},"responses":{"200":{"description":"The channels after the change","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentChannelsSetApiRes"}}}},"400":{"description":"Refused: CAMPAIGN_NOT_SMS (a campaign id is not an SMS campaign), AGENT_ID_INVALID (id is not an integer), or a body that is not well formed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"401":{"description":"Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"403":{"description":"The key lacks the scope the operation needs (agents:read, agents:write or agents:publish), or AI agents are not available on this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"404":{"description":"Refused: AGENT_NOT_FOUND (no agent with this id on the account), or CHANNEL_TARGET_NOT_FOUND (a number, workflow or campaign id is not on the account; missing lists them).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"409":{"description":"Refused: CHANNEL_CONFLICT (another agent holds a requested channel; conflicts lists each one and its agent, and takeOver moves them), or AGENT_ARCHIVED (an archived agent answers on no channel).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Set agent channels","tags":["AI Agents"],"x-mcp":{"title":"Set where an AI agent answers (applies at once)","openWorld":true},"x-required-scope":"agents:publish"}},"/api/v1/agents/{id}/publish":{"post":{"description":"Publishes the draft: from then on the agent texts contacts on its own, on every channel it has, with the settings of this draft. When something is still missing (no channel, a calendar that is not connected, blank instructions and so on) nothing is published and the refusal lists the gaps with how each is closed, the same ones readiness.gaps shows in agents_get. Conversations already running keep the version they started with unless applyToLiveSessions is true. What comes before a publish (agents_preview, a test, the yes of the user) is in agents_get_build_guide. agents_restore_version brings an older version back into the draft. Limited to 10 a minute.","operationId":"AgentsController_publish","parameters":[{"name":"id","required":true,"in":"path","description":"Agent ID (integer; the \"id\" field of an agent from agents_list). Not a uuid or a name.","schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublishAgentApiDto"}}}},"responses":{"200":{"description":"The agent, the version now answering and the rollout","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentPublishedApiRes"}}}},"400":{"description":"Refused: CONFIG_INVALID (a setting of the draft is not valid; issues lists each field), INVALID_BINDINGS (the draft names a knowledge collection the agent cannot use), or AGENT_ID_INVALID (id is not an integer).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"401":{"description":"Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"403":{"description":"The key lacks the scope the operation needs (agents:read, agents:write or agents:publish), or AI agents are not available on this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"404":{"description":"Refused: AGENT_NOT_FOUND (no agent with this id on the account the key acts in).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"409":{"description":"Refused: AGENT_NOT_READY (something is missing; gaps lists each item and nothing was published), DRAFT_CONFLICT (the draft was published by someone else meanwhile), ROLLOUT_CONFLICT (live conversations are still being moved by an earlier publish; nothing was published, publish again), or AGENT_ARCHIVED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Publish agent","tags":["AI Agents"],"x-mcp":{"title":"Publish an AI agent (it starts texting contacts)","destructive":true,"openWorld":true},"x-required-scope":"agents:publish"}},"/api/v1/agents/{id}/versions/{versionId}/restore":{"post":{"description":"Replaces the draft of an agent with a copy of one of its versions (ids from agents_list_versions). Edits in the current draft that were not published are lost. Nothing changes for contacts: the published version keeps answering until agents_publish publishes the restored draft. Settings that apply at once (name, timezone, enabled, reply hours, channels) are not part of a version and stay as they are. The response is the agent with its new draft.","operationId":"AgentsController_restoreVersion","parameters":[{"name":"id","required":true,"in":"path","description":"Agent ID (integer; the \"id\" field of an agent from agents_list). Not a uuid or a name.","schema":{"type":"integer"}},{"name":"versionId","required":true,"in":"path","description":"Version ID (integer; the \"id\" field of a version from agents_list_versions, not its versionNumber).","schema":{"type":"integer"}}],"responses":{"200":{"description":"The agent with the restored draft","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentDetailApiRes"}}}},"400":{"description":"Refused: AGENT_ID_INVALID or VERSION_ID_INVALID (the id is not an integer).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"401":{"description":"Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"403":{"description":"The key lacks the scope the operation needs (agents:read, agents:write or agents:publish), or AI agents are not available on this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"404":{"description":"Refused: AGENT_NOT_FOUND (no agent with this id on the account), or VERSION_NOT_FOUND (the agent has no version with that id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"409":{"description":"Refused: AGENT_ARCHIVED (an archived agent cannot be changed).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Restore agent version","tags":["AI Agents"],"x-required-scope":"agents:write"}},"/api/v1/agents/{id}/sessions":{"post":{"description":"Starts a published agent on one conversation, named by conversationId (conversations_list) or contactUuid. The agent does not text first: it answers the next reply of the contact, or at once when the newest message is a text nobody answered, so this can send an SMS. The contact leaves the workflows that would keep texting them and a conversation_agent_pause stop is lifted. Where the agent already holds it, that session is returned (created false). Another agent holding it is refused without replace. A contact with no conversation is refused: messages_v2_send starts one. Limited to 10 a minute.","operationId":"AgentsController_startSession","parameters":[{"name":"id","required":true,"in":"path","description":"Agent ID (integer; the \"id\" field of an agent from agents_list). Not a uuid or a name.","schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StartAgentSessionApiDto"}}}},"responses":{"200":{"description":"The session that holds the conversation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentSessionStartedApiRes"}}}},"400":{"description":"Refused: AGENT_ID_INVALID (id is not an integer), PHONE_NUMBER_UNRESOLVED (no phone number of the account could be chosen; send phoneNumberId), or a body that is not well formed (exactly one of conversationId and contactUuid is needed).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"401":{"description":"Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"403":{"description":"The key lacks the scope the operation needs (agents:read, agents:write or agents:publish), or AI agents are not available on this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"404":{"description":"Refused: AGENT_NOT_FOUND, CONVERSATION_NOT_FOUND or CONTACT_NOT_FOUND (no agent, conversation or contact with this id on the account).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"409":{"description":"Refused: AGENT_NOT_ACTIVE or AGENT_NOT_PUBLISHED (publish the agent first), AGENTS_PAUSED (every agent of the account is paused), THREAD_BUSY (another agent holds the conversation; liveSessionId names its session and replace takes over), CONVERSATION_REQUIRED (the contact has no conversation yet), or CONTACT_OPTED_OUT.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Start agent on a conversation","tags":["AI Agents"],"x-mcp":{"title":"Start an AI agent on a conversation (may send an SMS)","destructive":true,"openWorld":true},"x-required-scope":"agents:publish"}},"/api/v1/agent-settings":{"get":{"description":"Returns the two switches that apply to every agent of the account. The default agent (defaultAgentId, on when defaultEnabled is true) answers a new conversation that no agent claims through a phone number, workflow or campaign. agentsPaused is Pause all: while true no agent of the account replies, follows up or sends anything, whatever each agent is set to. Both are changed with agent_settings_update; agents_list gives the agent ids.","operationId":"AgentSettingsController_get","parameters":[],"responses":{"200":{"description":"The settings","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentSettingsApiRes"}}}},"401":{"description":"Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"403":{"description":"The key lacks the scope the operation needs (agents:read or agents:publish), or AI agents are not available on this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Get agent settings","tags":["AI Agents"],"x-required-scope":"agents:read"},"patch":{"description":"Changes only the switches sent. agentsPaused true stops every agent of the account at once (replies, follow-ups and sends) and false lets them answer again. defaultAgentId names the agent that answers new conversations no other agent claims: it has to be published and active (agents_publish), and null clears it. defaultEnabled switches that default agent on or off and needs a default agent to switch on. All of it applies at once and changes which contacts get a text from an agent. agent_settings_get shows the current values.","operationId":"AgentSettingsController_update","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAgentSettingsApiDto"}}}},"responses":{"200":{"description":"The settings after the change","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentSettingsApiRes"}}}},"400":{"description":"Refused: DEFAULT_AGENT_NOT_LIVE (the agent named is not published and active on this account), DEFAULT_AGENT_REQUIRED (the default cannot be switched on while no default agent is set), or a body that is not well formed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"401":{"description":"Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"403":{"description":"The key lacks the scope the operation needs (agents:read or agents:publish), or AI agents are not available on this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Update agent settings","tags":["AI Agents"],"x-required-scope":"agents:publish"}},"/api/v1/agents/{id}/knowledge/collections":{"get":{"description":"Returns the knowledge collections of one agent, oldest first: id, name, description and how many sources each holds. A collection holds what the agent may look facts up in, such as a price list, an FAQ or a policy. An agent searches every collection it owns that holds a ready source, unless its knowledgeCollectionIds (agents_get) names a list, which restricts it to those. attached says whether the draft searches a collection, and draftCollectionIds is that list as the draft has it (empty = every collection). List the content of one with agent_knowledge_list_sources. The agent id comes from agents_list.","operationId":"AgentKnowledgeController_listCollections","parameters":[{"name":"id","required":true,"in":"path","description":"Agent ID (integer; the \"id\" field of an agent from agents_list). Not a uuid or a name.","schema":{"type":"integer"}}],"responses":{"200":{"description":"The collections","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentKnowledgeCollectionListApiRes"}}}},"400":{"description":"Refused: AGENT_ID_INVALID (id is not an integer).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"401":{"description":"Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"403":{"description":"The key lacks the scope the operation needs (agents:read or agents:write), or AI agents are not available on this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"404":{"description":"Refused: AGENT_NOT_FOUND (no agent with this id on the account the key acts in).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"List knowledge collections","tags":["AI Agents"],"x-required-scope":"agents:read"},"post":{"description":"Creates an empty knowledge collection owned by the agent; add content with agent_knowledge_create_source. An agent searches every collection it owns that holds a ready source, unless its knowledgeCollectionIds (agents_get) names a list, which restricts it to those. So the new collection is used as soon as it holds a ready source, also by conversations already running, with no publish. With attach true (the default) an agent that is restricted to a list gets the new id added to the knowledgeCollectionIds of its draft, so one call makes the collection usable once agents_publish runs; publishRequired says when that applies. attach false leaves the list alone. Nothing is sent to any contact.","operationId":"AgentKnowledgeController_createCollection","parameters":[{"name":"id","required":true,"in":"path","description":"Agent ID (integer; the \"id\" field of an agent from agents_list). Not a uuid or a name.","schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAgentKnowledgeCollectionApiDto"}}}},"responses":{"201":{"description":"The collection that was created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentKnowledgeCollectionCreatedApiRes"}}}},"400":{"description":"Refused: AGENT_ID_INVALID (id is not an integer), or a body that is not well formed (name is missing or too long).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"401":{"description":"Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"403":{"description":"The key lacks the scope the operation needs (agents:read or agents:write), or AI agents are not available on this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"404":{"description":"Refused: AGENT_NOT_FOUND (no agent with this id on the account the key acts in).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"409":{"description":"Refused: AGENT_ARCHIVED (the draft of an archived agent cannot take the new collection; nothing was created).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Create knowledge collection","tags":["AI Agents"],"x-mcp":{"destructive":false},"x-required-scope":"agents:write"}},"/api/v1/agents/{id}/knowledge/collections/{collectionId}":{"delete":{"description":"Deletes a knowledge collection with every source in it, including files uploaded in the app. This cannot be undone, and the agent stops finding that content at once, also in conversations already running. When the knowledgeCollectionIds of the draft names the collection, its id is removed from that list as well (detachedFromDraft); a list left empty by that means the agent searches every collection it still owns. Ids come from agent_knowledge_list_collections.","operationId":"AgentKnowledgeController_deleteCollection","parameters":[{"name":"id","required":true,"in":"path","description":"Agent ID (integer; the \"id\" field of an agent from agents_list). Not a uuid or a name.","schema":{"type":"integer"}},{"name":"collectionId","required":true,"in":"path","description":"Knowledge collection ID (integer; the \"id\" field of a collection from agent_knowledge_list_collections).","schema":{"type":"integer"}}],"responses":{"200":{"description":"The collection was deleted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentKnowledgeCollectionDeletedApiRes"}}}},"400":{"description":"Refused: AGENT_ID_INVALID or KNOWLEDGE_COLLECTION_ID_INVALID (a path id is not an integer).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"401":{"description":"Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"403":{"description":"The key lacks the scope the operation needs (agents:read or agents:write), or AI agents are not available on this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"404":{"description":"Refused: AGENT_NOT_FOUND (no agent with this id on the account), or KNOWLEDGE_COLLECTION_NOT_FOUND (the agent has no collection with that id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"409":{"description":"Refused: DRAFT_CONFLICT (the draft was published while its list was being changed; nothing was deleted, call again).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Delete knowledge collection","tags":["AI Agents"],"x-required-scope":"agents:write"}},"/api/v1/agents/{id}/knowledge/collections/{collectionId}/sources":{"get":{"description":"Returns the sources of one knowledge collection, oldest first (the first take of them: default 50, max 200): id, type (text, qa, table, or file for one uploaded in the app), title, status and how many passages it was split into. status ready means the agent can find the source; failed means it was saved but could not be indexed, with the reason in error. The content itself is not returned. Ids come from agent_knowledge_list_collections.","operationId":"AgentKnowledgeController_listSources","parameters":[{"name":"id","required":true,"in":"path","description":"Agent ID (integer; the \"id\" field of an agent from agents_list). Not a uuid or a name.","schema":{"type":"integer"}},{"name":"collectionId","required":true,"in":"path","description":"Knowledge collection ID (integer; the \"id\" field of a collection from agent_knowledge_list_collections).","schema":{"type":"integer"}},{"name":"take","required":false,"in":"query","description":"How many sources to return, oldest first (default 50, max 200)","schema":{"example":"50","type":"string"}}],"responses":{"200":{"description":"The sources","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentKnowledgeSourceListApiRes"}}}},"400":{"description":"Refused: AGENT_ID_INVALID or KNOWLEDGE_COLLECTION_ID_INVALID (a path id is not an integer).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"401":{"description":"Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"403":{"description":"The key lacks the scope the operation needs (agents:read or agents:write), or AI agents are not available on this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"404":{"description":"Refused: AGENT_NOT_FOUND (no agent with this id on the account), or KNOWLEDGE_COLLECTION_NOT_FOUND (the agent has no collection with that id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"List knowledge sources","tags":["AI Agents"],"x-required-scope":"agents:read"},"post":{"description":"Adds one source to a knowledge collection and indexes it before answering. type picks the kind and the field that carries it: text with content (up to 50,000 characters), qa with pairs (1 to 500 question and answer pairs), or table with columns and rows (up to 50 columns, 1,000 rows and 2 MB of text, one text cell per column). The response is the source with its status: ready means the agent can find it from now on, also in conversations already running; failed means it was saved but not indexed, with the reason in error. Files are uploaded in the app. Ids come from agent_knowledge_list_collections. Limited to 20 a minute.","operationId":"AgentKnowledgeController_createSource","parameters":[{"name":"id","required":true,"in":"path","description":"Agent ID (integer; the \"id\" field of an agent from agents_list). Not a uuid or a name.","schema":{"type":"integer"}},{"name":"collectionId","required":true,"in":"path","description":"Knowledge collection ID (integer; the \"id\" field of a collection from agent_knowledge_list_collections).","schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAgentKnowledgeSourceApiDto"}}}},"responses":{"201":{"description":"The source, indexed (ready) or saved without an index (failed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentKnowledgeSourceApiRes"}}}},"400":{"description":"Refused: AGENT_ID_INVALID or KNOWLEDGE_COLLECTION_ID_INVALID (a path id is not an integer), CONFIG_INVALID (a table row does not hold one text cell per column, or the table holds more than 2 MB of text), or a body that is not well formed for its type.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"401":{"description":"Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"403":{"description":"The key lacks the scope the operation needs (agents:read or agents:write), or AI agents are not available on this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"404":{"description":"Refused: AGENT_NOT_FOUND (no agent with this id on the account), or KNOWLEDGE_COLLECTION_NOT_FOUND (the agent has no collection with that id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Add knowledge source","tags":["AI Agents"],"x-mcp":{"destructive":false},"x-required-scope":"agents:write"}},"/api/v1/agents/{id}/knowledge/collections/{collectionId}/sources/{sourceId}":{"patch":{"description":"Changes the title and/or the content of one text, qa or table source. type names the type the source already has (a source keeps its type) and decides which content field is read; content that is sent replaces what is stored and the source is indexed again before the answer, so status and error tell whether the agent can find the new content. A field left out is untouched. The change reaches conversations already running. A file source is changed in the app. Ids come from agent_knowledge_list_sources. Limited to 20 a minute.","operationId":"AgentKnowledgeController_updateSource","parameters":[{"name":"id","required":true,"in":"path","description":"Agent ID (integer; the \"id\" field of an agent from agents_list). Not a uuid or a name.","schema":{"type":"integer"}},{"name":"collectionId","required":true,"in":"path","description":"Knowledge collection ID (integer; the \"id\" field of a collection from agent_knowledge_list_collections).","schema":{"type":"integer"}},{"name":"sourceId","required":true,"in":"path","description":"Knowledge source ID (integer; the \"id\" field of a source from agent_knowledge_list_sources).","schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAgentKnowledgeSourceApiDto"}}}},"responses":{"200":{"description":"The source after the change","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentKnowledgeSourceApiRes"}}}},"400":{"description":"Refused: AGENT_ID_INVALID, KNOWLEDGE_COLLECTION_ID_INVALID or KNOWLEDGE_SOURCE_ID_INVALID (a path id is not an integer), KNOWLEDGE_SOURCE_TYPE_MISMATCH (type is not the type of this source, or it is a file source), CONFIG_INVALID (nothing to change, a table row does not hold one text cell per column, or the table holds more than 2 MB of text), or a body that is not well formed for its type.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"401":{"description":"Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"403":{"description":"The key lacks the scope the operation needs (agents:read or agents:write), or AI agents are not available on this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"404":{"description":"Refused: AGENT_NOT_FOUND (no agent with this id on the account), KNOWLEDGE_COLLECTION_NOT_FOUND (the agent has no collection with that id), or KNOWLEDGE_SOURCE_NOT_FOUND (the collection has no source with that id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Update knowledge source","tags":["AI Agents"],"x-required-scope":"agents:write"},"delete":{"description":"Deletes one source from a knowledge collection, whatever its type. This cannot be undone, and the agent stops finding that content at once, also in conversations already running. The collection and its other sources stay. Ids come from agent_knowledge_list_sources.","operationId":"AgentKnowledgeController_deleteSource","parameters":[{"name":"id","required":true,"in":"path","description":"Agent ID (integer; the \"id\" field of an agent from agents_list). Not a uuid or a name.","schema":{"type":"integer"}},{"name":"collectionId","required":true,"in":"path","description":"Knowledge collection ID (integer; the \"id\" field of a collection from agent_knowledge_list_collections).","schema":{"type":"integer"}},{"name":"sourceId","required":true,"in":"path","description":"Knowledge source ID (integer; the \"id\" field of a source from agent_knowledge_list_sources).","schema":{"type":"integer"}}],"responses":{"200":{"description":"The source was deleted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentKnowledgeSourceDeletedApiRes"}}}},"400":{"description":"Refused: AGENT_ID_INVALID, KNOWLEDGE_COLLECTION_ID_INVALID or KNOWLEDGE_SOURCE_ID_INVALID (a path id is not an integer).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"401":{"description":"Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"403":{"description":"The key lacks the scope the operation needs (agents:read or agents:write), or AI agents are not available on this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"404":{"description":"Refused: AGENT_NOT_FOUND (no agent with this id on the account), KNOWLEDGE_COLLECTION_NOT_FOUND (the agent has no collection with that id), or KNOWLEDGE_SOURCE_NOT_FOUND (the collection has no source with that id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Delete knowledge source","tags":["AI Agents"],"x-required-scope":"agents:write"}},"/api/v1/agent-sessions":{"get":{"description":"Returns agent sessions, newest first. A session is an agent's run with one contact on one conversation. Filter by agentId (from agents_list), conversationId (from conversations_list), contactUuid (from contacts_list), status, or needsAttention true (waiting on a person). status is live (active, paused_by_user, paused_no_credits) or ended (completed, escalated, max_turns, expired, superseded); reasonCode and reason say why it escalated or ended; outcome is its result; qualification holds a booking agent's questions and the answers. Read the messages with conversations_get_messages by conversationId. Paged by page and take (default 20, max 100). No test chats. Limited to 60 a minute.","operationId":"AgentSessionsController_list","parameters":[{"name":"page","required":false,"in":"query","description":"Page number (1-based). The list reaches the first 10,000 sessions that match; narrow it with a filter to go further.","schema":{"example":"1","type":"string"}},{"name":"take","required":false,"in":"query","description":"Items per page (default 20, max 100)","schema":{"example":"20","type":"string"}},{"name":"agentId","required":false,"in":"query","description":"Only sessions of this agent (integer id from agents_list)","schema":{"type":"integer"}},{"name":"conversationId","required":false,"in":"query","description":"Only sessions of this conversation (integer id from conversations_list)","schema":{"type":"integer"}},{"name":"contactUuid","required":false,"in":"query","description":"Only sessions with this contact (uuid from contacts_list)","schema":{"format":"uuid","type":"string"}},{"name":"status","required":false,"in":"query","description":"Only sessions in this status. active, paused_by_user and paused_no_credits are live; the others have ended.","schema":{"type":"string","enum":["active","paused_by_user","paused_no_credits","completed","escalated","max_turns","expired","superseded"]}},{"name":"needsAttention","required":false,"in":"query","description":"true = only sessions waiting on a person (flagged and not yet reviewed)","schema":{"type":"boolean"}}],"responses":{"200":{"description":"A page of sessions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentSessionListApiRes"}}}},"400":{"description":"Refused: PAGE_OUT_OF_RANGE (the page starts past the first 10,000 sessions that match; narrow the list with a filter), or a filter is malformed: agentId or conversationId is not a positive integer, contactUuid is not a uuid, status is not a session status, or needsAttention is not a boolean","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"401":{"description":"Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"403":{"description":"The key lacks the scope the operation needs (agents:read or agents:write), or AI agents are not available on this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"List agent sessions","tags":["AI Agents"],"x-required-scope":"agents:read"}},"/api/v1/agent-sessions/{id}":{"get":{"description":"Returns one agent session by its integer id (from agent_sessions_list, or sessionId in an agent webhook event): the agent, the conversation, the contact's uuid, when it started, when each side last wrote and how many turns the agent took. status is live (active, paused_by_user, paused_no_credits) or ended (completed, escalated, max_turns, expired, superseded); reasonCode and reason say why it escalated or ended; outcome is its result; qualification holds a booking agent's questions and the answers. needsAttention marks one waiting on a person. Read the messages with conversations_get_messages using conversationId and the contact with contacts_get using contactUuid.","operationId":"AgentSessionsController_get","parameters":[{"name":"id","required":true,"in":"path","description":"Agent session ID (integer; the \"id\" field of a session from agent_sessions_list). Not a contactUuid and not a conversation id.","schema":{"type":"integer"}}],"responses":{"200":{"description":"The session","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentSessionApiRes"}}}},"400":{"description":"Refused: AGENT_SESSION_ID_INVALID (id is not an integer).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"401":{"description":"Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"403":{"description":"The key lacks the scope the operation needs (agents:read or agents:write), or AI agents are not available on this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"404":{"description":"Refused: AGENT_SESSION_NOT_FOUND (no session with this id on the account the key acts in).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Get agent session","tags":["AI Agents"],"x-required-scope":"agents:read"}},"/api/v1/agent-sessions/{id}/acknowledge":{"post":{"description":"Records that a person has dealt with a session that needs attention (an escalation, a lead left for review, a reply that was held back): needsAttention becomes false, so it leaves the needsAttention filter of agent_sessions_list and the alerts in the app. Nothing else changes: the status, reason and outcome stay, the agent is neither resumed nor stopped, and nothing is sent to the contact. Acknowledging a session that is already handled changes nothing. The response is the session as agent_sessions_get returns it. The id comes from agent_sessions_list or sessionId in an agent webhook event.","operationId":"AgentSessionsController_acknowledge","parameters":[{"name":"id","required":true,"in":"path","description":"Agent session ID (integer; the \"id\" field of a session from agent_sessions_list). Not a contactUuid and not a conversation id.","schema":{"type":"integer"}}],"responses":{"200":{"description":"The session, no longer needing attention","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentSessionApiRes"}}}},"400":{"description":"Refused: AGENT_SESSION_ID_INVALID (id is not an integer).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"401":{"description":"Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"403":{"description":"The key lacks the scope the operation needs (agents:read or agents:write), or AI agents are not available on this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"404":{"description":"Refused: AGENT_SESSION_NOT_FOUND (no session with this id on the account the key acts in).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Acknowledge agent session","tags":["AI Agents"],"x-mcp":{"destructive":false,"idempotent":true},"x-required-scope":"agents:write"}},"/api/v1/conversations/{id}/agent":{"get":{"description":"Returns whether an AI agent may answer on one conversation and what the agent on it is doing: agentPaused (the switch that conversation_agent_pause sets, also set when a teammate texts the contact from the app), agentStatus, needsAttention, and the session and agent behind them (details with agent_sessions_get). agentStatus is null when no agent ever handled the conversation. The account-wide stop is agentsPaused in agent_settings_get. The id comes from conversations_list.","operationId":"ConversationAgentController_get","parameters":[{"name":"id","required":true,"in":"path","description":"Conversation ID (integer; the \"id\" field of a conversation). Not the contactUuid. To find a contact's conversation, list conversations filtered by contactUuid.","schema":{"type":"integer"}}],"responses":{"200":{"description":"The agent state of the conversation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationAgentApiRes"}}}},"400":{"description":"id is not an integer","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"401":{"description":"Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"403":{"description":"The key lacks the scope the operation needs (agents:read or agents:write), or AI agents are not available on this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"404":{"description":"Refused: CONVERSATION_NOT_FOUND (no conversation with this id on the account the key acts in).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Get agent on a conversation","tags":["AI Agents"],"x-required-scope":"agents:read"}},"/api/v1/conversations/{id}/agent/pause":{"post":{"description":"Stops every AI agent on one conversation so a person can take it over: no agent answers there, and replies it had queued or held and its pending follow-ups are cancelled. The agent session keeps its status and nothing is sent to the contact. It stays stopped until conversation_agent_resume. Pausing a paused conversation changes nothing. The response is the state conversation_agent_get returns. The id comes from conversations_list, or conversationId of a session in agent_sessions_list.","operationId":"ConversationAgentController_pause","parameters":[{"name":"id","required":true,"in":"path","description":"Conversation ID (integer; the \"id\" field of a conversation). Not the contactUuid. To find a contact's conversation, list conversations filtered by contactUuid.","schema":{"type":"integer"}}],"responses":{"200":{"description":"The agent state of the conversation, now paused","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationAgentApiRes"}}}},"400":{"description":"id is not an integer","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"401":{"description":"Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"403":{"description":"The key lacks the scope the operation needs (agents:read or agents:write), or AI agents are not available on this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"404":{"description":"Refused: CONVERSATION_NOT_FOUND (no conversation with this id on the account the key acts in).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Pause agent on a conversation","tags":["AI Agents"],"x-mcp":{"idempotent":true},"x-required-scope":"agents:write"}},"/api/v1/conversations/{id}/agent/resume":{"post":{"description":"Lifts the stop that conversation_agent_pause (or a teammate texting from the app) put on one conversation. Nothing is sent by this call: an agent that still holds the conversation answers the contact's next text, and an agent whose channel the conversation is on may start on that next text. It does not restart an agent session that has ended. Resuming a conversation that is not paused changes nothing. The response is the state conversation_agent_get returns.","operationId":"ConversationAgentController_resume","parameters":[{"name":"id","required":true,"in":"path","description":"Conversation ID (integer; the \"id\" field of a conversation). Not the contactUuid. To find a contact's conversation, list conversations filtered by contactUuid.","schema":{"type":"integer"}}],"responses":{"200":{"description":"The agent state of the conversation, no longer paused","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationAgentApiRes"}}}},"400":{"description":"id is not an integer","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"401":{"description":"Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"403":{"description":"The key lacks the scope the operation needs (agents:read or agents:write), or AI agents are not available on this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"404":{"description":"Refused: CONVERSATION_NOT_FOUND (no conversation with this id on the account the key acts in).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Resume agent on a conversation","tags":["AI Agents"],"x-mcp":{"destructive":false,"idempotent":true},"x-required-scope":"agents:write"}},"/api/v1/agents/{id}/test-sessions":{"post":{"description":"Opens a test conversation with an agent, played as one of the account's contacts (contactUuid from contacts_list), so the agent reads that contact as it would for real. The draft is tested unless useDraft is false, which tests the published version. No SMS is sent and the contact receives nothing; includeHistory lets the agent read the contact's real conversation first. Opening a test costs nothing; each message sent with agent_test_sessions_send does. A draft that cannot run yet (for example no calendar connected) is refused with what is missing, as readiness.gaps in agents_get. An earlier test conversation of the same agent is closed.","operationId":"AgentTestSessionsController_create","parameters":[{"name":"id","required":true,"in":"path","description":"Agent ID (integer; the \"id\" field of an agent from agents_list). Not a uuid or a name.","schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAgentTestSessionApiDto"}}}},"responses":{"201":{"description":"The test conversation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentTestSessionApiRes"}}}},"400":{"description":"Refused: AGENT_ID_INVALID (id is not an integer), CONFIG_INVALID (a setting of the draft is not valid; issues lists each field), or a body that is not well formed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"401":{"description":"Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"403":{"description":"The key lacks agents:write, or AI agents are not available on this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"404":{"description":"Refused: AGENT_NOT_FOUND (no agent with this id on the account), or CONTACT_NOT_FOUND (no contact with this contactUuid on the account).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"409":{"description":"Refused: AGENT_NOT_READY (the draft cannot run yet; gaps lists what is missing), AGENT_NOT_PUBLISHED (useDraft is false and the agent was never published), or AGENT_ARCHIVED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Start test conversation","tags":["AI Agents"],"x-required-scope":"agents:write"}},"/api/v1/agents/{id}/test-sessions/{sessionId}/messages":{"post":{"description":"Sends one message to a test conversation as the contact would text it and returns what the agent would have replied. It spends credits like a live reply and sends no SMS: the contact receives nothing, and no alert, tag, webhook or booking leaves the test (the agent can read a calendar but not write to it). action says what the agent decided (continue, complete, escalate), toolCalls which tools it used and whether each worked, qualification what a booking agent has learned, and sessionStatus whether the test takes more messages. A null reply with skippedReason means a rule stopped the agent before it answered. A turn can take up to a minute. Start over with agent_test_sessions_reset.","operationId":"AgentTestSessionsController_send","parameters":[{"name":"id","required":true,"in":"path","description":"Agent ID (integer; the \"id\" field of an agent from agents_list). Not a uuid or a name.","schema":{"type":"integer"}},{"name":"sessionId","required":true,"in":"path","description":"Test session ID (integer; the \"id\" field returned by agent_test_sessions_create). Not the id of a session from agent_sessions_list.","schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendAgentTestMessageApiDto"}}}},"responses":{"200":{"description":"The turn","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentTestTurnApiRes"}}}},"400":{"description":"Refused: AGENT_ID_INVALID or TEST_SESSION_ID_INVALID (the id is not an integer), CONFIG_INVALID (the draft under test stopped being valid), or content that is empty or longer than 2000 characters.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"401":{"description":"Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"402":{"description":"Refused: INSUFFICIENT_CREDITS (the account has too few credits for a turn; nothing was sent to the agent).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"403":{"description":"The key lacks agents:write, or AI agents are not available on this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"404":{"description":"Refused: AGENT_NOT_FOUND (no agent with this id on the account), or TEST_SESSION_NOT_FOUND (no test session with this id belongs to the agent).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"409":{"description":"Refused: TEST_SESSION_CLOSED (the test conversation has ended and takes no more messages; reset it), or AGENT_NOT_READY (the draft under test cannot run any more; gaps lists what is missing).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"502":{"description":"TEST_TURN_FAILED: the turn could not be completed and was not recorded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"504":{"description":"TEST_TURN_FAILED: the turn took too long and was stopped","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Send test message","tags":["AI Agents"],"x-mcp":{"title":"Send a test message to an AI agent (spends credits, sends no SMS)","destructive":false,"openWorld":false},"x-required-scope":"agents:write"}},"/api/v1/agents/{id}/test-sessions/{sessionId}/reset":{"post":{"description":"Closes a test conversation and opens a fresh one with the same contact, the same choice of draft or published version and the same history choice. The agent remembers nothing of the closed one, and a draft test picks up the edits made since. The response is the new test conversation: use its id for the next agent_test_sessions_send. Nothing is sent to the contact and no credits are spent.","operationId":"AgentTestSessionsController_reset","parameters":[{"name":"id","required":true,"in":"path","description":"Agent ID (integer; the \"id\" field of an agent from agents_list). Not a uuid or a name.","schema":{"type":"integer"}},{"name":"sessionId","required":true,"in":"path","description":"Test session ID (integer; the \"id\" field returned by agent_test_sessions_create). Not the id of a session from agent_sessions_list.","schema":{"type":"integer"}}],"responses":{"201":{"description":"The new test conversation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentTestSessionApiRes"}}}},"400":{"description":"Refused: AGENT_ID_INVALID or TEST_SESSION_ID_INVALID (the id is not an integer), or CONFIG_INVALID (a setting of the draft is not valid).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"401":{"description":"Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"403":{"description":"The key lacks agents:write, or AI agents are not available on this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"404":{"description":"Refused: AGENT_NOT_FOUND (no agent with this id on the account), or TEST_SESSION_NOT_FOUND (no test session with this id belongs to the agent). CONTACT_NOT_FOUND when the contact was deleted meanwhile.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}},"409":{"description":"Refused: AGENT_NOT_READY (the draft cannot run yet; gaps lists what is missing), AGENT_NOT_PUBLISHED or AGENT_ARCHIVED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Reset test conversation","tags":["AI Agents"],"x-mcp":{"idempotent":true},"x-required-scope":"agents:write"}},"/api/v1/compliance/check":{"post":{"description":"Check SMS first-message compliance (brand name + opt-out wording) before saving a workflow or campaign. A draft is saved even when its first message fails; MESSAGE_NOT_COMPLIANT refuses publishing a workflow, the first start of a campaign, and a first-message change once it is live. Each text gets compliant, the issues and the suggestions to fix it, in the order sent, plus mergeFieldWarnings for merge fields that will not be filled. Nothing is saved or sent.","operationId":"ComplianceController_check","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ComplianceCheckDto"},"examples":{"one":{"summary":"One first message","value":{"messages":["Hi {firstName}, this is Acme Roofing. Reply STOP to opt out."]}},"variants":{"summary":"Two variants of the same first message","value":{"messages":["Hi {firstName}, Acme Roofing here. Reply STOP to opt out.","Hello {firstName}, can we help with your roof?"]}}}}}},"responses":{"200":{"description":"One result per text, in the order sent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ComplianceCheckRes"}}}},"400":{"description":"A malformed body (no texts, more than ten, or a text that is empty or too long) answers the status text \"Bad Request\" with every problem in message[]."},"401":{"description":"Missing or invalid API key"},"403":{"description":"The key lacks the workflows read scope"},"422":{"description":"Refused: BRAND_REQUIRED (the account has no 10DLC brand, so no text can pass; register the brand first).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ComplianceApiErrorRes"}}}},"429":{"description":"Rate limit exceeded"},"503":{"description":"COMPLIANCE_UNAVAILABLE: the check could not run and nothing was recorded. Safe to retry in a few minutes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ComplianceApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Check first-message compliance (brand name and opt-out wording)","tags":["Compliance"],"x-mcp":{"readOnly":true,"idempotent":true,"title":"Check first-message compliance"},"x-required-scope":"workflows:read"}},"/api/v1/webhooks":{"get":{"description":"Returns paginated list of webhooks","operationId":"WebhooksApiController_list","parameters":[{"name":"page","required":false,"in":"query","description":"Page number","schema":{"example":"1","type":"string"}},{"name":"take","required":false,"in":"query","description":"Number of items per page","schema":{"example":"10","type":"string"}}],"responses":{"200":{"description":"Webhooks retrieved successfully","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/WebhookRes"}}}}}},"security":[{"api-key":[]}],"summary":"List webhooks","tags":["Manage Webhooks"],"x-required-scope":"webhooks:read"},"post":{"description":"Creates a new webhook endpoint. Maximum 10 webhooks per account.","operationId":"WebhooksApiController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateWebhookApiDto"}}}},"responses":{"201":{"description":"Webhook created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookRes"}}}},"400":{"description":"Invalid request body or webhook limit reached"}},"security":[{"api-key":[]}],"summary":"Create webhook","tags":["Manage Webhooks"],"x-mcp":{"openWorld":true},"x-required-scope":"webhooks:write"}},"/api/v1/webhooks/{extId}":{"get":{"description":"Retrieves a single webhook by ID","operationId":"WebhooksApiController_get","parameters":[{"name":"extId","required":true,"in":"path","description":"Webhook UUID","schema":{"type":"string"}}],"responses":{"200":{"description":"Webhook retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookRes"}}}},"404":{"description":"Webhook not found"}},"security":[{"api-key":[]}],"summary":"Get webhook","tags":["Manage Webhooks"],"x-required-scope":"webhooks:read"},"patch":{"description":"Updates a webhook endpoint: its URL, subscribed events or enabled state.","operationId":"WebhooksApiController_update","parameters":[{"name":"extId","required":true,"in":"path","description":"Webhook UUID","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateWebhookApiDto"}}}},"responses":{"200":{"description":"Webhook updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookRes"}}}},"404":{"description":"Webhook not found"}},"security":[{"api-key":[]}],"summary":"Update webhook","tags":["Manage Webhooks"],"x-mcp":{"openWorld":true},"x-required-scope":"webhooks:write"},"delete":{"description":"Permanently deletes a webhook endpoint; it stops receiving events at once.","operationId":"WebhooksApiController_delete","parameters":[{"name":"extId","required":true,"in":"path","description":"Webhook UUID","schema":{"type":"string"}}],"responses":{"204":{"description":"Webhook deleted successfully"},"404":{"description":"Webhook not found"}},"security":[{"api-key":[]}],"summary":"Delete webhook","tags":["Manage Webhooks"],"x-required-scope":"webhooks:write"}},"/api/v1/webhooks/{extId}/test":{"post":{"description":"Sends a test event to the webhook endpoint","operationId":"WebhooksApiController_test","parameters":[{"name":"extId","required":true,"in":"path","description":"Webhook UUID","schema":{"type":"string"}}],"responses":{"200":{"description":"Test delivery sent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookDeliveryRes"}}}},"404":{"description":"Webhook not found"}},"security":[{"api-key":[]}],"summary":"Test webhook","tags":["Manage Webhooks"],"x-mcp":{"destructive":false,"openWorld":true},"x-required-scope":"webhooks:write"}},"/api/v1/webhooks/events/{eventName}/sample":{"get":{"description":"Returns the exact envelope a real webhook delivery would carry for the given event, with a realistic data payload matching the production signature. Read-only and stateless — no webhook record is required.","operationId":"WebhooksApiController_getEventSample","parameters":[{"name":"eventName","required":true,"in":"path","description":"Webhook event name (e.g. contact.created)","schema":{"type":"string"}}],"responses":{"200":{"description":"Sample envelope retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEventSampleRes"}}}},"404":{"description":"Unknown event — body lists the valid event names"}},"security":[{"api-key":[]}],"summary":"Get a sample payload for a webhook event","tags":["Manage Webhooks"],"x-required-scope":"webhooks:read"}},"/api/v1/webhooks/{extId}/deliveries":{"get":{"description":"Returns a paginated list of the test deliveries sent to this webhook with POST /v1/webhooks/{extId}/test. Deliveries of real events are not listed here.","operationId":"WebhooksApiController_listDeliveries","parameters":[{"name":"extId","required":true,"in":"path","description":"Webhook UUID","schema":{"type":"string"}},{"name":"page","required":false,"in":"query","description":"Page number","schema":{"example":"1","type":"string"}},{"name":"take","required":false,"in":"query","description":"Number of items per page","schema":{"example":"10","type":"string"}},{"name":"status","required":false,"in":"query","description":"Filter by delivery status","schema":{"example":"success","type":"string"}}],"responses":{"200":{"description":"Deliveries retrieved successfully","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/WebhookDeliveryRes"}}}}},"404":{"description":"Webhook not found"}},"security":[{"api-key":[]}],"summary":"List test deliveries","tags":["Manage Webhooks"],"x-mcp":{"description":"Returns a paginated list of the test deliveries sent to this webhook with webhooks_api_test. Deliveries of real events are not listed here."},"x-required-scope":"webhooks:read"}},"/api/v1/async-operations/{operationId}":{"get":{"description":"Retrieves the status and progress of an async operation by ID. Use this to track the progress of bulk operations such as imports or deletions, for example the bulk_contact_delete operation that POST /v1/scrubs/{scrubId}/remove (scrubs_remove_results) starts. Poll until status is completed or failed. A failed operation answers 404 about 30 minutes after it failed.","operationId":"AsyncOperationsApiController_getOperation","parameters":[{"name":"operationId","required":true,"in":"path","description":"Async operation ID (UUID)","schema":{"type":"string"}}],"responses":{"200":{"description":"The operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AsyncOperationRes"},"examples":{"running":{"summary":"bulk_contact_delete running","value":{"operationId":"3f1c2a9e-8b7d-4e6f-9a10-2b3c4d5e6f70","operationType":"bulk_contact_delete","status":"in_progress","progress":{"total":190,"processed":120,"percentage":63,"successCount":120,"errorCount":0,"message":"Deleting contacts..."},"createdAt":"2026-11-17T15:12:00.000Z"}},"completed":{"summary":"bulk_contact_delete completed","value":{"operationId":"3f1c2a9e-8b7d-4e6f-9a10-2b3c4d5e6f70","operationType":"bulk_contact_delete","status":"completed","progress":{"total":190,"processed":190,"percentage":100,"successCount":190,"errorCount":0,"message":"Deleted 190 of 190 contacts"},"result":{"deletedCount":190},"createdAt":"2026-11-17T15:12:00.000Z","completedAt":"2026-11-17T15:12:09.000Z"}},"failed":{"summary":"bulk_contact_delete failed","value":{"operationId":"3f1c2a9e-8b7d-4e6f-9a10-2b3c4d5e6f70","operationType":"bulk_contact_delete","status":"failed","progress":{"total":190,"processed":40,"percentage":21,"successCount":40,"errorCount":0},"createdAt":"2026-11-17T15:12:00.000Z","completedAt":"2026-11-17T15:12:04.000Z"}}}}}},"404":{"description":"Operation not found: unknown, expired or of another account"}},"security":[{"api-key":[]}],"summary":"Get async operation","tags":["Async Operations"],"x-required-scope":"async-operations:read"}},"/api/v1/credits":{"get":{"description":"Returns the authenticated account’s SMS credit balance, auto-recharge configuration, verification-credit balance, AI-credit balances (purchased, lifetime purchased, and what is left of the monthly free and reserved AI credits; present only when AI credits are enabled for the account), and who pays for the account (`billedBy`). An account an organization owns reads `billedBy: organisation`: its credits come from the organization’s pool and money writes through this key are refused.","operationId":"CreditsBalanceApiController_getBalance","parameters":[],"responses":{"200":{"description":"Balance retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditsBalanceRes"}}}}},"security":[{"api-key":[]}],"summary":"Get credit balance","tags":["Credits"],"x-required-scope":"credits:read"}},"/api/v1/credits/transfers":{"get":{"description":"Read-only ledger of credit grants and usage; nothing is moved. Returns the paginated credit history of the authenticated account, including team transfers, admin grants and credits removed by a refund.","operationId":"CreditsBalanceApiController_getTransfers","parameters":[{"name":"page","required":false,"in":"query","description":"Page number (1-indexed)","schema":{"default":1,"type":"number"}},{"name":"limit","required":false,"in":"query","description":"Maximum number of transfers per page","schema":{"maximum":100,"default":100,"type":"number"}},{"name":"type","required":false,"in":"query","description":"Filter by transfer type","schema":{"enum":["all","team_transfer","admin_grant","feedback_reward","admin_refund","admin_ai_refund","admin_verification_refund"],"type":"string"}},{"name":"sortBy","required":false,"in":"query","description":"Sort transfers by field","schema":{"enum":["createdAt","amount","transferType"],"type":"string"}},{"name":"sortOrder","required":false,"in":"query","description":"Sort order","schema":{"enum":["asc","desc"],"type":"string"}}],"responses":{"200":{"description":"Transfers retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditTransfersRes"}}}}},"security":[{"api-key":[]}],"summary":"List credit transfers","tags":["Credits"],"x-mcp":{"title":"List credit history"},"x-required-scope":"credits:read"}},"/api/v1/credits/purchase":{"post":{"description":"Charges the account's saved card for one SMS, verification or AI pack and answers the purchase. The credits land when the payment is confirmed, usually within seconds: poll `statusUrl` until `creditsGranted` is set. A bank challenge is a 402 whose `purchase.completeUrl` a signed-in person finishes; the purchase then completes on its own. SMS packs need a carrier-accepted campaign. An AI pack grants its base credits plus its bonus (the `credits` the products list shows). AI credit packs require the AI credits feature on the account; without it AI packs are not listed and `kind: ai` is refused. Requires the `credits:write` scope; full access does not include it, the key must be minted with it.","operationId":"CreditsPurchaseApiController_purchase","parameters":[{"name":"Idempotency-Key","in":"header","description":"Your own reference for this one purchase, 8 to 255 characters of letters, digits, \".\", \"_\", \":\" or \"-\". Replaying it returns the same purchase instead of charging again; keys are honoured for 24 hours.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseCreditsReq"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditPurchaseRes"}}}},"400":{"description":"No or malformed `Idempotency-Key`, or the body names neither or both of `productId` and `lookupKey`."},"402":{"description":"`AUTHENTICATION_REQUIRED` (the bank wants the cardholder; `purchase.completeUrl` is for a person) or `CARD_DECLINED` (`declineCode` says why).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditPurchaseRefusalRes"}}}},"403":{"description":"`campaign_not_approved`: SMS credits need a carrier-accepted campaign first. `billed_by_organisation`: the organization that owns this account pays for it; buy on the organization surface instead.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditsApiErrorRes"}}}},"404":{"description":"`PRODUCT_NOT_FOUND`: no such pack of that kind is on sale (and `kind: ai` without the AI credits feature).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditsApiErrorRes"}}}},"409":{"description":"`NO_PAYMENT_METHOD`: no card on file; `setupLinkEndpoint` says where to get one added.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditsApiErrorRes"}}}},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: that key was used for a different purchase.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Buy a credit pack","tags":["Credits"],"x-required-scope":"credits:write"}},"/api/v1/credits/purchases/{id}":{"get":{"description":"The state of one purchase made by this account. `creditsGranted` is set once the payment was confirmed and the credits added; until then it is null.","operationId":"CreditsPurchaseApiController_purchaseStatus","parameters":[{"name":"id","required":true,"in":"path","description":"The purchase id a purchase answered","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditPurchaseRes"}}}},"404":{"description":"`PURCHASE_NOT_FOUND`: no purchase with that id belongs to the account.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Get a credit purchase","tags":["Credits"],"x-required-scope":"credits:read"}},"/api/v1/credits/auto-recharge":{"put":{"description":"Arms auto-recharge (`active: true`) so the saved card buys the chosen pack whenever the balance drops below `threshold`, or disarms it (`active: false`). `kind` picks the pool: `sms` (the default) or `ai`. Arming SMS needs a carrier-accepted campaign, a card on file and an SMS pack on sale. Arming AI needs a threshold (10 to 1000 credits) and an AI pack, supplied or already stored; as on the dashboard, a card is only needed when a recharge fires. Nothing is charged by this call itself. AI credit packs require the AI credits feature on the account; without it AI packs are not listed and `kind: ai` is refused. Requires the `credits:write` scope; full access does not include it, the key must be minted with it.","operationId":"CreditsPurchaseApiController_updateAutoRecharge","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAutoRechargeReq"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutoRechargeRes"}}}},"400":{"description":"With `kind: ai`: a threshold outside 10 to 1000, or arming without a threshold and pack (supplied or stored)."},"403":{"description":"`campaign_not_approved`: SMS credits need a carrier-accepted campaign first. `billed_by_organisation`: the organization that owns this account pays for it; buy on the organization surface instead.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditsApiErrorRes"}}}},"404":{"description":"`PRODUCT_NOT_FOUND`: no pack of that kind (SMS, or AI with `kind: ai`) with that id is on sale, or `kind: ai` without the AI credits feature (with or without a `productId`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditsApiErrorRes"}}}},"409":{"description":"`NO_PAYMENT_METHOD`: no card on file; `setupLinkEndpoint` says where to get one added.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditsApiErrorRes"}}}}},"security":[{"api-key":[]}],"summary":"Arm or disarm SMS or AI auto-recharge","tags":["Credits"],"x-required-scope":"credits:write"}},"/api/v1/credits/products":{"get":{"description":"Returns every SMS, verification and AI credit pack on sale with its price, SMS packs first, then verification, then AI, each kind in ascending credit order. `credits` is what a purchase of the pack grants (for an AI pack, bonus included); `id` and `lookupKey` identify the pack when buying it. Packs whose grant cannot be determined are omitted. `kind` narrows the list to one pool. AI credit packs require the AI credits feature on the account; without it AI packs are not listed and `kind: ai` is refused.","operationId":"CreditsProductsApiController_listProducts","parameters":[{"name":"kind","required":false,"in":"query","description":"Only the packs of this kind; omit for every kind. AI credit packs require the AI credits feature on the account; without it AI packs are not listed and `kind: ai` is refused. (`kind=ai` then answers an empty list.)","schema":{"type":"string","enum":["sms","verification","ai"]}}],"responses":{"200":{"description":"Packs retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditProductsRes"}}}}},"security":[{"api-key":[]}],"summary":"List credit packs","tags":["Credits"],"x-required-scope":"credits:read"}},"/api/v1/credits/usage":{"get":{"description":"Returns the SMS credits one campaign and/or workflow spent, one row per day, newest first, within an optional date range, plus the credits spent so far today. At least one of campaignId or workflowId is required; a campaign or workflow this account does not own answers 404.","operationId":"CreditsUsageApiController_getUsage","parameters":[{"name":"campaignId","required":false,"in":"query","description":"Campaign to report on. At least one of campaignId or workflowId is required.","schema":{"type":"number"}},{"name":"workflowId","required":false,"in":"query","description":"Workflow to report on. At least one of campaignId or workflowId is required.","schema":{"type":"number"}},{"name":"from","required":false,"in":"query","description":"First day included, YYYY-MM-DD (UTC). Omit for no lower bound.","schema":{"example":"2026-01-01","type":"string"}},{"name":"to","required":false,"in":"query","description":"Last day included, YYYY-MM-DD (UTC). Omit for no upper bound.","schema":{"example":"2026-01-31","type":"string"}},{"name":"page","required":false,"in":"query","description":"Page number (1-indexed)","schema":{"default":1,"type":"number"}},{"name":"limit","required":false,"in":"query","description":"Maximum number of days per page","schema":{"maximum":100,"default":100,"type":"number"}}],"responses":{"200":{"description":"Usage retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditUsageRes"}}}},"400":{"description":"Neither campaignId nor workflowId was given, or a parameter is malformed"},"404":{"description":"Campaign or workflow not found"}},"security":[{"api-key":[]}],"summary":"Get credit usage by campaign or workflow","tags":["Credits"],"x-required-scope":"credits:read"}},"/api/v1/billing":{"get":{"description":"Returns the account-status value, payment-method validity, and which billing-gated capabilities (send, purchase, vetting, campaign submit) are currently blocked and why. Read-only. Uses the same billing health the dashboard shows, including the cards and past-due invoices on the Stripe customer that pays for the account.","operationId":"BillingApiController_getStatus","parameters":[],"responses":{"200":{"description":"Billing status retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingStatusRes"}}}}},"security":[{"api-key":[]}],"summary":"Get billing & account status","tags":["Billing"],"x-required-scope":"billing:read"}},"/api/v1/billing/payment-methods":{"get":{"description":"Returns the cards saved on the account’s billing customer, masked (brand, last four digits, expiry) and flagged as the default or not. Adding a card is never an API action: a card is entered by a person in the dashboard.","operationId":"BillingApiController_listPaymentMethods","parameters":[],"responses":{"200":{"description":"Cards retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentMethodsRes"}}}},"404":{"description":"The account has no billing customer yet (no card was ever added)"}},"security":[{"api-key":[]}],"summary":"List saved cards","tags":["Billing"],"x-required-scope":"billing:read"}},"/api/v1/billing/invoices":{"get":{"description":"Returns the invoices of the account’s billing customer, newest first, with amounts in the smallest unit of the currency and links to the hosted invoice and its PDF. Page forward by passing the last invoice id as `startingAfter` while `hasMore` is true.","operationId":"BillingApiController_listInvoices","parameters":[{"name":"limit","required":false,"in":"query","description":"Maximum number of invoices to return","schema":{"maximum":100,"default":20,"type":"number"}},{"name":"startingAfter","required":false,"in":"query","description":"Cursor: the id of the last invoice of the previous page. Returns the invoices after it.","schema":{"type":"string"}}],"responses":{"200":{"description":"Invoices retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoicesRes"}}}},"404":{"description":"The account has no billing customer yet (nothing was ever billed)"}},"security":[{"api-key":[]}],"summary":"List invoices","tags":["Billing"],"x-required-scope":"billing:read"}},"/api/v1/billing/payment-methods/setup-link":{"post":{"description":"Returns a hosted page where a person enters a card for this account; the agent never sees card details. Once Stripe confirms the card it becomes the default and is applied to every subscription, usually within seconds. Creates the billing customer if the account has none yet. Requires the `billing:write` scope; full access does not include it, the key must be minted with it.","operationId":"BillingApiController_createCardSetupLink","parameters":[],"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CardSetupLinkRes"}}}},"403":{"description":"`billed_by_organisation`: the organization that owns this account pays for it; its card is managed on the organization surface."}},"security":[{"api-key":[]}],"summary":"Issue a link for a person to add a card","tags":["Billing"],"x-required-scope":"billing:write"}},"/api/v1/billing/payment-methods/default":{"put":{"description":"Makes one of the saved cards the one charged by default, and applies it to every active subscription. Requires the `billing:write` scope; full access does not include it, the key must be minted with it.","operationId":"BillingApiController_setDefaultPaymentMethod","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetDefaultPaymentMethodReq"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DefaultPaymentMethodRes"}}}},"403":{"description":"`billed_by_organisation`: the organization that owns this account pays for it; its card is managed on the organization surface."},"404":{"description":"The account has no billing customer yet (no card was ever added)"}},"security":[{"api-key":[]}],"summary":"Set the default card","tags":["Billing"],"x-required-scope":"billing:write"}},"/api/v1/billing/payment-methods/{id}":{"delete":{"description":"Detaches a saved card from the account. The default card cannot be removed: set another card as the default first. Requires the `billing:write` scope; full access does not include it, the key must be minted with it.","operationId":"BillingApiController_deletePaymentMethod","parameters":[{"name":"id","required":true,"in":"path","description":"A card id from `GET /v1/billing/payment-methods (billing_api_list_payment_methods)`","schema":{"type":"string"}}],"responses":{"204":{"description":"Card removed"},"400":{"description":"That card is the default; set another default first"},"403":{"description":"`billed_by_organisation`: the organization that owns this account pays for it; its card is managed on the organization surface."},"404":{"description":"The account has no billing customer yet (no card was ever added)"}},"security":[{"api-key":[]}],"summary":"Remove a saved card","tags":["Billing"],"x-required-scope":"billing:write"}},"/api/v1/accounts":{"get":{"description":"Available only to a key belonging to an account that an organization owns. Returns every account that organization owns, including the one this key was minted on, and excluding closed accounts. A key on a personally-owned account gets a 404.","operationId":"AccountsApiController_list","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AccountRes"}}}}},"404":{"description":"This key does not belong to an account owned by an organization."}},"security":[{"api-key":[]}],"summary":"List the accounts your organization owns","tags":["Accounts"],"x-required-scope":"accounts:read"}},"/api/v1/organisation":{"get":{"description":"The organization this key was issued for: its name, logo, account limit and whether it may create accounts. Billing figures are not included.","operationId":"OrganisationProfileApiController_profile","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationRes"}}}}},"security":[{"organisation-api-key":[]}],"summary":"Get your organization","tags":["Organization"],"x-required-scope":"organisation:read"}},"/api/v1/organisation/accounts":{"get":{"description":"Every open account the organization owns, oldest first. Closed accounts are excluded.","operationId":"OrganisationAccountsApiController_list","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/OrganisationAccountRes"}}}}}},"security":[{"organisation-api-key":[]}],"summary":"List the accounts your organization owns","tags":["Organization"],"x-required-scope":"organisation:accounts:read"},"post":{"description":"Creates an account owned by your organization and, when `apiKey` is given, mints an API key on it in the same call. The key secret is returned once, in this response only. Every new account takes a seat on your subscription: when no seat is free, `purchaseSeat` must be true or the request is refused with 409 `SEAT_NOT_AGREED` and nothing is billed. Every refusal carries a stable `code` next to its message. If the account is created but the key cannot be minted, the response is still 201 with `apiKey: null`; mint one with POST /accounts/{id}/api-keys.","operationId":"OrganisationAccountsApiController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateOrganisationAccountReq"}}}},"responses":{"201":{"description":"The account, and the key with its one-time secret when one was requested.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatedOrganisationAccountRes"}}}},"400":{"description":"A `userIds` entry is not a member of your organization (`ASSIGNEE_NOT_A_MEMBER`), or the spending policy is another organization’s (`SPENDING_POLICY_NOT_IN_ORGANISATION`). A malformed body is refused without a code.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationApiErrorRes"}}}},"403":{"description":"Your organization may not create accounts (`ACCOUNT_CREATION_NOT_GRANTED`), or sandbox accounts are off in this environment (`SANDBOX_NOT_ENABLED`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationApiErrorRes"}}}},"404":{"description":"The organization no longer exists (`ORGANISATION_NOT_FOUND`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationApiErrorRes"}}}},"409":{"description":"No seat is free and `purchaseSeat` was not true (`SEAT_NOT_AGREED`), the account limit is reached (`ACCOUNT_LIMIT_REACHED`), or an open account of yours already has that name (`ACCOUNT_NAME_TAKEN`). Nothing is billed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationApiErrorRes"}}}}},"security":[{"organisation-api-key":[]}],"summary":"Create an account","tags":["Organization"],"x-mcp":{"description":"Creates an account owned by your organization and, when `apiKey` is given, mints an API key on it in the same call. The key secret is returned once, in this response only. Every new account takes a seat on your subscription: when no seat is free, `purchaseSeat` must be true or the request is refused with 409 `SEAT_NOT_AGREED` and nothing is billed. Every refusal carries a stable `code` next to its message. If the account is created but the key cannot be minted, the response is still 201 with `apiKey: null`; create a key for it from the organization dashboard."},"x-required-scope":"organisation:accounts:write"}},"/api/v1/organisation/accounts/{id}":{"get":{"operationId":"OrganisationAccountsApiController_getOne","parameters":[{"name":"id","required":true,"in":"path","description":"Account ID","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationAccountRes"}}}},"404":{"description":"No open account with this id is owned by your organization (`code`: `ACCOUNT_NOT_FOUND`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationApiErrorRes"}}}}},"security":[{"organisation-api-key":[]}],"summary":"Get one account your organization owns","tags":["Organization"],"x-required-scope":"organisation:accounts:read"},"patch":{"description":"Changes the account name and nothing else. Names are unique among your open accounts, ignoring case.","operationId":"OrganisationAccountsApiController_rename","parameters":[{"name":"id","required":true,"in":"path","description":"Account ID","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RenameOrganisationAccountReq"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationAccountRes"}}}},"404":{"description":"No open account with this id is owned by your organization (`code`: `ACCOUNT_NOT_FOUND`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationApiErrorRes"}}}},"409":{"description":"Another open account of yours already has that name (`ACCOUNT_NAME_TAKEN`). Nothing was changed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationApiErrorRes"}}}}},"security":[{"organisation-api-key":[]}],"summary":"Rename an account","tags":["Organization"],"x-required-scope":"organisation:accounts:write"},"delete":{"description":"Irreversible. Closes the account, revokes every API key minted on it, releases its phone numbers back to the provider and frees its seat. Its data is retained but can no longer be reached through the API.","operationId":"OrganisationAccountsApiController_close","parameters":[{"name":"id","required":true,"in":"path","description":"Account ID","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClosedOrganisationAccountRes"}}}},"404":{"description":"No open account with this id is owned by your organization (`code`: `ACCOUNT_NOT_FOUND`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationApiErrorRes"}}}}},"security":[{"organisation-api-key":[]}],"summary":"Close an account","tags":["Organization"],"x-required-scope":"organisation:accounts:write"}},"/api/v1/organisation/accounts/{id}/api-keys":{"get":{"description":"Never includes a secret.","operationId":"OrganisationAccountApiKeysController_list","parameters":[{"name":"id","required":true,"in":"path","description":"Account ID","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AccountApiKeyRes"}}}}},"404":{"description":"No open account with this id is owned by your organization, or the key is not on it."}},"security":[{"organisation-api-key":[]}],"summary":"List an account's API keys","tags":["Organization"],"x-required-scope":"organisation:api-keys:write"},"post":{"description":"The secret is returned once, in this response only; it is stored as a hash and cannot be read again.","operationId":"OrganisationAccountApiKeysController_create","parameters":[{"name":"id","required":true,"in":"path","description":"Account ID","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAccountApiKeyReq"}}}},"responses":{"201":{"description":"The secret is returned once, in this response only; it is stored as a hash and cannot be read again.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountApiKeyWithSecretRes"}}}},"400":{"description":"The account already holds the maximum number of keys."},"404":{"description":"No open account with this id is owned by your organization, or the key is not on it."}},"security":[{"organisation-api-key":[]}],"summary":"Create an API key on an account","tags":["Organization"],"x-mcp":{"hidden":true},"x-required-scope":"organisation:api-keys:write"}},"/api/v1/organisation/accounts/{id}/api-keys/{keyId}/regenerate":{"post":{"description":"Invalidates the current secret immediately. The secret is returned once, in this response only; it is stored as a hash and cannot be read again.","operationId":"OrganisationAccountApiKeysController_regenerate","parameters":[{"name":"id","required":true,"in":"path","description":"Account ID","schema":{"type":"number"}},{"name":"keyId","required":true,"in":"path","description":"The key extId","schema":{"type":"string"}}],"responses":{"201":{"description":"The secret is returned once, in this response only; it is stored as a hash and cannot be read again.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountApiKeyWithSecretRes"}}}},"404":{"description":"No open account with this id is owned by your organization, or the key is not on it."}},"security":[{"organisation-api-key":[]}],"summary":"Regenerate an API key's secret","tags":["Organization"],"x-mcp":{"hidden":true},"x-required-scope":"organisation:api-keys:write"}},"/api/v1/organisation/accounts/{id}/api-keys/{keyId}":{"delete":{"description":"Requests with the key fail from this point on.","operationId":"OrganisationAccountApiKeysController_remove","parameters":[{"name":"id","required":true,"in":"path","description":"Account ID","schema":{"type":"number"}},{"name":"keyId","required":true,"in":"path","description":"The key extId","schema":{"type":"string"}}],"responses":{"204":{"description":""},"404":{"description":"No open account with this id is owned by your organization, or the key is not on it."}},"security":[{"organisation-api-key":[]}],"summary":"Revoke an API key","tags":["Organization"],"x-required-scope":"organisation:api-keys:write"}},"/api/v1/organisation/spending-policies":{"get":{"description":"Every spending policy the organization defines, with how many accounts hold each.","operationId":"OrganisationSpendingPoliciesController_list","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SpendingPolicyRes"}}}}}},"security":[{"organisation-api-key":[]}],"summary":"List spending policies","tags":["Organization"],"x-required-scope":"organisation:spending-policies:read"},"post":{"description":"Names must be unique within the organization. Every limit is a number or an explicit null for \"no limit\".","operationId":"OrganisationSpendingPoliciesController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SpendingPolicyReq"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SpendingPolicyRes"}}}},"409":{"description":"A policy with that name exists."}},"security":[{"organisation-api-key":[]}],"summary":"Create a spending policy","tags":["Organization"],"x-required-scope":"organisation:spending-policies:write"}},"/api/v1/organisation/spending-policies/{id}":{"get":{"operationId":"OrganisationSpendingPoliciesController_getOne","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SpendingPolicyRes"}}}},"404":{"description":"No such spending policy or account in this organization (`code`: `SPENDING_POLICY_NOT_FOUND` or `ACCOUNT_NOT_FOUND`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationApiErrorRes"}}}}},"security":[{"organisation-api-key":[]}],"summary":"Get a spending policy","tags":["Organization"],"x-required-scope":"organisation:spending-policies:read"},"put":{"description":"Replaces every field. Accounts holding the policy see the new limits from their next debit.","operationId":"OrganisationSpendingPoliciesController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SpendingPolicyReq"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SpendingPolicyRes"}}}},"404":{"description":"No such spending policy or account in this organization (`code`: `SPENDING_POLICY_NOT_FOUND` or `ACCOUNT_NOT_FOUND`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationApiErrorRes"}}}},"409":{"description":"A policy with that name exists."}},"security":[{"organisation-api-key":[]}],"summary":"Replace a spending policy","tags":["Organization"],"x-required-scope":"organisation:spending-policies:write"},"delete":{"description":"Refused while any account holds the policy; detach it from them first.","operationId":"OrganisationSpendingPoliciesController_remove","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"204":{"description":""},"404":{"description":"No such spending policy or account in this organization (`code`: `SPENDING_POLICY_NOT_FOUND` or `ACCOUNT_NOT_FOUND`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationApiErrorRes"}}}},"409":{"description":"The policy is attached to one or more accounts."}},"security":[{"organisation-api-key":[]}],"summary":"Delete a spending policy","tags":["Organization"],"x-required-scope":"organisation:spending-policies:write"}},"/api/v1/organisation/accounts/{id}/spending-policy":{"put":{"description":"Attach one of the organization’s policies to an account it owns, or send null to detach the current one.","operationId":"OrganisationSpendingPoliciesController_attach","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttachSpendingPolicyReq"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountSpendingPolicyRes"}}}},"400":{"description":"The policy belongs to a different organization."},"404":{"description":"No such spending policy or account in this organization (`code`: `SPENDING_POLICY_NOT_FOUND` or `ACCOUNT_NOT_FOUND`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationApiErrorRes"}}}}},"security":[{"organisation-api-key":[]}],"summary":"Attach or detach the spending policy of an account","tags":["Organization"],"x-required-scope":"organisation:spending-policies:write"}},"/api/v1/organisation/accounts/{id}/spending":{"get":{"description":"How much of its policy’s limit an account it owns has used in the current period, per credit pool, and how many phone numbers it holds against its allowance. A period is a rolling duration from the first debit under the policy (a `month` is 30 days), not a calendar unit; `resetAt` says when it ends. An account that reaches a limit is paused until the period rolls or the policy changes. Not cached: the period is derived at read time.","operationId":"OrganisationSpendingPoliciesController_spendingState","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountSpendingStateRes"}}}},"404":{"description":"No such spending policy or account in this organization (`code`: `SPENDING_POLICY_NOT_FOUND` or `ACCOUNT_NOT_FOUND`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationApiErrorRes"}}}}},"security":[{"organisation-api-key":[]}],"summary":"Get the spending state of an account","tags":["Organization"],"x-required-scope":"organisation:spending-policies:read"}},"/api/v1/organisation/accounts/{id}/access":{"get":{"description":"The people granted access to the account. Organization owners and admins reach every account without a grant and are not listed.","operationId":"OrganisationAccountAccessController_list","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AccountAccessGrantRes"}}}}},"404":{"description":"The account is not owned by this organization, or the person has no grant on it."}},"security":[{"organisation-api-key":[]}],"summary":"List who has access to an account","tags":["Organization"],"x-required-scope":"organisation:accounts:read"},"post":{"description":"Every user id must be a member of the organization. People who already have access are reported under \"skipped\" rather than failing the call.","operationId":"OrganisationAccountAccessController_grant","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GrantAccountAccessReq"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GrantAccountAccessRes"}}}},"400":{"description":"A user id is nobody (`ASSIGNEE_NOT_FOUND`) or not a member of the organization (`ASSIGNEE_NOT_A_MEMBER`). Nothing was granted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationApiErrorRes"}}}},"404":{"description":"The account is not owned by this organization, or the person has no grant on it."}},"security":[{"organisation-api-key":[]}],"summary":"Grant people access to an account","tags":["Organization"],"x-required-scope":"organisation:accounts:write"}},"/api/v1/organisation/accounts/{id}/access/{userId}":{"patch":{"description":"Changes the role a person holds on the account. Refused when the account would be left without anyone who can manage its access.","operationId":"OrganisationAccountAccessController_changeRole","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}},{"name":"userId","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAccountAccessRoleReq"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountAccessGrantRes"}}}},"400":{"description":"The account would be left without anyone who can manage its access."},"404":{"description":"The account is not owned by this organization, or the person has no grant on it."}},"security":[{"organisation-api-key":[]}],"summary":"Change the role of a person on an account","tags":["Organization"],"x-required-scope":"organisation:accounts:write"},"delete":{"description":"Removes the person’s grant on the account; their access ends at once. Organization owners and admins keep reaching every account.","operationId":"OrganisationAccountAccessController_revoke","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}},{"name":"userId","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"204":{"description":""},"404":{"description":"The account is not owned by this organization, or the person has no grant on it."}},"security":[{"organisation-api-key":[]}],"summary":"Revoke a person’s access to an account","tags":["Organization"],"x-required-scope":"organisation:accounts:write"}},"/api/v1/organisation/credits":{"get":{"description":"The SMS, verification and AI credits left in the organization pool, what has been bought into it so far, and its auto-recharge rule. Cached for 15 seconds; `asOf` says when the answer was computed. AI credit packs require the AI credits feature on the organization; without it AI packs are not listed or sold, and the balance has no AI fields.","operationId":"OrganisationCreditsApiController_balance","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationCreditsRes"}}}},"429":{"description":"More than 60 reads a minute."}},"security":[{"organisation-api-key":[]}],"summary":"Get the organization credit balance","tags":["Organization"],"x-required-scope":"organisation:credits:read"}},"/api/v1/organisation/credits/products":{"get":{"description":"Every SMS, verification and AI credit pack, with the credits it grants (bonus included) and its price in minor units. `kind` narrows the list to the packs of one pool. Cached for five minutes per organization. AI credit packs require the AI credits feature on the organization; without it AI packs are not listed or sold, and the balance has no AI fields.","operationId":"OrganisationCreditsApiController_products","parameters":[{"name":"kind","required":false,"in":"query","description":"Only the packs that fill this pool; every pack when omitted. `ai` lists nothing when AI credits are not enabled for the organization.","schema":{"type":"string","enum":["sms","verification","ai"]}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/OrganisationCreditProductRes"}}}}},"400":{"description":"`kind` is not one of the pools a caller may filter by."},"429":{"description":"More than 60 reads a minute."}},"security":[{"organisation-api-key":[]}],"summary":"List the credit packs an organization can buy","tags":["Organization"],"x-required-scope":"organisation:credits:read"}},"/api/v1/organisation/credits/movements":{"get":{"description":"Purchases, auto-recharges, refunds and grants, newest first, a page at a time. Debits are not listed here; `GET /v1/organisation/credits/usage (organisation_credits_api_usage)` sums them per account. Cached for 60 seconds per page; a new deposit drops the cache.","operationId":"OrganisationCreditsApiController_movements","parameters":[{"name":"limit","required":false,"in":"query","description":"Movements per page","schema":{"minimum":1,"maximum":100,"default":50,"type":"number"}},{"name":"before","required":false,"in":"query","description":"The `nextCursor` of the previous page: only movements older than it are returned.","schema":{"minimum":1,"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationCreditMovementsRes"}}}},"400":{"description":"`limit` is not an integer from 1 to 100, or `before` is not a positive integer."},"429":{"description":"More than 60 reads a minute."}},"security":[{"organisation-api-key":[]}],"summary":"List what went into the organization pool","tags":["Organization"],"x-required-scope":"organisation:credits:read"}},"/api/v1/organisation/credits/usage":{"get":{"description":"What each account the organization owns drew from each pool, over the last `days` days (default 30, at most 90) or between `from` and `to` (UTC calendar days, inclusive, at most 92 apart). `granularity=day` returns one row per account, pool and day. Closed accounts keep their rows, dated by `accountClosedAt`. Cached for 60 seconds per window; the underlying rollup runs hourly, so today is always partial.","operationId":"OrganisationCreditsApiController_usage","parameters":[{"name":"days","required":false,"in":"query","description":"Window in days, counted back from today (UTC), today included. Default 30 when `from` and `to` are absent; cannot be combined with them.","schema":{"minimum":1,"maximum":90,"type":"number"}},{"name":"from","required":false,"in":"query","description":"First UTC day of the window, inclusive (YYYY-MM-DD). Goes with `to`; at most 92 days apart.","schema":{"example":"2026-10-01","type":"string"}},{"name":"to","required":false,"in":"query","description":"Last UTC day of the window, inclusive (YYYY-MM-DD). Goes with `from`.","schema":{"example":"2026-10-31","type":"string"}},{"name":"granularity","required":false,"in":"query","description":"One row per account and pool over the whole window (`total`), or one per UTC day as well (`day`).","schema":{"default":"total","type":"string","enum":["total","day"]}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationCreditsUsageRes"}}}},"400":{"description":"`days` is not an integer from 1 to 90, `from`/`to` are not both given as real calendar dates in order and at most 92 days apart, or `days` was combined with them."},"429":{"description":"More than 60 reads a minute."}},"security":[{"organisation-api-key":[]}],"summary":"Get credit usage by account","tags":["Organization"],"x-required-scope":"organisation:credits:read"}},"/api/v1/organisation/credits/purchase":{"post":{"description":"Charges the organization's card on file for one pack and answers the purchase. The credits land in the pool when the payment is confirmed, usually within seconds: poll `statusUrl` until `creditsGranted` is set. A bank challenge is a 402 whose `purchase.completeUrl` a person finishes; the purchase then completes on its own. Requires the `organisation:credits:write` scope. Not included in full access. The key must be minted with it. AI credit packs require the AI credits feature on the organization; without it AI packs are not listed or sold, and the balance has no AI fields.","operationId":"OrganisationCreditsApiController_purchase","parameters":[{"name":"Idempotency-Key","in":"header","description":"Your own reference for this one purchase, 8 to 255 characters of letters, digits, \".\", \"_\", \":\" or \"-\". Replaying it returns the same purchase instead of charging again; keys are honoured for 24 hours.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseOrganisationCreditsReq"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationCreditPurchaseRes"}}}},"400":{"description":"No or malformed `Idempotency-Key`, or the body names neither or both of `productId` and `priceId`."},"402":{"description":"`AUTHENTICATION_REQUIRED` (the bank wants the cardholder; `purchase.completeUrl` is for a person) or `CARD_DECLINED` (`declineCode` says why).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationPurchaseRefusalRes"}}}},"404":{"description":"`PRODUCT_NOT_FOUND`: no such pack is on sale.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationApiErrorRes"}}}},"409":{"description":"`NO_ORGANISATION_CARD`: no card on file; `setupLinkEndpoint` says where to get one added.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationApiErrorRes"}}}},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: that key was used for a different purchase.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationApiErrorRes"}}}},"429":{"description":"More than 60 reads a minute."}},"security":[{"organisation-api-key":[]}],"summary":"Buy a credit pack into the organization pool","tags":["Organization"],"x-required-scope":"organisation:credits:write"}},"/api/v1/organisation/credits/purchases/{id}":{"get":{"description":"The state of one purchase made by this organization. `creditsGranted` is set once the payment was confirmed and the pool credited; until then it is null. Not cached.","operationId":"OrganisationCreditsApiController_purchaseStatus","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationCreditPurchaseRes"}}}},"404":{"description":"`PURCHASE_NOT_FOUND`: no purchase with that id belongs to the organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationApiErrorRes"}}}},"429":{"description":"More than 60 reads a minute."}},"security":[{"organisation-api-key":[]}],"summary":"Get a credit purchase","tags":["Organization"],"x-required-scope":"organisation:credits:read"}},"/api/v1/organisation/credits/recharge":{"put":{"description":"Every field given is changed; an absent field is left alone. Switching the recharge on needs a pack, given now or earlier. The pack must be an SMS pack from `GET /v1/organisation/credits/products (organisation_credits_api_products)`: the recharge refills the SMS pool only. Answers the balance as `GET /v1/organisation/credits (organisation_credits_api_balance)` does. Requires the `organisation:credits:write` scope. Not included in full access. The key must be minted with it.","operationId":"OrganisationCreditsApiController_updateRecharge","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateOrganisationRechargeReq"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationCreditsRes"}}}},"400":{"description":"A field is malformed, or the recharge was switched on with no pack chosen."},"404":{"description":"`PRODUCT_NOT_FOUND`: `rechargeProductId` is not an SMS pack on sale.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationApiErrorRes"}}}},"429":{"description":"More than 60 reads a minute."}},"security":[{"organisation-api-key":[]}],"summary":"Change the auto-recharge rule of the organization pool","tags":["Organization"],"x-required-scope":"organisation:credits:write"}},"/api/v1/organisation/sharing/workflows":{"get":{"description":"Every workflow shared with the organization, newest share first, with who shared it (a person or an API key), the note, how many accounts copied it and the workflow summary. The share id is what get, copy, stats and withdraw take.","operationId":"OrganisationSharedWorkflowsController_list","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/OrganisationSharedWorkflowRes"}}}}}},"security":[{"organisation-api-key":[]}],"summary":"List the workflows shared with your organization","tags":["Organization"],"x-required-scope":"organisation:sharing:read"},"post":{"description":"Publishes a workflow of an account your organization owns to everyone in the organization, attributed to this API key. One share per workflow: sharing it again is refused. Copies made later stay when the share is withdrawn.","operationId":"OrganisationSharedWorkflowsController_share","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShareOrganisationWorkflowReq"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationSharedWorkflowRes"}}}},"403":{"description":"accountId is not an open account your organization owns (`ACCOUNT_NOT_IN_ORGANISATION`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationApiErrorRes"}}}},"404":{"description":"The workflow does not belong to accountId.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationApiErrorRes"}}}},"409":{"description":"The workflow is already shared with the organization (`WORKFLOW_ALREADY_SHARED`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationApiErrorRes"}}}}},"security":[{"organisation-api-key":[]}],"summary":"Share a workflow of one of your accounts with the organization","tags":["Organization"],"x-mcp":{"destructive":false},"x-required-scope":"organisation:sharing:write"}},"/api/v1/organisation/sharing/workflows/{shareId}":{"get":{"operationId":"OrganisationSharedWorkflowsController_get","parameters":[{"name":"shareId","required":true,"in":"path","description":"Share id, from organisation_shared_workflows_list","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationSharedWorkflowRes"}}}},"404":{"description":"No share with this id in your organization (`WORKFLOW_SHARE_NOT_FOUND`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationApiErrorRes"}}}}},"security":[{"organisation-api-key":[]}],"summary":"Get one workflow shared with your organization","tags":["Organization"],"x-required-scope":"organisation:sharing:read"},"delete":{"description":"Removes the workflow from the organization library. The source workflow and every copy already made stay as they are; nobody can copy it again until it is shared again.","operationId":"OrganisationSharedWorkflowsController_withdraw","parameters":[{"name":"shareId","required":true,"in":"path","description":"Share id, from organisation_shared_workflows_list","schema":{"type":"number"}}],"responses":{"204":{"description":""},"404":{"description":"No share with this id in your organization (`WORKFLOW_SHARE_NOT_FOUND`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationApiErrorRes"}}}}},"security":[{"organisation-api-key":[]}],"summary":"Withdraw a workflow share","tags":["Organization"],"x-required-scope":"organisation:sharing:write"}},"/api/v1/organisation/sharing/workflows/{shareId}/copy":{"post":{"description":"Clones the shared workflow into an account your organization owns as a new draft, carrying its tags over by name. Idempotent per account: when that account already holds a copy of this share, the existing copy is answered with alreadyExisted true and nothing is cloned.","operationId":"OrganisationSharedWorkflowsController_copy","parameters":[{"name":"shareId","required":true,"in":"path","description":"Share id, from organisation_shared_workflows_list","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CopyOrganisationWorkflowReq"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationWorkflowCopyRes"}}}},"403":{"description":"accountId is not an open account your organization owns (`ACCOUNT_NOT_IN_ORGANISATION`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationApiErrorRes"}}}},"404":{"description":"No share with this id in your organization (`WORKFLOW_SHARE_NOT_FOUND`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationApiErrorRes"}}}}},"security":[{"organisation-api-key":[]}],"summary":"Copy a shared workflow into one of your accounts","tags":["Organization"],"x-mcp":{"destructive":false,"idempotent":true},"x-required-scope":"organisation:sharing:write"}},"/api/v1/organisation/sharing/workflows/{shareId}/stats":{"get":{"description":"Every account that copied the share, newest first, with who copied it (a person or an API key) and the copy, which is null once deleted.","operationId":"OrganisationSharedWorkflowsController_stats","parameters":[{"name":"shareId","required":true,"in":"path","description":"Share id, from organisation_shared_workflows_list","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationWorkflowShareStatsRes"}}}},"404":{"description":"No share with this id in your organization (`WORKFLOW_SHARE_NOT_FOUND`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationApiErrorRes"}}}}},"security":[{"organisation-api-key":[]}],"summary":"List who copied a shared workflow","tags":["Organization"],"x-required-scope":"organisation:sharing:read"}},"/api/v1/organisation/sharing/templates":{"get":{"description":"Every message template shared with the organization, newest share first, with its full text, who shared it (a person or an API key), the note and how many accounts copied it. The share id is what get, copy, stats and withdraw take.","operationId":"OrganisationSharedTemplatesController_list","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/OrganisationSharedTemplateRes"}}}}}},"security":[{"organisation-api-key":[]}],"summary":"List the message templates shared with your organization","tags":["Organization"],"x-required-scope":"organisation:sharing:read"},"post":{"description":"Publishes a saved message template of an account your organization owns to everyone in the organization, attributed to this API key. One share per template: sharing it again is refused. Copies made later stay when the share is withdrawn.","operationId":"OrganisationSharedTemplatesController_share","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShareOrganisationTemplateReq"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationSharedTemplateRes"}}}},"403":{"description":"accountId is not an open account your organization owns (`ACCOUNT_NOT_IN_ORGANISATION`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationApiErrorRes"}}}},"404":{"description":"The template does not belong to accountId.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationApiErrorRes"}}}},"409":{"description":"The template is already shared with the organization (`TEMPLATE_ALREADY_SHARED`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationApiErrorRes"}}}}},"security":[{"organisation-api-key":[]}],"summary":"Share a message template of one of your accounts with the organization","tags":["Organization"],"x-mcp":{"destructive":false},"x-required-scope":"organisation:sharing:write"}},"/api/v1/organisation/sharing/templates/{shareId}":{"get":{"operationId":"OrganisationSharedTemplatesController_get","parameters":[{"name":"shareId","required":true,"in":"path","description":"Share id, from organisation_shared_templates_list","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationSharedTemplateRes"}}}},"404":{"description":"No share with this id in your organization (`TEMPLATE_SHARE_NOT_FOUND`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationApiErrorRes"}}}}},"security":[{"organisation-api-key":[]}],"summary":"Get one message template shared with your organization","tags":["Organization"],"x-required-scope":"organisation:sharing:read"},"delete":{"description":"Removes the template from the organization library. The source template and every copy already made stay as they are; nobody can copy it again until it is shared again.","operationId":"OrganisationSharedTemplatesController_withdraw","parameters":[{"name":"shareId","required":true,"in":"path","description":"Share id, from organisation_shared_templates_list","schema":{"type":"number"}}],"responses":{"204":{"description":""},"404":{"description":"No share with this id in your organization (`TEMPLATE_SHARE_NOT_FOUND`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationApiErrorRes"}}}}},"security":[{"organisation-api-key":[]}],"summary":"Withdraw a message template share","tags":["Organization"],"x-required-scope":"organisation:sharing:write"}},"/api/v1/organisation/sharing/templates/{shareId}/copy":{"post":{"description":"Adds the shared template to the end of the template list of an account your organization owns. Idempotent per account: while that account still holds a copy of this share, the existing copy is answered with alreadyExisted true and nothing is created.","operationId":"OrganisationSharedTemplatesController_copy","parameters":[{"name":"shareId","required":true,"in":"path","description":"Share id, from organisation_shared_templates_list","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CopyOrganisationTemplateReq"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationTemplateCopyRes"}}}},"403":{"description":"accountId is not an open account your organization owns (`ACCOUNT_NOT_IN_ORGANISATION`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationApiErrorRes"}}}},"404":{"description":"No share with this id in your organization (`TEMPLATE_SHARE_NOT_FOUND`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationApiErrorRes"}}}}},"security":[{"organisation-api-key":[]}],"summary":"Copy a shared message template into one of your accounts","tags":["Organization"],"x-mcp":{"destructive":false,"idempotent":true},"x-required-scope":"organisation:sharing:write"}},"/api/v1/organisation/sharing/templates/{shareId}/stats":{"get":{"description":"Every account that copied the share, newest first, with who copied it (a person or an API key) and the copy, which is null once deleted.","operationId":"OrganisationSharedTemplatesController_stats","parameters":[{"name":"shareId","required":true,"in":"path","description":"Share id, from organisation_shared_templates_list","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationTemplateShareStatsRes"}}}},"404":{"description":"No share with this id in your organization (`TEMPLATE_SHARE_NOT_FOUND`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationApiErrorRes"}}}}},"security":[{"organisation-api-key":[]}],"summary":"List who copied a shared message template","tags":["Organization"],"x-required-scope":"organisation:sharing:read"}},"/api/v1/templates":{"get":{"description":"Returns paginated list of SMS templates for the authenticated user","operationId":"TemplatesController_list","parameters":[{"name":"page","required":false,"in":"query","description":"Page number","schema":{"example":"1","type":"string"}},{"name":"take","required":false,"in":"query","description":"Items per page (max 500)","schema":{"example":"20","type":"string"}},{"name":"search","required":false,"in":"query","description":"Search by template name","schema":{"type":"string"}}],"responses":{"200":{"description":"Templates retrieved successfully"},"401":{"description":"Invalid or missing API key"},"403":{"description":"Insufficient permissions (requires templates:read)"}},"security":[{"api-key":[]}],"summary":"List SMS templates","tags":["Templates"],"x-required-scope":"templates:read"},"post":{"description":"Creates a new SMS template that campaigns and workflows can use. mergeFieldWarnings in the reply lists merge fields that will not be filled.","operationId":"TemplatesController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTemplateDto"}}}},"responses":{"201":{"description":"Template created successfully"},"400":{"description":"Invalid request body"}},"security":[{"api-key":[]}],"summary":"Create SMS template","tags":["Templates"],"x-mcp":{"destructive":false},"x-required-scope":"templates:write"}},"/api/v1/templates/{id}":{"get":{"description":"Retrieves a single SMS template by ID","operationId":"TemplatesController_get","parameters":[{"name":"id","required":true,"in":"path","description":"Template ID","schema":{"type":"number"}}],"responses":{"200":{"description":"Template retrieved successfully"},"404":{"description":"Template not found"}},"security":[{"api-key":[]}],"summary":"Get SMS template","tags":["Templates"],"x-required-scope":"templates:read"},"patch":{"description":"Updates name and/or content of an existing template. mergeFieldWarnings in the reply lists merge fields of the new content that will not be filled.","operationId":"TemplatesController_update","parameters":[{"name":"id","required":true,"in":"path","description":"Template ID","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateTemplateDto"}}}},"responses":{"200":{"description":"Template updated successfully"},"400":{"description":"Invalid request body"},"404":{"description":"Template not found"}},"security":[{"api-key":[]}],"summary":"Update SMS template","tags":["Templates"],"x-required-scope":"templates:write"},"delete":{"description":"Permanently deletes an SMS template. This cannot be undone.","operationId":"TemplatesController_delete","parameters":[{"name":"id","required":true,"in":"path","description":"Template ID","schema":{"type":"number"}}],"responses":{"204":{"description":"Template deleted successfully"},"404":{"description":"Template not found"}},"security":[{"api-key":[]}],"summary":"Delete SMS template","tags":["Templates"],"x-required-scope":"templates:write"}},"/api/v1/organisation-library/templates":{"get":{"description":"The library of the organization that owns this account, newest share first: each share with the full template text, who shared it (a person or an API key), the note, how many accounts copied it and whether this account already holds a copy. The share id is what the other template_organisation_library tools take.","operationId":"TemplateOrganisationLibraryController_list","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/OrganisationSharedTemplateRes"}}}}},"401":{"description":"Invalid or missing API key"},"403":{"description":"Refused: ACCOUNT_NOT_IN_ORGANISATION (this account is personal, so it has no organization library); the share is not one this key may manage (an account key reads the copies of, and withdraws, only shares of this account or that it made); or the credential is an integration access token rather than an API key."}},"security":[{"api-key":[]}],"summary":"List the message templates shared in this account's organization","tags":["Templates"],"x-required-scope":"templates:read"},"post":{"description":"Publishes one of this account's saved message templates to everyone in the organization that owns the account, attributed to this API key; template ids come from templates_list. One share per template: sharing it again is refused. Copies made later stay when the share is withdrawn.","operationId":"TemplateOrganisationLibraryController_share","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShareTemplateWithOrganisationReq"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationSharedTemplateRes"}}}},"401":{"description":"Invalid or missing API key"},"403":{"description":"Refused: ACCOUNT_NOT_IN_ORGANISATION (this account is personal, so it has no organization library); the share is not one this key may manage (an account key reads the copies of, and withdraws, only shares of this account or that it made); or the credential is an integration access token rather than an API key."},"404":{"description":"Refused: the template is not found or is not this account's."},"409":{"description":"Refused: TEMPLATE_ALREADY_SHARED (the template is already in the library)."}},"security":[{"api-key":[]}],"summary":"Share one of this account's message templates with its organization","tags":["Templates"],"x-mcp":{"destructive":false},"x-required-scope":"templates:write"}},"/api/v1/organisation-library/templates/{shareId}":{"get":{"operationId":"TemplateOrganisationLibraryController_get","parameters":[{"name":"shareId","required":true,"in":"path","description":"Share id, from template_organisation_library_list","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationSharedTemplateRes"}}}},"401":{"description":"Invalid or missing API key"},"403":{"description":"Refused: ACCOUNT_NOT_IN_ORGANISATION (this account is personal, so it has no organization library); the share is not one this key may manage (an account key reads the copies of, and withdraws, only shares of this account or that it made); or the credential is an integration access token rather than an API key."},"404":{"description":"Refused: TEMPLATE_SHARE_NOT_FOUND (no share with this id that you can see)."}},"security":[{"api-key":[]}],"summary":"Get one message template shared in this account's organization","tags":["Templates"],"x-required-scope":"templates:read"},"delete":{"description":"Removes one of this account's templates from the organization library. The template and every copy already made stay as they are; nobody can copy it again until it is shared again.","operationId":"TemplateOrganisationLibraryController_withdraw","parameters":[{"name":"shareId","required":true,"in":"path","description":"Share id, from template_organisation_library_list","schema":{"type":"number"}}],"responses":{"204":{"description":""},"401":{"description":"Invalid or missing API key"},"403":{"description":"Refused: ACCOUNT_NOT_IN_ORGANISATION (this account is personal, so it has no organization library); the share is not one this key may manage (an account key reads the copies of, and withdraws, only shares of this account or that it made); or the credential is an integration access token rather than an API key."},"404":{"description":"Refused: TEMPLATE_SHARE_NOT_FOUND (no share with this id that you can see)."}},"security":[{"api-key":[]}],"summary":"Withdraw a share of this account's message template","tags":["Templates"],"x-required-scope":"templates:write"}},"/api/v1/organisation-library/templates/{shareId}/copy":{"post":{"description":"Adds the shared template to the end of this account's template list. Idempotent: while this account still holds a copy of the share, that copy is answered with alreadyExisted true and nothing is created. Read the copy with templates_get.","operationId":"TemplateOrganisationLibraryController_copy","parameters":[{"name":"shareId","required":true,"in":"path","description":"Share id, from template_organisation_library_list","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationTemplateCopyRes"}}}},"401":{"description":"Invalid or missing API key"},"403":{"description":"Refused: ACCOUNT_NOT_IN_ORGANISATION (this account is personal, so it has no organization library); the share is not one this key may manage (an account key reads the copies of, and withdraws, only shares of this account or that it made); or the credential is an integration access token rather than an API key."},"404":{"description":"Refused: TEMPLATE_SHARE_NOT_FOUND (no share with this id that you can see)."}},"security":[{"api-key":[]}],"summary":"Copy a shared message template into this account","tags":["Templates"],"x-mcp":{"destructive":false,"idempotent":true},"x-required-scope":"templates:write"}},"/api/v1/organisation-library/templates/{shareId}/stats":{"get":{"description":"Every account that copied the share, newest first, with who copied it (a person or an API key) and the copy. Answered for shares this key made or whose template is this account’s.","operationId":"TemplateOrganisationLibraryController_stats","parameters":[{"name":"shareId","required":true,"in":"path","description":"Share id, from template_organisation_library_list","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganisationTemplateShareStatsRes"}}}},"401":{"description":"Invalid or missing API key"},"403":{"description":"Refused: ACCOUNT_NOT_IN_ORGANISATION (this account is personal, so it has no organization library); the share is not one this key may manage (an account key reads the copies of, and withdraws, only shares of this account or that it made); or the credential is an integration access token rather than an API key."},"404":{"description":"Refused: TEMPLATE_SHARE_NOT_FOUND (no share with this id that you can see)."}},"security":[{"api-key":[]}],"summary":"List who copied a shared message template","tags":["Templates"],"x-required-scope":"templates:read"}},"/api/v1/10dlc/brands":{"get":{"description":"Returns the authenticated user’s registered 10DLC brands.","operationId":"TenDlcBrandsController_list","parameters":[],"responses":{"200":{"description":"Brands retrieved successfully"}},"security":[{"api-key":[]}],"summary":"List 10DLC brands","tags":["10DLC Brands"],"x-required-scope":"brand:read"},"post":{"description":"Registers a new 10DLC brand with the messaging provider.","operationId":"TenDlcBrandsController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateBrandDto"}}}},"responses":{"201":{"description":"Brand registered successfully"},"400":{"description":"Invalid request body"},"409":{"description":"EIN or legal company name already registered to another account"},"422":{"description":"The brand details fail a brand alignment rule (`errorCode` `brand_alignment_failed`): the contact email must be on the website's domain (the same domain or a subdomain of it). The body carries `findings`, one per failed rule, each with `rule`, `field`, `message` and `fix`. Nothing was registered."}},"security":[{"api-key":[]}],"summary":"Register a 10DLC brand","tags":["10DLC Brands"],"x-mcp":{"destructive":true,"openWorld":true},"x-required-scope":"brand:write"}},"/api/v1/10dlc/brands/{id}":{"get":{"description":"Retrieves a single brand by its provider brand ID, refreshing its status from the carrier registry first (falls back to the stored brand when the registry is unreachable).","operationId":"TenDlcBrandsController_getById","parameters":[{"name":"id","required":true,"in":"path","description":"Provider brand ID","schema":{"type":"string"}}],"responses":{"200":{"description":"Brand retrieved successfully"},"404":{"description":"Brand not found"}},"security":[{"api-key":[]}],"summary":"Get 10DLC brand","tags":["10DLC Brands"],"x-required-scope":"brand:read"}},"/api/v1/10dlc/brands/{id}/capabilities":{"get":{"description":"Returns per-MNO messaging capabilities for the brand.","operationId":"TenDlcBrandsController_getCapabilities","parameters":[{"name":"id","required":true,"in":"path","description":"Provider brand ID","schema":{"type":"string"}}],"responses":{"200":{"description":"Capabilities retrieved successfully"},"404":{"description":"Brand not found"},"409":{"description":"Brand verification has not finished yet (errorCode brand_not_verified)"}},"security":[{"api-key":[]}],"summary":"Get 10DLC brand capabilities","tags":["10DLC Brands"],"x-required-scope":"brand:read"}},"/api/v1/10dlc/brands/{id}/vetting-history":{"get":{"description":"Returns the external-vetting ledger for the brand, newest first.","operationId":"TenDlcBrandsController_getVettingHistory","parameters":[{"name":"id","required":true,"in":"path","description":"Provider brand ID","schema":{"type":"string"}}],"responses":{"200":{"description":"Vetting history retrieved successfully"},"404":{"description":"Brand not found"}},"security":[{"api-key":[]}],"summary":"List 10DLC brand vetting history","tags":["10DLC Brands"],"x-required-scope":"brand:read"}},"/api/v1/10dlc/brands/resubmit":{"post":{"description":"Starts an async resubmission of the user’s unverified brand.","operationId":"TenDlcBrandsController_resubmit","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResubmitBrandDto"}}}},"responses":{"200":{"description":"Resubmission started"},"400":{"description":"Brand is not resubmittable"},"404":{"description":"No brand found to resubmit"},"409":{"description":"EIN or legal company name already registered to another account"},"422":{"description":"The resubmitted details, applied over the brand's saved ones, fail a brand alignment rule (`errorCode` `brand_alignment_failed`): the contact email must be on the website's domain. The body carries `findings`. The existing brand is left untouched."}},"security":[{"api-key":[]}],"summary":"Resubmit a 10DLC brand","tags":["10DLC Brands"],"x-mcp":{"destructive":true,"openWorld":true},"x-required-scope":"brand:write"}},"/api/v1/10dlc/brands/{id}/dba":{"patch":{"description":"Renames the brand display name (DBA) at the provider.","operationId":"TenDlcBrandsController_updateDba","parameters":[{"name":"id","required":true,"in":"path","description":"Provider brand ID","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateBrandDbaDto"}}}},"responses":{"200":{"description":"DBA updated successfully"},"404":{"description":"Brand not found"}},"security":[{"api-key":[]}],"summary":"Update 10DLC brand DBA","tags":["10DLC Brands"],"x-mcp":{"destructive":true,"openWorld":true},"x-required-scope":"brand:write"}},"/api/v1/10dlc/brands/{id}/vetting":{"post":{"description":"Orders external vetting (STANDARD or ENHANCED) for the brand. A brand whose details fail a brand alignment rule (for example a contact email that is not on the website's domain) is likely to score poorly: the order is refused with a 422 listing the findings unless `acknowledgedAlignmentRules` names each finding's `rule`.","operationId":"TenDlcBrandsController_requestVetting","parameters":[{"name":"id","required":true,"in":"path","description":"Provider brand ID","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestVettingDto"}}}},"responses":{"200":{"description":"Vetting requested successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestVettingRes"}}}},"400":{"description":"Invalid vetting class, no valid payment method, or the vetting order failed. When the order failed after the payment was authorised, the body carries `paymentIntentId`: send it back on the retry to reuse that authorisation."},"404":{"description":"Brand not found"},"422":{"description":"Either the registry refused the order (`errorCode` `brand_vetting_rejected`), for example a repeat vetting on a brand whose profile has not changed since the last one; the message says why; the authorisation is released, nothing was charged and retrying the same order cannot succeed. Or the brand has alignment findings the request did not acknowledge (`errorCode` `brand_vetting_alignment_unacknowledged`): the body carries `findings` and `retryable: false`, no payment was authorised; fix the brand, or send the order again with each finding's `rule` in `acknowledgedAlignmentRules`."}},"security":[{"api-key":[]}],"summary":"Request 10DLC brand vetting","tags":["10DLC Brands"],"x-mcp":{"title":"Request 10DLC brand vetting (paid)","destructive":true,"openWorld":true},"x-required-scope":"brand:write"}},"/api/v1/10dlc/campaigns":{"post":{"description":"Registers a campaign at the human REVIEW gate. The campaign does NOT reach the carrier until an internal review approves it, so the response always reports `state: in_review`.","operationId":"TenDlcCampaignsController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTenDlcCampaignDto"}}}},"responses":{"201":{"description":"Campaign created (parked at review)"}},"security":[{"api-key":[]}],"summary":"Create a 10DLC campaign","tags":["10DLC Campaigns"],"x-mcp":{"destructive":true,"openWorld":true},"x-required-scope":"tendlc-campaign:write"},"get":{"description":"Returns all campaigns belonging to the given provider brand id, each refreshed from the carrier first (best effort: stored values are returned when the carrier is unreachable).","operationId":"TenDlcCampaignsController_listByBrand","parameters":[{"name":"brandId","required":true,"in":"query","description":"Provider brand id to list campaigns for","schema":{"type":"string"}}],"responses":{"200":{"description":"Campaigns retrieved successfully"}},"security":[{"api-key":[]}],"summary":"List campaigns for a brand","tags":["10DLC Campaigns"],"x-required-scope":"tendlc-campaign:read"}},"/api/v1/10dlc/campaigns/{id}":{"get":{"description":"Fetches a single campaign by its internal id, refreshed from the carrier first (best effort: the stored campaign is returned when the carrier is unreachable).","operationId":"TenDlcCampaignsController_get","parameters":[{"name":"id","required":true,"in":"path","description":"Internal campaign id","schema":{"type":"number"}}],"responses":{"200":{"description":"Campaign retrieved successfully"},"404":{"description":"Campaign not found"}},"security":[{"api-key":[]}],"summary":"Get a campaign","tags":["10DLC Campaigns"],"x-required-scope":"tendlc-campaign:read"},"put":{"description":"Updates an in-review campaign through the provider and mirrors it locally.","operationId":"TenDlcCampaignsController_edit","parameters":[{"name":"id","required":true,"in":"path","description":"Provider campaign id","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateTenDlcCampaignDto"}}}},"responses":{"200":{"description":"Campaign updated successfully"},"404":{"description":"Campaign not found"}},"security":[{"api-key":[]}],"summary":"Edit a campaign while in review","tags":["10DLC Campaigns"],"x-mcp":{"destructive":true,"openWorld":true},"x-required-scope":"tendlc-campaign:write"},"delete":{"description":"Cancels the campaign subscription and provider campaign, then soft-deletes it.","operationId":"TenDlcCampaignsController_remove","parameters":[{"name":"id","required":true,"in":"path","description":"Provider campaign id","schema":{"type":"string"}}],"responses":{"204":{"description":"Campaign deleted successfully"},"404":{"description":"Campaign not found"}},"security":[{"api-key":[]}],"summary":"Delete a campaign","tags":["10DLC Campaigns"],"x-mcp":{"destructive":true,"openWorld":true},"x-required-scope":"tendlc-campaign:write"}},"/api/v1/10dlc/campaigns/{id}/resubmit":{"put":{"description":"Resubmits a DECLINED campaign through the provider and resets its DCA status.","operationId":"TenDlcCampaignsController_resubmit","parameters":[{"name":"id","required":true,"in":"path","description":"Provider campaign id","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResubmitCampaignDto"}}}},"responses":{"200":{"description":"Campaign resubmitted successfully"},"400":{"description":"Only declined campaigns can be resubmitted"},"404":{"description":"Campaign not found"}},"security":[{"api-key":[]}],"summary":"Resubmit a declined campaign","tags":["10DLC Campaigns"],"x-mcp":{"destructive":true,"openWorld":true},"x-required-scope":"tendlc-campaign:write"}},"/api/v1/10dlc/campaigns/{id}/phone":{"post":{"description":"Attaches owned phone numbers to a campaign via the provider.","operationId":"TenDlcCampaignsController_attachPhone","parameters":[{"name":"id","required":true,"in":"path","description":"Provider campaign id","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttachPhoneDto"}}}},"responses":{"201":{"description":"Phone numbers attached successfully"},"400":{"description":"No valid phone numbers found"},"404":{"description":"Campaign not found"}},"security":[{"api-key":[]}],"summary":"Attach phone numbers to a campaign","tags":["10DLC Campaigns"],"x-mcp":{"destructive":true,"openWorld":true},"x-required-scope":"tendlc-campaign:write"}},"/api/v1/10dlc/generations":{"post":{"description":"Starts a new auto-flow (GENERATION) registration run for the authenticated user. Does not enqueue any worker — the flow waits for a domain to be selected.","operationId":"TenDlcGenerationsController_create","parameters":[],"requestBody":{"required":true,"description":"Business registration data for the auto-flow generation. Validated server-side against the 10DLC generation schema.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"responses":{"201":{"description":"Generation created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerationRes"}}}}},"security":[{"api-key":[]}],"summary":"Create a 10DLC generation","tags":["10DLC Generations"],"x-mcp":{"destructive":true,"openWorld":true,"title":"Start an AI-written 10DLC registration draft"},"x-required-scope":"tendlc-generation:write"},"get":{"description":"Returns the generation to surface for the user (most-recent completed, else most-recent in-progress), or null when none applies.","operationId":"TenDlcGenerationsController_getForUser","parameters":[],"responses":{"200":{"description":"Generation retrieved","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerationRes"}}}}},"security":[{"api-key":[]}],"summary":"Get the active 10DLC generation","tags":["10DLC Generations"],"x-mcp":{"title":"Get the current AI-written 10DLC registration draft"},"x-required-scope":"tendlc-generation:read"}},"/api/v1/10dlc/generations/{id}":{"get":{"description":"Returns the authenticated user’s generation by id (404 if not owned).","operationId":"TenDlcGenerationsController_getById","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Generation retrieved","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerationRes"}}}}},"security":[{"api-key":[]}],"summary":"Get a 10DLC generation by id","tags":["10DLC Generations"],"x-mcp":{"title":"Get one AI-written 10DLC registration draft"},"x-required-scope":"tendlc-generation:read"},"delete":{"description":"Deletes a generation, only if no domain has been purchased yet.","operationId":"TenDlcGenerationsController_remove","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Generation deleted"}},"security":[{"api-key":[]}],"summary":"Delete a 10DLC generation","tags":["10DLC Generations"],"x-mcp":{"title":"Delete an AI-written 10DLC registration draft"},"x-required-scope":"tendlc-generation:write"}},"/api/v1/10dlc/generations/{id}/retry":{"post":{"description":"Retries a failed generation from its last failed step, scheduling the appropriate worker (or resetting for domain selection).","operationId":"TenDlcGenerationsController_retry","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Retry processed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RetryGenerationRes"}}}}},"security":[{"api-key":[]}],"summary":"Retry a failed 10DLC generation","tags":["10DLC Generations"],"x-mcp":{"destructive":true,"openWorld":true,"title":"Retry a failed AI-written 10DLC registration draft"},"x-required-scope":"tendlc-generation:write"}},"/api/v1/10dlc/generations/{id}/domain":{"post":{"description":"Secures the given domain, stamps the website/email onto the generation, and enqueues the template-clone worker.","operationId":"TenDlcGenerationsController_setDomain","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetGenerationDomainDto"}}}},"responses":{"200":{"description":"Domain assigned","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetGenerationDomainRes"}}}}},"security":[{"api-key":[]}],"summary":"Assign a domain to a 10DLC generation","tags":["10DLC Generations"],"x-mcp":{"destructive":true,"openWorld":true,"title":"Set the website domain of a 10DLC registration draft"},"x-required-scope":"tendlc-generation:write"}},"/api/v1/10dlc/enums/{type}":{"get":{"description":"Resolves a provider enum used during 10DLC setup (use cases, verticals, entity types, brand relationships, stock exchanges, alternate business id types).","operationId":"TenDlcReferenceController_getEnums","parameters":[{"name":"type","required":true,"in":"path","schema":{"enum":["usecases","verticals","entityTypes","brandRelationships","stockExchanges","altBusinessIdTypes"],"type":"string"}}],"responses":{"200":{"description":"Enum values retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnumValuesRes"}}}}},"security":[{"api-key":[]}],"summary":"Get 10DLC setup enum","tags":["10DLC Reference"],"x-required-scope":"brand:read"}},"/api/v1/10dlc/check-display-name":{"get":{"description":"Deprecated: brand display names are no longer required to be unique, so this endpoint always returns `available: true` for any non-empty name. Retained for backward compatibility with existing integrations. A missing `displayName` still returns 400.","operationId":"TenDlcReferenceController_checkDisplayName","parameters":[{"name":"displayName","required":true,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Availability resolved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckDisplayNameRes"}}}}},"security":[{"api-key":[]}],"summary":"Check brand display-name availability (deprecated)","tags":["10DLC Reference"],"x-mcp":{"openWorld":true},"x-required-scope":"brand:read"}},"/api/v1/10dlc/provider-status":{"get":{"description":"Summarizes which messaging providers the authenticated user already has brands on, and whether a V2 upgrade is recommended. No upgrade is recommended while a brand-migration request is pending or in progress.","operationId":"TenDlcReferenceController_getProviderStatus","parameters":[],"responses":{"200":{"description":"Provider status retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProviderStatusRes"}}}}},"security":[{"api-key":[]}],"summary":"Get provider status","tags":["10DLC Reference"],"x-mcp":{"openWorld":true},"x-required-scope":"brand:read"}},"/api/oauth/token":{"post":{"tags":["OAuth Integrations"],"summary":"Exchange an authorization code, or refresh an access token","description":"Server-to-server endpoint serving both OAuth grants. Authenticate with your `client_id` + `client_secret`, then either present the single-use `code` (`grant_type=authorization_code`) or a previously issued `refresh_token` (`grant_type=refresh_token`). Returns a scoped access token, a rotated refresh token, and its expiry. The per-integration webhook signing secret is returned only on the initial code exchange. Accepts form-encoded (OAuth standard) or JSON bodies.","requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"type":"object","required":["grant_type","client_id","client_secret"],"properties":{"grant_type":{"type":"string","description":"Either `authorization_code` (initial exchange) or `refresh_token` (rotation).","example":"authorization_code"},"client_id":{"type":"string","description":"Your integration client ID.","example":"cid_RLEZbCyKs6aSj85syN1wLw"},"client_secret":{"type":"string","description":"Your integration client secret. Send only from your backend.","example":"csk_…"},"code":{"type":"string","description":"Required for `authorization_code`. The single-use authorization code from the redirect (valid 3 minutes).","example":"code_3-VhWpb…"},"redirect_uri":{"type":"string","description":"Required for `authorization_code`. The exact redirect URI used to obtain the code.","example":"https://app.partner.com/oauth/callback"},"refresh_token":{"type":"string","description":"Required for `refresh_token`. The refresh token from the previous response (rotates on every use).","example":"pitr_U98ziiH5MKmVEHkc.3EYc5XHw6anZPZULanaVgbN6yOmqB6"}}}}}},"responses":{"200":{"description":"A new access/refresh token pair was issued.","content":{"application/json":{"schema":{"type":"object","properties":{"access_token":{"type":"string","description":"Short-lived. Use on Developer API requests via `Authorization: Bearer` or `x-api-key`.","example":"pit_U98ziiH5MKmVEHkc.3EYc5XHw6anZPZULanaVgbN6yOmqB6"},"refresh_token":{"type":"string","description":"Long-lived, single-use. Rotates on every refresh — persist the latest and discard the previous.","example":"pitr_U98ziiH5MKmVEHkc.3EYc5XHw6anZPZULanaVgbN6yOmqB6"},"token_type":{"type":"string","example":"Bearer"},"scopes":{"type":"array","items":{"type":"string"},"description":"Granted scopes as a list.","example":["contacts:read","messages:write"]},"expires_in":{"type":"integer","description":"Seconds until the access token expires.","example":3600},"expires_at":{"type":"string","format":"date-time","description":"Absolute access-token expiry (ISO-8601).","example":"2026-06-23T18:00:00.000Z"},"webhook_secret":{"type":"string","nullable":true,"description":"The integration's webhook signing secret on initial exchange (or null if no webhooks URL is configured); always null on refresh.","example":"whsec_…"}}}}}},"400":{"description":"Invalid or expired code, or unsupported grant type."},"401":{"description":"Invalid client credentials, or an invalid/revoked refresh token."}}}},"/api/mcp":{"post":{"tags":["MCP Server"],"summary":"Call the MCP server (JSON-RPC)","description":"The Model Context Protocol endpoint, using the **Streamable HTTP** transport. Send one JSON-RPC 2.0 message per request; the server is stateless, so there is no session id to keep. MCP clients (Claude Code, Cursor and the others above) call this for you: you only need it to debug a key or build your own client. `GET` and `DELETE` return `405`.","security":[{"api-key":[]}],"parameters":[{"name":"accept","in":"header","required":true,"description":"Must accept both JSON and server-sent events.","schema":{"type":"string","example":"application/json, text/event-stream"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["jsonrpc","method"],"properties":{"jsonrpc":{"type":"string","enum":["2.0"]},"id":{"oneOf":[{"type":"integer"},{"type":"string"}]},"method":{"type":"string","description":"`initialize`, `tools/list` or `tools/call`.","example":"tools/list"},"params":{"type":"object"}}},"examples":{"listTools":{"summary":"List the tools","value":{"jsonrpc":"2.0","id":1,"method":"tools/list"}},"callTool":{"summary":"Call a tool","value":{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"contacts_list","arguments":{"take":"5"}}}}}}}},"responses":{"200":{"description":"The JSON-RPC response, as JSON or as a single server-sent event. A failing tool returns `result.isError: true` with the API error, not an HTTP error."},"401":{"description":"Missing, invalid or revoked API key."},"405":{"description":"Only `POST` is supported."}}}}},"info":{"title":"PitchPrfct Developer API","description":"REST API for integrating with PitchPrfct. Manage contacts, send messages, read conversations, run campaigns and build workflows programmatically. The same operations are available to AI agents as tools through the MCP Server (see that section).\n\n## Rate limits\n\nEvery Developer API request is counted against two sliding windows. A request is\nrejected as soon as either one is exhausted.\n\n| Window | Limit | Purpose |\n|--------|-------|---------|\n| `sustained` | **1,000 requests per minute** | Overall throughput |\n| `burst` | **100 requests per second** | Short spikes |\n\n### What counts toward the limit\n\n- Limits apply **per PitchPrfct user**, not per API key. All of a user's API keys,\n  every OAuth integration connected to that user, and MCP tool calls made on their\n  behalf (see the **MCP Server** section) share the same two windows.\n- Each HTTP request counts once, regardless of how many records it touches. Bulk\n  endpoints (bulk contact create, bulk tag add/remove, batch get, bulk enroll) are\n  the cheapest way to move large volumes.\n- Requests rejected for missing or invalid credentials (`401`) are not counted.\n\n### Endpoints with their own limit\n\nA few endpoints are also counted in a window of their own, per account, on top\nof the two above. A request to one of them is rejected as soon as any of its\nwindows is exhausted; requests to other endpoints are not affected by these.\n\n| Window | Limit | Endpoints |\n|--------|-------|-----------|\n| `credits` | **60 requests per minute** | Organisation credit balance and usage; AI agent test messages |\n| `agentsPublish` | **10 requests per minute** | Publish an AI agent, set its channels, start it on a conversation |\n| `agentsKnowledge` | **20 requests per minute** | Add or update an AI agent knowledge source |\n| `agentsHeavyRead` | **60 requests per minute** | AI agent setup options, preview and the agent sessions list |\n\nA `429` from one of these windows has the same headers and body as any other,\nwith `limit` set to that window's limit.\n\n### Rate-limit headers\n\nSuccessful responses report your remaining capacity in each window:\n\n| Header | Meaning |\n|--------|---------|\n| `X-RateLimit-Limit-sustained` / `X-RateLimit-Limit-burst` | Requests allowed in the window |\n| `X-RateLimit-Remaining-sustained` / `X-RateLimit-Remaining-burst` | Requests left in the window |\n\n### When you exceed a limit\n\nThe API responds with **`429 Too Many Requests`** and blocks further requests for\nthe length of the window you exceeded: about **1 second** for\n`burst`, up to **60 seconds** for `sustained`. Requests sent\nwhile blocked are rejected too, but they don't extend the block.\n\n| Header | Meaning |\n|--------|---------|\n| `Retry-After` | Seconds to wait before retrying |\n| `X-RateLimit-Limit` | Requests allowed in the window you exceeded |\n| `X-RateLimit-Remaining` | Always `0` |\n| `X-RateLimit-Reset` | Length of that window, in seconds |\n\nThe same values are included in the response body, so you can back off without\nreading headers:\n\n```json\n{\n  \"statusCode\": 429,\n  \"message\": \"Too many requests\",\n  \"error\": \"TOO_MANY_REQUESTS\",\n  \"retryAfter\": 60,\n  \"limit\": 1000,\n  \"remaining\": 0,\n  \"reset\": 60\n}\n```\n\n### Best practices\n\n- **Honor `Retry-After`.** Wait at least that many seconds before retrying a `429`.\n  For repeated failures, add exponential backoff with jitter.\n- **Pace bulk jobs.** Spread large syncs over time instead of sending them in\n  parallel bursts, and watch the `X-RateLimit-Remaining-*` headers.\n- **Prefer bulk endpoints** over one request per record.\n- **Use webhooks instead of polling** to react to new messages, replies, and\n  contact changes.\n","version":"1.0","contact":{}},"tags":[{"name":"Contacts","description":"Manage your contacts"},{"name":"Contact Lists","description":"Group contacts into static lists"},{"name":"Contact Tags","description":"Manage contact tags"},{"name":"Contact Custom Fields","description":"Manage custom fields for contacts"},{"name":"Contact Opt-Outs","description":"Manage contact opt-out status"},{"name":"Scrubs","description":"\nA scrub checks the phone numbers of a set of contacts for line type, carrier,\nand do-not-call and litigator lists. It spends verification credits, which are\nseparate from SMS credits. With `autoRemoveBadLines: true` it also deletes\ncontacts.\n\nEvery call sends an account API key in the `x-api-key` header. Paths start\nwith `/api/v1`. Every successful answer is wrapped as\n`{ \"status\": true, \"message\": \"Ok\", \"data\": … }`; the examples below show the\nwrapper once, in the first step, and then only `data`.\n\n### Scopes\n\n| Scope | Allows |\n|---|---|\n| `scrubs:read` | list eligible workflows and campaigns, preview, list scrubs, get a scrub, get its summary, list results, request and get the results file |\n| `scrubs:write` | start, stop, retry, remove |\n| `async-operations:read` | follow a remove with `GET /v1/async-operations/{operationId}` |\n| `credits:read` / `credits:write` | read the verification balance; buy a verification pack (`credits:write` must be granted by name) |\n\n`scrubs:write` does not include `scrubs:read`: a key that starts scrubs and\nreads them needs both. Preview and the results-file request are `POST` calls\nunder `scrubs:read`. A `403` means the key lacks the scope, or scrubs are not\nenabled for the account (`\"This feature is unavailable at the moment.\"`).\n\n### Scrub, read the summary, remove\n\n1. Start the scrub. `autoRemoveBadLines` is required. A scrub of every\n   contact is `{ \"allContacts\": true, \"autoRemoveBadLines\": false }`; the\n   other targets are below.\n\n```http\nPOST /api/v1/scrubs\nx-api-key: sk_…\nContent-Type: application/json\n\n{ \"workflowIds\": [42], \"autoRemoveBadLines\": true }\n```\n\n`202`\n\n```json\n{\n  \"status\": true,\n  \"message\": \"Ok\",\n  \"data\": {\n    \"id\": \"0b7f6c1e-2d4a-4b8e-9c1f-3a5d7e9b1c2f\",\n    \"status\": \"pending\",\n    \"failureCode\": null,\n    \"autoRemoveBadLines\": true,\n    \"counts\": {\n      \"total\": 1500, \"processed\": 0,\n      \"lineTypes\": { \"mobile\": 0, \"landline\": 0, \"voip\": 0, \"unknown\": 0 },\n      \"doNotCall\": { \"clean\": 0, \"flagged\": 0, \"unknown\": 0 },\n      \"lists\": null, \"failed\": 0, \"removed\": 0\n    },\n    \"credits\": { \"charged\": 0, \"returned\": 0 },\n    \"createdAt\": \"2026-11-17T15:01:48.000Z\",\n    \"completedAt\": null\n  }\n}\n```\n\n2. Read the summary. It answers `status` too, so the same call follows the\n   scrub until `status` is `completed` or `failed`; the counts are live\n   while it runs. Every category is listed, zeros included, and each row\n   carries in `remove` the exact body that deletes its remaining contacts.\n\n```http\nGET /api/v1/scrubs/0b7f6c1e-2d4a-4b8e-9c1f-3a5d7e9b1c2f/summary\n```\n\n`200`\n\n```json\n{\n  \"scrubId\": \"0b7f6c1e-2d4a-4b8e-9c1f-3a5d7e9b1c2f\",\n  \"status\": \"completed\",\n  \"totals\": {\"contacts\": 1500, \"checked\": 1488, \"clean\": 1150, \"flagged\": 97, \"badLines\": 241, \"failed\": 12, \"pending\": 0, \"removed\": 255},\n  \"categories\": [\n    {\"key\": \"tcpa\", \"label\": \"TCPA litigators\", \"group\": \"flagged\", \"count\": 12, \"remaining\": 10, \"remove\": {\"categories\": [\"tcpa\"]}},\n    {\"key\": \"troll\", \"label\": \"TCPA trolls\", \"group\": \"flagged\", \"count\": 0, \"remaining\": 0, \"remove\": {\"categories\": [\"troll\"]}},\n    {\"key\": \"federal_dnc\", \"label\": \"National Do Not Call Registry\", \"group\": \"flagged\", \"count\": 81, \"remaining\": 50, \"remove\": {\"categories\": [\"federal_dnc\"]}},\n    {\"key\": \"state_dnc\", \"label\": \"State Do Not Call lists\", \"group\": \"flagged\", \"count\": 9, \"remaining\": 6, \"remove\": {\"categories\": [\"state_dnc\"]}},\n    {\"key\": \"dnc_complainers\", \"label\": \"Known complainers\", \"group\": \"flagged\", \"count\": 0, \"remaining\": 0, \"remove\": {\"categories\": [\"dnc_complainers\"]}},\n    {\"key\": \"nra\", \"label\": \"Additional do-not-contact list\", \"group\": \"flagged\", \"count\": 0, \"remaining\": 0, \"remove\": {\"categories\": [\"nra\"]}},\n    {\"key\": \"other\", \"label\": \"Other flagged list\", \"group\": \"flagged\", \"count\": 0, \"remaining\": 0, \"remove\": {\"categories\": [\"other\"]}},\n    {\"key\": \"legacy\", \"label\": \"Do Not Call (litigators included)\", \"group\": \"flagged\", \"count\": 0, \"remaining\": 0, \"remove\": {\"categories\": [\"legacy\"]}},\n    {\"key\": \"landline\", \"label\": \"Landlines\", \"group\": \"kept\", \"count\": 160, \"remaining\": 0, \"remove\": {\"categories\": [\"landline\"]}},\n    {\"key\": \"voip\", \"label\": \"VoIP numbers\", \"group\": \"kept\", \"count\": 55, \"remaining\": 0, \"remove\": {\"categories\": [\"voip\"]}},\n    {\"key\": \"unknown\", \"label\": \"No line or unconfirmed\", \"group\": \"kept\", \"count\": 26, \"remaining\": 23, \"remove\": {\"categories\": [\"unknown\"]}},\n    {\"key\": \"failed\", \"label\": \"Could not be checked\", \"group\": \"failed\", \"count\": 12, \"remaining\": 12, \"remove\": {\"categories\": [\"failed\"]}}\n  ],\n  \"overlap\": true\n}\n```\n\n- `totals.flagged` counts each contact once. A contact on two lists counts\n  in both list rows, so `overlap: true` says the flagged rows add up to more.\n- `count` includes the contacts already removed; `remaining` is what a\n  remove deletes now. `totals.removed` counts the contacts deleted by\n  `autoRemoveBadLines` and by removes alike.\n- `totals.contacts` is `clean + flagged + badLines + failed + pending`.\n  While a scrub runs, a contact an earlier scrub already checked counts under\n  its earlier result (`flagged` or a bad line) until this one checks it.\n\n3. Delete the contacts of one or more categories. Keys of different groups go\n   in one call and one background job.\n\n```http\nPOST /api/v1/scrubs/0b7f6c1e-2d4a-4b8e-9c1f-3a5d7e9b1c2f/remove\nContent-Type: application/json\n\n{ \"categories\": [\"federal_dnc\", \"state_dnc\", \"tcpa\"] }\n```\n\n`202`\n\n```json\n{ \"operationId\": \"3f1c2a9e-8b7d-4e6f-9a10-2b3c4d5e6f70\", \"totalContacts\": 0, \"initializing\": true }\n```\n\nThe answer is always `totalContacts: 0` and `initializing: true`: the\ncontacts are counted after it. A contact in two of the categories is deleted\nonce. `categories` takes 1 to 12 keys; a key repeated or outside the table\nbelow is refused as `Bad Request`.\n\n4. Follow the operation (scope `async-operations:read`) until `status` is\n   `completed` or `failed`:\n\n```http\nGET /api/v1/async-operations/3f1c2a9e-8b7d-4e6f-9a10-2b3c4d5e6f70\n```\n\n`200` (fields that are not about the delete left out)\n\n```json\n{ \"operationId\": \"3f1c2a9e-8b7d-4e6f-9a10-2b3c4d5e6f70\", \"operationType\": \"bulk_contact_delete\", \"status\": \"completed\",\n  \"progress\": { \"total\": 58, \"processed\": 58, \"percentage\": 100, \"successCount\": 58, \"errorCount\": 0, \"message\": \"Deleted 58 of 58 contacts\" },\n  \"result\": { \"deletedCount\": 58 }, \"createdAt\": \"2026-11-17T15:12:00.000Z\", \"completedAt\": \"2026-11-17T15:12:04.000Z\" }\n```\n\nA remove is not charged and works on a scrub in any status. Each call starts a\nnew delete; a second one deletes what is left, usually nothing. Contacts\ndeleted by a remove show in the summary's `remaining` and in each result\nrow's `removed`, not in `counts.removed`, which counts only what\n`autoRemoveBadLines` deleted.\n\nThe older body `{ \"group\": \"flagged\", \"list\": \"federal_dnc\" }` still works and\ndeletes one group, or one list of it. A body with both `categories` and\n`group` or `list`, or with neither, is refused with\n`INVALID_SCRUB_RESULT_SCOPE`.\n\n### Result categories\n\nThe summary lists these categories in this order, and `categories` on a\nremove takes their keys. Each category is one `group` and `list`, the\nvalues `GET /v1/scrubs/{scrubId}/results` takes to list its contacts (for\n`state_dnc`: `?group=flagged&list=state_dnc`; for `failed`: `?group=failed`).\n\n| Key | Label | `group` | `list` |\n|---|---|---|---|\n| `tcpa` | TCPA litigators | `flagged` | `tcpa` |\n| `troll` | TCPA trolls | `flagged` | `troll` |\n| `federal_dnc` | National Do Not Call Registry | `flagged` | `federal_dnc` |\n| `state_dnc` | State Do Not Call lists | `flagged` | `state_dnc` |\n| `dnc_complainers` | Known complainers | `flagged` | `dnc_complainers` |\n| `nra` | Additional do-not-contact list | `flagged` | `nra` |\n| `other` | Other flagged list | `flagged` | `other` |\n| `legacy` | Do Not Call (litigators included) | `flagged` | `legacy` |\n| `landline` | Landlines | `kept` | `landline` |\n| `voip` | VoIP numbers | `kept` | `voip` |\n| `unknown` | No line or unconfirmed | `kept` | `unknown` |\n| `failed` | Could not be checked | `failed` | none |\n\nEach contact of a scrub lands in one group, the first that applies: `failed`\n(the check did not complete, `failureReason` `stopped` or `error`),\n`flagged` (on a do-not-call or litigator list, whatever its line type),\n`kept` (a landline, VoIP, no-line or undetermined number), then `clean` (a\nmobile line on no list). `clean` is not a category: a scrub never removes\nclean contacts.\n\n- `kept` is the name of the group. It does not mean \"kept in the account\":\n  with `autoRemoveBadLines: true` its landline, VoIP and no-line contacts are\n  deleted. Deletion goes by line type only, so a flagged landline is deleted\n  too; a list match alone deletes nothing.\n- `unknown` holds two kinds of number. A number with no line is deleted by\n  `autoRemoveBadLines`. A number whose line type could not be determined is\n  not. Both read `lineType: \"unknown\"`.\n- `other` holds the contacts on a list none of the other keys names, the\n  list literally named `other` included, so a remove of `other` deletes\n  every contact on an unrecognised list. The summary's `other` row and the\n  results with `list=other` count and list the same contacts.\n- `legacy` holds contacts flagged before lists were recorded. In the older\n  `{ group, list }` form a `list` outside these values is accepted for\n  `flagged` and matches nothing.\n- `lineType` and `doNotCall` on a result row are the raw outcomes, not the\n  group. A `flagged` row can read `lineType: \"landline\"`; a `kept` row reads\n  `doNotCall: \"clean\"`.\n- Deletion is skipped for a batch of numbers whose check partly failed, or\n  where most numbers came back with no line. The summary's `remaining` shows\n  what is left.\n\n### Before a start: targets, cost and credits\n\n1. Pick a target. Any workflow or campaign id of the account is accepted; the\n   eligible lists are a convenience.\n\n```http\nGET /api/v1/scrubs/eligible-workflows\nx-api-key: sk_…\n```\n\n`200`\n\n```json\n[\n  { \"id\": 42, \"name\": \"New lead nurture\", \"status\": \"active\", \"contactCount\": 1620 },\n  { \"id\": 57, \"name\": \"Re-engagement\", \"status\": \"paused\", \"contactCount\": 91 }\n]\n```\n\n`contactCount` counts every enrollment; a scrub covers only the active and\npaused ones. `GET /api/v1/scrubs/eligible-campaigns` lists campaigns the same\nway, with `pendingContacts` (the contacts the campaign has not processed yet).\n\n2. Preview the cost. It spends nothing and changes nothing.\n\n```http\nPOST /api/v1/scrubs/preview\nContent-Type: application/json\n\n{ \"workflowIds\": [42] }\n```\n\n`200`\n\n```json\n{ \"totalContacts\": 1500, \"alreadyScrubbed\": 120, \"newToScrub\": 1380, \"creditsRequired\": 1380, \"estimated\": false }\n```\n\n3. Check the verification balance.\n\n```http\nGET /api/v1/credits\n```\n\n`200`\n\n```json\n{ \"billedBy\": \"account\", \"remainingCredits\": 5400, \"rechargeActive\": false, \"rechargeMinimum\": null, \"rechargeProductId\": null,\n  \"totalCreditsPurchased\": 10000, \"verificationCredits\": 1000, \"totalVerificationCreditsPurchased\": 2000 }\n```\n\n4. Short of 1,380? Buy a verification pack. Packs are listed by\n   `GET /api/v1/credits/products` (`kind: \"verification\"`).\n\n```http\nPOST /api/v1/credits/purchase\nIdempotency-Key: scrub-topup-2026-11-17\nContent-Type: application/json\n\n{ \"kind\": \"verification\", \"lookupKey\": \"500_verification_credits\" }\n```\n\n`200`\n\n```json\n{ \"id\": \"pi_3QFv2kLmN8pQrStU1aBcDeFg\", \"status\": \"succeeded\", \"kind\": \"verification\", \"credits\": 500,\n  \"amount\": { \"value\": 2500, \"currency\": \"usd\" }, \"creditsGranted\": null,\n  \"statusUrl\": \"https://…/api/v1/credits/purchases/pi_3QFv2kLmN8pQrStU1aBcDeFg\", \"createdAt\": \"2026-11-17T15:00:31.000Z\" }\n```\n\nThe credits land within seconds: `creditsGranted` is set once they have.\n\n### The scrub record and its contacts\n\nThe summary is enough to decide what to remove. Two reads give the rest.\n\n`GET /v1/scrubs/{scrubId}` answers the scrub record: `status`,\n`failureCode`, `credits`, its permanent `counts` and its timestamps, the\nsame body as `data` in the scrub webhooks. The breakdown by category is the\nsummary's.\n\n```http\nGET /api/v1/scrubs/0b7f6c1e-2d4a-4b8e-9c1f-3a5d7e9b1c2f\n```\n\n`200`\n\n```json\n{\n  \"id\": \"0b7f6c1e-2d4a-4b8e-9c1f-3a5d7e9b1c2f\",\n  \"status\": \"completed\",\n  \"failureCode\": null,\n  \"autoRemoveBadLines\": true,\n  \"counts\": {\n    \"total\": 1500, \"processed\": 1500,\n    \"lineTypes\": { \"mobile\": 1210, \"landline\": 190, \"voip\": 62, \"unknown\": 26 },\n    \"doNotCall\": { \"clean\": 1391, \"flagged\": 97, \"unknown\": 0 },\n    \"lists\": { \"tcpa\": 12, \"federal_dnc\": 81, \"state_dnc\": 9 },\n    \"failed\": 12, \"removed\": 255\n  },\n  \"credits\": { \"charged\": 1380, \"returned\": 12 },\n  \"createdAt\": \"2026-11-17T15:01:48.000Z\",\n  \"completedAt\": \"2026-11-17T15:09:40.101Z\"\n}\n```\n\n`GET /v1/scrubs/{scrubId}/results` lists the contacts with their results, a\npage at a time; `group` and `list` narrow it to one category:\n\n```http\nGET /api/v1/scrubs/0b7f6c1e-2d4a-4b8e-9c1f-3a5d7e9b1c2f/results?group=flagged&take=100\n```\n\n`200`\n\n```json\n{\n  \"rows\": [\n    { \"contactUuid\": \"6ba7b810-9dad-41d1-80b4-00c04fd430c8\", \"phoneNumber\": \"+13105550188\", \"status\": \"completed\",\n      \"group\": \"flagged\", \"lineType\": \"mobile\", \"carrier\": \"Verizon\", \"doNotCall\": \"flagged\",\n      \"flaggedLists\": [\"tcpa\", \"federal_dnc\"], \"failureReason\": null,\n      \"verifiedAt\": \"2026-11-17T15:04:02.118Z\", \"removed\": false, \"removedAt\": null },\n    { \"contactUuid\": \"7c9e6679-7425-40de-944b-e07fc1f90ae7\", \"phoneNumber\": \"+15125550143\", \"status\": \"completed\",\n      \"group\": \"flagged\", \"lineType\": \"landline\", \"carrier\": \"AT&T\", \"doNotCall\": \"flagged\",\n      \"flaggedLists\": [\"state_dnc\"], \"failureReason\": null,\n      \"verifiedAt\": \"2026-11-17T15:04:02.118Z\", \"removed\": true, \"removedAt\": \"2026-11-17T15:04:02.530Z\" }\n  ],\n  \"nextCursor\": \"c3IxOjEwMjQ0\"\n}\n```\n\nThe second row is a landline on a list: `autoRemoveBadLines` deleted it, and\nit stays listed with `removed: true`. For the whole scrub as a CSV, see the\nresults file below.\n\n### Targets\n\nA preview or a start takes exactly one of these keys:\n\n| Key | Covers | Limit | Balance checked at start |\n|---|---|---|---|\n| `contactUuids` | those contacts; uuids that are not a live contact of the account are skipped | 10,000 uuids | the exact cost |\n| `filter` | the contacts that match every condition | none | a positive balance |\n| `allContacts: true` | every contact of the account | none | a positive balance |\n| `workflowIds` | contacts whose enrollment in those workflows is active or paused | 100 ids, 250,000 contacts | the exact cost |\n| `campaignIds` | contacts those campaigns have not processed yet | 100 ids, 250,000 contacts | the exact cost |\n\n- `filter` takes the conditions of `POST /v1/contacts/export` (`search`,\n  `tags`, `optedOut`, `listId`, `folderId`, `createdAfter`,\n  `createdBefore`, not `filename`) plus `importJobId`. A filter that names\n  no condition is refused; the whole account is `allContacts: true`.\n- `search` counts as a condition only from 3 characters. A shorter search is\n  ignored and does not narrow the target; a `filter` whose only condition is\n  a shorter search is refused with `INVALID_SCRUB_TARGET`.\n- `tags` takes tag ids or names; a contact with any of them matches.\n- importJobId is the jobId an import through the contacts bulk endpoint answered. Imports created before scrubs were added to the API, and imports whose job has not started yet, are not found by it.\n\nPreview answers `estimated: false` and an exact split for `contactUuids`,\n`workflowIds` and `campaignIds`. For `filter` it answers `estimated: true`,\n`alreadyScrubbed: 0` and `creditsRequired` equal to `totalContacts`, an\nupper bound. For `allContacts` it answers an exact split, still marked\n`estimated: true`. A target with no contact answers zeros on preview and\n`NO_CONTACTS_FOUND` on start.\n\n### Credits\n\n- A scrub spends one verification credit for each contact whose number this account has not scrubbed before; numbers already scrubbed cost nothing.\n- The credits are charged when the scrub starts running, not when the start is accepted. A start with contactUuids, workflowIds or campaignIds is refused when the balance is short of the exact cost; a start with filter or allContacts only needs a positive balance. Any scrub can still end failed with failureCode insufficient_credits or spend_cap_reached when that charge is refused.\n- Stopping a scrub returns the credits charged for the numbers it had not\n  checked yet.\n- A retry charges, in the request, for the failed numbers this account has\n  never scrubbed. A refused charge answers `402` at once.\n\n### autoRemoveBadLines\n\n- `autoRemoveBadLines`: true deletes, as results arrive, the contacts whose number comes back as a landline, a VoIP line or a number with no line, including those also on a do-not-call or litigator list. A list match alone never deletes a contact, and neither does a line type that could not be determined. false deletes nothing and only records the results. There is no default.\n- A retry keeps the value the scrub was started with.\n- Deleted contacts stay in the results with `removed: true`.\n\n### Status and lifecycle\n\n| `status` | Meaning |\n|---|---|\n| `pending` | accepted; contacts not gathered and nothing charged yet |\n| `in_progress` | numbers being checked |\n| `completed` | every number has a result or a failure |\n| `failed` | ended early; `failureCode` says why |\n\n| `failureCode` (only when `failed`) | Meaning |\n|---|---|\n| `stopped` | stopped through the API or the app |\n| `worker_lost` | the scrub stopped running and was closed |\n| `insufficient_credits` | the verification balance was short when the scrub started running |\n| `spend_cap_reached` | the account’s spending cap refused the charge |\n| `no_contacts` | the target held no contact with a phone number when the scrub ran |\n| `error` | any other failure, and every scrub that failed before codes were recorded |\n\n- Stop (`POST /v1/scrubs/{scrubId}/stop`) ends a pending or in-progress scrub:\n  the numbers not checked yet fail with `failureReason: \"stopped\"`, and\n  contacts already deleted stay deleted. On a finished scrub it answers\n  `stopped: false` and `creditsReturned: 0`.\n- Retry (`POST /v1/scrubs/{scrubId}/retry`) checks the failed numbers of a\n  completed or failed scrub again, in the same scrub with the same id. It\n  answers `scrubId`, `retriedCount` and `creditsCharged`, and clears\n  `failureCode`.\n- One scrub runs per account at a time: a start or a retry while another scrub is pending or in progress is refused with SCRUB_IN_PROGRESS. A repeated start after a scrub finished is a\n  new scrub, and the numbers the first one checked cost nothing.\n\n### Reading counts and results\n\n- `counts` is what the scrub recorded. `processed` includes the failed\n  numbers, so the numbers checked are `processed` minus `failed`.\n  `lineTypes.unknown` includes the numbers with no line. `counts.lists`\n  counts a contact on two lists in both; it is `null` for scrubs that ran\n  before lists were recorded.\n- The summary and the result rows are live. A category's `count` is the\n  contacts in it whose most recent scrub is this one, deleted ones included;\n  `remaining` is those not deleted. During a run `count` grows.\n- Results list the contacts whose most recent scrub is this one. A contact scrubbed again by a later scrub leaves this scrub’s results and file; the scrub’s counts stay as they were and are its permanent record. For example: scrub A checks contact X, then\n  scrub B checks X again. X leaves A's results and A's file and appears in B's;\n  A's `counts` do not change.\n- Contacts removed by the scrub or by a remove stay listed with removed true and removedAt.\n- Result pages go by contact, in a stable order: send back `nextCursor` as\n  `cursor` until it is `null`. `take` is 1 to 500 (default 100). `group`\n  and `list` narrow the rows to one category, as in the category table.\n- `GET /v1/scrubs` lists scrubs newest first (`take` up to 100, default 20),\n  including scrubs started in the app and by imports. Each row is the body of\n  `GET /v1/scrubs/{scrubId}`.\n\n### Results file\n\n`POST /v1/scrubs/{scrubId}/results-file` prepares a CSV of the scrub's\nresults, for a completed or failed scrub. It is not charged. It answers `202`\nwith the file state; a file prepared in the last 10 minutes, with no change to\nthe scrub since, is reused and can come back `completed` at once.\n`GET /v1/scrubs/{scrubId}/results-file` reads the state; once `completed`,\n`download.downloadUrl` is a link valid one hour, signed again on each read.\n\n- Columns: `contactId`, `phoneNumber`, `status`, `group`, `lineType`, `carrier`, `doNotCall`, `flaggedLists`, `verifiedAt`, `removed`, `removedAt`. No names, no `failureReason`.\n- `contactId` is the contact uuid, the same value as `contactUuid` in the\n  results.\n- `flaggedLists` is joined with `|`; booleans read `true` or `false`; an\n  empty value is an empty cell.\n\n### Webhooks\n\n- Events: `scrub.started` (contacts gathered and credits charged, and again\n  on each retry), `scrub.completed` and `scrub.failed`. Subscribe to each\n  name; there is no wildcard.\n- `data` is the body `GET /v1/scrubs/{scrubId}` answers.\n- A scrub that ends before it runs sends `scrub.failed` with no\n  `scrub.started`. A retry sends `scrub.started` again, so one scrub can\n  send each event more than once.\n- The envelope `timestamp` is when the scrub changed state. Deduplicate on\n  `data.id` + `event` + `timestamp`.\n- A lost event is not sent again; `GET /v1/scrubs/{scrubId}` is the record.\n  Subscribe with the webhook subscriptions API.\n\n### Refusals carry a code\n\nA refused request answers `{ \"statusCode\", \"message\", \"error\": \"<CODE>\", …details }`.\nThe message is for a person and may be reworded; `error` is stable, so branch\non it. A refusal with no code puts the HTTP status text in `error`. A missing\nor invalid key answers `401`, a key without the scope or an account without\nscrubs `403`, too many requests `429`, and a server fault `500` with\n`\"Something went wrong. Try again in a moment.\"`.\n\n| `error` | Status | Endpoints | When | Details |\n|---|---|---|---|---|\n| `INVALID_SCRUB_TARGET` | 400 | preview, start | no target, more than one, or a `filter` that names no condition; also a `filter` whose only condition is a `search` under 3 characters | `targets`, except for the short search |\n| `NO_CONTACTS_FOUND` | 400 | preview, start | start: the target holds no contact with a phone number. Preview answers zeros instead, and refuses only `contactUuids` none of which is a contact of the account |  |\n| `UNSUPPORTED_FILTER_FIELDS` | 400 | preview, start | a `filter` condition the account’s contact search cannot apply (for example `folderId`) | `fields` |\n| `SCRUB_TARGET_TOO_LARGE` | 400 | preview, start | the workflows or campaigns hold more than 250,000 contacts | `max` |\n| `NO_FAILED_CONTACTS` | 400 | retry | the scrub has no failed contact left. Checked before `SCRUB_NOT_FINISHED` |  |\n| `CREDIT_DEDUCTION_FAILED` | 400 | retry | the retry charge failed for a reason other than the balance or the spending cap |  |\n| `INVALID_SCRUB_RESULT_SCOPE` | 400 | results, remove | remove: `categories` together with `group` or `list`, or neither of them. Both calls: `list` outside `landline`, `voip`, `unknown` for `kept`, a `list` for `failed` or `clean`, a `list` with no `group`, or a blank `list` |  |\n| `INVALID_CURSOR` | 400 | results | a `cursor` this API did not answer. Checked before the scrub id, so it can come before `SCRUB_NOT_FOUND` |  |\n| `Bad Request` | 400 | any | a malformed body or query (`message` is a list of problems), or a `{scrubId}` that is not a uuid (`message` is one string) |  |\n| `INSUFFICIENT_VERIFICATION_CREDITS` | 402 | start, retry | the verification balance is short of the cost (start: the exact cost for id targets, a positive balance for `filter` and `allContacts`) | `required`, `available`, `shortfall` when known; `available: 0` alone when the account has no verification credits |\n| `ACCOUNT_SPEND_CAP_REACHED` | 402 | retry | the account’s spending cap refused the retry charge. A start is never refused with it: the scrub ends `failed` with `spend_cap_reached` |  |\n| `WORKFLOW_NOT_FOUND` | 404 | preview, start | a workflow id that is not the account’s | `workflowIds` (the missing ones) |\n| `CAMPAIGN_NOT_FOUND` | 404 | preview, start | a campaign id that is not the account’s | `campaignIds` (the missing ones) |\n| `IMPORT_NOT_FOUND` | 404 | preview, start | `filter.importJobId` names no import of the account |  |\n| `SCRUB_NOT_FOUND` | 404 | every `{scrubId}` call | no scrub of the account has this id |  |\n| `RESULTS_FILE_NOT_REQUESTED` | 404 | get results file | no results file was requested for this scrub, or the last one is too old to keep | `scrubId` |\n| `Not Found` | 404 | preview, start | `filter.listId` is not a contact list of the account |  |\n| `SCRUB_IN_PROGRESS` | 409 | start, retry | another scrub of the account is pending or in progress, or is being started | `scrubId` and `status` of the running scrub; or `retryable: true` while another start is being accepted; or neither, when the running scrub cannot be named |\n| `SCRUB_NOT_FINISHED` | 409 | retry, request results file | the scrub is still pending or in progress | `scrubId` (retry only) |\n| `Conflict` | 409 | remove | a contact import of the account is running |  |\n| `Service Unavailable` | 503 | remove | the delete could not be queued; nothing was deleted, try again |  |\n"},{"name":"Messages","description":"Send and retrieve messages"},{"name":"Templates","description":"Reusable message templates"},{"name":"Conversations","description":"Access conversation threads"},{"name":"Campaigns","description":"Create, schedule, and control bulk SMS campaigns"},{"name":"Phone Numbers","description":"List your phone numbers with their 10DLC compliance status and labels, and manage call forwarding"},{"name":"Workflows","description":"\nCreate, edit, run and manage workflow automations: a trigger, an ordered chain of\ntext, wait and tag steps, sending hours and the numbers it sends from. Every call\ntakes an account API key (`sk_…`) with `workflows:read` or `workflows:write`.\n\n### Manage a workflow in five calls\n\n```\n# 1. Pick a sending number (its id goes into phoneConfig)\nGET /api/v1/phone-numbers\n→ rows[0].id = 3\n\n# 2. Create the workflow, published, enrolled by hand, three steps\nPOST /api/v1/workflows\n{\n  \"name\": \"New lead follow-up\",\n  \"status\": \"active\",\n  \"trigger\": { \"type\": \"manual\" },\n  \"steps\": [\n    { \"type\": \"sendSms\", \"config\": { \"message\": \"Hi {firstName}, thanks for reaching out! Reply STOP to opt out.\" } },\n    { \"type\": \"wait\", \"config\": { \"waitAmount\": 2, \"waitUnit\": \"days\" } },\n    { \"type\": \"sendSms\", \"config\": { \"message\": \"Hi again {firstName}, still interested?\" } }\n  ],\n  \"settings\": { \"timeZone\": \"America/New_York\", \"timeWindow\": { \"enabled\": true, \"startTime\": \"09:00\", \"endTime\": \"18:00\" } },\n  \"phoneConfig\": { \"mode\": \"single\", \"defaultPhoneNumberId\": 3 }\n}\n→ 201 { \"id\": 42, \"status\": \"active\", \"trigger\": { \"type\": \"manual\" },\n        \"steps\": [ { \"nodeId\": \"…\", \"type\": \"trigger\", \"order\": 0 },\n                   { \"nodeId\": \"a1…\", \"type\": \"sendSms\", \"order\": 1, \"config\": { \"message\": \"…\" } },\n                   { \"nodeId\": \"b2…\", \"type\": \"wait\", \"order\": 2, \"config\": { \"waitAmount\": 2, \"waitUnit\": \"days\" } },\n                   { \"nodeId\": \"c3…\", \"type\": \"sendSms\", \"order\": 3, \"config\": { \"message\": \"…\" } } ] }\n\n# 3. Put a contact in it\nPOST /api/v1/workflows/42/enroll\n{ \"phoneNumber\": \"+15551234567\" }\n→ 201 { \"enrolled\": 1, \"skipped\": 0, \"errors\": [], \"enrollmentId\": 1001 }\n\n# 4. Change one step; the rest of the chain is untouched\nPATCH /api/v1/workflows/42/steps/c3…\n{ \"config\": { \"message\": \"Hi again {firstName}, can we help?\" } }\n→ 200 { \"nodeId\": \"c3…\", \"type\": \"sendSms\", \"order\": 3, \"config\": { \"message\": \"…\" } }\n\n# 5. Watch it run\nGET /api/v1/workflows/42/enrollments?status=active\n→ 200 { \"rows\": [ { \"id\": 1001, \"contactUuid\": \"…\", \"status\": \"active\", \"currentNodeId\": \"b2…\" } ], \"metadata\": { … } }\n```\n\nTo add a step after the first text: `POST /api/v1/workflows/42/steps` with\n`{ \"afterNodeId\": \"a1…\", \"type\": \"tag\", \"config\": { \"addTagIds\": [12] } }`. A\ntag-triggered workflow takes `\"trigger\": { \"type\": \"tag_applied\", \"tagId\": 12 }`\n(ids from `GET /v1/tags`); one workflow per trigger tag, so a tag already in use\nanswers `DUPLICATE_TAG_TRIGGER`.\n\n### One step shape, read and write\n\n`{ \"nodeId\"?, \"type\": \"sendSms\" | \"wait\" | \"tag\", \"name\"?, \"config\": { … } }`. Reads add\n`order`, which writes accept and ignore. The `config` keys are the same both ways:\n`sendSms` takes `message` or `variants`, `followUpMessage`, `followUpVariants`,\n`useFollowUpForExistingConversations`, `cancelOnReply`, `actionName`; `wait` takes\n`waitAmount`, `waitUnit`, `businessDaysOnly`, `jitterMinutes`; `tag` takes\n`addTagIds`, `removeTagIds`. The trigger is read as top-level `trigger` and, for\ncompatibility, as `steps[0]` with `type: \"trigger\"`; it is written as `trigger` and\nis never a step: `PATCH` or `DELETE /steps/{nodeId}` on its id answers\n`TRIGGER_IS_NOT_A_STEP`. `nodeId` is a string minted by the server; `id` is the\nworkflow's number; contacts are named by `contactUuid` or `phoneNumber`.\n\n### GET then PATCH round-trips\n\nA detail body sent back unchanged as `PATCH /v1/workflows/{id}` is a no-op `200`.\nWhen `steps` is present the chain becomes exactly that list: a step sent with its\n`nodeId` is kept with its contacts and the fields you did not send, one without a\n`nodeId` is new, one left out is removed (contacts on it finish with the reason\n\"step removed\"). Without `steps` the chain is untouched. `description: null`\nclears; `name: null` is refused. A wrong key name for a known field (`id` for\n`nodeId`, `body` for `config.message`, `timezone` for `settings.timeZone`) is\nrefused with a message naming the right key.\n\n### Status and verbs\n\n| `status` on read | Meaning | How you get there | Contacts |\n|---|---|---|---|\n| `draft` | not published; nothing runs | create without `status`, or `PATCH {\"status\":\"draft\"}` | a published workflow taken back to draft pauses its contacts |\n| `active` | published and running | `PATCH {\"status\":\"active\"}` or create with it (needs a usable number) | enrollments run |\n| `paused` | published, held | `POST /v1/workflows/{id}/pause` (accepted at once, applied in the background) | enrollments wait where they are; new enrollments start paused |\n| `completed`, `failed` | finished | read-only | |\n\n`POST /v1/workflows/{id}/resume` continues a paused workflow (needs 50 credits,\nanswers `402` below that; `WORKFLOW_NOT_PAUSED` on a draft or a running\nworkflow). `POST /v1/workflows/{id}/activate` does the same and is deprecated.\n`PATCH` accepts `status` `draft`, `active`, and `paused` only as the read-back\nno-op on a paused workflow (`STATUS_NOT_SETTABLE` otherwise). Pause and resume\nanswer with `lifecycleState` (`pausing`, `paused`, `resuming`, `active`) and an\n`operationId`; a second lifecycle call while one is in flight answers `409`.\nEvery read carries `lifecycleState` too: poll `GET /v1/workflows/{id}` until it\nleaves `pausing` / `resuming` before the next pause, resume or status change.\n\n### Numbers\n\n`phoneConfig` names the ids `GET /v1/phone-numbers` returns: `mode` `single`\n(`defaultPhoneNumberId`), `pool` (`poolPhoneNumberIds` in rotation order,\n`poolRotationEnabled`, `poolRotationThreshold` 1–200) or `existing` (the number\nthat last texted the contact, then `fallbackMode` and `fallbackPhoneNumberId`).\nA workflow can use any of the account's enabled numbers, whichever provider account\neach one is on; the `provider_mismatch` problem is no longer returned. Pool numbers\nalso need a 10DLC campaign.\nOmitting `poolPhoneNumberIds` leaves the pool, `[]` empties it. Publishing needs a\nusable number, and a change that would leave a published workflow with nothing to\nsend from is refused (`PHONE_CONFIG_UNSATISFIABLE`).\n\n### Edits on a running workflow\n\nChanges to the steps apply to contacts who enter the workflow after the change. A contact already in the workflow may finish on the steps that were there when they entered: a step you add may not be sent to them, a wait you shorten may keep its old length for them, and a tag step you remove may still apply. Changing the text of a message step applies to everyone, including messages already waiting to go out. Removing the step a contact is on ends their run with the reason \"step removed\". Sending hours apply to messages not yet scheduled. A message already waiting for its sending slot may go out at the time it was given, even if you make the hours narrower later; narrowing never moves a message earlier. Switching sending hours on without a timezone uses US Eastern Time unless the workflow already has one.\n\n### Refusals carry a code\n\nA refused request answers `{ \"statusCode\", \"message\", \"error\": \"<CODE>\", …details }`.\nThe message is for a person and may be reworded; `error` is stable, branch on it.\nA malformed body answers `400` with `message` as a list of problems and\n`error: \"Bad Request\"`; a missing or invalid key `401`, a key without the scope\n`403`, a workflow of another account `404`.\n\n| Code | Status | When | Details |\n|------|--------|------|---------|\n| `STEP_NOT_FOUND` | 404 | `nodeId` in the path is not a step of this workflow | `nodeId` |\n| `TRIGGER_IS_NOT_A_STEP` | 400 | `nodeId` in the path is the trigger | `nodeId` |\n| `UNKNOWN_STEP` | 400 | a `nodeId` in the body (`steps[]`, `afterNodeId`) is not a step | `nodeId`, `field` |\n| `DUPLICATE_STEP` | 400 | a `nodeId` listed twice in `steps` | `nodeId` |\n| `STEP_TYPE_MISMATCH` | 400 | a kept step sent with another `type` | `nodeId`, `expected`, `received` |\n| `FIELD_NOT_FOR_STEP_TYPE` | 400 | a per-step `config` carries a key of another step type | `nodeId`, `type`, `fields` |\n| `TAG_STEP_INVALID` | 400 | a tag step with no tag, or a tag both added and removed | `nodeId` |\n| `REORDER_NOT_A_PERMUTATION` | 400 | the reorder list is not every step exactly once | `missing`, `extra`, `duplicates` |\n| `TAG_NOT_OWNED` | 400 | a tag that is not the account’s | `tagIds` |\n| `WORKFLOW_PHONE_NUMBER_INVALID` | 400 | a number that is not the account’s, is disabled, or (pool) has no 10DLC campaign | `problems[]` with `role`, `phoneNumberId`, `problem` |\n| `TIME_WINDOW_INVALID` | 400 | sending hours that do not start before they end |  |\n| `PHONE_CONFIG_UNSATISFIABLE` | 400 | publishing, or a phone change on a published workflow, would leave nothing to send from | `problem` |\n| `DUPLICATE_TAG_TRIGGER` | 400 | another workflow already starts on that tag | `conflicts` |\n| `SENTIMENT_TRIGGER_NOT_ENABLED` | 400 | the reply-sentiment trigger is not enabled for the account |  |\n| `WORKFLOW_NOT_PAUSED` | 400 | resume on a workflow that is not paused (a draft is published with `PATCH {\"status\":\"active\"}`) | `status` |\n| `STATUS_NOT_SETTABLE` | 400 | `status: \"paused\"` on a workflow that is not paused; use `POST /v1/workflows/{id}/pause` |  |\n| `HIGH_RISK_CONTACT` | 400 | the contact opted out within the last 30 days |  |\n| `OPT_OUT_SUSPENDED` | 403 | the account is on opt-out cooldown |  |\n| `MESSAGE_NOT_COMPLIANT` | 422 | publishing a draft (also by resuming it), or changing the first text step of a workflow that has been published, when that text does not name the brand or give opt-out wording; resuming a paused published workflow is not checked; `message` lists every issue and suggestion; test a text first with `POST /v1/compliance/check` | `issues[]` with `nodeId`, `variant`, `body`, `reasons`, `suggestions` |\n| `BRAND_REQUIRED` | 422 | the same writes on an account with no 10DLC brand: the first text cannot be checked |  |\n| `COMPLIANCE_UNAVAILABLE` | 503 | the compliance check could not run; nothing was saved or started, retry in a few minutes |  |\n| `WORKFLOW_ALREADY_PAUSED` | 409 | pause on a paused workflow |  |\n| `WORKFLOW_LIFECYCLE_IN_FLIGHT` | 409 | a pause or resume is still being applied | `operationId` |\n"},{"name":"AI Agents","description":"\nBuild, test, publish and follow AI agents: assistants that answer your contacts\nby SMS on their own, ask your qualifying questions and book appointments on\nGoogle Calendar or Calendly. Every call takes an account API key (`sk_…`) with\n`agents:read`, `agents:write` or `agents:publish`.\n\nAn agent never sends the first text of a conversation. It answers a contact who\ntexts one of its phone numbers, or who replies to one of its workflows or SMS\ncampaigns. Agents are created from the `booking` template, the only one today.\n\n### Build and publish an agent in five calls\n\n```\n# 1. See what the account has: connected calendars, event types, numbers, limits\nGET /api/v1/agents/setup-options\n→ 200 { \"summary\": \"Google Calendar connected; 1 number\",\n        \"calendars\": [ { \"provider\": \"google\", \"label\": \"Google Calendar\", \"connected\": true, \"accountLabel\": \"front-desk@acme.com\" },\n                       { \"provider\": \"calendly\", \"label\": \"Calendly\", \"connected\": false, \"accountLabel\": null } ],\n        \"phoneNumbers\": [ { \"id\": 3, \"number\": \"+15550100001\", \"usedByAgent\": null } ], \"workflows\": [], \"smsCampaigns\": [],\n        \"calendlyEventTypes\": [], \"defaultTimezone\": \"America/New_York\", \"templates\": [ \"booking\" ],\n        \"connectCalendarUrl\": \"https://…/app/integrations\", \"unavailable\": [], … }\n\n# 2. Create the agent as a draft\nPOST /api/v1/agents\n{\n  \"name\": \"Front desk\",\n  \"persona\": \"You are the scheduling assistant at Acme Dental.\",\n  \"tone\": \"friendly, quick, professional\",\n  \"instructions\": \"When the contact replies with interest, ask the qualifying questions set for this agent. When they qualify, move to booking. Never quote prices.\",\n  \"timezone\": \"America/New_York\",\n  \"calendarProvider\": \"google\",\n  \"appointmentTitle\": \"New patient consultation\",\n  \"durationMinutes\": 30,\n  \"bookingHours\": { \"start\": \"09:00\", \"end\": \"17:00\", \"days\": [1, 2, 3, 4, 5] },\n  \"qualifyingQuestions\": [\n    { \"question\": \"Are you a new patient?\", \"required\": true, \"qualificationCriteria\": \"Has not visited the practice before\", \"followUpEnabled\": true }\n  ],\n  \"followUp\": { \"intervalValue\": 1, \"intervalUnit\": \"hours\", \"maxFollowUps\": 1, \"jitterMinutes\": 0 },\n  \"requirePositiveSentiment\": true\n}\n→ 201 { \"id\": 17, \"kind\": \"booking\", \"status\": \"draft\", \"draftId\": 51, \"publishedVersion\": null,\n        \"qualifyingQuestions\": [ { \"id\": \"…\", \"question\": \"Are you a new patient?\", \"required\": true, … } ],\n        \"channels\": { \"phoneNumberIds\": [], \"workflowIds\": [], \"campaignIds\": [], \"phoneNumbers\": [], \"workflows\": [], \"campaigns\": [] }, \"answering\": false,\n        \"readiness\": { \"ready\": false, \"gaps\": [ { \"key\": \"channels\", \"label\": \"Add a number, a workflow or an SMS campaign\",\n                                                   \"fixWith\": { \"tool\": \"agents_set_channels\" }, \"appUrl\": \"https://…/app/ai-agents/17?section=channels\" } ] },\n        \"summary\": { \"headline\": \"Created \\\"Front desk\\\" as a draft. It is not published and answers nobody yet.\", \"state\": \"draft\", \"sections\": [ … ] },\n        \"nextSteps\": [ { \"tool\": \"agent_test_sessions_create\", \"why\": \"…\" }, { \"tool\": \"agents_set_channels\", \"why\": \"…\" }, { \"tool\": \"agents_publish\", \"why\": \"…\" } ],\n        \"appUrl\": \"https://…/app/ai-agents/17\",\n        \"warnings\": [], \"incomplete\": [], … }\n\n# 3. Say where it answers (number ids from step 1)\nPUT /api/v1/agents/17/channels\n{ \"phoneNumberIds\": [3] }\n→ 200 { \"phoneNumbers\": [ { \"id\": 3, \"number\": \"+15550100001\" } ], \"workflows\": [], \"campaigns\": [],\n        \"answering\": false, \"heldByOtherAgents\": [], \"movedFromAgentIds\": [],\n        \"summary\": { \"headline\": \"\\\"Front desk\\\" now answers on 1 number. It is a draft, so it answers nobody until it is published.\", \"state\": \"draft\", … }, … }\n\n# 4. Publish: from here the agent texts contacts on its own\nPOST /api/v1/agents/17/publish\n{ \"changelog\": \"First version\" }\n→ 200 { \"agent\": { \"id\": 17, \"status\": \"active\", \"answering\": true, … },\n        \"publishedVersion\": { \"id\": 51, \"versionNumber\": 1, \"publishedAt\": \"2026-11-12T15:04:05.000Z\" },\n        \"summary\": { \"headline\": \"Published \\\"Front desk\\\" v1. It now answers new conversations on 1 number.\", \"state\": \"live_answering\", … },\n        \"rollout\": null }\n\n# 5. Follow the conversations it handles\nGET /api/v1/agent-sessions?agentId=17&needsAttention=true\n→ 200 { \"rows\": [ { \"id\": 9042, \"agentId\": 17, \"conversationId\": 10293, \"contactUuid\": \"…\", \"status\": \"escalated\",\n                    \"reasonCode\": \"agent_escalated\", \"needsAttention\": true, \"qualification\": { \"result\": \"review\", \"answers\": [ … ] }, … } ],\n        \"metadata\": { … } }\n```\n\nOnly `name` is required on create. A calendar is connected by a person in the\napp at `connectCalendarUrl`, never through the API; an agent whose calendar is\nnot connected can be created and edited, but not published.\n\n### Building an agent with a person\n\nTwo calls exist for a client that builds an agent in a conversation, such as\nan AI assistant connected over MCP. Neither writes anything.\n\n`GET /v1/agents/build-guide` returns how an agent is built, as data: the\n`steps` in order with the tools of each, the seven `brief` items to settle\nwith the person one at a time (why each matters, how to ask it, preset answers\nwith the recommended one marked), `advancedOffer`, the `options` (every\nsetting in the words of the app, with its default and when a change takes\neffect), `writingRules` for the persona, instructions and questions, and\n`neverDo`. The advanced settings (wrap-up and off-topic instructions, the\nhand-off message, idle conversations, timezone, reply language) are optional:\nthey are offered once, with one question, and are not part of the interview.\n\n`POST /v1/agents/preview` takes the create body and answers what\n`POST /v1/agents` would do with it, as a proposal:\n\n```\nPOST /api/v1/agents/preview\n{ \"name\": \"Front desk\", \"appointmentTitle\": \"New patient consultation\", \"phoneNumberIds\": [3],\n  \"rationale\": [ \"Most dental offices book 30-minute first visits.\" ] }\n→ 200 { \"status\": \"ready_to_create\", \"issues\": [],\n        \"proposal\": { \"title\": \"Recommended booking agent\",\n                      \"sections\": [ { \"label\": \"Name\", \"value\": \"Front desk\" }, { \"label\": \"Answers on\", \"value\": \"Number +15550100001\" }, … ],\n                      \"questions\": [], \"followUpSummary\": \"No follow-ups\", \"rationale\": [ \"Most dental offices book 30-minute first visits.\" ], \"unsupported\": [] },\n        \"warnings\": [ \"Google Calendar is not connected: the agent can be created, but not published until you connect it in the builder.\" ],\n        \"text\": \"Recommended booking agent\\nName: Front desk\\n…\\n\\nNothing has been created yet. …\",\n        \"createArguments\": { \"name\": \"Front desk\", \"appointmentTitle\": \"New patient consultation\" },\n        \"afterCreate\": { \"phoneNumberIds\": [3], \"workflowIds\": [], \"campaignIds\": [], \"takeOver\": false } }\n```\n\n`text` is the whole proposal in plain words, to show the person before\nanything exists. `createArguments` is the body for `POST /v1/agents` and\n`afterCreate` the one for the channels call; `takeOver` is `true` when a\nchosen channel would move from another agent. A setup the create would refuse\nstill answers `200`, with `status: \"not_creatable\"`, each field in\n`issues` and `createArguments: null`. `phoneNumberIds`, `workflowIds`\nand `campaignIds` are only named and checked here. Creating without a\npreview stays possible.\n\n### Results written for people\n\nEvery result that carries an agent (create, read, update, duplicate, publish,\nrestore) also says it in words, beside the fields:\n\n- `summary.headline`: one or two sentences on what happened and where the\n  agent stands. `summary.state` is `draft`, `live_answering`,\n  `live_no_channel`, `switched_off` or `archived`. `summary.sections`\n  holds the setup as label and value rows; long text is cut there and whole in\n  its own field. The optional advanced settings come last, with\n  `group: \"advanced\"`.\n- `nextSteps`: what is left to do, in order, at most four. Each names a\n  `tool`, or is `inApp` with a `url` when only a person can do it\n  (connecting a calendar), and says `why`.\n- `appUrl`: the agent in the app.\n- Names beside ids: `channels.phoneNumbers`, `channels.workflows` and\n  `channels.campaigns` beside the id lists, `calendar` (provider, label,\n  whether it is connected and under which account), `calendlyEventTypeName`,\n  `timezoneLabel` and `knowledgeCollections`.\n- `readiness.gaps[]` adds `fixWith` (the `tool` and `field` that close\n  the gap, or `inApp`) and `appUrl` (the place in the app).\n\nThe channels call answers its own `summary`, `nextSteps` and `appUrl`.\nAll of these are read-only.\n\n### Draft and published\n\nAn agent holds one draft and, once published, the version contacts are answered\nwith. `GET /v1/agents/{id}` returns the draft; `publishedVersion` names the\nversion in use and `hasUnpublishedChanges` says whether they differ.\n`status` is `draft` (never published), `active` or `archived`. `answering` is\ntrue when the agent is published, switched on (`enabled`) and attached to at\nleast one channel.\n\n| Field | In the app | Applies |\n|---|---|---|\n| `name` | Name | at once |\n| `persona` | Persona | after a publish |\n| `tone` | Tone | after a publish |\n| `description` | Description | at once |\n| `instructions` | Instructions | after a publish |\n| `qualifyingQuestions` | Qualifying questions | after a publish |\n| `followUp` | Follow-ups | after a publish |\n| `calendarProvider` | Calendar | after a publish |\n| `calendlyEventTypeId` | Calendly event type | after a publish |\n| `appointmentTitle` | Appointment title | after a publish |\n| `appointmentDescription` | Appointment description | after a publish |\n| `durationMinutes` | Length | after a publish |\n| `lookAheadDays` | Days ahead | after a publish |\n| `maxSlotsToOffer` | Time options offered | after a publish |\n| `minimumNoticeMinutes` | Minimum notice | after a publish |\n| `bookingHours` | Booking hours | after a publish |\n| `humanPacing` | Reply at a human pace | at once |\n| `replyHours` | Reply hours | at once |\n| `enabled` | Agent on | at once |\n| `requirePositiveSentiment` | Only engage positive contacts | at once |\n| `knowledgeCollectionIds` | Knowledge | after a publish |\n| `wrapUpInstructions` | Wrap-up instructions | after a publish |\n| `offTopicInstructions` | Off-topic instructions | after a publish |\n| `handoff` | Hand-off message | after a publish |\n| `idleExpiryDays` | End idle conversations after | at once |\n| `idleExpiryTag` | Add a tag when a conversation ends as idle | at once |\n| `timezone` | Timezone | at once |\n| `language` | Reply language | after a publish |\n\nChannels (`PUT /v1/agents/{id}/channels`; in the app: Phone numbers, Workflow replies, SMS campaign replies) apply\nat once. `GET /v1/agents/build-guide` gives the same fields with what each\ndoes, its choices and its default.\n\n`POST /v1/agents/{id}/publish` checks `readiness` first: with gaps it answers\n`AGENT_NOT_READY` and publishes nothing. A channel is one of the checks, so set\nchannels before the first publish. Conversations already running finish on the\nversion they started with unless `applyToLiveSessions` is `true`; the move then\nruns in the background and `rollout` reports it. `GET /v1/agents/{id}/versions`\nlists the newest versions, and `POST /v1/agents/{id}/versions/{versionId}/restore`\ncopies one back into the draft (unpublished edits are lost; contacts are\nunaffected until the next publish). `DELETE /v1/agents/{id}` archives: the\nagent stops answering at once and its channels are released.\n\n### One flat shape, read and write\n\nCreate and update take the field names `GET /v1/agents/{id}` returns. The\nread-only fields of that body (`id`, `kind`, `status`, `createdAt`,\n`updatedAt`, `publishedVersion`, `hasUnpublishedChanges`, `draftId`,\n`channels`, `answering`, `readiness`, `summary`, `nextSteps`, `appUrl`,\n`calendar`, `calendlyEventTypeName`, `timezoneLabel`,\n`knowledgeCollections`) are ignored on write, so a detail body\nsent back unchanged as `PATCH /v1/agents/{id}` is a no-op `200` with\n`changedFields: []`.\n\n- A field left out is untouched. `null` clears a nullable field\n  (`description`, `calendlyEventTypeId`, `appointmentDescription`,\n  `followUp`, `wrapUpInstructions`, `offTopicInstructions`, `replyHours`,\n  `idleExpiryDays`, `idleExpiryTag`; `minimumNoticeMinutes: null` means next\n  day only) and is `CONFIG_INVALID` on any other.\n- Lists replace whole: `qualifyingQuestions` and `knowledgeCollectionIds`\n  become exactly what is sent. Send a question with its `id` to keep it the\n  same question; conversations in progress remember answers by that id.\n- `bookingHours` is sent with `start`, `end` and `days` together (`days`\n  0 = Sunday … 6 = Saturday); without `timezone` it keeps the booking time\n  zone. `handoff` merges field by field.\n- `expectedDraftId` (update only) takes the `draftId` the fields were read\n  with: when the draft is no longer that one, nothing is written and the answer\n  is `DRAFT_CONFLICT`.\n- The update response adds `publishRequired`, `changedFields` and\n  `warnings`; create adds `warnings` and `incomplete` (fields that were not\n  saved, to send again with `PATCH`). Warnings never refuse: instructions past\n  the 8,000 characters the agent reads, `{braces}` placeholders the agent never\n  fills in, a step that has the agent send the first text, a qualifying question\n  repeated in the instructions.\n\nLimits: `name` 120 characters, `persona` 2,000, `tone` 500, `instructions` 20,000, up to\n25 questions of 500 characters, `durationMinutes` 5–240, `lookAheadDays`\n1–60, `maxSlotsToOffer` 1–10, and 200 ids per channel list.\n`GET /v1/agents/setup-options` returns the same numbers in `limits`.\n\n### Scopes\n\n| Scope | Allows |\n|---|---|\n| `agents:read` | list and read agents, the build guide, a preview, setup options, versions, channels, knowledge, account settings, sessions and the agent state of a conversation |\n| `agents:write` | create, update, duplicate, archive and restore drafts; knowledge; test conversations; pause and resume an agent on one conversation; acknowledge a session |\n| `agents:publish` | set channels, publish, change the account settings (default agent, pause all) and start a session. An OAuth connection grants it to account admins only |\n\nA key with `agents:write` alone answers `403` on the publish-scope calls, so an\nintegration can prepare agents without being able to put one in front of\ncontacts. An OAuth connection approved before these scopes existed does not\nhold them; the user approves access again to add them.\n\n### Channels and account settings\n\n`PUT /v1/agents/{id}/channels` takes `phoneNumberIds`, `workflowIds` and\n`campaignIds` (ids from `GET /v1/agents/setup-options`, which lists the\nnumbers, workflows and SMS campaigns with the agent that holds each; SMS\ncampaigns only). A list given replaces that kind, a list\nleft out is kept, `[]` removes them all. A number, workflow or campaign belongs\nto one agent at a time: one another agent holds is refused with\n`CHANNEL_CONFLICT` and who holds it, unless `takeOver` is `true`, which moves\nit (`movedFromAgentIds` names the agents that lost one).\n`GET /v1/agents/{id}/channels` lists `heldByOtherAgents` up front.\n\n`GET` and `PATCH /v1/agent-settings` hold two account-wide switches:\n`defaultAgentId` with `defaultEnabled` (the agent that answers a new\nconversation no channel routes; it must be published and active) and\n`agentsPaused`, which stops every agent of the account at once.\n\n### Testing\n\nA test conversation plays one of your contacts against the agent, one message\nper call. No SMS is sent, the contact receives nothing, and no alert, tag,\nwebhook or booking leaves the test (the agent can read a calendar, not write to\nit).\n\n```\nPOST /api/v1/agents/17/test-sessions\n{ \"contactUuid\": \"550e8400-e29b-41d4-a716-446655440000\" }\n→ 201 { \"id\": 9100, \"agentId\": 17, \"contactUuid\": \"550e8400-…\", \"usesDraft\": true, \"status\": \"active\", \"createdAt\": \"…\" }\n\nPOST /api/v1/agents/17/test-sessions/9100/messages\n{ \"content\": \"Hi, do you have anything on Thursday?\" }\n→ 200 { \"reply\": \"Happy to help! Are you a new patient?\", \"action\": \"continue\", \"toolCalls\": [],\n        \"outcome\": null, \"qualification\": { \"result\": \"pending\", \"answers\": [ … ] },\n        \"sessionStatus\": \"active\", \"creditsCharged\": null, \"turnNumber\": 1, \"skippedReason\": null }\n```\n\nThe draft is tested unless `useDraft` is `false`, which tests the published\nversion. `includeHistory: true` lets the agent read the contact's real\nconversation first. Opening a test costs nothing; each message spends credits\nlike a live reply and can take up to a minute. `action` is `continue`,\n`complete` or `escalate`; a `null` reply with `skippedReason` means a rule\nstopped the agent before it answered. When `sessionStatus` is no longer\n`active` the test takes no more messages:\n`POST /v1/agents/{id}/test-sessions/{sessionId}/reset` opens a fresh one with\nthe same contact and choices, and its `id` replaces the old one. A draft that\ncannot run yet is refused with `AGENT_NOT_READY` and its `gaps`. Test\nconversations are never listed under `/v1/agent-sessions`.\n\n### Knowledge\n\nA knowledge collection holds what an agent may look facts up in: a price list,\nan FAQ, a policy. Collections belong to one agent, under\n`/v1/agents/{id}/knowledge`.\n\n```\nPOST /api/v1/agents/17/knowledge/collections\n{ \"name\": \"Price list\" }\n→ 201 { \"id\": 8, \"agentId\": 17, \"name\": \"Price list\", \"sourceCount\": 0, \"attached\": true, \"publishRequired\": false, \"warnings\": [], … }\n\nPOST /api/v1/agents/17/knowledge/collections/8/sources\n{ \"type\": \"qa\", \"title\": \"Prices 2026\", \"pairs\": [ { \"question\": \"How much is a cleaning?\", \"answer\": \"$120\" } ] }\n→ 201 { \"id\": 31, \"collectionId\": 8, \"type\": \"qa\", \"title\": \"Prices 2026\", \"status\": \"ready\", \"error\": null, \"passageCount\": 1, … }\n```\n\nA source is `text` (`content`, up to 50,000 characters), `qa` (`pairs`, up to 500)\nor `table` (`columns` and `rows`, up to 50 columns, 1,000 rows and 2 MB of text in all). It is indexed\nbefore the call answers: `status` `ready` means the agent can find it from then\non, also in conversations already running; `failed` means it was saved but not\nindexed, with the reason in `error`. `PATCH …/sources/{sourceId}` takes the\n`type` the source already has and replaces the content sent. Files are uploaded\nin the app; a file source is listed and can be deleted here. Listing the\nsources of a collection returns the first `take` of them, oldest first\n(default 50, max 200), without their content.\n\nWhile the agent's `knowledgeCollectionIds` is empty it searches every\ncollection it owns, so a new collection needs no publish. When that list names\ncollections, the agent searches only those: creating a collection adds its id\nto the draft's list (unless `attach` is `false`) and `publishRequired` is\n`true`. Deleting a collection removes its sources at once and cannot be undone.\n\n### Following an agent\n\nA session is one run of an agent with one contact on one conversation.\n`GET /v1/agent-sessions` filters by `agentId`, `conversationId`,\n`contactUuid`, `status` and `needsAttention`, paged with `page` and `take`\n(default 20, max 100). The list reaches the first 10,000 sessions that match: a\npage past them answers `PAGE_OUT_OF_RANGE`, so narrow the list with a filter\ninstead of paging further. `status` is live (`active`, `paused_by_user`,\n`paused_no_credits`) or ended (`completed`, `escalated`, `max_turns`,\n`expired`, `superseded`). `needsAttention` marks a session waiting on a\nperson. `qualification` carries `result` (`pending`, `qualified`, `review`)\nand each question with its answer. Read the texts with\n`GET /v1/conversations/{id}/messages` using `conversationId`.\n\nTo be told instead of polling, subscribe a webhook (`POST /v1/webhooks`) to:\n\n| Event | Fired when |\n|---|---|\n| `agent.session_started` | an agent starts a conversation with a contact |\n| `agent.lead_qualified` | the contact's answers meet the qualifying rules |\n| `agent.escalated` | the agent hands the conversation to a person |\n| `agent.session_ended` | the session ends for any reason |\n\nThe four events share one `data` shape: `sessionId`, `agentId`, `agentName`,\n`conversationId`, `turnNumber`, `status`, `contact` (`uuid`, `firstName`,\n`lastName`, `phone`), `reasonCode`, `reason`, `outcome` and `qualification`.\nAn escalation delivers `agent.escalated` and `agent.session_ended` for the same\n`sessionId`. `sessionId` + `event` + `turnNumber` is stable across retries of\none delivery. `sessionId` is the `id` of `GET /v1/agent-sessions/{id}`.\n\n`reasonCode` says why a session was escalated or ended, and is `null` while it\nruns:\n\n| `reasonCode` | Meaning |\n|---|---|\n| `agent_escalated` | The agent decided the conversation needs a person. |\n| `review_needed` | The agent finished and left the conversation for you to review. |\n| `no_availability` | The lead qualified, but there was no open time to offer. |\n| `follow_ups_exhausted` | The contact did not answer any of the follow-up messages. |\n| `rate_limited` | The agent could not reply because a sending limit was reached. |\n| `max_turns` | The agent reached its turn limit for one conversation. |\n| `opted_out` | The contact opted out or replied negatively. |\n| `idle` | The contact did not reply within the time the agent waits. |\n| `superseded` | A workflow, a campaign or another agent took over the conversation. |\n| `completed` | The session ended with an outcome. |\n\nA webhook can carry a more specific code than the session read: `no_availability`,\n`follow_ups_exhausted` and `rate_limited` are known only when the event is sent,\nand the session then reads `agent_escalated`.\n\nAn appointment an agent books fires `appointment.booked` with `source: \"agent\"`\nand the same `agentId` and `sessionId`, so a booking links to the session and\nthe qualification answers behind it. Both are `null` on appointments booked any\nother way.\n\n### Taking over a conversation\n\n`POST /v1/conversations/{id}/agent/pause` stops every agent on one conversation\nso a person can take it over: no agent answers there, and the replies it had\nqueued and its pending follow-ups are cancelled. The session keeps its status and\nnothing is sent. `POST /v1/conversations/{id}/agent/resume` lifts the stop and\nsends nothing by itself; the agent answers the contact's next text. A session\nthat has ended is not restarted. `GET /v1/conversations/{id}/agent` returns\n`agentPaused`, `agentStatus`, `needsAttention`, `sessionId` and\n`agentId`. A teammate who texts the contact from the app pauses the\nconversation as well.\n\n`POST /v1/agent-sessions/{id}/acknowledge` records that a person has dealt with\na session that needs attention: `needsAttention` becomes `false` and nothing\nelse changes. `PATCH /v1/agent-settings` with `agentsPaused: true` is the\naccount-wide stop.\n\n### Starting a session\n\nAn agent normally starts on its own, when a contact texts or replies on one of\nits channels. `POST /v1/agents/{id}/sessions` hands one existing conversation\nto a published agent, named by `conversationId` or by `contactUuid` (one of\nthe two).\n\n```\nPOST /api/v1/agents/17/sessions\n{ \"conversationId\": 10293 }\n→ 200 { \"session\": { \"id\": 9043, \"agentId\": 17, \"conversationId\": 10293, \"status\": \"active\", … }, \"created\": true }\n```\n\nThe agent does not text first: it answers the contact's next reply, or at once\nwhen the newest message of the conversation is a text from the contact that\nnobody answered, so the call can send an SMS. The contact is taken out of the\nworkflows that would keep texting them, and a pause on the conversation is\nlifted. `phoneNumberId` picks the number the agent texts from; left out, it is\nthe number the conversation last used, else the agent's first number. Starting\nthe same agent again where it already holds the conversation returns that\nsession with `created: false`. Another agent holding it answers\n`THREAD_BUSY` unless `replace` is `true`. A contact with no conversation yet\nanswers `CONVERSATION_REQUIRED`: no conversation is created.\n\n### Limits on the heavier calls\n\nOn top of the two windows every request counts in (see **Rate limits**), a few\ncalls have their own limit per account, counted over one minute. Past it the\ncall answers `429` with the same body and `Retry-After` as any other limit;\nthe other calls are not affected.\n\n| Limit | Calls |\n|---|---|\n| 10 a minute | publish an agent, set its channels, start a session |\n| 20 a minute | add or update a knowledge source |\n| 60 a minute | setup options, a preview, the sessions list |\n\n`GET /v1/agents` is paged with `page` and `take` (default 50, max 100);\n`totalCount` counts every agent that matches. `GET /v1/agents/{id}/versions`\nreturns the newest `take` versions (default 50, max 100).\n\n### Refusals carry a code\n\nA refused request answers `{ \"statusCode\", \"message\", \"error\": \"<CODE>\", …details }`.\nThe message is for a person and may be reworded; `error` is stable, branch on it.\nA malformed body answers `400` with `message` as a list of problems and\n`error: \"Bad Request\"`; a missing or invalid key `401`; a key without the scope,\nor an account where AI agents are not available, `403`.\n\n| Code | Status | When | Details |\n|------|--------|------|---------|\n| `AGENT_NOT_FOUND` | 404 | no agent with this `id` on the account the key acts in |  |\n| `AGENT_SESSION_NOT_FOUND` | 404 | no session with this `id` on the account, or the session is a test conversation |  |\n| `AGENT_ID_INVALID` | 400 | the agent `id` in the path is not an integer |  |\n| `AGENT_SESSION_ID_INVALID` | 400 | the session `id` in the path is not an integer (a `contactUuid` or a conversation id was sent) |  |\n| `VERSION_ID_INVALID` | 400 | `versionId` in the path is not an integer |  |\n| `VERSION_NOT_FOUND` | 404 | restore: the agent has no version with that id |  |\n| `CONFIG_INVALID` | 400 | a field is out of range or not valid for this agent, `null` was sent for a field that cannot be cleared, or a setting of the draft is not valid at publish | `issues[]` with `path`, `message` |\n| `MANAGED_BY_TEMPLATE` | 400 | a setting the agent’s template fixes was changed | `fields[]` |\n| `TEMPLATE_NOT_AVAILABLE` | 403 | create from, or duplicate an agent of, a template agents cannot be created from |  |\n| `AGENT_NOT_READY` | 409 | publish while something is missing (no channel, a calendar that is not connected, blank instructions); nothing is published | `gaps[]` with `key`, `label`, `fixWith` (`tool` and `field`, or `inApp`), `appUrl` |\n| `AGENT_ARCHIVED` | 409 | edit, publish, restore or set channels on an archived agent |  |\n| `AGENT_LIMIT_REACHED` | 409 | create or duplicate while the account holds as many agents as it may; archive one first | `limit` |\n| `DRAFT_CONFLICT` | 409 | the draft is no longer the one named by `expectedDraftId`, or it was published meanwhile; read the agent again |  |\n| `ROLLOUT_CONFLICT` | 409 | publish with `applyToLiveSessions` while an earlier publish is still moving live conversations; nothing is published, publish again |  |\n| `INVALID_BINDINGS` | 400 | publish: the draft names a knowledge collection the agent cannot use | `knowledgeCollectionIds[]` |\n| `CHANNEL_CONFLICT` | 409 | another agent holds a requested number, workflow or campaign and `takeOver` is not `true`; nothing is changed | `conflicts[]` with `kind`, `id`, `heldByAgentId`, `heldByAgentName` |\n| `CHANNEL_TARGET_NOT_FOUND` | 404 | a number, workflow or campaign id is not on the account | `missing` with `phoneNumberIds`, `workflowIds`, `campaignIds` |\n| `CAMPAIGN_NOT_SMS` | 400 | a campaign id is not an SMS campaign | `missing.campaignIds` |\n| `DEFAULT_AGENT_NOT_LIVE` | 400 | the default agent named is not published and active on this account |  |\n| `DEFAULT_AGENT_REQUIRED` | 400 | `defaultEnabled: true` while no default agent is set |  |\n| `TEST_SESSION_ID_INVALID` | 400 | `sessionId` in the path is not an integer |  |\n| `TEST_SESSION_NOT_FOUND` | 404 | the agent has no test conversation with that `sessionId` |  |\n| `TEST_SESSION_CLOSED` | 409 | a message sent to a test conversation that has ended; reset it |  |\n| `TEST_TURN_FAILED` | 502 / 504 | the test turn could not be completed (`502`) or took too long (`504`); it was not recorded, send the message again |  |\n| `INSUFFICIENT_CREDITS` | 402 | the account has too few credits for a test turn; the agent was not run |  |\n| `CONTACT_NOT_FOUND` | 404 | no contact with this `contactUuid` on the account |  |\n| `KNOWLEDGE_COLLECTION_ID_INVALID` | 400 | `collectionId` in the path is not an integer |  |\n| `KNOWLEDGE_SOURCE_ID_INVALID` | 400 | `sourceId` in the path is not an integer |  |\n| `KNOWLEDGE_COLLECTION_NOT_FOUND` | 404 | no collection with that id belongs to this agent |  |\n| `KNOWLEDGE_SOURCE_NOT_FOUND` | 404 | no source with that id is in the collection |  |\n| `KNOWLEDGE_SOURCE_TYPE_MISMATCH` | 400 | update: `type` is not the type the source has, or the source is a file |  |\n| `CONVERSATION_NOT_FOUND` | 404 | no conversation with this id on the account |  |\n| `CONVERSATION_REQUIRED` | 409 | start a session by `contactUuid` for a contact with no conversation yet; a conversation starts with a message |  |\n| `AGENT_NOT_ACTIVE` | 409 | start a session on an agent that was never published or is archived |  |\n| `AGENT_NOT_PUBLISHED` | 409 | start a session, or a test with `useDraft: false`, on an agent with no published version |  |\n| `PHONE_NUMBER_UNRESOLVED` | 400 | start a session: no number of the account could be chosen to text from; send `phoneNumberId` |  |\n| `THREAD_BUSY` | 409 | start a session on a conversation another agent holds, without `replace: true`; nothing is changed | `liveSessionId` |\n| `AGENTS_PAUSED` | 409 | start a session while `agentsPaused` is on |  |\n| `CONTACT_OPTED_OUT` | 409 | start a session for a contact who opted out of texts |  |\n| `PAGE_OUT_OF_RANGE` | 400 | list sessions: the page starts past the first 10,000 sessions that match; narrow the list with `agentId`, `status`, `conversationId` or `contactUuid` |  |\n"},{"name":"Compliance","description":"Check that a first message names the brand and gives opt-out wording before a workflow or campaign is published or started"},{"name":"10DLC Brands","description":"Register and manage 10DLC brands"},{"name":"10DLC Campaigns","description":"Create and manage 10DLC campaigns (poll-only review)"},{"name":"10DLC Generations","description":"Auto-generated 10DLC brand + campaign flow"},{"name":"10DLC Reference","description":"10DLC enums, display-name checks, and provider status"},{"name":"Billing","description":"Read account/billing status and billing-gated capabilities"},{"name":"Credits","description":"Read your credit balance and transfer history"},{"name":"Accounts","description":"List the accounts your organization owns, through a key minted on one of them"},{"name":"Organization","description":"\nRun your organization from your own system: create accounts and hand each one its\nAPI key in the same call, cap spend with policies, grant your members access to\naccounts, and read the shared credit balance.\n\n### These endpoints take a different key\n\nEvery other section of this API is called with an **account API key** (`sk_…`),\nwhich acts inside one account. The endpoints under `/v1/organisation` take an\n**organization API key** (`osk_…`) instead, which acts for the\norganization as a whole. The two are not interchangeable:\n\n- An account key sent to `/v1/organisation/*` is answered with **401**.\n- An organization key sent to any account endpoint (contacts, messages, …) is\n  answered with **401**. To act inside an account, use that account's own key.\n\nBoth go in the same header: `x-api-key: osk_…`.\n\n### Getting an organization key\n\nAn organization **owner** mints it in the dashboard under\n**Organization → Settings → API keys**, choosing its permissions. The secret is\nshown once, at creation and on regenerate; only a hash is stored, so a lost secret\nmeans regenerating the key. An organization can hold up to\n10 keys.\n\n### Permissions\n\n| Scope | Grants |\n|-------|--------|\n| `organisation:read` | View the organization profile |\n| `organisation:accounts:read` | List the accounts the organization owns and who has access to them |\n| `organisation:accounts:write` | Create, rename and close accounts, and grant or revoke member access to them |\n| `organisation:api-keys:write` | Create, regenerate and revoke API keys on the accounts the organization owns |\n| `organisation:spending-policies:read` | View spending policies and which accounts hold them |\n| `organisation:spending-policies:write` | Create, edit and delete spending policies and attach them to accounts |\n| `organisation:credits:read` | View the credit pool balance, credit packs, deposits and per-account usage |\n| `organisation:credits:write` | Buy credit packs into the pool and change its auto-recharge, charged to the organization's card Not included in full access. |\n| `organisation:billing:read` | View the organization's card on file, subscription, seats and invoices |\n| `organisation:billing:write` | Issue a link to add or replace the organization's card Not included in full access. |\n| `organisation:sharing:read` | View the workflows and message templates shared with the organization, and who copied them |\n| `organisation:sharing:write` | Share an account's workflows and message templates with the organization, copy them into its accounts, and withdraw shares |\n| `organisation:full-access` | Every organization permission, including ones added later, except spending money |\n\nA key holding `organisation:full-access` passes every check, including ones\nadded later, except the scopes marked \"Not included in full access.\" above: those spend the\norganization's money and must be named on the key. A call that needs one of them from a\nkey holding only full access is refused with **403** and\n`errorCode: scope_must_be_explicit`.\n\n### Creating an account\n\n`POST /v1/organisation/accounts` takes a `name` (required) and, optionally,\n`userIds` (members to grant access), `spendingPolicyId`, `sandbox` (not available in\nproduction) and `apiKey`. People are not invited through the API: `invites` is not\naccepted here, and membership is managed in the dashboard. Names are unique among the\norganization's open accounts, ignoring case; a name already in use is refused with\n**409 `ACCOUNT_NAME_TAKEN`** before anything is billed, and\nclosing an account frees its name.\n\nEvery open account takes a seat on the organization's subscription. When no seat is\nfree, the request must send `\"purchaseSeat\": true` to agree to the charge; without\nit the create is refused with **409 `SEAT_NOT_AGREED`** and nothing\nis billed. When a seat is already free, `purchaseSeat` is ignored and nothing extra is\ncharged. What a seat costs is shown in the dashboard under\n**Organization → Billing**.\n\n### Creating an account that can call the API right away\n\n`POST /v1/organisation/accounts` accepts an optional `apiKey` object\n(`{ \"alias\": \"...\", \"scopes\": [...] }`). When present, the new account's first API key\nis minted in the same request and its secret is returned **in that response only**.\nLater keys for that account are managed under `/v1/organisation/accounts/{id}/api-keys`\n(list, create, regenerate, revoke); none of those routes ever returns an existing secret.\n\n### Account status\n\nThe `status` of an account in these responses describes whether it can run, and is\nderived from the organization rather than from the account itself:\n\n- `active` — the organization's subscription is running.\n- `no_subscription` — the organization has no running subscription; its accounts\n  cannot send until it does.\n- `suspended` — an administrator has suspended the organization; every account\n  it owns is paused (`pausedReasons` includes `organisation_suspended`).\n\n`paused` and `pausedReasons` are the account's own holds and can be set in any status.\n\n### Refusals carry a code\n\nA refused request answers `{ \"message\": \"...\", \"code\": \"...\" }`. The message is for a\nperson and may be reworded; the `code` is stable — branch on it.\n\n| Code | Status | Meaning |\n|------|--------|---------|\n| `SEAT_NOT_AGREED` | 409 | No seat was free and `purchaseSeat` was not `true`. Nothing was billed. |\n| `ACCOUNT_LIMIT_REACHED` | 409 | The organization already owns as many open accounts as it may. |\n| `ACCOUNT_NAME_TAKEN` | 409 | An open account of the organization already has that name, ignoring case. On a create nothing was billed; on a rename nothing was changed. |\n| `ACCOUNT_CREATION_NOT_GRANTED` | 403 | The organization has not been granted account creation. |\n| `SANDBOX_NOT_ENABLED` | 403 | `sandbox: true` in an environment that does not mint sandbox accounts (production never does). |\n| `ASSIGNEE_NOT_A_MEMBER` | 400 | A `userIds` entry is not a member of the organization. Nothing was created or granted. |\n| `ASSIGNEE_NOT_FOUND` | 400 | A `userIds` entry is nobody: no person has that id. Nothing was granted. |\n| `SPENDING_POLICY_NOT_IN_ORGANISATION` | 400 | The spending policy belongs to another organization. |\n| `MEMBER_AWAITING_ACCOUNT` | 409 | The member's own account has not arrived yet, so they cannot be granted access. |\n| `MEMBER_SEATS_FULL` | 409 | No member seat is free for the person. |\n| `ACCOUNT_NOT_FOUND` | 404 | No open account with that id is owned by the organization. |\n| `SPENDING_POLICY_NOT_FOUND` | 404 | No such spending policy in the organization. |\n| `ORGANISATION_NOT_FOUND` | 404 | The organization no longer exists. |\n| `ACCOUNT_NOT_IN_ORGANISATION` | 403 | The `accountId` of a share or copy is not an open account the organization owns. An account key on a personal account gets it from the organization library too. |\n| `WORKFLOW_ALREADY_SHARED` | 409 | The workflow is already in the organization library. Nothing was changed. |\n| `WORKFLOW_SHARE_NOT_FOUND` | 404 | No workflow share with that id in the organization. |\n| `TEMPLATE_ALREADY_SHARED` | 409 | The message template is already in the organization library. Nothing was changed. |\n| `TEMPLATE_SHARE_NOT_FOUND` | 404 | No message template share with that id in the organization. |\n| `PRODUCT_NOT_FOUND` | 404 | No credit pack with that `productId` or `priceId` is on sale; list them with `GET /v1/organisation/credits/products`. |\n| `PURCHASE_NOT_FOUND` | 404 | No purchase with that id belongs to the organization. |\n| `NO_ORGANISATION_CARD` | 409 | The organization has no card on file. `POST /v1/organisation/billing/card/setup-link` issues a link a person adds one through. Nothing was charged. |\n| `AUTHENTICATION_REQUIRED` | 402 | The bank wants the cardholder to confirm the charge. The body carries the purchase with a `completeUrl` a person finishes it at; poll the purchase until it is `succeeded`. |\n| `CARD_DECLINED` | 402 | The card refused the charge; `declineCode` says why. Nothing was credited. |\n| `IDEMPOTENCY_KEY_REUSED` | 422 | That `Idempotency-Key` was already used for a different purchase. Keys are honoured for 24 hours; use a new one. |\n\nA missing or invalid key (401), a key without the needed scope (403) and a malformed\nbody (400) are answered the same way as on the rest of the API, without a code.\n\n### Money on the organization key\n\nCredit packs and their prices, buying a pack into the pool, the pool's auto-recharge\nsettings, the card on file, subscription and seats, a link to add or replace the card,\nand reads of credit movements and per-account spending are all on this key, under the\n`organisation:credits:read`, `organisation:credits:write`,\n`organisation:billing:read` and `organisation:billing:write` scopes.\n\n### The shared library\n\nWorkflows and message templates of the organization's accounts can be shared with the\nwhole organization and copied into any of its accounts, under `/v1/organisation/sharing/workflows`\nand `/v1/organisation/sharing/templates` (scopes `organisation:sharing:read` and\n`organisation:sharing:write`). A share or copy names the account it acts in with\n`accountId`, which must be an account the organization owns. One share per item; a copy is\nidempotent per account and answers the existing copy with `alreadyExisted: true`. Withdrawing a\nshare keeps every copy already made. What an API key shares or copies is attributed to the key by\nname (`sharedByApiKey`, `copiedByApiKey`) instead of a person.\n\nThe same library is open to each account's own key under `/v1/organisation-library/workflows`\nand `/v1/organisation-library/templates` (scopes `workflows:*` and `templates:*`): it shares\nthat account's items, copies into that account only, and withdraws only that account's shares.\n\n### What stays in the dashboard\n\nInviting people and changing their organization role. The API grants and revokes an\nexisting member's access to an account, but membership itself is managed in the\ndashboard.\n\n### Credits\n\n`GET /v1/organisation/credits` is served from a short-lived cache and carries an\n`asOf` timestamp; poll it no more than once every few seconds. It has its own\nrate-limit bucket (`credits`) on top of the shared ones.\n"},{"name":"Async Operations","description":"Poll the status of long-running jobs (imports, exports, bulk sends)"},{"name":"Manage Webhooks","description":"Create, update, and inspect webhook subscriptions and their delivery history. See the \"Webhooks\" section below for the outbound event payloads we send to your endpoints."},{"name":"OAuth Integrations","description":"\nLet your product connect to a user's PitchPrfct account and act on their behalf\nthrough this Developer API — without the user ever pasting an API key into your\napp. This is a standard **OAuth 2.0 Authorization Code** flow with PitchPrfct as\nthe authorization server.\n\n### 1. Get your credentials\n\nRegister your integration on the Developers page (OAuth Apps tab, \"Create OAuth app\") —\nor, if your account cannot create apps yet, a PitchPrfct admin registers it for you. Either\nway you get:\n\n- **`client_id`** and **`client_secret`** — identify and authenticate your backend.\n- A **redirect URI** — where users are sent back after they approve. Must match exactly.\n- A **webhook signing secret** — used to verify the webhooks we forward to you.\n- The **permissions** your integration is allowed (e.g. read contacts, send messages).\n\n### 2. Send the user to the consent screen\n\nRedirect the user's browser to the consent URL (the host is provided at registration):\n\n```\nhttps://<app-host>/app/oauth/consent\n  ?client_id=YOUR_CLIENT_ID\n  &redirect_uri=YOUR_REGISTERED_REDIRECT_URI\n  &state=OPAQUE_VALUE\n```\n\n- **`state`** is an opaque value you choose; we return it unchanged so you can\n  match the callback to the user/session and protect against CSRF.\n- Scopes are **not** passed here — the consent grants the permissions your\n  integration was configured with. The screen shows the user exactly what it covers.\n\nThe user logs in (if needed) and approves.\n\n### 3. Receive the authorization code\n\nWe redirect the browser back to your `redirect_uri`:\n\n```\nYOUR_REGISTERED_REDIRECT_URI?code=AUTHORIZATION_CODE&state=OPAQUE_VALUE\n```\n\nThe **`code`** is single-use and expires in **3 minutes**. If the user denies, we\nredirect with `?error=access_denied&state=...` instead.\n\n### 4. Exchange the code for a token pair (server-to-server)\n\nFrom your backend, exchange the code using your client credentials — see\n**`POST /api/oauth/token`** below. The response includes a short-lived\n**`access_token`** (expires in **1 hour**, see `expires_in` / `expires_at`), a\nlong-lived **`refresh_token`**, and the scopes granted. Store the refresh token\nsecurely — it is shown only here and on each refresh.\n\n### 5. Call the API\n\nSend the access token on any Developer API request, either header works:\n\n```\nAuthorization: Bearer pit_XXXXXXXX.YYYYYYYY\n```\n\nor\n\n```\nx-api-key: pit_XXXXXXXX.YYYYYYYY\n```\n\nThe token can only reach the Developer API, limited to the scopes the user\ngranted — it cannot access the user-facing app.\n\n### 6. Refresh the access token\n\nWhen the access token nears expiry, exchange your **`refresh_token`** for a new\npair at the same **`POST /api/oauth/token`** endpoint with\n`grant_type=refresh_token` and your client credentials. **Refresh tokens rotate:**\neach refresh returns a *new* refresh token and invalidates the old pair, so always\npersist the latest one. A refresh token stays valid until the user disconnects.\n\n```\ngrant_type=refresh_token\n&refresh_token=pitr_XXXXXXXX.YYYYYYYY\n&client_id=YOUR_CLIENT_ID\n&client_secret=YOUR_CLIENT_SECRET\n```\n\n### 7. Receive webhooks\n\nIf your integration has a webhooks URL configured, the user's events (within the\ngranted scopes) are forwarded to it, signed with your **webhook signing secret**\nusing the same HMAC scheme described in the **Webhooks** section. One signing\nsecret verifies every user's events for your integration; the `userId` in each\npayload tells you which connected user it is about.\n\n### Disconnecting\n\nUsers can disconnect your integration at any time from their Integrations page,\nand an admin can revoke any connection. Revocation immediately invalidates the\naccess and refresh tokens and stops webhook forwarding for that user — subsequent\nrefresh attempts return `invalid_grant`.\n"},{"name":"MCP Server","description":"\nPitchPrfct runs a remote **Model Context Protocol (MCP)** server that exposes this\nsame Developer API as tools an AI agent can call. Connect Claude Code, Codex CLI,\nCursor, Gemini CLI or Claude Desktop, and the agent can look up contacts, send\nmessages, enroll contacts in campaigns, build and change workflows and more — in\nplain language, without you writing any glue code.\n\n### What it is\n\n- **Remote and hosted.** Nothing to install or run besides your agent: the server\n  lives at PitchPrfct and speaks MCP's **Streamable HTTP** transport (`POST` only,\n  stateless — there is no session to keep alive).\n- **One tool per API operation.** Every endpoint in this reference is a tool with\n  the same parameters and the same response.\n- **Same rules as the API key.** Tool calls run with the key's scopes, count\n  against the same rate limits, and see exactly the account the key belongs to.\n- **Labelled by effect.** Every tool says whether it is read-only, writes data\n  or is destructive (may change or remove data, or reaches people outside\n  PitchPrfct, such as sending SMS), so your agent can ask before acting.\n\n**When to use it:** reach for MCP when an agent or coding assistant should work\nwith your PitchPrfct data interactively. For your own backend, scheduled syncs or\nproduction integrations, call the REST endpoints directly.\n\n### Endpoint & authentication\n\n```\nhttps://app.pitchprfct.com/api/mcp\n```\n\n- Send an API key in the **`x-api-key`** header. Create one on the\n  **Developers** page (API Keys tab); it is shown once, so store it somewhere safe.\n- `Authorization: Bearer <token>` with an OAuth access token from an\n  **OAuth Integrations** connection is accepted too.\n- An **organization API key** (`osk_…`, see **Organization**) works in the\n  same header. It sees the organization tools only (`/v1/organisation/*`), and an account\n  key never sees those.\n- \"Sign in with PitchPrfct\" for connector UIs (Claude.ai, ChatGPT), where the agent\n  discovers OAuth on its own instead of taking a key, is **coming soon**.\n\n### Quick start\n\nReplace `YOUR_API_KEY` with your API key in the block for your agent. Cursor\nalso offers a one-click install from the in-app **Developers → MCP** tab right\nafter you create a key.\n\n#### Claude Code\n\nRun in your terminal:\n\n```bash\nclaude mcp add --transport http pitchprfct https://app.pitchprfct.com/api/mcp --header \"x-api-key: YOUR_API_KEY\"\n```\n\n#### Codex CLI\n\nAdd to `~/.codex/config.toml`:\n\n```toml\n[mcp_servers.pitchprfct]\nurl = \"https://app.pitchprfct.com/api/mcp\"\nhttp_headers = { \"x-api-key\" = \"YOUR_API_KEY\" }\n```\n\n#### Cursor\n\nAdd to `~/.cursor/mcp.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"pitchprfct\": {\n      \"url\": \"https://app.pitchprfct.com/api/mcp\",\n      \"headers\": {\n        \"x-api-key\": \"YOUR_API_KEY\"\n      }\n    }\n  }\n}\n```\n\n#### Gemini CLI\n\nAdd to `~/.gemini/settings.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"pitchprfct\": {\n      \"httpUrl\": \"https://app.pitchprfct.com/api/mcp\",\n      \"headers\": {\n        \"x-api-key\": \"YOUR_API_KEY\"\n      }\n    }\n  }\n}\n```\n\n#### Claude Desktop\n\nAdd to `~/Library/Application Support/Claude/claude_desktop_config.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"pitchprfct\": {\n      \"command\": \"npx\",\n      \"args\": [\n        \"-y\",\n        \"mcp-remote\",\n        \"https://app.pitchprfct.com/api/mcp\",\n        \"--header\",\n        \"x-api-key:${PITCHPRFCT_API_KEY}\"\n      ],\n      \"env\": {\n        \"PITCHPRFCT_API_KEY\": \"YOUR_API_KEY\"\n      }\n    }\n  }\n}\n```\n\n- On Windows the file is %APPDATA%\\Claude\\claude_desktop_config.json.\n- Requires Node.js 18 or later (the bridge runs through npx). Restart Claude Desktop after saving.\n\n### Verify\n\nRestart your agent, then ask it to **\"list your PitchPrfct tools\"** — it should\nname tools such as the ones below. In Claude Code, `/mcp` shows the\n`pitchprfct` server as connected along with its tool count.\n\nTo check the endpoint and your key without an agent:\n\n```bash\ncurl -s -X POST https://app.pitchprfct.com/api/mcp \\\n  -H 'x-api-key: YOUR_API_KEY' \\\n  -H 'content-type: application/json' \\\n  -H 'accept: application/json, text/event-stream' \\\n  -d '{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"tools/list\"}'\n```\n\n### Example: an agent builds a workflow\n\nAsk the agent to \"create a workflow that texts new leads tagged *Webinar* and\nwaits a day before a follow-up\". It calls `workflows_create` with the trigger, the\nsteps and the sending number, reads the result back with `workflows_get` (every\nstep comes back with its permanent `nodeId`), changes one step with\n`workflows_update_step` or the whole chain with `workflows_update`, publishes with\n`workflows_update` `{ \"status\": \"active\" }`, and pauses or resumes with\n`workflows_pause` / `workflows_resume`. Pause and resume finish in the background:\nthe agent polls `workflows_get` until `lifecycleState` leaves `pausing` or\n`resuming`. A refused call comes back as an error result whose text carries the\nsame machine code the REST endpoint answers (`STEP_NOT_FOUND`, `TAG_NOT_OWNED`, …),\nand a tool's description ends with the codes it can answer when its reference\nnames them.\n\n### Tool reference\n\nEach tool maps to one endpoint in this reference; open the endpoint for its full\nparameters and response. A tool takes **one flat object** of arguments: the\nendpoint's path, query and body fields side by side (`contacts_list` takes\n`{ \"take\": \"5\" }`). **Kind** is the effect the tool declares to your agent:\n**Read-only** changes nothing, **Writes** creates or updates data, and\n**Destructive** may change or remove existing data or reach people outside\nPitchPrfct (sending SMS, for example).\n\nDeprecated endpoints are not listed: use the replacement (`workflows_resume`,\nnot `workflows_activate`). A tool whose request body has worked examples\ncarries them in its input schema, and a tool that answers a JSON object declares\nthat shape as its output schema.\n\n<details>\n<summary>All 225 tools</summary>\n\n**Contacts**\n\n| Tool | Kind | Endpoint | Description |\n|------|------|----------|-------------|\n| `contacts_list` | Read-only | `GET /api/v1/contacts` | List contacts |\n| `contacts_create` | Destructive | `POST /api/v1/contacts` | Create contact |\n| `contacts_batch_get` | Read-only | `POST /api/v1/contacts/batch` | Batch get contacts |\n| `contacts_list_deleted` | Read-only | `GET /api/v1/contacts/deleted` | List deleted contacts |\n| `contacts_restore` | Writes | `POST /api/v1/contacts/restore` | Restore deleted contacts |\n| `contacts_get` | Read-only | `GET /api/v1/contacts/{uuid}` | Get contact |\n| `contacts_update` | Destructive | `PATCH /api/v1/contacts/{uuid}` | Update contact |\n| `contacts_delete` | Destructive | `DELETE /api/v1/contacts/{uuid}` | Delete contact |\n| `contacts_list_messages` | Read-only | `GET /api/v1/contacts/{uuid}/messages` | List contact messages |\n| `contacts_bulk_create` | Destructive | `POST /api/v1/contacts/bulk` | Bulk create/update contacts |\n| `contacts_export_contacts` | Read-only | `POST /api/v1/contacts/export` | Start a contacts CSV export |\n| `contacts_get_job_status` | Read-only | `GET /api/v1/contacts/jobs/{id}` | Get job status |\n| `contact_metadata_get` | Read-only | `GET /api/v1/contacts/{uuid}/metadata` | Get contact metadata |\n| `contact_metadata_set` | Destructive | `PUT /api/v1/contacts/{uuid}/metadata` | Set contact metadata |\n| `contact_metadata_remove` | Destructive | `DELETE /api/v1/contacts/{uuid}/metadata` | Delete contact metadata |\n\n**Contact Lists**\n\n| Tool | Kind | Endpoint | Description |\n|------|------|----------|-------------|\n| `contact_lists_list` | Read-only | `GET /api/v1/contact-lists` | List contact lists |\n| `contact_lists_create` | Writes | `POST /api/v1/contact-lists` | Create contact list |\n| `contact_lists_get_by_id` | Read-only | `GET /api/v1/contact-lists/{id}` | Get contact list |\n| `contact_lists_update` | Destructive | `PATCH /api/v1/contact-lists/{id}` | Update contact list |\n| `contact_lists_delete` | Destructive | `DELETE /api/v1/contact-lists/{id}` | Delete contact list |\n| `contact_lists_add_contacts` | Writes | `POST /api/v1/contact-lists/{id}/contacts` | Add contacts to list |\n| `contact_lists_remove_contacts` | Destructive | `DELETE /api/v1/contact-lists/{id}/contacts` | Remove contacts from list |\n\n**Contact Tags**\n\n| Tool | Kind | Endpoint | Description |\n|------|------|----------|-------------|\n| `tags_list` | Read-only | `GET /api/v1/tags` | List tags |\n| `tags_create` | Writes | `POST /api/v1/tags` | Create tag |\n| `tags_update` | Destructive | `PATCH /api/v1/tags/{id}` | Update tag |\n| `tags_delete` | Destructive | `DELETE /api/v1/tags/{id}` | Delete tag |\n| `contact_tags_bulk_add_tags` | Writes | `POST /api/v1/contacts/tags/bulk` | Add tags to many contacts |\n| `contact_tags_bulk_remove_tags` | Destructive | `POST /api/v1/contacts/tags/bulk-remove` | Remove tags from many contacts |\n| `contact_tags_add_tags` | Writes | `POST /api/v1/contacts/{uuid}/tags` | Add tags to contact |\n| `contact_tags_remove_tag` | Destructive | `DELETE /api/v1/contacts/{uuid}/tags/{tagId}` | Remove tag from contact |\n\n**Contact Custom Fields**\n\n| Tool | Kind | Endpoint | Description |\n|------|------|----------|-------------|\n| `contact_custom_fields_list` | Read-only | `GET /api/v1/custom-fields` | List custom fields |\n| `contact_custom_fields_create` | Writes | `POST /api/v1/custom-fields` | Create custom field |\n| `contact_custom_fields_delete` | Destructive | `DELETE /api/v1/custom-fields/{id}` | Delete custom field |\n\n**Contact Opt-Outs**\n\n| Tool | Kind | Endpoint | Description |\n|------|------|----------|-------------|\n| `contact_opt_outs_list` | Read-only | `GET /api/v1/opt-outs` | List opted-out contacts |\n| `contact_opt_out_actions_opt_out` | Destructive | `POST /api/v1/contacts/{uuid}/opt-out` | Opt out contact |\n| `contact_opt_out_actions_opt_in` | Destructive | `POST /api/v1/contacts/{uuid}/opt-in` | Opt in contact |\n\n**Scrubs**\n\n| Tool | Kind | Endpoint | Description |\n|------|------|----------|-------------|\n| `scrubs_list_eligible_workflows` | Read-only | `GET /api/v1/scrubs/eligible-workflows` | List workflows a scrub can target |\n| `scrubs_list_eligible_campaigns` | Read-only | `GET /api/v1/scrubs/eligible-campaigns` | List campaigns a scrub can target |\n| `scrubs_preview` | Read-only | `POST /api/v1/scrubs/preview` | Preview a scrub's cost |\n| `scrubs_list` | Read-only | `GET /api/v1/scrubs` | List scrubs |\n| `scrubs_start` | Destructive | `POST /api/v1/scrubs` | Start a phone scrub (uses verification credits, can delete contacts) |\n| `scrubs_get` | Read-only | `GET /api/v1/scrubs/{scrubId}` | Get a scrub |\n| `scrubs_get_summary` | Read-only | `GET /api/v1/scrubs/{scrubId}/summary` | Get a scrub's results summary |\n| `scrubs_stop` | Writes | `POST /api/v1/scrubs/{scrubId}/stop` | Stop a scrub |\n| `scrubs_retry` | Destructive | `POST /api/v1/scrubs/{scrubId}/retry` | Retry failed numbers of a scrub (uses verification credits) |\n| `scrubs_list_results` | Read-only | `GET /api/v1/scrubs/{scrubId}/results` | List a scrub's contacts and results |\n| `scrubs_get_results_file` | Read-only | `GET /api/v1/scrubs/{scrubId}/results-file` | Get a scrub's results file |\n| `scrubs_request_results_file` | Read-only | `POST /api/v1/scrubs/{scrubId}/results-file` | Start a scrub results file |\n| `scrubs_remove_results` | Destructive | `POST /api/v1/scrubs/{scrubId}/remove` | Delete the contacts of scrub result categories |\n\n**Messages**\n\n| Tool | Kind | Endpoint | Description |\n|------|------|----------|-------------|\n| `messages_list` | Read-only | `GET /api/v1/messages` | List messages |\n| `messages_get` | Read-only | `GET /api/v1/messages/{id}` | Get message |\n| `messages_v2_send` | Destructive | `POST /api/v2/messages` | Send an SMS (uses credits) |\n| `messages_v2_get_by_key` | Read-only | `GET /api/v2/messages/by-key/{key}` | Get a sent message by idempotency key |\n| `messages_v2_get` | Read-only | `GET /api/v2/messages/{id}` | Get a sent message |\n\n**Templates**\n\n| Tool | Kind | Endpoint | Description |\n|------|------|----------|-------------|\n| `templates_list` | Read-only | `GET /api/v1/templates` | List SMS templates |\n| `templates_create` | Writes | `POST /api/v1/templates` | Create SMS template |\n| `templates_get` | Read-only | `GET /api/v1/templates/{id}` | Get SMS template |\n| `templates_update` | Destructive | `PATCH /api/v1/templates/{id}` | Update SMS template |\n| `templates_delete` | Destructive | `DELETE /api/v1/templates/{id}` | Delete SMS template |\n| `template_organisation_library_list` | Read-only | `GET /api/v1/organisation-library/templates` | List the message templates shared in this account's organization |\n| `template_organisation_library_share` | Writes | `POST /api/v1/organisation-library/templates` | Share one of this account's message templates with its organization |\n| `template_organisation_library_get` | Read-only | `GET /api/v1/organisation-library/templates/{shareId}` | Get one message template shared in this account's organization |\n| `template_organisation_library_withdraw` | Destructive | `DELETE /api/v1/organisation-library/templates/{shareId}` | Withdraw a share of this account's message template |\n| `template_organisation_library_copy` | Writes | `POST /api/v1/organisation-library/templates/{shareId}/copy` | Copy a shared message template into this account |\n| `template_organisation_library_stats` | Read-only | `GET /api/v1/organisation-library/templates/{shareId}/stats` | List who copied a shared message template |\n\n**Conversations**\n\n| Tool | Kind | Endpoint | Description |\n|------|------|----------|-------------|\n| `conversations_list` | Read-only | `GET /api/v1/conversations` | List conversations |\n| `conversations_get` | Read-only | `GET /api/v1/conversations/{id}` | Get conversation |\n| `conversations_update` | Destructive | `PATCH /api/v1/conversations/{id}` | Update conversation |\n| `conversations_get_messages` | Read-only | `GET /api/v1/conversations/{id}/messages` | Get conversation messages |\n| `conversations_bulk_update` | Destructive | `POST /api/v1/conversations/bulk` | Bulk update conversations |\n\n**Campaigns**\n\n| Tool | Kind | Endpoint | Description |\n|------|------|----------|-------------|\n| `campaigns_list` | Read-only | `GET /api/v1/campaigns` | List campaigns |\n| `campaigns_create` | Writes | `POST /api/v1/campaigns` | Create a draft campaign (sends nothing) |\n| `campaigns_get` | Read-only | `GET /api/v1/campaigns/{id}` | Get campaign |\n| `campaigns_update` | Destructive | `PATCH /api/v1/campaigns/{id}` | Update campaign |\n| `campaigns_delete` | Destructive | `DELETE /api/v1/campaigns/{id}` | Delete campaign |\n| `campaigns_start` | Destructive | `POST /api/v1/campaigns/{id}/start` | Start a campaign (sends SMS, uses credits) |\n| `campaigns_pause` | Writes | `POST /api/v1/campaigns/{id}/pause` | Pause campaign |\n| `campaigns_resume` | Destructive | `POST /api/v1/campaigns/{id}/resume` | Resume a campaign (sends SMS, uses credits) |\n| `campaigns_list_contacts` | Read-only | `GET /api/v1/campaigns/{id}/contacts` | List campaign contacts |\n| `campaigns_add_contacts` | Destructive | `POST /api/v1/campaigns/{id}/contacts` | Add contacts to a campaign (may send SMS) |\n\n**Phone Numbers**\n\n| Tool | Kind | Endpoint | Description |\n|------|------|----------|-------------|\n| `phone_numbers_list` | Read-only | `GET /api/v1/phone-numbers` | List phone numbers |\n| `phone_numbers_set_forwarding_bulk` | Destructive | `POST /api/v1/phone-numbers/forwarding/bulk` | Set or clear call forwarding in bulk |\n| `phone_numbers_get` | Read-only | `GET /api/v1/phone-numbers/{id}` | Get phone number |\n| `phone_numbers_set_forwarding` | Destructive | `PUT /api/v1/phone-numbers/{id}/forwarding` | Set call forwarding |\n| `phone_numbers_clear_forwarding` | Destructive | `DELETE /api/v1/phone-numbers/{id}/forwarding` | Clear call forwarding |\n\n**Workflows**\n\n| Tool | Kind | Endpoint | Description |\n|------|------|----------|-------------|\n| `workflows_list` | Read-only | `GET /api/v1/workflows` | List workflows (one page; filter by status or name search) |\n| `workflows_create` | Destructive | `POST /api/v1/workflows` | Create a workflow (draft unless status is active) |\n| `workflows_get` | Read-only | `GET /api/v1/workflows/{id}` | Get workflow (trigger, steps with nodeIds in running order, settings, numbers) |\n| `workflows_update` | Destructive | `PATCH /api/v1/workflows/{id}` | Update a workflow (unlisted steps are deleted) |\n| `workflows_delete` | Destructive | `DELETE /api/v1/workflows/{id}` | Delete workflow permanently (refused while a campaign uses it) |\n| `workflows_insert_step` | Destructive | `POST /api/v1/workflows/{id}/steps` | Insert one step (others kept): last, after afterNodeId, or first |\n| `workflows_reorder_steps` | Destructive | `POST /api/v1/workflows/{id}/steps/reorder` | Reorder steps (nodeIds must list every step exactly once) |\n| `workflows_update_step` | Destructive | `PATCH /api/v1/workflows/{id}/steps/{nodeId}` | Edit one step (name and/or config only; type and position are fixed) |\n| `workflows_remove_step` | Destructive | `DELETE /api/v1/workflows/{id}/steps/{nodeId}` | Remove one step (its neighbours are joined; others kept) |\n| `workflows_resume` | Destructive | `POST /api/v1/workflows/{id}/resume` | Resume a workflow (may send SMS) |\n| `workflows_pause` | Writes | `POST /api/v1/workflows/{id}/pause` | Pause workflow (finishes in the background) |\n| `workflows_list_enrollments` | Read-only | `GET /api/v1/workflows/{id}/enrollments` | List workflow enrollments (one page; filter by status) |\n| `workflows_clear_enrollments` | Destructive | `DELETE /api/v1/workflows/{id}/enrollments` | Clear all enrollments (every active and paused contact leaves) |\n| `workflows_enroll` | Destructive | `POST /api/v1/workflows/{id}/enroll` | Enroll a contact in a workflow (may send SMS) |\n| `workflows_bulk_enroll` | Destructive | `POST /api/v1/workflows/{id}/enroll/bulk` | Enroll contacts in a workflow (may send SMS) |\n| `workflows_remove_enrollment` | Destructive | `DELETE /api/v1/workflows/{id}/enrollments/{enrollmentId}` | Remove one enrollment (the contact leaves the workflow) |\n| `workflow_organisation_library_list` | Read-only | `GET /api/v1/organisation-library/workflows` | List the workflows shared in this account's organization |\n| `workflow_organisation_library_share` | Writes | `POST /api/v1/organisation-library/workflows` | Share one of this account's workflows with its organization |\n| `workflow_organisation_library_get` | Read-only | `GET /api/v1/organisation-library/workflows/{shareId}` | Get one workflow shared in this account's organization |\n| `workflow_organisation_library_withdraw` | Destructive | `DELETE /api/v1/organisation-library/workflows/{shareId}` | Withdraw a share of this account's workflow |\n| `workflow_organisation_library_copy` | Writes | `POST /api/v1/organisation-library/workflows/{shareId}/copy` | Copy a shared workflow into this account |\n| `workflow_organisation_library_stats` | Read-only | `GET /api/v1/organisation-library/workflows/{shareId}/stats` | List who copied a shared workflow |\n\n**AI Agents**\n\n| Tool | Kind | Endpoint | Description |\n|------|------|----------|-------------|\n| `agents_list` | Read-only | `GET /api/v1/agents` | List agents |\n| `agents_create` | Writes | `POST /api/v1/agents` | Create an AI agent (draft, answers nobody yet) |\n| `agents_get_build_guide` | Read-only | `GET /api/v1/agents/build-guide` | Get build guide |\n| `agents_preview` | Read-only | `POST /api/v1/agents/preview` | Preview an AI agent (creates nothing) |\n| `agents_get_setup_options` | Read-only | `GET /api/v1/agents/setup-options` | Get setup options |\n| `agents_get` | Read-only | `GET /api/v1/agents/{id}` | Get agent |\n| `agents_update` | Destructive | `PATCH /api/v1/agents/{id}` | Update agent |\n| `agents_archive` | Destructive | `DELETE /api/v1/agents/{id}` | Archive agent |\n| `agents_list_versions` | Read-only | `GET /api/v1/agents/{id}/versions` | List agent versions |\n| `agents_duplicate` | Writes | `POST /api/v1/agents/{id}/duplicate` | Duplicate agent |\n| `agents_get_channels` | Read-only | `GET /api/v1/agents/{id}/channels` | Get agent channels |\n| `agents_set_channels` | Destructive | `PUT /api/v1/agents/{id}/channels` | Set where an AI agent answers (applies at once) |\n| `agents_publish` | Destructive | `POST /api/v1/agents/{id}/publish` | Publish an AI agent (it starts texting contacts) |\n| `agents_restore_version` | Destructive | `POST /api/v1/agents/{id}/versions/{versionId}/restore` | Restore agent version |\n| `agents_start_session` | Destructive | `POST /api/v1/agents/{id}/sessions` | Start an AI agent on a conversation (may send an SMS) |\n| `agent_settings_get` | Read-only | `GET /api/v1/agent-settings` | Get agent settings |\n| `agent_settings_update` | Destructive | `PATCH /api/v1/agent-settings` | Update agent settings |\n| `agent_knowledge_list_collections` | Read-only | `GET /api/v1/agents/{id}/knowledge/collections` | List knowledge collections |\n| `agent_knowledge_create_collection` | Writes | `POST /api/v1/agents/{id}/knowledge/collections` | Create knowledge collection |\n| `agent_knowledge_delete_collection` | Destructive | `DELETE /api/v1/agents/{id}/knowledge/collections/{collectionId}` | Delete knowledge collection |\n| `agent_knowledge_list_sources` | Read-only | `GET /api/v1/agents/{id}/knowledge/collections/{collectionId}/sources` | List knowledge sources |\n| `agent_knowledge_create_source` | Writes | `POST /api/v1/agents/{id}/knowledge/collections/{collectionId}/sources` | Add knowledge source |\n| `agent_knowledge_update_source` | Destructive | `PATCH /api/v1/agents/{id}/knowledge/collections/{collectionId}/sources/{sourceId}` | Update knowledge source |\n| `agent_knowledge_delete_source` | Destructive | `DELETE /api/v1/agents/{id}/knowledge/collections/{collectionId}/sources/{sourceId}` | Delete knowledge source |\n| `agent_sessions_list` | Read-only | `GET /api/v1/agent-sessions` | List agent sessions |\n| `agent_sessions_get` | Read-only | `GET /api/v1/agent-sessions/{id}` | Get agent session |\n| `agent_sessions_acknowledge` | Writes | `POST /api/v1/agent-sessions/{id}/acknowledge` | Acknowledge agent session |\n| `conversation_agent_get` | Read-only | `GET /api/v1/conversations/{id}/agent` | Get agent on a conversation |\n| `conversation_agent_pause` | Destructive | `POST /api/v1/conversations/{id}/agent/pause` | Pause agent on a conversation |\n| `conversation_agent_resume` | Writes | `POST /api/v1/conversations/{id}/agent/resume` | Resume agent on a conversation |\n| `agent_test_sessions_create` | Destructive | `POST /api/v1/agents/{id}/test-sessions` | Start test conversation |\n| `agent_test_sessions_send` | Writes | `POST /api/v1/agents/{id}/test-sessions/{sessionId}/messages` | Send a test message to an AI agent (spends credits, sends no SMS) |\n| `agent_test_sessions_reset` | Destructive | `POST /api/v1/agents/{id}/test-sessions/{sessionId}/reset` | Reset test conversation |\n\n**Compliance**\n\n| Tool | Kind | Endpoint | Description |\n|------|------|----------|-------------|\n| `compliance_check` | Read-only | `POST /api/v1/compliance/check` | Check first-message compliance |\n\n**10DLC Brands**\n\n| Tool | Kind | Endpoint | Description |\n|------|------|----------|-------------|\n| `ten_dlc_brands_list` | Read-only | `GET /api/v1/10dlc/brands` | List 10DLC brands |\n| `ten_dlc_brands_create` | Destructive | `POST /api/v1/10dlc/brands` | Register a 10DLC brand |\n| `ten_dlc_brands_get_by_id` | Read-only | `GET /api/v1/10dlc/brands/{id}` | Get 10DLC brand |\n| `ten_dlc_brands_get_capabilities` | Read-only | `GET /api/v1/10dlc/brands/{id}/capabilities` | Get 10DLC brand capabilities |\n| `ten_dlc_brands_get_vetting_history` | Read-only | `GET /api/v1/10dlc/brands/{id}/vetting-history` | List 10DLC brand vetting history |\n| `ten_dlc_brands_resubmit` | Destructive | `POST /api/v1/10dlc/brands/resubmit` | Resubmit a 10DLC brand |\n| `ten_dlc_brands_update_dba` | Destructive | `PATCH /api/v1/10dlc/brands/{id}/dba` | Update 10DLC brand DBA |\n| `ten_dlc_brands_request_vetting` | Destructive | `POST /api/v1/10dlc/brands/{id}/vetting` | Request 10DLC brand vetting (paid) |\n\n**10DLC Campaigns**\n\n| Tool | Kind | Endpoint | Description |\n|------|------|----------|-------------|\n| `ten_dlc_campaigns_list_by_brand` | Read-only | `GET /api/v1/10dlc/campaigns` | List campaigns for a brand |\n| `ten_dlc_campaigns_create` | Destructive | `POST /api/v1/10dlc/campaigns` | Create a 10DLC campaign |\n| `ten_dlc_campaigns_get` | Read-only | `GET /api/v1/10dlc/campaigns/{id}` | Get a campaign |\n| `ten_dlc_campaigns_edit` | Destructive | `PUT /api/v1/10dlc/campaigns/{id}` | Edit a campaign while in review |\n| `ten_dlc_campaigns_remove` | Destructive | `DELETE /api/v1/10dlc/campaigns/{id}` | Delete a campaign |\n| `ten_dlc_campaigns_resubmit` | Destructive | `PUT /api/v1/10dlc/campaigns/{id}/resubmit` | Resubmit a declined campaign |\n| `ten_dlc_campaigns_attach_phone` | Destructive | `POST /api/v1/10dlc/campaigns/{id}/phone` | Attach phone numbers to a campaign |\n\n**10DLC Generations**\n\n| Tool | Kind | Endpoint | Description |\n|------|------|----------|-------------|\n| `ten_dlc_generations_get_for_user` | Read-only | `GET /api/v1/10dlc/generations` | Get the current AI-written 10DLC registration draft |\n| `ten_dlc_generations_create` | Destructive | `POST /api/v1/10dlc/generations` | Start an AI-written 10DLC registration draft |\n| `ten_dlc_generations_get_by_id` | Read-only | `GET /api/v1/10dlc/generations/{id}` | Get one AI-written 10DLC registration draft |\n| `ten_dlc_generations_remove` | Destructive | `DELETE /api/v1/10dlc/generations/{id}` | Delete an AI-written 10DLC registration draft |\n| `ten_dlc_generations_retry` | Destructive | `POST /api/v1/10dlc/generations/{id}/retry` | Retry a failed AI-written 10DLC registration draft |\n| `ten_dlc_generations_set_domain` | Destructive | `POST /api/v1/10dlc/generations/{id}/domain` | Set the website domain of a 10DLC registration draft |\n\n**10DLC Reference**\n\n| Tool | Kind | Endpoint | Description |\n|------|------|----------|-------------|\n| `ten_dlc_reference_get_enums` | Read-only | `GET /api/v1/10dlc/enums/{type}` | Get 10DLC setup enum |\n| `ten_dlc_reference_get_provider_status` | Read-only | `GET /api/v1/10dlc/provider-status` | Get provider status |\n\n**Billing**\n\n| Tool | Kind | Endpoint | Description |\n|------|------|----------|-------------|\n| `billing_api_get_status` | Read-only | `GET /api/v1/billing` | Get billing & account status |\n| `billing_api_list_payment_methods` | Read-only | `GET /api/v1/billing/payment-methods` | List saved cards |\n| `billing_api_list_invoices` | Read-only | `GET /api/v1/billing/invoices` | List invoices |\n| `billing_api_create_card_setup_link` | Destructive | `POST /api/v1/billing/payment-methods/setup-link` | Issue a link for a person to add a card |\n| `billing_api_set_default_payment_method` | Destructive | `PUT /api/v1/billing/payment-methods/default` | Set the default card |\n| `billing_api_delete_payment_method` | Destructive | `DELETE /api/v1/billing/payment-methods/{id}` | Remove a saved card |\n\n**Credits**\n\n| Tool | Kind | Endpoint | Description |\n|------|------|----------|-------------|\n| `credits_balance_api_get_balance` | Read-only | `GET /api/v1/credits` | Get credit balance |\n| `credits_balance_api_get_transfers` | Read-only | `GET /api/v1/credits/transfers` | List credit history |\n| `credits_purchase_api_purchase` | Destructive | `POST /api/v1/credits/purchase` | Buy a credit pack |\n| `credits_purchase_api_purchase_status` | Read-only | `GET /api/v1/credits/purchases/{id}` | Get a credit purchase |\n| `credits_purchase_api_update_auto_recharge` | Destructive | `PUT /api/v1/credits/auto-recharge` | Arm or disarm SMS or AI auto-recharge |\n| `credits_products_api_list_products` | Read-only | `GET /api/v1/credits/products` | List credit packs |\n| `credits_usage_api_get_usage` | Read-only | `GET /api/v1/credits/usage` | Get credit usage by campaign or workflow |\n\n**Accounts**\n\n| Tool | Kind | Endpoint | Description |\n|------|------|----------|-------------|\n| `accounts_api_list` | Read-only | `GET /api/v1/accounts` | List the accounts your organization owns |\n\n**Organization**\n\n| Tool | Kind | Endpoint | Description |\n|------|------|----------|-------------|\n| `organisation_profile_api_profile` | Read-only | `GET /api/v1/organisation` | Get your organization |\n| `organisation_accounts_api_list` | Read-only | `GET /api/v1/organisation/accounts` | List the accounts your organization owns |\n| `organisation_accounts_api_create` | Destructive | `POST /api/v1/organisation/accounts` | Create an account |\n| `organisation_accounts_api_get_one` | Read-only | `GET /api/v1/organisation/accounts/{id}` | Get one account your organization owns |\n| `organisation_accounts_api_rename` | Destructive | `PATCH /api/v1/organisation/accounts/{id}` | Rename an account |\n| `organisation_accounts_api_close` | Destructive | `DELETE /api/v1/organisation/accounts/{id}` | Close an account |\n| `organisation_account_api_keys_list` | Read-only | `GET /api/v1/organisation/accounts/{id}/api-keys` | List an account's API keys |\n| `organisation_account_api_keys_remove` | Destructive | `DELETE /api/v1/organisation/accounts/{id}/api-keys/{keyId}` | Revoke an API key |\n| `organisation_spending_policies_list` | Read-only | `GET /api/v1/organisation/spending-policies` | List spending policies |\n| `organisation_spending_policies_create` | Destructive | `POST /api/v1/organisation/spending-policies` | Create a spending policy |\n| `organisation_spending_policies_get_one` | Read-only | `GET /api/v1/organisation/spending-policies/{id}` | Get a spending policy |\n| `organisation_spending_policies_update` | Destructive | `PUT /api/v1/organisation/spending-policies/{id}` | Replace a spending policy |\n| `organisation_spending_policies_remove` | Destructive | `DELETE /api/v1/organisation/spending-policies/{id}` | Delete a spending policy |\n| `organisation_spending_policies_attach` | Destructive | `PUT /api/v1/organisation/accounts/{id}/spending-policy` | Attach or detach the spending policy of an account |\n| `organisation_spending_policies_spending_state` | Read-only | `GET /api/v1/organisation/accounts/{id}/spending` | Get the spending state of an account |\n| `organisation_account_access_list` | Read-only | `GET /api/v1/organisation/accounts/{id}/access` | List who has access to an account |\n| `organisation_account_access_grant` | Destructive | `POST /api/v1/organisation/accounts/{id}/access` | Grant people access to an account |\n| `organisation_account_access_change_role` | Destructive | `PATCH /api/v1/organisation/accounts/{id}/access/{userId}` | Change the role of a person on an account |\n| `organisation_account_access_revoke` | Destructive | `DELETE /api/v1/organisation/accounts/{id}/access/{userId}` | Revoke a person’s access to an account |\n| `organisation_credits_api_balance` | Read-only | `GET /api/v1/organisation/credits` | Get the organization credit balance |\n| `organisation_credits_api_products` | Read-only | `GET /api/v1/organisation/credits/products` | List the credit packs an organization can buy |\n| `organisation_credits_api_movements` | Read-only | `GET /api/v1/organisation/credits/movements` | List what went into the organization pool |\n| `organisation_credits_api_usage` | Read-only | `GET /api/v1/organisation/credits/usage` | Get credit usage by account |\n| `organisation_credits_api_purchase` | Destructive | `POST /api/v1/organisation/credits/purchase` | Buy a credit pack into the organization pool |\n| `organisation_credits_api_purchase_status` | Read-only | `GET /api/v1/organisation/credits/purchases/{id}` | Get a credit purchase |\n| `organisation_credits_api_update_recharge` | Destructive | `PUT /api/v1/organisation/credits/recharge` | Change the auto-recharge rule of the organization pool |\n| `organisation_shared_workflows_list` | Read-only | `GET /api/v1/organisation/sharing/workflows` | List the workflows shared with your organization |\n| `organisation_shared_workflows_share` | Writes | `POST /api/v1/organisation/sharing/workflows` | Share a workflow of one of your accounts with the organization |\n| `organisation_shared_workflows_get` | Read-only | `GET /api/v1/organisation/sharing/workflows/{shareId}` | Get one workflow shared with your organization |\n| `organisation_shared_workflows_withdraw` | Destructive | `DELETE /api/v1/organisation/sharing/workflows/{shareId}` | Withdraw a workflow share |\n| `organisation_shared_workflows_copy` | Writes | `POST /api/v1/organisation/sharing/workflows/{shareId}/copy` | Copy a shared workflow into one of your accounts |\n| `organisation_shared_workflows_stats` | Read-only | `GET /api/v1/organisation/sharing/workflows/{shareId}/stats` | List who copied a shared workflow |\n| `organisation_shared_templates_list` | Read-only | `GET /api/v1/organisation/sharing/templates` | List the message templates shared with your organization |\n| `organisation_shared_templates_share` | Writes | `POST /api/v1/organisation/sharing/templates` | Share a message template of one of your accounts with the organization |\n| `organisation_shared_templates_get` | Read-only | `GET /api/v1/organisation/sharing/templates/{shareId}` | Get one message template shared with your organization |\n| `organisation_shared_templates_withdraw` | Destructive | `DELETE /api/v1/organisation/sharing/templates/{shareId}` | Withdraw a message template share |\n| `organisation_shared_templates_copy` | Writes | `POST /api/v1/organisation/sharing/templates/{shareId}/copy` | Copy a shared message template into one of your accounts |\n| `organisation_shared_templates_stats` | Read-only | `GET /api/v1/organisation/sharing/templates/{shareId}/stats` | List who copied a shared message template |\n\n**Async Operations**\n\n| Tool | Kind | Endpoint | Description |\n|------|------|----------|-------------|\n| `async_operations_api_get_operation` | Read-only | `GET /api/v1/async-operations/{operationId}` | Get async operation |\n\n**Manage Webhooks**\n\n| Tool | Kind | Endpoint | Description |\n|------|------|----------|-------------|\n| `webhooks_api_list` | Read-only | `GET /api/v1/webhooks` | List webhooks |\n| `webhooks_api_create` | Destructive | `POST /api/v1/webhooks` | Create webhook |\n| `webhooks_api_get` | Read-only | `GET /api/v1/webhooks/{extId}` | Get webhook |\n| `webhooks_api_update` | Destructive | `PATCH /api/v1/webhooks/{extId}` | Update webhook |\n| `webhooks_api_delete` | Destructive | `DELETE /api/v1/webhooks/{extId}` | Delete webhook |\n| `webhooks_api_test` | Writes | `POST /api/v1/webhooks/{extId}/test` | Test webhook |\n| `webhooks_api_get_event_sample` | Read-only | `GET /api/v1/webhooks/events/{eventName}/sample` | Get a sample payload for a webhook event |\n| `webhooks_api_list_deliveries` | Read-only | `GET /api/v1/webhooks/{extId}/deliveries` | List test deliveries |\n\n</details>\n\n### Rate limits & permissions\n\n- Every tool call is **one API request** against the key, under the windows in\n  **Rate limits** (in the Introduction). Agents can issue many calls in a row; a `429` is returned\n  to the agent like any other error.\n- A tool only succeeds when the key holds the scope its endpoint requires. A key\n  with narrower scopes lists only the tools it can call; a call outside the\n  scopes returns the endpoint's `403` to the agent.\n- Tools that spend money (`credits:write`, `billing:write`;\n  `organisation:credits:write`, `organisation:billing:write` on an organization key)\n  are never covered by full access. The key must be minted with that scope ticked;\n  a full-access key without it does not list those tools.\n\n### Troubleshooting\n\n| Symptom | What to check |\n|---------|---------------|\n| `401 Unauthorized` | The key is missing, mistyped or revoked, or was sent under another header name. The header must be exactly `x-api-key`. |\n| `405 Method Not Allowed` on `GET` | The endpoint is `POST` only. Configure your client for **Streamable HTTP**, not the legacy SSE transport. |\n| `403` or a tool fails | The key lacks the scope for that endpoint, or the account cannot use the feature. Create a key with the scope you need. |\n| `403` with `errorCode: scope_must_be_explicit` | The tool spends money and the key holds only full access. Mint a key with the money scope ticked; a wider wildcard does not help. |\n| Rotated or revoked a key | Put the new key in your agent's config, then restart the agent. |\n| Claude Desktop shows no tools | Install **Node.js 18 or later** (the bridge runs through `npx`), check the JSON is valid, and restart Claude Desktop. |\n"}],"servers":[],"components":{"securitySchemes":{"api-key":{"type":"apiKey","in":"header","name":"x-api-key","description":"Account API key (`sk_…`), minted on the Developers page of an account."},"organisation-api-key":{"type":"apiKey","in":"header","name":"x-api-key","description":"Organization API key (`osk_…`), minted by an organization owner under Organization → Settings → API keys. Only the Organization endpoints accept it."}},"schemas":{"CreateTagDto":{"type":"object","properties":{"name":{"type":"string","description":"Tag name","example":"hot-lead","minLength":1,"maxLength":30},"color":{"type":"string","description":"Hex color code","example":"#3B82F6","default":"#3B82F6"}},"required":["name"]},"UpdateTagDto":{"type":"object","properties":{"name":{"type":"string","description":"Tag name","minLength":1,"maxLength":30},"color":{"type":"string","description":"Hex color code","example":"#EF4444"}}},"BulkAddContactTagsDto":{"type":"object","properties":{"contactUuids":{"description":"UUIDs of the contacts to tag.","example":["3fb94e00-be18-48d3-8aae-f1639df99210"],"type":"array","items":{"type":"string"}},"tags":{"description":"Tag names to add. Tags are auto-created if they do not exist.","example":["hot-lead","follow-up"],"type":"array","items":{"type":"string"}}},"required":["contactUuids","tags"]},"BulkAddContactTagsRes":{"type":"object","properties":{"affectedCount":{"type":"number","description":"Number of contacts the tags were applied to"},"tagIds":{"description":"IDs of the tags applied (created or existing)","type":"array","items":{"type":"number"}}},"required":["affectedCount","tagIds"]},"BulkRemoveContactTagsDto":{"type":"object","properties":{"contactUuids":{"description":"UUIDs of the contacts to remove the tags from.","example":["3fb94e00-be18-48d3-8aae-f1639df99210"],"type":"array","items":{"type":"string"}},"tagIds":{"description":"IDs of the tags to remove. Use \"List tags\" to resolve names to IDs.","example":[12,34],"type":"array","items":{"type":"number"}}},"required":["contactUuids","tagIds"]},"BulkRemoveContactTagsRes":{"type":"object","properties":{"affectedCount":{"type":"number","description":"Number of contacts the tags were removed from"}},"required":["affectedCount"]},"AddContactTagsDto":{"type":"object","properties":{"tags":{"description":"Tag names to add. Tags are auto-created if they do not exist.","example":["hot-lead","follow-up"],"type":"array","items":{"type":"string"}}},"required":["tags"]},"CreateCustomFieldDto":{"type":"object","properties":{"name":{"type":"string","description":"Field name","example":"Lead Source","minLength":1,"maxLength":50},"type":{"type":"string","description":"Field type","enum":["text","number","date","email","phone","url"],"example":"text"}},"required":["name","type"]},"CreateContactDto":{"type":"object","properties":{"firstName":{"type":"string","description":"First name","maxLength":100},"lastName":{"type":"string","description":"Last name","maxLength":100},"phoneNumber":{"type":"string","description":"Phone number (will be formatted to E.164)","example":"+15551234567"},"email":{"type":"string","description":"Email address","maxLength":255},"company":{"type":"string","description":"Company name","maxLength":200},"address":{"type":"string","description":"Street address","maxLength":500},"city":{"type":"string","description":"City","maxLength":100},"state":{"type":"string","description":"State/Province","maxLength":100},"zipCode":{"type":"string","description":"ZIP/Postal code","maxLength":20},"tags":{"description":"Tag names to apply (creates if not exists)","example":["lead"],"type":"array","items":{"type":"string"}},"customFields":{"type":"object","description":"Custom field values (field must exist; each value at most 200 characters)","example":{"Lead Source":"Website"}},"folderId":{"type":"number","description":"Folder ID to assign contact to"},"updateExisting":{"type":"boolean","description":"Update the existing contact when the phone number already belongs to one (default: false). Either way the request succeeds and returns the contact — 201 when it was created, 200 when it already existed. Mirrors the flag of the same name on bulk create.","default":false}},"required":["phoneNumber"]},"BatchGetContactsDto":{"type":"object","properties":{"ids":{"description":"Contact UUIDs to retrieve (max 500)","minItems":2,"maxItems":500,"type":"array","items":{"type":"string"}}},"required":["ids"]},"RestoreToNewListDto":{"type":"object","properties":{"name":{"type":"string","description":"Name of the new list. It must not be the name of a list the account already has.","maxLength":255,"example":"Restored contacts · Nov 25, 2026"}},"required":["name"]},"RestoreDeletedContactsDto":{"type":"object","properties":{"ids":{"description":"UUIDs of the deleted contacts to restore, 1 to 10000. A UUID that cannot be restored (not deleted, deleted more than 7 days ago, or removed by phone verification or risk rules) is left out. Not together with all.","minItems":1,"maxItems":10000,"type":"array","items":{"type":"string","format":"uuid"}},"all":{"type":"boolean","description":"true restores every contact that can be restored, optionally only those deleted in the range from and to. Not together with ids.","example":true},"from":{"type":"string","description":"With all: only contacts deleted at or after this instant (ISO 8601)","example":"2026-11-24T00:00:00.000Z"},"to":{"type":"string","description":"With all: only contacts deleted before this instant (ISO 8601)","example":"2026-11-25T00:00:00.000Z"},"addToList":{"description":"Also add the restored contacts to a new list with this name","allOf":[{"$ref":"#/components/schemas/RestoreToNewListDto"}]}}},"RestoreDeletedContactsRes":{"type":"object","properties":{"operationId":{"type":"string","description":"Id of the bulk_contact_restore async operation","format":"uuid"},"totalContacts":{"type":"number","description":"Contacts the restore will bring back","minimum":1},"listId":{"type":"number","description":"Id of the new list (only when addToList was sent)"}},"required":["operationId","totalContacts"]},"UpdateContactDto":{"type":"object","properties":{"firstName":{"type":"string","description":"First name","minLength":1,"maxLength":100},"lastName":{"type":"string","description":"Last name","maxLength":100},"email":{"type":"string","description":"Email address","maxLength":255},"company":{"type":"string","description":"Company name","maxLength":200},"address":{"type":"string","description":"Street address","maxLength":500},"city":{"type":"string","description":"City","maxLength":100},"state":{"type":"string","description":"State/Province","maxLength":100},"zipCode":{"type":"string","description":"ZIP/Postal code","maxLength":20},"tags":{"description":"Tag names (replaces all existing tags)","example":["lead","hot"],"type":"array","items":{"type":"string"}},"customFields":{"type":"object","description":"Custom field values to merge (field must exist; each value at most 200 characters)","example":{"Lead Source":"Website"}},"starred":{"type":"boolean","description":"Whether contact is starred/favorited"},"folderId":{"type":"object","description":"Folder ID (set to null to remove from folder)","nullable":true}}},"BulkContactItemDto":{"type":"object","properties":{"firstName":{"type":"string","description":"First name","maxLength":100},"lastName":{"type":"string","description":"Last name","maxLength":100},"phoneNumber":{"type":"string","description":"Phone number (will be formatted to E.164)","example":"+15551234567"},"email":{"type":"string","description":"Email address","maxLength":255},"company":{"type":"string","description":"Company name","maxLength":200},"address":{"type":"string","description":"Street address","maxLength":500},"city":{"type":"string","description":"City","maxLength":100},"state":{"type":"string","description":"State/Province","maxLength":100},"zipCode":{"type":"string","description":"ZIP/Postal code","maxLength":20},"tags":{"description":"Tag names to apply (creates if not exists)","example":["lead"],"type":"array","items":{"type":"string"}},"customFields":{"type":"object","description":"Custom field values (field must exist; each value at most 200 characters, else the item is rejected individually)","example":{"Lead Source":"Website"}}},"required":["phoneNumber"]},"BulkCreateContactsDto":{"type":"object","properties":{"contacts":{"description":"Contacts to create (max 1000)","minItems":1,"maxItems":1000,"type":"array","items":{"$ref":"#/components/schemas/BulkContactItemDto"}},"updateExisting":{"type":"boolean","description":"Update existing contacts if phone number matches (default: false)","default":false},"addToList":{"type":"number","description":"List ID to add contacts to after import"},"tagIds":{"description":"Tag IDs to apply to imported contacts","type":"array","items":{"type":"number"}}},"required":["contacts"]},"BulkJobResponseDto":{"type":"object","properties":{"jobId":{"type":"string","description":"Job ID for tracking progress","format":"uuid"},"message":{"type":"string","description":"Status message"},"totalContacts":{"type":"number","description":"Total contacts in the job"}},"required":["jobId","message"]},"ExportContactsDto":{"type":"object","properties":{"search":{"type":"string","description":"Search term (matches firstName, lastName, phoneNumber, email)"},"tags":{"description":"Filter by tag names","type":"array","items":{"type":"string"}},"optedOut":{"type":"boolean","description":"Filter by opted-out status"},"listId":{"type":"number","description":"Export contacts from a specific list"},"folderId":{"type":"number","description":"Filter by folder ID"},"createdAfter":{"type":"string","description":"Filter contacts created after this date (ISO 8601)","example":"2024-01-01T00:00:00Z"},"createdBefore":{"type":"string","description":"Filter contacts created before this date (ISO 8601)","example":"2024-12-31T23:59:59Z"},"filename":{"type":"string","description":"Custom filename for the export (without extension)","example":"my_contacts_backup"}}},"JobProgressDto":{"type":"object","properties":{"total":{"type":"number","description":"Total items to process"},"processed":{"type":"number","description":"Items processed so far"},"percentage":{"type":"number","description":"Completion percentage (0-100)"},"successCount":{"type":"number","description":"Number of successful operations"},"errorCount":{"type":"number","description":"Number of failed operations"},"message":{"type":"string","description":"Current status message"}},"required":["total","processed","percentage"]},"JobStatusResponseDto":{"type":"object","properties":{"id":{"type":"string","description":"Job ID","format":"uuid"},"type":{"type":"string","description":"Job type","enum":["contacts_import","contacts_export"]},"status":{"type":"string","description":"Job status","enum":["pending","in_progress","completed","failed","cancelled"]},"progress":{"description":"Progress information","allOf":[{"$ref":"#/components/schemas/JobProgressDto"}]},"result":{"description":"Result data (available when completed)","oneOf":[{"$ref":"#/components/schemas/BulkImportResultDto"},{"$ref":"#/components/schemas/ExportResultDto"}]},"createdAt":{"type":"string","description":"Job creation timestamp (ISO 8601)"},"completedAt":{"type":"string","description":"Job completion timestamp (ISO 8601)"}},"required":["id","type","status","progress","createdAt"]},"ContactMetadataResponseDto":{"type":"object","properties":{"metadata":{"type":"string","nullable":true,"description":"The stored text, or null when nothing has been set"},"updatedAt":{"type":"string","nullable":true,"format":"date-time","description":"When the metadata was last written, or null when nothing has been set"}},"required":["metadata","updatedAt"]},"SetContactMetadataDto":{"type":"object","properties":{"metadata":{"type":"string","description":"Opaque text your integration stores about this contact. Any format; plain text or YAML uses the space better than JSON.","maxLength":10000,"example":"stage: qualified\nlast_call: 2026-10-20\nnotes: asked for pricing"}},"required":["metadata"]},"CreateContactListDto":{"type":"object","properties":{"name":{"type":"string","description":"List name","example":"Hot Leads","minLength":1,"maxLength":50},"description":{"type":"string","description":"List description","example":"Contacts that showed high interest"}},"required":["name"]},"UpdateContactListDto":{"type":"object","properties":{"name":{"type":"string","description":"List name","minLength":1,"maxLength":50},"description":{"type":"string","description":"List description","example":"Updated description"}}},"AddContactsToListDto":{"type":"object","properties":{"contactIds":{"description":"Contact IDs to add to the list","example":[1,2,3],"type":"array","items":{"type":"number"}}},"required":["contactIds"]},"RemoveContactsFromListDto":{"type":"object","properties":{"contactIds":{"description":"Contact IDs to remove from the list","example":[1,2,3],"type":"array","items":{"type":"number"}}},"required":["contactIds"]},"OptOutContactDto":{"type":"object","properties":{"reason":{"type":"string","description":"Reason for opt-out (for internal tracking)","maxLength":255}}},"OptInContactDto":{"type":"object","properties":{"consentConfirmed":{"type":"boolean","description":"Must be true to confirm consent was obtained. Required for TCPA compliance.","example":true}},"required":["consentConfirmed"]},"ScrubsApiErrorRes":{"type":"object","properties":{"statusCode":{"type":"number","description":"HTTP status code, repeated in the body"},"error":{"type":"string","description":"A stable machine-readable reason for a business refusal (branch on this, not on the message). A malformed body answers the status text \"Bad Request\" with every problem in message[].","enum":["SCRUB_IN_PROGRESS","INSUFFICIENT_VERIFICATION_CREDITS","ACCOUNT_SPEND_CAP_REACHED","NO_CONTACTS_FOUND","UNSUPPORTED_FILTER_FIELDS","INVALID_SCRUB_TARGET","SCRUB_TARGET_TOO_LARGE","WORKFLOW_NOT_FOUND","CAMPAIGN_NOT_FOUND","IMPORT_NOT_FOUND","NO_FAILED_CONTACTS","CREDIT_DEDUCTION_FAILED","SCRUB_NOT_FOUND","SCRUB_NOT_FINISHED","RESULTS_FILE_NOT_REQUESTED","INVALID_SCRUB_RESULT_SCOPE","INVALID_CURSOR","Bad Request","Unauthorized","Forbidden","Not Found","Conflict","TOO_MANY_REQUESTS","Service Unavailable"]},"message":{"description":"What was refused, in words (a string, or a list of problems for a malformed body). May be reworded.","oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]}},"required":["statusCode","error","message"]},"ScrubEligibleWorkflowRes":{"type":"object","properties":{"id":{"type":"number","description":"Workflow id (the workflowIds of a scrub)"},"name":{"type":"string","description":"Workflow name","example":"New lead nurture"},"status":{"type":"string","description":"active or paused (the workflows this list holds)","enum":["active","paused"]},"contactCount":{"type":"number","description":"Every enrollment of the workflow, whatever its state; a scrub covers only the contacts whose enrollment is active or paused"}},"required":["id","name","status","contactCount"]},"ScrubEligibleCampaignRes":{"type":"object","properties":{"id":{"type":"number","description":"Campaign id (the campaignIds of a scrub)"},"name":{"type":"string","description":"Campaign name","example":"November promo"},"status":{"type":"string","description":"Campaign status (never completed)","enum":["not_started","scheduled","in_progress","paused","cancelled","failed"]},"contactCount":{"type":"number","description":"Contacts in the campaign"},"pendingContacts":{"type":"number","description":"Contacts not yet processed: what a scrub covers"}},"required":["id","name","status","contactCount","pendingContacts"]},"ScrubContactFilterDto":{"type":"object","properties":{"search":{"type":"string","description":"Search term (matches first name, last name, phone number, email). It counts as a condition only with 3 or more characters: a shorter term is ignored, and a filter whose only condition is a shorter search is refused with INVALID_SCRUB_TARGET.","maxLength":200,"example":"smith"},"tags":{"description":"Tag ids or tag names; a contact with any of them matches. A tag the account does not have matches no contact.","example":["new-leads","17"],"type":"array","items":{"type":"string"}},"optedOut":{"type":"boolean","description":"Only opted-out (true) or not opted-out (false) contacts"},"listId":{"type":"number","description":"Only the members of this contact list (list id)","example":12},"folderId":{"type":"number","description":"Only the contacts of this folder (folder id)","example":3},"createdAfter":{"type":"string","description":"Only contacts created at or after this instant (ISO 8601)","example":"2026-01-01T00:00:00Z"},"createdBefore":{"type":"string","description":"Only contacts created at or before this instant (ISO 8601)","example":"2026-12-31T23:59:59Z"},"importJobId":{"type":"string","description":"Only the contacts one import created or updated. importJobId is the jobId an import through the contacts bulk endpoint answered. Imports created before scrubs were added to the API, and imports whose job has not started yet, are not found by it.","format":"uuid","example":"3f2c9a4e-8b1d-4c6e-9a7f-2d5b8e1c0a93"}}},"PreviewScrubDto":{"type":"object","properties":{"contactUuids":{"description":"Contacts by uuid, up to 10,000. Uuids that are not a contact of the account are skipped.","example":["550e8400-e29b-41d4-a716-446655440000"],"type":"array","items":{"type":"string","format":"uuid"}},"filter":{"description":"Every contact matching these conditions. Names at least one condition; every contact of the account is allContacts.","allOf":[{"$ref":"#/components/schemas/ScrubContactFilterDto"}]},"allContacts":{"type":"boolean","description":"true: every contact of the account. A filter with no condition is refused, not read as every contact."},"workflowIds":{"description":"The contacts enrolled (active or paused) in these workflows, up to 100 ids. GET /v1/scrubs/eligible-workflows (scrubs_list_eligible_workflows) lists the active and paused ones; any workflow id of the account is accepted.","example":[42,57],"type":"array","items":{"type":"number"}},"campaignIds":{"description":"The contacts these campaigns have not processed yet, up to 100 ids. GET /v1/scrubs/eligible-campaigns (scrubs_list_eligible_campaigns) lists the campaigns not completed that have contacts; any campaign id of the account is accepted.","example":[12],"type":"array","items":{"type":"number"}}}},"ScrubPreviewRes":{"type":"object","properties":{"totalContacts":{"type":"number","description":"Contacts the target names that have a phone number; for filter, the contacts that match"},"alreadyScrubbed":{"type":"number","description":"Of those, contacts whose number this account already scrubbed (free); always 0 for a filter target"},"newToScrub":{"type":"number","description":"Contacts whose number is new to this account (charged)"},"creditsRequired":{"type":"number","description":"Verification credits a start would charge"},"estimated":{"type":"boolean","description":"true for filter and allContacts targets: creditsRequired is an upper bound (for filter every match counts as new; allContacts has the split at this moment), and the exact cost is known when the scrub runs. false for contactUuids, workflowIds and campaignIds."}},"required":["totalContacts","alreadyScrubbed","newToScrub","creditsRequired","estimated"]},"StartScrubDto":{"type":"object","properties":{"contactUuids":{"description":"Contacts by uuid, up to 10,000. Uuids that are not a contact of the account are skipped.","example":["550e8400-e29b-41d4-a716-446655440000"],"type":"array","items":{"type":"string","format":"uuid"}},"filter":{"description":"Every contact matching these conditions. Names at least one condition; every contact of the account is allContacts.","allOf":[{"$ref":"#/components/schemas/ScrubContactFilterDto"}]},"allContacts":{"type":"boolean","description":"true: every contact of the account. A filter with no condition is refused, not read as every contact."},"workflowIds":{"description":"The contacts enrolled (active or paused) in these workflows, up to 100 ids. GET /v1/scrubs/eligible-workflows (scrubs_list_eligible_workflows) lists the active and paused ones; any workflow id of the account is accepted.","example":[42,57],"type":"array","items":{"type":"number"}},"campaignIds":{"description":"The contacts these campaigns have not processed yet, up to 100 ids. GET /v1/scrubs/eligible-campaigns (scrubs_list_eligible_campaigns) lists the campaigns not completed that have contacts; any campaign id of the account is accepted.","example":[12],"type":"array","items":{"type":"number"}},"autoRemoveBadLines":{"type":"boolean","description":"Required. true deletes, as results arrive, the contacts whose number comes back as a landline, a VoIP line or a number with no line, including those also on a do-not-call or litigator list. A list match alone never deletes a contact, and neither does a line type that could not be determined. false deletes nothing and only records the results. There is no default."}},"required":["autoRemoveBadLines"]},"ScrubLineTypeCountsRes":{"type":"object","properties":{"mobile":{"type":"number","description":"Mobile numbers"},"landline":{"type":"number","description":"Landline numbers"},"voip":{"type":"number","description":"VoIP numbers"},"unknown":{"type":"number","description":"Numbers with no line, or whose line type could not be determined"}},"required":["mobile","landline","voip","unknown"]},"ScrubDoNotCallCountsRes":{"type":"object","properties":{"clean":{"type":"number","description":"Numbers on no do-not-call or litigator list"},"flagged":{"type":"number","description":"Numbers on at least one do-not-call or litigator list"},"unknown":{"type":"number","description":"Numbers whose list check gave no answer"}},"required":["clean","flagged","unknown"]},"ScrubCountsRes":{"type":"object","properties":{"total":{"type":"number","description":"Contacts in the scrub. An estimate while pending for filter and allContacts targets, exact afterwards."},"processed":{"type":"number","description":"Contacts with a result or a failure so far"},"lineTypes":{"$ref":"#/components/schemas/ScrubLineTypeCountsRes"},"doNotCall":{"$ref":"#/components/schemas/ScrubDoNotCallCountsRes"},"lists":{"type":"object","description":"Contacts matched per list key (tcpa, troll, dnc_complainers, federal_dnc, state_dnc, nra, other); a contact on two lists counts in both. null for scrubs that ran before per-list results were recorded.","additionalProperties":{"type":"integer"},"nullable":true,"example":{"tcpa":12,"federal_dnc":81,"state_dnc":9}},"failed":{"type":"number","description":"Contacts whose check failed; POST /v1/scrubs/:scrubId/retry (scrubs_retry) checks them again"},"removed":{"type":"number","description":"Contacts the scrub deleted automatically (autoRemoveBadLines); contacts deleted by a remove are not counted here"}},"required":["total","processed","lineTypes","doNotCall","lists","failed","removed"]},"ScrubCreditsRes":{"type":"object","properties":{"charged":{"type":"number","description":"Verification credits charged"},"returned":{"type":"number","description":"Verification credits given back (stopped or failed numbers)"}},"required":["charged","returned"]},"ScrubRes":{"type":"object","properties":{"id":{"type":"string","description":"Scrub id","format":"uuid","example":"0b7f6c1e-5d1c-4a55-9f0e-3c2a7d9e4b10"},"status":{"type":"string","description":"pending (accepted, not running yet), in_progress, completed or failed. A stopped scrub is failed with failureCode stopped.","enum":["pending","in_progress","completed","failed"]},"failureCode":{"type":"string","description":"Why the scrub failed; null unless status is failed. Scrubs that failed before codes were recorded read error.","enum":["stopped","worker_lost","insufficient_credits","spend_cap_reached","no_contacts","error"],"nullable":true},"autoRemoveBadLines":{"type":"boolean","description":"Whether the scrub deletes bad lines as results arrive"},"counts":{"$ref":"#/components/schemas/ScrubCountsRes"},"credits":{"$ref":"#/components/schemas/ScrubCreditsRes"},"createdAt":{"type":"string","description":"When the scrub was started (ISO 8601)","format":"date-time"},"completedAt":{"type":"string","description":"When the scrub completed (ISO 8601); null unless status is completed","nullable":true,"format":"date-time"}},"required":["id","status","failureCode","autoRemoveBadLines","counts","credits","createdAt","completedAt"]},"ScrubPageMetadataRes":{"type":"object","properties":{"totalPages":{"type":"number","description":"Number of pages"},"totalItems":{"type":"number","description":"Number of scrubs across every page"},"itemsPerPage":{"type":"number","description":"Scrubs per page (take)"},"currentPage":{"type":"number","description":"This page (1-based)"}},"required":["totalPages","totalItems","itemsPerPage","currentPage"]},"ScrubListRes":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/ScrubRes"}},"metadata":{"$ref":"#/components/schemas/ScrubPageMetadataRes"}},"required":["rows","metadata"]},"ScrubSummaryTotalsRes":{"type":"object","properties":{"contacts":{"type":"number","description":"Contacts whose most recent scrub is this one, removed ones included"},"checked":{"type":"number","description":"Of those, numbers checked with a result"},"clean":{"type":"number","description":"Checked, on no list and a mobile line: nothing to remove"},"flagged":{"type":"number","description":"Contacts on at least one list; a contact on two lists counts once here"},"badLines":{"type":"number","description":"Not flagged, with a landline, VoIP, no-line or unconfirmed number"},"failed":{"type":"number","description":"Numbers that could not be checked"},"pending":{"type":"number","description":"Numbers not checked yet (the scrub is still running)"},"removed":{"type":"number","description":"Contacts already removed, by autoRemoveBadLines or a remove"}},"required":["contacts","checked","clean","flagged","badLines","failed","pending","removed"]},"ScrubSummaryRemoveBodyRes":{"type":"object","properties":{"categories":{"type":"array","description":"The one category key of this row","minItems":1,"maxItems":1,"items":{"type":"string","enum":["tcpa","troll","federal_dnc","state_dnc","dnc_complainers","nra","other","legacy","landline","voip","unknown","failed"]}}},"required":["categories"]},"ScrubSummaryCategoryRes":{"type":"object","properties":{"key":{"type":"string","description":"Category key, the value a remove takes in categories","enum":["tcpa","troll","federal_dnc","state_dnc","dnc_complainers","nra","other","legacy","landline","voip","unknown","failed"]},"label":{"type":"string","description":"The category's name, as the app's results screen shows it","example":"State Do Not Call lists"},"group":{"type":"string","description":"The result group of the category; the results call takes it as group, with the key as list except for failed","enum":["flagged","kept","failed"]},"count":{"type":"number","description":"Contacts of this scrub in the category, removed ones included"},"remaining":{"type":"number","description":"Of count, the contacts not removed yet: what a remove deletes"},"remove":{"description":"The body of POST /v1/scrubs/:scrubId/remove (scrubs_remove_results) that deletes the remaining contacts of this category","allOf":[{"$ref":"#/components/schemas/ScrubSummaryRemoveBodyRes"}]}},"required":["key","label","group","count","remaining","remove"]},"ScrubSummaryRes":{"type":"object","properties":{"scrubId":{"type":"string","description":"Scrub id","format":"uuid","example":"0b7f6c1e-5d1c-4a55-9f0e-3c2a7d9e4b10"},"status":{"type":"string","description":"The scrub status: pending, in_progress, completed or failed","enum":["pending","in_progress","completed","failed"]},"totals":{"description":"Live totals of the scrub: they cover the contacts whose most recent scrub is this one, and move while it runs","allOf":[{"$ref":"#/components/schemas/ScrubSummaryTotalsRes"}]},"categories":{"description":"Every category in display order (flagged lists in risk order, then bad line types, then failed), zeros included, so the shape never changes","type":"array","items":{"$ref":"#/components/schemas/ScrubSummaryCategoryRes"}},"overlap":{"type":"boolean","description":"true when some flagged contacts are on more than one list, so the flagged category counts add up to more than totals.flagged"}},"required":["scrubId","status","totals","categories","overlap"]},"ScrubStopRes":{"type":"object","properties":{"stopped":{"type":"boolean","description":"false when the scrub had already finished: nothing changed"},"creditsReturned":{"type":"number","description":"Verification credits given back by this stop"},"scrub":{"$ref":"#/components/schemas/ScrubRes"}},"required":["stopped","creditsReturned","scrub"]},"ScrubRetryRes":{"type":"object","properties":{"scrubId":{"type":"string","description":"Scrub id","format":"uuid"},"retriedCount":{"type":"number","description":"Failed contacts sent to be checked again"},"creditsCharged":{"type":"number","description":"Verification credits charged for the retry"}},"required":["scrubId","retriedCount","creditsCharged"]},"ScrubContactResultRes":{"type":"object","properties":{"contactUuid":{"type":"string","description":"Contact uuid","format":"uuid"},"phoneNumber":{"type":"string","description":"Phone number (E.164)","example":"+15125550143"},"status":{"type":"string","description":"pending (no result yet), completed or failed","enum":["pending","completed","failed"]},"group":{"type":"string","description":"Result group, in priority order failed, flagged, kept, clean. A pending contact can show the group of an earlier scrub until this one checks it; null when it has none","enum":["clean","flagged","kept","failed"],"nullable":true},"lineType":{"type":"string","description":"Line type; a pending contact can show the one of an earlier scrub; null when never checked","enum":["mobile","landline","voip","unknown"],"nullable":true},"carrier":{"type":"string","description":"Carrier of the number; null when unknown","nullable":true,"example":"Verizon"},"doNotCall":{"type":"string","description":"Do-not-call outcome; a pending contact can show the one of an earlier scrub; null when never checked","enum":["clean","flagged","unknown"],"nullable":true},"flaggedLists":{"description":"Lists the number is on (tcpa, troll, dnc_complainers, federal_dnc, state_dnc, nra, other); empty when on none","type":"array","items":{"type":"string"}},"failureReason":{"type":"string","description":"Why the check failed (stopped: the scrub was stopped first); null unless failed","enum":["stopped","error"],"nullable":true},"verifiedAt":{"type":"string","description":"When the number was last checked (ISO 8601)","nullable":true,"format":"date-time"},"removed":{"type":"boolean","description":"Whether the contact has been deleted"},"removedAt":{"type":"string","description":"When it was deleted (ISO 8601)","nullable":true,"format":"date-time"}},"required":["contactUuid","phoneNumber","status","group","lineType","carrier","doNotCall","flaggedLists","failureReason","verifiedAt","removed","removedAt"]},"ScrubContactResultPageRes":{"type":"object","properties":{"rows":{"description":"Results list the contacts whose most recent scrub is this one. A contact scrubbed again by a later scrub leaves this scrub’s results and file; the scrub’s counts stay as they were and are its permanent record. Contacts removed by the scrub or by a remove stay listed with removed true and removedAt.","type":"array","items":{"$ref":"#/components/schemas/ScrubContactResultRes"}},"nextCursor":{"type":"string","description":"Pass as cursor for the next page; null on the last page","nullable":true,"example":"c3IxOjEwMjQ0"}},"required":["rows","nextCursor"]},"ScrubResultsFileProgressRes":{"type":"object","properties":{"total":{"type":"number","description":"Contacts to write"},"processed":{"type":"number","description":"Contacts written so far"},"percentage":{"type":"number","description":"0–100"}},"required":["total","processed","percentage"]},"ScrubResultsFileDownloadRes":{"type":"object","properties":{"downloadUrl":{"type":"string","description":"Download link, valid one hour from this answer","format":"uri"},"expiresAt":{"type":"string","description":"When the link expires (ISO 8601)","format":"date-time"},"expiresIn":{"type":"number","description":"Seconds until the link expires"},"filename":{"type":"string","description":"File name","example":"scrub_results_2026-11-17.csv"},"fileSize":{"type":"number","description":"Size in bytes","nullable":true},"rowCount":{"type":"number","description":"Contacts in the file (header excluded)"}},"required":["downloadUrl","expiresAt","expiresIn","filename","fileSize","rowCount"]},"ScrubResultsFileRes":{"type":"object","properties":{"scrubId":{"type":"string","description":"Scrub id","format":"uuid"},"status":{"type":"string","description":"pending, in_progress, completed or failed (a cancelled file reads failed)","enum":["pending","in_progress","completed","failed"]},"progress":{"$ref":"#/components/schemas/ScrubResultsFileProgressRes"},"requestedAt":{"type":"string","description":"When this file was requested (ISO 8601)","format":"date-time"},"generatedAt":{"type":"string","description":"When the file was written (ISO 8601); null until completed","nullable":true,"format":"date-time"},"download":{"description":"Set only when completed; a new link on every read","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/ScrubResultsFileDownloadRes"}]},"error":{"type":"string","description":"Why the file failed; null unless failed","nullable":true}},"required":["scrubId","status","progress","requestedAt","generatedAt","download","error"]},"ScrubRemoveDto":{"type":"object","properties":{"categories":{"type":"array","description":"The result categories whose remaining contacts are deleted, by the key GET /v1/scrubs/:scrubId/summary (scrubs_get_summary) lists; 1 to 12 distinct keys, any mix of groups. Not together with group or list.","minItems":1,"maxItems":12,"uniqueItems":true,"example":["federal_dnc","state_dnc","tcpa"],"items":{"type":"string","enum":["tcpa","troll","federal_dnc","state_dnc","dnc_complainers","nra","other","legacy","landline","voip","unknown","failed"]}},"group":{"type":"string","description":"The older form: the result group whose contacts are deleted. Not together with categories.","enum":["flagged","kept","failed"]},"list":{"type":"string","description":"With group only, one list of it: for flagged a list key (tcpa, troll, dnc_complainers, federal_dnc, state_dnc, nra, other) or legacy (flagged with no list recorded), and a key it does not know matches no contact; for kept landline, voip or unknown; failed has no lists.","maxLength":64,"example":"landline"}}},"ScrubRemoveRes":{"type":"object","properties":{"operationId":{"type":"string","description":"The background deletion: GET /v1/async-operations/:operationId (async_operations_api_get_operation) follows it (scope async-operations:read)","format":"uuid"},"totalContacts":{"type":"number","description":"Always 0 in this answer: the contacts are counted after it, and the operation reports the count"},"initializing":{"type":"boolean","description":"Always true in this answer: the contacts are still being counted"}},"required":["operationId","totalContacts","initializing"]},"SendMessageDto":{"type":"object","properties":{"contactUuid":{"type":"string","description":"UUID of the contact to message (provide this OR toNumber, not both)","format":"uuid"},"toNumber":{"type":"string","description":"Phone number of the recipient (E.164 format). Provide this OR contactUuid, not both.","example":"+15551234567"},"content":{"type":"string","description":"Message content","minLength":1,"maxLength":1600},"fromNumber":{"type":"string","description":"Phone number to send from (E.164). Must be an enabled number of the account, otherwise 403.","example":"+15551234567"},"scheduledFor":{"type":"string","description":"Schedule message for future delivery (ISO 8601). A future time queues the message: the response reports status \"scheduled\" and creditsDeducted null, and credits are charged when it is sent. A time in the past sends immediately.","example":"2024-12-31T10:00:00Z"}},"required":["content","fromNumber"]},"SendMessageV2Dto":{"type":"object","properties":{"contactUuid":{"type":"string","description":"UUID of the contact to message (provide this OR toNumber, not both)","format":"uuid"},"toNumber":{"type":"string","description":"Phone number of the recipient (E.164 format). Provide this OR contactUuid, not both.","example":"+15551234567"},"content":{"type":"string","description":"Message content","minLength":1,"maxLength":1600},"fromNumber":{"type":"string","description":"Phone number to send from (E.164). Must be an enabled number of the account, otherwise 403.","example":"+15551234567"},"scheduledFor":{"type":"string","description":"Not supported on v2 — the request is refused with 400. Use `POST /v1/messages` to schedule a message.","deprecated":true},"idempotencyKey":{"type":"string","example":"3f0c9d2e-8b1a-4c55-9e2f-5d1c0a7b9e11","description":"Client-generated key that identifies this send (8-255 chars of letters, digits, \".\", \"_\", \":\" or \"-\"; a UUID is a good choice). Required unless the `Idempotency-Key` header is sent; the header wins when both are present. Repeating a request with the same key returns the same message instead of sending twice."}},"required":["content","fromNumber"]},"MessageRes":{"type":"object","properties":{"id":{"type":"number","description":"Message ID"},"conversationId":{"type":"number","description":"Conversation ID"},"contactUuid":{"type":"string","description":"Contact UUID","format":"uuid"},"content":{"type":"string","description":"Message content"},"direction":{"type":"string","description":"Message direction relative to the account. 'unknown' is emitted only for a message whose stored sender/recipient could not be resolved to either party (a failed send that never got that far).","enum":["inbound","outbound","unknown"]},"status":{"type":"string","description":"Current message status. A later carrier update never moves a message back (a late \"sent\" after \"delivered\" still reads \"delivered\"). Null when the message has no delivery history yet.","enum":["sending","sent","delivered","failed","undelivered","received","scheduled"],"nullable":true},"statusDetail":{"type":"object","description":"Status detail (reason for failure)","nullable":true},"fromNumber":{"type":"object","description":"Phone number message was sent from","nullable":true},"toNumber":{"type":"object","description":"Phone number message was sent to","nullable":true},"scheduledFor":{"type":"object","description":"Scheduled delivery time (ISO 8601)","nullable":true},"sentAt":{"type":"object","description":"When message was sent (ISO 8601)","nullable":true},"deliveredAt":{"type":"object","description":"When message was delivered (ISO 8601)","nullable":true},"createdAt":{"type":"string","description":"Creation timestamp (ISO 8601)"}},"required":["id","conversationId","contactUuid","content","direction","status","statusDetail","fromNumber","toNumber","scheduledFor","sentAt","deliveredAt","createdAt"]},"SendMessageV2Res":{"type":"object","properties":{"success":{"type":"boolean","description":"Whether the message was accepted for sending"},"message":{"description":"Message details. Always outbound. `status` is \"sending\" until the background send reports \"sent\" or \"failed\"; poll `GET /v2/messages/:id` or `GET /v2/messages/by-key/:key`, or subscribe to the message.sent / message.failed webhooks.","example":{"id":912044,"conversationId":58520059,"contactUuid":"c1c0e4d2-7b7e-4d8c-9a21-5f3e0b1c2d3e","content":"Hi Ana, your viewing is confirmed for 4pm.","direction":"outbound","status":"sending","statusDetail":null,"fromNumber":"+15125550142","toNumber":"+14155550199","scheduledFor":null,"sentAt":null,"deliveredAt":null,"createdAt":"2026-09-30T14:02:11.412Z"},"allOf":[{"$ref":"#/components/schemas/MessageRes"}]},"idempotencyKey":{"type":"string","description":"The Idempotency-Key the request was accepted under","example":"3f0c9d2e-8b1a-4c55-9e2f-5d1c0a7b9e11"},"creditsEstimated":{"type":"number","description":"Credits the send will charge when it runs","example":1},"creditsDeducted":{"type":"number","description":"Always null on v2: credits are deducted when the message is sent, not at acceptance.","nullable":true}},"required":["success","message","idempotencyKey","creditsEstimated","creditsDeducted"]},"UpdateConversationDto":{"type":"object","properties":{"isArchived":{"type":"boolean","description":"Set conversation archived status"},"isRead":{"type":"boolean","description":"Set conversation read status"}}},"BulkUpdateConversationsDto":{"type":"object","properties":{"conversationIds":{"description":"Array of conversation IDs to update","type":"array","items":{"type":"number"}},"operation":{"type":"string","description":"Operation to perform","enum":["archive","unarchive","read","unread"],"example":"archive"}},"required":["conversationIds","operation"]},"CreateCampaignDto":{"type":"object","properties":{"name":{"type":"string","description":"Campaign name","example":"Summer Outreach","minLength":1,"maxLength":255},"description":{"type":"string","description":"Campaign description","example":"Reach out to summer leads"},"type":{"type":"string","description":"Campaign type","enum":["sms","workflow"]},"message":{"type":"string","description":"Message content. Required for SMS campaigns. Not accepted for workflow campaigns, which send the text steps of their workflow: leave it out or send null (a message with text is refused with MESSAGE_NOT_FOR_WORKFLOW_CAMPAIGN). Merge fields use single braces, like {firstName}.","example":"Hi {firstName}, check out our summer deals!"},"phoneNumber":{"type":"string","description":"Phone number to send from in E.164 format (required for SMS single mode campaigns)","example":"+15551234567"},"workflowId":{"type":"number","description":"Workflow ID (required for workflow campaigns)","example":1},"scheduledStart":{"type":"string","description":"Scheduled start time (ISO 8601)","example":"2024-12-31T10:00:00Z"},"dripBatchSize":{"type":"number","description":"Number of contacts per drip batch","example":10,"minimum":1,"default":10},"dripInterval":{"type":"number","description":"Interval between drip batches","example":1},"dripIntervalUnit":{"type":"string","description":"Unit for drip interval","enum":["minutes","hours","days"]}},"required":["name","type"]},"UpdateCampaignDto":{"type":"object","properties":{"name":{"type":"string","description":"Campaign name","minLength":1,"maxLength":255},"description":{"type":"string","description":"Campaign description"},"message":{"type":"string","description":"Message content (SMS campaigns only). On a workflow campaign leave it out, send null or send back the stored value; a new message with text is refused with MESSAGE_NOT_FOR_WORKFLOW_CAMPAIGN. Merge fields use single braces, like {firstName}."},"scheduledStart":{"type":"string","description":"Scheduled start time (ISO 8601)","example":"2024-12-31T10:00:00Z"},"dripBatchSize":{"type":"number","description":"Number of contacts per drip batch","minimum":1},"dripInterval":{"type":"number","description":"Interval between drip batches"},"dripIntervalUnit":{"type":"string","description":"Unit for drip interval","enum":["minutes","hours","days"]}}},"AddContactsToCampaignDto":{"type":"object","properties":{"contactUuids":{"description":"Array of contact UUIDs to add to the campaign","example":["550e8400-e29b-41d4-a716-446655440000"],"type":"array","items":{"type":"string"}}},"required":["contactUuids"]},"BulkForwardingDto":{"type":"object","properties":{"phoneNumberIds":{"description":"Phone number IDs to update (max 100)","example":[1,2,3],"type":"array","items":{"type":"number"}},"forwardTo":{"type":"object","description":"Destination number in E.164 format, checked per number: an invalid one is listed in `failures` for each number. Pass null or an empty (or whitespace-only) string to clear forwarding for the selection","example":"+14151234567","nullable":true},"forwardToName":{"type":"object","description":"Friendly name for the forward destination","example":"Front desk","maxLength":100}},"required":["phoneNumberIds","forwardTo"]},"SetForwardingDto":{"type":"object","properties":{"forwardTo":{"type":"string","description":"Destination number in E.164 format that calls are forwarded to","example":"+14151234567"},"forwardToName":{"type":"object","description":"Friendly name for the forward destination","example":"Front desk","maxLength":100}},"required":["forwardTo"]},"WorkflowsApiErrorRes":{"type":"object","properties":{"statusCode":{"type":"number","description":"HTTP status code, repeated in the body","example":400},"error":{"type":"string","description":"A stable machine-readable reason for a business refusal (branch on this, not on the message). A malformed body answers the status text \"Bad Request\" with every problem in message[].","enum":["STEP_NOT_FOUND","TRIGGER_IS_NOT_A_STEP","UNKNOWN_STEP","DUPLICATE_STEP","STEP_TYPE_MISMATCH","FIELD_NOT_FOR_STEP_TYPE","TAG_STEP_INVALID","STEP_CONFIG_INVALID","TRIGGER_INVALID","REORDER_NOT_A_PERMUTATION","TAG_NOT_OWNED","WORKFLOW_PHONE_NUMBER_INVALID","TIME_WINDOW_INVALID","PHONE_CONFIG_UNSATISFIABLE","DUPLICATE_TAG_TRIGGER","SENTIMENT_TRIGGER_NOT_ENABLED","OPT_OUT_SUSPENDED","WORKFLOW_LIFECYCLE_IN_FLIGHT","WORKFLOW_ALREADY_PAUSED","WORKFLOW_NOT_PAUSED","STATUS_NOT_SETTABLE","CAMPAIGNS_ATTACHED","HIGH_RISK_CONTACT","HIGH_RISK_CONTACTS","MESSAGE_NOT_COMPLIANT","BRAND_REQUIRED","COMPLIANCE_UNAVAILABLE","Bad Request","Not Found","Forbidden"]},"message":{"description":"What was refused, in words (a string, or a list of problems for a malformed body). May be reworded.","oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]}},"required":["statusCode","error","message"]},"WorkflowTriggerRes":{"type":"object","properties":{"type":{"type":"string","description":"Trigger type. Writes accept tag_applied, message_sentiment, contact_starred, contact_unstarred, appointment_no_show, manual; contact_added, message_received and time_based never start a workflow and only appear on workflows built before they were retired.","enum":["tag_applied","contact_added","message_received","time_based","manual","contact_starred","contact_unstarred","appointment_no_show","message_sentiment"]},"tagId":{"type":"number","description":"tag_applied: the tag that starts the workflow","example":12},"sentiment":{"type":"string","description":"message_sentiment: the reply sentiment that starts the workflow","enum":["positive","neutral","negative"]},"minConfidence":{"type":"number","description":"message_sentiment: minimum classifier confidence (0..100)","example":70}},"required":["type"]},"WorkflowStatsRes":{"type":"object","properties":{"totalEnrolled":{"type":"number","description":"Contacts ever enrolled (lifetime)"},"active":{"type":"number","description":"Contacts currently in the workflow"},"completed":{"type":"number","description":"Contacts who finished"},"failed":{"type":"number","description":"Contacts whose run failed"},"removed":{"type":"number","description":"Contacts removed before finishing"}},"required":["totalEnrolled","active","completed","failed","removed"]},"WorkflowTimeWindowRes":{"type":"object","properties":{"enabled":{"type":"boolean","description":"Whether sending hours are enforced"},"startTime":{"type":"string","description":"Start of the sending window (HH:mm:ss, 24-hour; HH:mm accepted on write)","example":"08:00:00"},"endTime":{"type":"string","description":"End of the sending window (HH:mm:ss, 24-hour; HH:mm accepted on write)","example":"20:00:00"},"days":{"description":"Days the workflow sends on","example":["monday","tuesday","wednesday","thursday","friday"],"type":"array","items":{"type":"string"}}},"required":["enabled","startTime","endTime","days"]},"WorkflowSettingsRes":{"type":"object","properties":{"allowReentry":{"type":"boolean","description":"Whether a contact who finished may enter again"},"removeFromWorkflows":{"type":"boolean","description":"Whether enrolling removes the contact from other workflows"},"timeZone":{"type":"object","description":"Workflow timezone (US zone), or null","nullable":true},"timeWindow":{"description":"Sending hours","allOf":[{"$ref":"#/components/schemas/WorkflowTimeWindowRes"}]},"useContactTimezone":{"type":"boolean","description":"When on, each contact's own timezone is used for the sending hours and the workflow's timezone only for contacts without one. Applies only to accounts that have the contact-timezone feature; otherwise the workflow's timezone is used for everyone."}},"required":["allowReentry","removeFromWorkflows","timeZone","timeWindow","useContactTimezone"]},"WorkflowPhoneConfigRes":{"type":"object","properties":{"mode":{"type":"string","description":"How a sending number is chosen: single (defaultPhoneNumberId), pool (poolPhoneNumberIds, rotated), existing (the number that last texted the contact)","enum":["single","pool","existing"]},"defaultPhoneNumberId":{"type":"number","description":"The number used in single mode","nullable":true},"fallbackMode":{"type":"string","description":"In existing mode, how contacts never texted before get a number","enum":["single","pool"]},"fallbackPhoneNumberId":{"type":"number","description":"The number used when fallbackMode is single","nullable":true},"poolRotationEnabled":{"type":"boolean","description":"Whether the pool rotates between its numbers"},"poolRotationThreshold":{"type":"number","description":"Messages a pool number sends before the next one takes over (1..200)"},"poolPhoneNumberIds":{"description":"The pool, in rotation order (ids from GET /v1/phone-numbers). A workflow can use any of the account's enabled numbers, whichever provider account each one is on; the provider_mismatch problem is no longer returned.","type":"array","items":{"type":"number"}}},"required":["mode","defaultPhoneNumberId","fallbackMode","fallbackPhoneNumberId","poolRotationEnabled","poolRotationThreshold","poolPhoneNumberIds"]},"WorkflowRes":{"type":"object","properties":{"id":{"type":"number","description":"Workflow ID"},"name":{"type":"string","description":"Workflow name"},"description":{"type":"object","description":"Workflow description","nullable":true},"status":{"type":"string","description":"Effective workflow status: whether it is published (draft or active), with \"paused\" for a published workflow that is paused. A draft is always \"draft\", even when its contacts are paused: see lifecycleState. Pause and activate are asynchronous: the status flips as soon as the request is accepted, while the enrollment/task sweep finishes in the background — see lifecycleState.","enum":["draft","active","paused","completed","failed"]},"lifecycleState":{"type":"string","description":"Pause/resume lifecycle state: whether the contacts in the workflow are moving or paused, apart from status. A published workflow taken back to draft pauses its contacts, so it shows status \"draft\" with lifecycleState \"paused\"; publishing it again (status \"active\") resumes them. \"pausing\" / \"resuming\" mean a background operation is still applying the change; status is eventually consistent with it. On every read: poll GET /v1/workflows/:id until it leaves pausing/resuming before the next pause, resume or status change (those answer 409 WORKFLOW_LIFECYCLE_IN_FLIGHT meanwhile).","enum":["active","pausing","paused","resuming"]},"operationId":{"type":"string","description":"Id of the background operation applying a pause or activate. Poll GET /v1/async-operations/:id to follow it to completion.","format":"uuid"},"triggerType":{"type":"string","description":"Trigger type (trigger.type); null when the workflow has no trigger","enum":["tag_applied","contact_added","message_received","time_based","manual","contact_starred","contact_unstarred","appointment_no_show","message_sentiment"],"nullable":true},"trigger":{"description":"What starts the workflow, in the shape a write accepts; null when the workflow has no trigger","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/WorkflowTriggerRes"}]},"stats":{"description":"Enrollment statistics","allOf":[{"$ref":"#/components/schemas/WorkflowStatsRes"}]},"settings":{"description":"Workflow settings","allOf":[{"$ref":"#/components/schemas/WorkflowSettingsRes"}]},"phoneConfig":{"description":"Sending numbers. A contact is given a sending number the first time the workflow texts them and keeps it. Changing the numbers affects only contacts who have not been texted yet. Removing a number from the pool does not move the contacts already using it. \"existing\" mode texts a contact from the number that last texted them, falling back to the fallback number or pool for contacts never texted before.","allOf":[{"$ref":"#/components/schemas/WorkflowPhoneConfigRes"}]},"createdAt":{"type":"string","description":"Creation timestamp (ISO 8601)"},"updatedAt":{"type":"string","description":"Last update timestamp (ISO 8601)"}},"required":["id","name","description","status","triggerType","trigger","stats","settings","phoneConfig","createdAt","updatedAt"]},"PaginationMetadataRes":{"type":"object","properties":{"totalPages":{"type":"number","description":"Number of pages"},"totalItems":{"type":"number","description":"Number of items across every page"},"itemsPerPage":{"type":"number","description":"Items per page (take)"},"currentPage":{"type":"number","description":"This page (1-based)"}},"required":["totalPages","totalItems","itemsPerPage","currentPage"]},"WorkflowListRes":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/WorkflowRes"}},"metadata":{"$ref":"#/components/schemas/PaginationMetadataRes"}},"required":["rows","metadata"]},"WorkflowTriggerConfigRes":{"type":"object","properties":{"tagId":{"type":"number","description":"tag_applied: the tag that starts the workflow","example":12},"sentiment":{"type":"string","description":"message_sentiment: the reply sentiment that starts the workflow","enum":["positive","neutral","negative"]},"minConfidence":{"type":"number","description":"message_sentiment: minimum classifier confidence (0..100)","example":70}}},"WorkflowTriggerStepConfigRes":{"type":"object","properties":{"triggerType":{"type":"string","description":"Trigger type","enum":["tag_applied","contact_added","message_received","time_based","manual","contact_starred","contact_unstarred","appointment_no_show","message_sentiment"]},"config":{"description":"Trigger settings","allOf":[{"$ref":"#/components/schemas/WorkflowTriggerConfigRes"}]}},"required":["triggerType","config"]},"WorkflowMediaRes":{"type":"object","properties":{"mediaUrl":{"type":"string","description":"Public URL of the image, as handed out by the app upload","example":"https://bucket.s3.us-east-1.amazonaws.com/mms/12/photo.png"},"contentType":{"type":"string","description":"Content type","enum":["image/jpeg","image/png","image/gif","image/webp"]},"fileName":{"type":"string","description":"File name shown in the app","example":"photo.png"}},"required":["mediaUrl","contentType","fileName"]},"WorkflowMessageVariantRes":{"type":"object","properties":{"id":{"type":"string","description":"Variant id (permanent)","format":"uuid"},"letter":{"type":"string","description":"Variant letter","enum":["A","B","C","D","E"]},"nickname":{"type":"string","description":"Optional label the app shows for this variant"},"body":{"type":"string","description":"Message text (may be empty when the variant has images)"},"weightPercent":{"type":"number","description":"Share of sends this variant receives (0..100), or null for an even split","nullable":true},"media":{"description":"Images of this variant. Images are URLs handed out by the app's upload; they are dropped from the saved step unless picture messaging is enabled for the account.","type":"array","items":{"$ref":"#/components/schemas/WorkflowMediaRes"}}},"required":["id","letter","nickname","body","weightPercent"]},"WorkflowSendSmsStepConfigRes":{"type":"object","properties":{"message":{"type":"string","description":"Message text (variant A)"},"actionName":{"type":"string","description":"Step label shown in the app"},"testNumber":{"type":"string","description":"Number the app sends a test to"},"cancelOnReply":{"type":"boolean","description":"Whether a reply from the contact ends their run (default true)"},"variants":{"description":"Message variants A..E with their weights and images. Absent when the step has only its message text.","type":"array","items":{"$ref":"#/components/schemas/WorkflowMessageVariantRes"}},"followUpMessage":{"type":"string","description":"Follow-up message: what contacts who already have a conversation with this number receive instead of message. Absent when empty."},"followUpVariants":{"description":"Variants of the follow-up message","type":"array","items":{"$ref":"#/components/schemas/WorkflowMessageVariantRes"}},"useFollowUpForExistingConversations":{"type":"boolean","description":"Whether contacts with an existing conversation get the follow-up message instead of message. Honoured on every text step."}},"required":["message"]},"WorkflowWaitStepConfigRes":{"type":"object","properties":{"actionName":{"type":"string","description":"Step label shown in the app"},"waitAmount":{"type":"number","description":"How long to wait","example":2},"waitUnit":{"type":"string","description":"Unit of waitAmount","enum":["minutes","hours","days"]},"businessDaysOnly":{"type":"boolean","description":"Count business days only"},"jitterMinutes":{"type":"number","description":"Random extra delay added to the wait, in minutes (0..1440)"}},"required":["waitAmount","waitUnit"]},"WorkflowTagStepConfigRes":{"type":"object","properties":{"addTagIds":{"description":"Tags added to the contact","type":"array","items":{"type":"number"}},"removeTagIds":{"description":"Tags removed from the contact","type":"array","items":{"type":"number"}}},"required":["addTagIds","removeTagIds"]},"WorkflowStepRes":{"type":"object","properties":{"nodeId":{"type":"string","description":"Node ID (permanent)"},"type":{"type":"string","description":"Node type","enum":["trigger","sendSms","wait","tag"]},"name":{"type":"object","description":"Node name","nullable":true},"order":{"type":"number","description":"Step order in the workflow (0-based)"},"config":{"description":"Type-specific configuration: the trigger settings for a trigger step, the message with its variants and follow-up for a sendSms step, the delay for a wait step, the tag ids for a tag step.","anyOf":[{"$ref":"#/components/schemas/WorkflowTriggerStepConfigRes"},{"$ref":"#/components/schemas/WorkflowSendSmsStepConfigRes"},{"$ref":"#/components/schemas/WorkflowWaitStepConfigRes"},{"$ref":"#/components/schemas/WorkflowTagStepConfigRes"}],"examples":{"trigger":{"triggerType":"tag_applied","config":{"tagId":12}},"sendSms":{"message":"Hi {firstName}, thanks for reaching out!","cancelOnReply":true,"useFollowUpForExistingConversations":false},"wait":{"waitAmount":2,"waitUnit":"days","businessDaysOnly":false,"jitterMinutes":0},"tag":{"addTagIds":[12],"removeTagIds":[]}}}},"required":["nodeId","type","name","order","config"]},"ComplianceReportIssueRes":{"type":"object","properties":{"nodeId":{"type":"object","description":"The workflow step (nodeId) the text belongs to; null for a campaign","nullable":true},"variant":{"type":"string","description":"The variant letter of the text","example":"A"},"body":{"type":"string","description":"The text that was checked"},"reasons":{"description":"Why the text does not pass","type":"array","items":{"type":"string"}},"suggestions":{"description":"How to fix it","type":"array","items":{"type":"string"}}},"required":["nodeId","variant","body","reasons","suggestions"]},"ComplianceReportRes":{"type":"object","properties":{"status":{"type":"string","description":"compliant: the first message passes. issues: it does not pass; going live for the first time, and a change of a first message that is already live, are refused (422 MESSAGE_NOT_COMPLIANT) until it does. unchecked: the check could not run now; it runs when the item goes live.","enum":["compliant","issues","unchecked"]},"message":{"type":"string","description":"The status in words. With issues, every reason and suggestion on its own line."},"issues":{"description":"One entry per text that does not pass; empty unless status is issues","type":"array","items":{"$ref":"#/components/schemas/ComplianceReportIssueRes"}}},"required":["status","message","issues"]},"WorkflowDetailRes":{"type":"object","properties":{"id":{"type":"number","description":"Workflow ID"},"name":{"type":"string","description":"Workflow name"},"description":{"type":"object","description":"Workflow description","nullable":true},"status":{"type":"string","description":"Effective workflow status: whether it is published (draft or active), with \"paused\" for a published workflow that is paused. A draft is always \"draft\", even when its contacts are paused: see lifecycleState. Pause and activate are asynchronous: the status flips as soon as the request is accepted, while the enrollment/task sweep finishes in the background — see lifecycleState.","enum":["draft","active","paused","completed","failed"]},"lifecycleState":{"type":"string","description":"Pause/resume lifecycle state: whether the contacts in the workflow are moving or paused, apart from status. A published workflow taken back to draft pauses its contacts, so it shows status \"draft\" with lifecycleState \"paused\"; publishing it again (status \"active\") resumes them. \"pausing\" / \"resuming\" mean a background operation is still applying the change; status is eventually consistent with it. On every read: poll GET /v1/workflows/:id until it leaves pausing/resuming before the next pause, resume or status change (those answer 409 WORKFLOW_LIFECYCLE_IN_FLIGHT meanwhile).","enum":["active","pausing","paused","resuming"]},"operationId":{"type":"string","description":"Id of the background operation applying a pause or activate. Poll GET /v1/async-operations/:id to follow it to completion.","format":"uuid"},"triggerType":{"type":"string","description":"Trigger type (trigger.type); null when the workflow has no trigger","enum":["tag_applied","contact_added","message_received","time_based","manual","contact_starred","contact_unstarred","appointment_no_show","message_sentiment"],"nullable":true},"trigger":{"description":"What starts the workflow, in the shape a write accepts; null when the workflow has no trigger","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/WorkflowTriggerRes"}]},"stats":{"description":"Enrollment statistics","allOf":[{"$ref":"#/components/schemas/WorkflowStatsRes"}]},"settings":{"description":"Workflow settings","allOf":[{"$ref":"#/components/schemas/WorkflowSettingsRes"}]},"phoneConfig":{"description":"Sending numbers. A contact is given a sending number the first time the workflow texts them and keeps it. Changing the numbers affects only contacts who have not been texted yet. Removing a number from the pool does not move the contacts already using it. \"existing\" mode texts a contact from the number that last texted them, falling back to the fallback number or pool for contacts never texted before.","allOf":[{"$ref":"#/components/schemas/WorkflowPhoneConfigRes"}]},"createdAt":{"type":"string","description":"Creation timestamp (ISO 8601)"},"updatedAt":{"type":"string","description":"Last update timestamp (ISO 8601)"},"steps":{"description":"The trigger first (order 0), then every step in running order. Sent back as steps on PATCH, the trigger entry is ignored and the rest describes the chain.","type":"array","items":{"$ref":"#/components/schemas/WorkflowStepRes"}},"compliance":{"description":"The compliance check of the saved first message. Only in the reply of a save (create, update, step changes), and only when the server compliance check is on for the account. A save that does not go live is never refused: read this field to learn whether going live will be.","allOf":[{"$ref":"#/components/schemas/ComplianceReportRes"}]}},"required":["id","name","description","status","triggerType","trigger","stats","settings","phoneConfig","createdAt","updatedAt","steps"]},"WorkflowTriggerDto":{"type":"object","properties":{"type":{"type":"string","description":"What starts the workflow. tag_applied needs tagId; message_sentiment needs sentiment (and minConfidence, default 70); contact_starred, contact_unstarred, appointment_no_show and manual take no setting.","enum":["tag_applied","message_sentiment","contact_starred","contact_unstarred","appointment_no_show","manual"]},"tagId":{"type":"number","description":"tag_applied only: the tag (GET /v1/tags) that starts the workflow. A tag can start only one workflow per account.","example":12},"sentiment":{"type":"string","description":"message_sentiment only: the reply sentiment that starts the workflow","enum":["positive","neutral","negative"]},"minConfidence":{"type":"number","description":"message_sentiment only: minimum classifier confidence, 0..100 (default 70)","example":70}},"required":["type"]},"WorkflowMessageVariantDto":{"type":"object","properties":{"id":{"type":"string","description":"The id of an existing variant to keep (from GET). Omit for a new variant. On an edit, a stored variant whose id is not sent is archived.","format":"uuid"},"letter":{"type":"string","description":"Variant letter, unique within the list","enum":["A","B","C","D","E"]},"nickname":{"type":"string","description":"Label shown in the app (default \"\")","maxLength":80},"body":{"type":"string","description":"Message text. May be empty when the variant carries an image.","maxLength":1600},"weightPercent":{"type":"number","description":"Share of sends (0..100). Either every variant sets one and they sum to 100, or none does (default null: even split).","nullable":true},"media":{"type":"array","description":"Up to 10 images. Images are URLs handed out by the app's upload; they are dropped from the saved step unless picture messaging is enabled for the account.","items":{"type":"object","required":["mediaUrl","contentType","fileName"],"properties":{"mediaUrl":{"type":"string","description":"https URL the app upload handed out for this account"},"contentType":{"type":"string","enum":["image/jpeg","image/png","image/gif","image/webp"]},"fileName":{"type":"string","maxLength":255}}}}},"required":["letter","body"]},"WorkflowSendSmsConfigDto":{"type":"object","properties":{"message":{"type":"string","description":"The message text (variant A). Required on a new step unless variants is sent; when both are sent, variants wins. On an edit, message alone rewrites variant A and keeps the other variants.","maxLength":1600},"variants":{"description":"The full list of message variants (1..5, unique letters). On an edit it replaces the active list: variants sent with their id are kept, the rest are archived.","type":"array","items":{"$ref":"#/components/schemas/WorkflowMessageVariantDto"}},"followUpMessage":{"type":"string","description":"The follow-up message contacts who already have a conversation with this number receive instead of message (see useFollowUpForExistingConversations).","maxLength":1600},"followUpVariants":{"description":"Variants of the follow-up message; same rules as variants","type":"array","items":{"$ref":"#/components/schemas/WorkflowMessageVariantDto"}},"useFollowUpForExistingConversations":{"type":"boolean","description":"Send the follow-up message to contacts who already have a conversation with the sending number (default false). Honoured on every text step."},"cancelOnReply":{"type":"boolean","description":"A reply from the contact ends their run (default true)"},"actionName":{"type":"string","description":"The label shown on the step (default: the step name)","maxLength":255}}},"WorkflowWaitConfigDto":{"type":"object","properties":{"waitAmount":{"type":"number","description":"How long to wait (1..365); required on a new wait step","example":2},"waitUnit":{"type":"string","description":"Unit of waitAmount; required on a new wait step","enum":["minutes","hours","days"]},"businessDaysOnly":{"type":"boolean","description":"Count business days only (default false)"},"jitterMinutes":{"type":"number","description":"Random extra delay in minutes, 0..1440 (default 0)"},"actionName":{"type":"string","description":"The label shown on the step (default: the step name)","maxLength":255}}},"WorkflowTagConfigDto":{"type":"object","properties":{"addTagIds":{"description":"Tags (GET /v1/tags) added to the contact (default []). A tag step needs at least one tag across addTagIds and removeTagIds, and a tag cannot be in both.","type":"array","items":{"type":"number"}},"removeTagIds":{"description":"Tags removed from the contact (default [])","type":"array","items":{"type":"number"}}}},"WorkflowStepInputDto":{"type":"object","properties":{"name":{"type":"string","description":"Step name shown in the app (default: \"Send SMS\", \"Wait\", \"Tags\")","maxLength":255,"nullable":true},"config":{"description":"Type-specific settings, the same keys GET returns: message, variants and the follow-up fields for sendSms; waitAmount and waitUnit for wait; addTagIds and removeTagIds for tag. A key of another type is refused (FIELD_NOT_FOR_STEP_TYPE). For a type \"trigger\" entry: { triggerType, config } as GET lists it.","anyOf":[{"$ref":"#/components/schemas/WorkflowSendSmsConfigDto"},{"$ref":"#/components/schemas/WorkflowWaitConfigDto"},{"$ref":"#/components/schemas/WorkflowTagConfigDto"}],"examples":{"sendSms":{"message":"Hi {firstName}, thanks for reaching out!","cancelOnReply":true},"wait":{"waitAmount":2,"waitUnit":"days"},"tag":{"addTagIds":[12]}}},"type":{"type":"string","description":"Step type. A \"trigger\" entry (as GET lists at steps[0]) is accepted and never counted as a step: it is the trigger when top-level trigger is absent.","enum":["trigger","sendSms","wait","tag"]},"nodeId":{"type":"string","description":"The permanent id of an existing step (from GET). On PATCH a step sent with its nodeId is kept, with its contacts and every setting the body does not change; a step without one is new; a stored step not listed is deleted. On POST no step exists yet, so a nodeId is refused (UNKNOWN_STEP).","maxLength":64},"order":{"type":"object","description":"Read-only position GET reports; accepted and ignored on write"}},"required":["config","type"]},"WorkflowTimeWindowInputDto":{"type":"object","properties":{"enabled":{"type":"boolean","description":"Enforce the sending hours (default true)"},"startTime":{"type":"string","description":"Start of the sending window, HH:mm 24-hour, before endTime (default 08:00)","example":"08:00"},"endTime":{"type":"string","description":"End of the sending window, HH:mm 24-hour (default 20:00)","example":"20:00"},"days":{"type":"array","description":"Days the workflow sends on (default: every day)","items":{"type":"string","enum":["sunday","monday","tuesday","wednesday","thursday","friday","saturday"]}}}},"WorkflowSettingsInputDto":{"type":"object","properties":{"allowReentry":{"type":"boolean","description":"Let a contact who finished enter again (default false)"},"removeFromWorkflows":{"type":"boolean","description":"Enrolling removes the contact from other workflows (default true)"},"useContactTimezone":{"type":"boolean","description":"Default false. When on, each contact's own timezone is used for the sending hours and the workflow's timezone only for contacts without one. Applies only to accounts that have the contact-timezone feature; otherwise the workflow's timezone is used for everyone."},"timeZone":{"type":"string","description":"Workflow timezone, a US zone (default null); null clears it","enum":["America/New_York","America/Chicago","America/Denver","America/Phoenix","America/Los_Angeles","America/Anchorage","Pacific/Honolulu"],"nullable":true},"timeWindow":{"description":"Sending hours. Sending hours apply to messages not yet scheduled. A message already waiting for its sending slot may go out at the time it was given, even if you make the hours narrower later; narrowing never moves a message earlier. Switching sending hours on without a timezone uses US Eastern Time unless the workflow already has one.","allOf":[{"$ref":"#/components/schemas/WorkflowTimeWindowInputDto"}]}}},"WorkflowPhoneConfigInputDto":{"type":"object","properties":{"mode":{"type":"string","description":"single: defaultPhoneNumberId sends everything; pool: poolPhoneNumberIds rotate; existing: the number that last texted the contact, with fallbackMode for contacts never texted before. Default single.","enum":["single","pool","existing"]},"defaultPhoneNumberId":{"type":"number","description":"The number (GET /v1/phone-numbers) used in single mode (default null); null clears it","nullable":true},"fallbackMode":{"type":"string","description":"existing mode: how a contact never texted before gets a number (default single)","enum":["single","pool"]},"fallbackPhoneNumberId":{"type":"number","description":"The number used when fallbackMode is single (default null); null clears it","nullable":true},"poolRotationEnabled":{"type":"boolean","description":"Rotate between the pool numbers (default true)"},"poolRotationThreshold":{"type":"number","description":"Messages a pool number sends before the next takes over, 1..200 (default 1)"},"poolPhoneNumberIds":{"description":"The pool, in rotation order (default []). Omitted: untouched; []: emptied; a list: the pool becomes exactly that list in that order. Each number must be the account's, enabled and linked to a 10DLC campaign. A workflow can use any of the account's enabled numbers, whichever provider account each one is on; the provider_mismatch problem is no longer returned.","type":"array","items":{"type":"number"}}}},"CreateWorkflowDto":{"type":"object","properties":{"name":{"type":"string","description":"Workflow name","minLength":1,"maxLength":255},"description":{"type":"string","description":"Workflow description","nullable":true},"status":{"type":"string","description":"draft or active. active publishes the workflow (it needs a usable sending number and an account in good standing); on an existing workflow, draft takes a published workflow back to draft and pauses its contacts. Default draft.","enum":["draft","active"]},"trigger":{"description":"What starts the workflow. Required unless steps carries a type \"trigger\" entry.","allOf":[{"$ref":"#/components/schemas/WorkflowTriggerDto"}]},"steps":{"description":"The steps in running order (up to 100). A type \"trigger\" entry, as GET lists at steps[0], is the trigger when top-level trigger is absent and is never counted as a step. A workflow with no steps is a valid draft.","type":"array","items":{"$ref":"#/components/schemas/WorkflowStepInputDto"}},"settings":{"description":"Settings. Sending hours apply to messages not yet scheduled. A message already waiting for its sending slot may go out at the time it was given, even if you make the hours narrower later; narrowing never moves a message earlier. Switching sending hours on without a timezone uses US Eastern Time unless the workflow already has one.","allOf":[{"$ref":"#/components/schemas/WorkflowSettingsInputDto"}]},"phoneConfig":{"description":"Sending numbers. A contact is given a sending number the first time the workflow texts them and keeps it. Changing the numbers affects only contacts who have not been texted yet. Removing a number from the pool does not move the contacts already using it. \"existing\" mode texts a contact from the number that last texted them, falling back to the fallback number or pool for contacts never texted before. A workflow can use any of the account's enabled numbers, whichever provider account each one is on; the provider_mismatch problem is no longer returned.","allOf":[{"$ref":"#/components/schemas/WorkflowPhoneConfigInputDto"}]}},"required":["name"]},"MergeFieldWarningRes":{"type":"object","properties":{"field":{"type":"string","description":"Where the text is in the request, for example config.message","example":"config.message"},"token":{"type":"string","description":"The token as written in the text","example":"{{firstName}}"},"kind":{"type":"string","description":"double_braces: {{name}} or {name}}; unclosed_brace: a \"{\" with no \"}\" before the next \"{\"; unknown_field: not a standard or custom contact field.","enum":["double_braces","unclosed_brace","unknown_field"]},"reason":{"type":"string","description":"What happens to the token when the text is sent","example":"Double braces are not a merge field. The token is removed when the text is sent, and each extra \"}\" is sent as text."},"hint":{"type":"string","description":"How to fix it","example":"Use single braces: {firstName}."}},"required":["field","token","kind","reason","hint"]},"WorkflowWriteRes":{"type":"object","properties":{"id":{"type":"number","description":"Workflow ID"},"name":{"type":"string","description":"Workflow name"},"description":{"type":"object","description":"Workflow description","nullable":true},"status":{"type":"string","description":"Effective workflow status: whether it is published (draft or active), with \"paused\" for a published workflow that is paused. A draft is always \"draft\", even when its contacts are paused: see lifecycleState. Pause and activate are asynchronous: the status flips as soon as the request is accepted, while the enrollment/task sweep finishes in the background — see lifecycleState.","enum":["draft","active","paused","completed","failed"]},"lifecycleState":{"type":"string","description":"Pause/resume lifecycle state: whether the contacts in the workflow are moving or paused, apart from status. A published workflow taken back to draft pauses its contacts, so it shows status \"draft\" with lifecycleState \"paused\"; publishing it again (status \"active\") resumes them. \"pausing\" / \"resuming\" mean a background operation is still applying the change; status is eventually consistent with it. On every read: poll GET /v1/workflows/:id until it leaves pausing/resuming before the next pause, resume or status change (those answer 409 WORKFLOW_LIFECYCLE_IN_FLIGHT meanwhile).","enum":["active","pausing","paused","resuming"]},"operationId":{"type":"string","description":"Id of the background operation applying a pause or activate. Poll GET /v1/async-operations/:id to follow it to completion.","format":"uuid"},"triggerType":{"type":"string","description":"Trigger type (trigger.type); null when the workflow has no trigger","enum":["tag_applied","contact_added","message_received","time_based","manual","contact_starred","contact_unstarred","appointment_no_show","message_sentiment"],"nullable":true},"trigger":{"description":"What starts the workflow, in the shape a write accepts; null when the workflow has no trigger","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/WorkflowTriggerRes"}]},"stats":{"description":"Enrollment statistics","allOf":[{"$ref":"#/components/schemas/WorkflowStatsRes"}]},"settings":{"description":"Workflow settings","allOf":[{"$ref":"#/components/schemas/WorkflowSettingsRes"}]},"phoneConfig":{"description":"Sending numbers. A contact is given a sending number the first time the workflow texts them and keeps it. Changing the numbers affects only contacts who have not been texted yet. Removing a number from the pool does not move the contacts already using it. \"existing\" mode texts a contact from the number that last texted them, falling back to the fallback number or pool for contacts never texted before.","allOf":[{"$ref":"#/components/schemas/WorkflowPhoneConfigRes"}]},"createdAt":{"type":"string","description":"Creation timestamp (ISO 8601)"},"updatedAt":{"type":"string","description":"Last update timestamp (ISO 8601)"},"steps":{"description":"The trigger first (order 0), then every step in running order. Sent back as steps on PATCH, the trigger entry is ignored and the rest describes the chain.","type":"array","items":{"$ref":"#/components/schemas/WorkflowStepRes"}},"compliance":{"description":"The compliance check of the saved first message. Only in the reply of a save (create, update, step changes), and only when the server compliance check is on for the account. A save that does not go live is never refused: read this field to learn whether going live will be.","allOf":[{"$ref":"#/components/schemas/ComplianceReportRes"}]},"mergeFieldWarnings":{"description":"Merge fields in the texts of this request that will not be filled as written: double braces such as {{firstName}}, a \"{\" with no \"}\", or a name that is not a contact field of this account. A warning only: the write was saved. Present only when at least one is found. For the step texts sent.","type":"array","items":{"$ref":"#/components/schemas/MergeFieldWarningRes"}}},"required":["id","name","description","status","triggerType","trigger","stats","settings","phoneConfig","createdAt","updatedAt","steps"]},"UpdateWorkflowDto":{"type":"object","properties":{"name":{"type":"string","description":"Workflow name (never null)","minLength":1,"maxLength":255},"description":{"type":"string","description":"Workflow description; null clears it","nullable":true},"status":{"type":"string","description":"draft or active. active publishes the workflow (it needs a usable sending number and an account in good standing); on an existing workflow, draft takes a published workflow back to draft and pauses its contacts. paused is accepted only as GET reported it (a no-op); setting it otherwise is STATUS_NOT_SETTABLE: use POST :id/pause.","enum":["draft","active","paused"]},"trigger":{"description":"Replaces the trigger. Without steps, every step keeps its nodeId.","allOf":[{"$ref":"#/components/schemas/WorkflowTriggerDto"}]},"steps":{"description":"The steps in running order (up to 100). A type \"trigger\" entry, as GET lists at steps[0], is the trigger when top-level trigger is absent and is never counted as a step. Present: the chain becomes exactly this list (a step with its nodeId is kept with its contacts, a stored step not listed is deleted). Absent: the steps are untouched.","type":"array","items":{"$ref":"#/components/schemas/WorkflowStepInputDto"}},"settings":{"description":"Settings. Sending hours apply to messages not yet scheduled. A message already waiting for its sending slot may go out at the time it was given, even if you make the hours narrower later; narrowing never moves a message earlier. Switching sending hours on without a timezone uses US Eastern Time unless the workflow already has one. Omitted keys are unchanged.","allOf":[{"$ref":"#/components/schemas/WorkflowSettingsInputDto"}]},"phoneConfig":{"description":"Sending numbers. A contact is given a sending number the first time the workflow texts them and keeps it. Changing the numbers affects only contacts who have not been texted yet. Removing a number from the pool does not move the contacts already using it. \"existing\" mode texts a contact from the number that last texted them, falling back to the fallback number or pool for contacts never texted before. A workflow can use any of the account's enabled numbers, whichever provider account each one is on; the provider_mismatch problem is no longer returned. Omitted keys are unchanged.","allOf":[{"$ref":"#/components/schemas/WorkflowPhoneConfigInputDto"}]}}},"InsertWorkflowStepDto":{"type":"object","properties":{"name":{"type":"string","description":"Step name shown in the app (default: \"Send SMS\", \"Wait\", \"Tags\")","maxLength":255,"nullable":true},"config":{"description":"Type-specific settings, the same keys GET returns: message, variants and the follow-up fields for sendSms; waitAmount and waitUnit for wait; addTagIds and removeTagIds for tag. A key of another type is refused (FIELD_NOT_FOR_STEP_TYPE). For a type \"trigger\" entry: { triggerType, config } as GET lists it.","anyOf":[{"$ref":"#/components/schemas/WorkflowSendSmsConfigDto"},{"$ref":"#/components/schemas/WorkflowWaitConfigDto"},{"$ref":"#/components/schemas/WorkflowTagConfigDto"}],"examples":{"sendSms":{"message":"Hi {firstName}, thanks for reaching out!","cancelOnReply":true},"wait":{"waitAmount":2,"waitUnit":"days"},"tag":{"addTagIds":[12]}}},"type":{"type":"string","description":"Step type","enum":["sendSms","wait","tag"]},"afterNodeId":{"type":"string","description":"Where the step goes: after this step (its nodeId), first when it is the trigger's nodeId (steps[0] of GET), or last when omitted. An id that is not a step is refused (UNKNOWN_STEP).","maxLength":64}},"required":["config","type"]},"WorkflowStepWriteRes":{"type":"object","properties":{"nodeId":{"type":"string","description":"Node ID (permanent)"},"type":{"type":"string","description":"Node type","enum":["trigger","sendSms","wait","tag"]},"name":{"type":"object","description":"Node name","nullable":true},"order":{"type":"number","description":"Step order in the workflow (0-based)"},"config":{"description":"Type-specific configuration: the trigger settings for a trigger step, the message with its variants and follow-up for a sendSms step, the delay for a wait step, the tag ids for a tag step.","anyOf":[{"$ref":"#/components/schemas/WorkflowTriggerStepConfigRes"},{"$ref":"#/components/schemas/WorkflowSendSmsStepConfigRes"},{"$ref":"#/components/schemas/WorkflowWaitStepConfigRes"},{"$ref":"#/components/schemas/WorkflowTagStepConfigRes"}],"examples":{"trigger":{"triggerType":"tag_applied","config":{"tagId":12}},"sendSms":{"message":"Hi {firstName}, thanks for reaching out!","cancelOnReply":true,"useFollowUpForExistingConversations":false},"wait":{"waitAmount":2,"waitUnit":"days","businessDaysOnly":false,"jitterMinutes":0},"tag":{"addTagIds":[12],"removeTagIds":[]}}},"compliance":{"description":"The compliance check of the saved first message. Only in the reply of a save (create, update, step changes), and only when the server compliance check is on for the account. A save that does not go live is never refused: read this field to learn whether going live will be. It is about the workflow's first message, which this step may or may not be.","allOf":[{"$ref":"#/components/schemas/ComplianceReportRes"}]},"mergeFieldWarnings":{"description":"Merge fields in the texts of this request that will not be filled as written: double braces such as {{firstName}}, a \"{\" with no \"}\", or a name that is not a contact field of this account. A warning only: the write was saved. Present only when at least one is found. For the texts of config sent in this call.","type":"array","items":{"$ref":"#/components/schemas/MergeFieldWarningRes"}}},"required":["nodeId","type","name","order","config"]},"ReorderWorkflowStepsDto":{"type":"object","properties":{"nodeIds":{"description":"Every step of the workflow exactly once, in the new order. The trigger stays first and is not listed.","example":["0f2b7a3e-1111-4222-8333-444455556666","9a8b7c6d-2222-4333-8444-555566667777"],"type":"array","items":{"type":"string"}}},"required":["nodeIds"]},"UpdateWorkflowStepDto":{"type":"object","properties":{"name":{"type":"string","description":"Step name shown in the app","maxLength":255},"config":{"description":"The fields to change; everything else is kept. Step changes apply to contacts who enter afterwards; a contact already in the workflow may finish on the steps that were there when they entered. Changing a message text applies to everyone.","anyOf":[{"$ref":"#/components/schemas/WorkflowSendSmsConfigDto"},{"$ref":"#/components/schemas/WorkflowWaitConfigDto"},{"$ref":"#/components/schemas/WorkflowTagConfigDto"}]}}},"WorkflowEnrollmentRes":{"type":"object","properties":{"id":{"type":"number","description":"Enrollment ID"},"contactUuid":{"type":"string","description":"Contact UUID","format":"uuid"},"firstName":{"type":"object","description":"Contact first name","nullable":true},"lastName":{"type":"object","description":"Contact last name","nullable":true},"phoneNumber":{"type":"object","description":"Contact phone number","nullable":true},"status":{"type":"string","description":"Enrollment status","enum":["active","paused","completed","failed","removed"]},"currentNodeId":{"type":"object","description":"Current node ID in the workflow","nullable":true},"enrolledAt":{"type":"string","description":"When the contact was enrolled (ISO 8601)","nullable":true},"completedAt":{"type":"string","description":"When the enrollment completed (ISO 8601)","nullable":true},"failedReason":{"type":"object","description":"Reason for failure","nullable":true}},"required":["id","contactUuid","firstName","lastName","phoneNumber","status","currentNodeId","enrolledAt","completedAt","failedReason"]},"WorkflowEnrollmentListRes":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/WorkflowEnrollmentRes"}},"metadata":{"$ref":"#/components/schemas/PaginationMetadataRes"}},"required":["rows","metadata"]},"EnrollContactDto":{"type":"object","properties":{"contactUuid":{"type":"string","description":"UUID of the contact to enroll. Send exactly one of contactUuid or phoneNumber.","format":"uuid","example":"550e8400-e29b-41d4-a716-446655440000"},"phoneNumber":{"type":"string","description":"Phone number of the contact to enroll, in E.164 format (other US formats such as \"(555) 123-4567\" are changed to E.164 first). The contact must already exist in the account: no contact is created. Send exactly one of contactUuid or phoneNumber.","example":"+15551234567","maxLength":20}}},"EnrollContactErrorRes":{"type":"object","properties":{"contactId":{"type":"number","description":"The contact the reason is about"},"reason":{"type":"string","description":"Why the contact was skipped"}},"required":["contactId","reason"]},"EnrollContactsResultRes":{"type":"object","properties":{"enrolled":{"type":"number","description":"Number of contacts successfully enrolled"},"skipped":{"type":"number","description":"Number of contacts skipped (already enrolled, etc.)"},"errors":{"description":"Errors encountered during enrollment","type":"array","items":{"$ref":"#/components/schemas/EnrollContactErrorRes"}},"enrollmentId":{"type":"number","description":"Single enroll only. The id of the enrollment this call created. When the contact is skipped because it is already in the workflow (active or paused), the id of that existing enrollment. Not sent for other skips and never sent by bulk enroll.","example":12345}},"required":["enrolled","skipped","errors"]},"BulkEnrollContactsDto":{"type":"object","properties":{"contactUuids":{"description":"Array of contact UUIDs to enroll","example":["550e8400-e29b-41d4-a716-446655440000"],"type":"array","items":{"type":"string"}}},"required":["contactUuids"]},"SharingPersonRes":{"type":"object","properties":{"id":{"type":"number","description":"A user id, never an account id"},"email":{"type":"string"}},"required":["id","email"]},"SharingApiKeyRes":{"type":"object","properties":{"kind":{"type":"string","enum":["organisation","account"],"description":"An organization key, or the API key of one of its accounts"},"name":{"type":"string","description":"The key name when it acted; kept after the key is revoked"}},"required":["kind","name"]},"SharingAudienceRes":{"type":"object","properties":{"kind":{"type":"string","enum":["organisation","team","person"],"description":"Who the share is published to; \"organisation\" is everyone in it"},"subjectId":{"type":"number","nullable":true,"description":"The person or team id; null for \"organisation\""}},"required":["kind","subjectId"]},"SharedWorkflowSummaryRes":{"type":"object","properties":{"id":{"type":"number"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string","description":"The source workflow status (draft, active, paused, …)"},"nodeCount":{"type":"number","description":"How many steps the workflow has"}},"required":["id","name","description","status","nodeCount"]},"OrganisationSharedWorkflowRes":{"type":"object","properties":{"id":{"type":"number","description":"The share id: what get, copy, stats and withdraw take"},"organisationId":{"type":"number"},"workflowId":{"type":"number","description":"The shared (source) workflow"},"sourceAccountId":{"type":"number","description":"The account that owns the source workflow"},"sharedBy":{"nullable":true,"description":"The person who shared it; null when an API key did","type":"object","allOf":[{"$ref":"#/components/schemas/SharingPersonRes"}]},"sharedByApiKey":{"nullable":true,"description":"The API key that shared it; null when a person did","type":"object","allOf":[{"$ref":"#/components/schemas/SharingApiKeyRes"}]},"sharedAt":{"type":"string","description":"ISO timestamp"},"notes":{"type":"string","nullable":true},"copiedCount":{"type":"number","description":"How many accounts copied it"},"lastCopiedAt":{"type":"string","nullable":true,"description":"ISO timestamp"},"audiences":{"type":"array","items":{"$ref":"#/components/schemas/SharingAudienceRes"}},"workflow":{"$ref":"#/components/schemas/SharedWorkflowSummaryRes"},"alreadyCopied":{"type":"boolean","description":"The calling account already holds a copy. Always false for an organization key, which acts in no account"},"canWithdraw":{"type":"boolean","description":"The caller may withdraw this share"},"canSeeStats":{"type":"boolean","description":"The caller may read who copied it"}},"required":["id","organisationId","workflowId","sourceAccountId","sharedBy","sharedByApiKey","sharedAt","notes","copiedCount","lastCopiedAt","audiences","workflow","alreadyCopied","canWithdraw","canSeeStats"]},"ShareWorkflowWithOrganisationReq":{"type":"object","properties":{"workflowId":{"type":"number","description":"The workflow to share; it must be this account's"},"notes":{"type":"string","description":"A note shown with the share in the library, up to 500 characters","maxLength":500}},"required":["workflowId"]},"CopySharedWorkflowReq":{"type":"object","properties":{"newName":{"type":"string","description":"Name of the copy, up to 100 characters; defaults to the shared name with \"(Copy)\"","maxLength":100},"newDescription":{"type":"string","description":"Description of the copy, up to 500 characters; defaults to the shared description","maxLength":500}}},"SharingCreatedTagRes":{"type":"object","properties":{"id":{"type":"number"},"name":{"type":"string"}},"required":["id","name"]},"SharingDroppedTagRes":{"type":"object","properties":{"name":{"type":"string","nullable":true,"description":"null when the source tag no longer exists"},"reason":{"type":"string","description":"Why the copy could not keep the tag"}},"required":["name","reason"]},"SharedWorkflowCopyTagsRes":{"type":"object","properties":{"created":{"description":"Tags created in the target account because none had that name","type":"array","items":{"$ref":"#/components/schemas/SharingCreatedTagRes"}},"matched":{"type":"number","description":"Referenced tags the target account already had by name"},"dropped":{"description":"Tag references the copy could not keep; those tag steps were removed","type":"array","items":{"$ref":"#/components/schemas/SharingDroppedTagRes"}}},"required":["created","matched","dropped"]},"OrganisationWorkflowCopyRes":{"type":"object","properties":{"workflowId":{"type":"number","description":"The copy in the target account, new or pre-existing"},"alreadyExisted":{"type":"boolean","description":"The account already had a copy of this share; nothing was cloned"},"tags":{"description":"How the tags the workflow uses were carried over; absent on an existing copy","allOf":[{"$ref":"#/components/schemas/SharedWorkflowCopyTagsRes"}]}},"required":["workflowId","alreadyExisted"]},"SharedWorkflowCopyRes":{"type":"object","properties":{"targetAccountId":{"type":"number"},"targetAccountAlias":{"type":"string","nullable":true},"copiedBy":{"nullable":true,"description":"The person who copied it; null when an API key did","type":"object","allOf":[{"$ref":"#/components/schemas/SharingPersonRes"}]},"copiedByApiKey":{"nullable":true,"description":"The API key that copied it; null when a person did","type":"object","allOf":[{"$ref":"#/components/schemas/SharingApiKeyRes"}]},"copiedAt":{"type":"string","description":"ISO timestamp"},"copyWorkflowId":{"type":"number","nullable":true,"description":"null once the copy was deleted"},"copyWorkflowName":{"type":"string","nullable":true}},"required":["targetAccountId","targetAccountAlias","copiedBy","copiedByApiKey","copiedAt","copyWorkflowId","copyWorkflowName"]},"OrganisationWorkflowShareStatsRes":{"type":"object","properties":{"shareId":{"type":"number"},"workflowId":{"type":"number"},"workflowName":{"type":"string"},"copiedCount":{"type":"number"},"copies":{"description":"Newest copy first","type":"array","items":{"$ref":"#/components/schemas/SharedWorkflowCopyRes"}}},"required":["shareId","workflowId","workflowName","copiedCount","copies"]},"AgentsApiIssueRes":{"type":"object","properties":{"path":{"type":"string","description":"The field, by the name the API uses (dotted for a nested one); empty when the problem is not one field","example":"bookingHours.end"},"message":{"type":"string","description":"What is wrong with it"}},"required":["path","message"]},"AgentsApiGapFixRes":{"type":"object","properties":{"tool":{"type":"string","description":"The tool that closes it","example":"agents_update"},"field":{"type":"string","description":"The field of that tool to send","example":"calendlyEventTypeId"},"inApp":{"type":"boolean","description":"True when a person closes it in the app; no tool can"}}},"AgentsApiGapRes":{"type":"object","properties":{"key":{"type":"string","description":"Stable id of the gap","example":"calendar_connection"},"label":{"type":"string","description":"What is missing, in words"},"fixWith":{"description":"How it is closed","allOf":[{"$ref":"#/components/schemas/AgentsApiGapFixRes"}]},"appUrl":{"type":"string","description":"The place in the app where a person closes it"}},"required":["key","label"]},"AgentsApiChannelHolderRes":{"type":"object","properties":{"kind":{"type":"string","enum":["phoneNumber","workflow","campaign"]},"id":{"type":"number","description":"ID of the phone number, workflow or campaign"},"heldByAgentId":{"type":"number","description":"The agent that answers on it today"},"heldByAgentName":{"type":"string"}},"required":["kind","id","heldByAgentId","heldByAgentName"]},"AgentsApiMissingChannelsRes":{"type":"object","properties":{"phoneNumberIds":{"type":"array","items":{"type":"number"}},"workflowIds":{"type":"array","items":{"type":"number"}},"campaignIds":{"type":"array","items":{"type":"number"}}},"required":["phoneNumberIds","workflowIds","campaignIds"]},"AgentsApiErrorRes":{"type":"object","properties":{"statusCode":{"type":"number","description":"HTTP status code, repeated in the body","example":404},"error":{"type":"string","description":"A stable machine-readable reason for a refusal (branch on this, not on the message). A malformed query answers the status text \"Bad Request\" with every problem in message[].","enum":["AGENT_NOT_FOUND","AGENT_SESSION_NOT_FOUND","AGENT_ID_INVALID","AGENT_SESSION_ID_INVALID","VERSION_ID_INVALID","VERSION_NOT_FOUND","CONFIG_INVALID","MANAGED_BY_TEMPLATE","TEMPLATE_NOT_AVAILABLE","AGENT_NOT_READY","AGENT_ARCHIVED","AGENT_LIMIT_REACHED","DRAFT_CONFLICT","ROLLOUT_CONFLICT","INVALID_BINDINGS","CHANNEL_CONFLICT","CHANNEL_TARGET_NOT_FOUND","CAMPAIGN_NOT_SMS","DEFAULT_AGENT_NOT_LIVE","DEFAULT_AGENT_REQUIRED","TEST_SESSION_ID_INVALID","TEST_SESSION_NOT_FOUND","TEST_SESSION_CLOSED","TEST_TURN_FAILED","INSUFFICIENT_CREDITS","CONTACT_NOT_FOUND","KNOWLEDGE_COLLECTION_ID_INVALID","KNOWLEDGE_SOURCE_ID_INVALID","KNOWLEDGE_COLLECTION_NOT_FOUND","KNOWLEDGE_SOURCE_NOT_FOUND","KNOWLEDGE_SOURCE_TYPE_MISMATCH","CONVERSATION_NOT_FOUND","CONVERSATION_REQUIRED","AGENT_NOT_ACTIVE","AGENT_NOT_PUBLISHED","PHONE_NUMBER_UNRESOLVED","THREAD_BUSY","AGENTS_PAUSED","CONTACT_OPTED_OUT","PAGE_OUT_OF_RANGE","Bad Request","Not Found","Forbidden"]},"message":{"description":"What was refused, in words (a string, or a list of problems for a malformed query). May be reworded.","oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"issues":{"description":"CONFIG_INVALID only: every invalid field","type":"array","items":{"$ref":"#/components/schemas/AgentsApiIssueRes"}},"gaps":{"description":"AGENT_NOT_READY only: everything that blocks publishing","type":"array","items":{"$ref":"#/components/schemas/AgentsApiGapRes"}},"conflicts":{"description":"CHANNEL_CONFLICT only: the channels other agents hold","type":"array","items":{"$ref":"#/components/schemas/AgentsApiChannelHolderRes"}},"missing":{"description":"CHANNEL_TARGET_NOT_FOUND and CAMPAIGN_NOT_SMS only: the ids that were refused","allOf":[{"$ref":"#/components/schemas/AgentsApiMissingChannelsRes"}]},"fields":{"description":"MANAGED_BY_TEMPLATE only: the settings the template fixes","type":"array","items":{"type":"string"}},"knowledgeCollectionIds":{"description":"INVALID_BINDINGS only: knowledge collections the agent cannot use","type":"array","items":{"type":"number"}},"limit":{"type":"number","description":"AGENT_LIMIT_REACHED only: the most agents the account can hold"},"liveSessionId":{"type":"number","description":"THREAD_BUSY only: the session of the agent that holds the conversation"}},"required":["statusCode","error","message"]},"AgentChannelCountsApiRes":{"type":"object","properties":{"phoneNumbers":{"type":"number","description":"Phone numbers the agent answers new conversations on"},"workflows":{"type":"number","description":"Workflows whose replies the agent answers"},"campaigns":{"type":"number","description":"SMS campaigns whose replies the agent answers"}},"required":["phoneNumbers","workflows","campaigns"]},"AgentListItemApiRes":{"type":"object","properties":{"id":{"type":"number","description":"Agent ID (integer)"},"name":{"type":"string","description":"Internal name shown on the AI agents page"},"kind":{"type":"string","description":"What the agent does","enum":["custom","booking","support","sales","reengagement","faq"]},"status":{"type":"string","description":"draft = never published; active = has a published version; archived = retired","enum":["draft","active","archived"]},"description":{"type":"string","description":"Owner note","nullable":true},"isPublished":{"type":"boolean","description":"Whether a version has been published"},"publishedVersionNumber":{"type":"number","description":"Number of the published version; null when never published","nullable":true},"hasUnpublishedChanges":{"type":"boolean","description":"The draft differs from the published version (publish to apply it)"},"enabled":{"type":"boolean","description":"The \"Agent on\" switch: when false the agent starts no new conversation"},"channelCounts":{"$ref":"#/components/schemas/AgentChannelCountsApiRes"},"createdAt":{"type":"string","description":"ISO 8601","format":"date-time"},"updatedAt":{"type":"string","description":"ISO 8601","format":"date-time"}},"required":["id","name","kind","status","description","isPublished","publishedVersionNumber","hasUnpublishedChanges","enabled","channelCounts","createdAt","updatedAt"]},"AgentListApiRes":{"type":"object","properties":{"agents":{"type":"array","items":{"$ref":"#/components/schemas/AgentListItemApiRes"}},"totalCount":{"type":"number","description":"Number of agents that match, over every page"},"page":{"type":"number","description":"The page returned (1-based)"},"take":{"type":"number","description":"Items per page"}},"required":["agents","totalCount","page","take"]},"AgentQuestionApiDto":{"type":"object","properties":{"id":{"type":"string","description":"Id of an existing question (from agents_get) to keep it the same question; leave out for a new one and an id is generated","maxLength":64,"nullable":true,"example":"q1"},"question":{"type":"string","description":"The question the agent asks (not blank)","maxLength":500},"required":{"type":"boolean","description":"Must be answered before a time is offered"},"qualificationCriteria":{"type":"string","description":"Plain-language rule a good answer meets; null = any answer qualifies","maxLength":2000,"nullable":true},"followUpEnabled":{"type":"boolean","description":"Nudge the contact about this question when they go quiet (needs followUp)","default":false}},"required":["question","required"]},"AgentBookingHoursApiDto":{"type":"object","properties":{"start":{"type":"string","description":"Opens, HH:MM 24h","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$","example":"09:00"},"end":{"type":"string","description":"Closes, HH:MM 24h; after start","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$","example":"17:00"},"days":{"type":"array","description":"Weekdays, 0 = Sunday … 6 = Saturday; one to seven, each once","items":{"type":"integer","minimum":0,"maximum":6},"minItems":1,"maxItems":7,"uniqueItems":true,"example":[1,2,3,4,5]},"timezone":{"type":"string","description":"IANA timezone the booking hours are in; left out keeps the current one","maxLength":64,"example":"America/New_York"}},"required":["start","end","days"]},"AgentFollowUpApiDto":{"type":"object","properties":{"intervalValue":{"type":"number","description":"Wait between nudges","minimum":1,"example":4},"intervalUnit":{"type":"string","enum":["minutes","hours","days"]},"maxFollowUps":{"type":"number","description":"Nudges per silence","minimum":1,"maximum":5},"jitterMinutes":{"type":"number","description":"Random minutes added or removed per nudge; 0 = exact","enum":[0,5,10,15,20,30]}},"required":["intervalValue","intervalUnit","maxFollowUps","jitterMinutes"]},"AgentHandoffApiDto":{"type":"object","properties":{"textContact":{"type":"boolean","description":"Text the contact when the agent hands the conversation to a person (the owner is alerted either way)"},"message":{"type":"string","description":"The text sent when textContact is true","maxLength":500}}},"AgentHoursApiDto":{"type":"object","properties":{"start":{"type":"string","description":"Opens, HH:MM 24h","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$","example":"09:00"},"end":{"type":"string","description":"Closes, HH:MM 24h; after start","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$","example":"17:00"},"days":{"type":"array","description":"Weekdays, 0 = Sunday … 6 = Saturday; one to seven, each once","items":{"type":"integer","minimum":0,"maximum":6},"minItems":1,"maxItems":7,"uniqueItems":true,"example":[1,2,3,4,5]}},"required":["start","end","days"]},"CreateAgentApiDto":{"type":"object","properties":{"description":{"type":"string","description":"Owner note. Applies at once. null clears it.","maxLength":1000,"nullable":true},"persona":{"type":"string","description":"Who the agent is, one or two sentences. Needs a publish.","maxLength":2000},"tone":{"type":"string","description":"How the agent sounds. Needs a publish.","maxLength":500},"language":{"type":"string","description":"\"auto\" (the language the contact writes in) or a BCP-47 tag from agents_get_setup_options. Needs a publish.","maxLength":16,"example":"en-US"},"timezone":{"type":"string","description":"The agent's business timezone (IANA): reply hours are in it. Applies at once. On create it also sets the booking timezone unless bookingHours names one.","maxLength":64,"example":"America/New_York"},"instructions":{"type":"string","description":"The owner's instructions to the agent. The agent reads the first 8000 characters. Needs a publish.","maxLength":20000},"qualifyingQuestions":{"description":"The COMPLETE list of qualifying questions, in asking order (replaces the current list; an empty list books everyone). Needs a publish.","maxItems":25,"nullable":true,"type":"array","items":{"$ref":"#/components/schemas/AgentQuestionApiDto"}},"calendarProvider":{"type":"string","description":"Calendar the agent books on; it must be connected in the app (agents_get_setup_options says which are). Needs a publish.","enum":["google","calendly"],"nullable":true},"calendlyEventTypeId":{"type":"number","description":"Calendly only: the event type booked (an id from agents_get_setup_options); null clears it. Needs a publish.","minimum":1,"nullable":true},"appointmentTitle":{"type":"string","description":"What the appointment is called on the calendar (not blank). Needs a publish.","maxLength":200,"nullable":true},"appointmentDescription":{"type":"string","description":"Text added to the calendar event; null clears it. Needs a publish.","maxLength":1000,"nullable":true},"durationMinutes":{"type":"number","description":"Appointment length in minutes. Needs a publish.","minimum":5,"maximum":240,"nullable":true},"lookAheadDays":{"type":"number","description":"How many days ahead times are offered. Needs a publish.","minimum":1,"maximum":60,"nullable":true},"maxSlotsToOffer":{"type":"number","description":"How many times one answer offers. Needs a publish.","minimum":1,"maximum":10,"nullable":true},"minimumNoticeMinutes":{"type":"number","description":"Minutes of notice before a same-day time is offered (0 = none); null = next day only. Needs a publish.","minimum":0,"maximum":10080,"nullable":true},"bookingHours":{"description":"When appointments can be booked (start, end and days are sent together). Needs a publish.","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/AgentBookingHoursApiDto"}]},"followUp":{"description":"Nudges for a contact who goes quiet: on a question with followUpEnabled, or after the agent offered times they have not picked from; null = no follow-ups. On create, omitted = every 2 hours, up to 3 nudges, ±30 min. Needs a publish.","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/AgentFollowUpApiDto"}]},"wrapUpInstructions":{"type":"string","description":"How the agent wraps up when every question is answered but the lead is not clearly qualified; null = the built-in wording. Needs a publish.","maxLength":500,"nullable":true},"offTopicInstructions":{"type":"string","description":"How the agent steers an off-topic contact back; null = the built-in guidance. Needs a publish.","maxLength":500,"nullable":true},"handoff":{"description":"What the contact is told on a handoff; a field left out keeps its current value. Needs a publish.","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/AgentHandoffApiDto"}]},"enabled":{"type":"boolean","description":"The \"Agent on\" switch: when false the agent starts no new conversation. Applies at once."},"requirePositiveSentiment":{"type":"boolean","description":"Start a conversation only when the contact's first message reads as positive. Applies at once."},"humanPacing":{"type":"boolean","description":"Wait a few minutes before each reply, as a person would. Applies at once."},"replyHours":{"description":"Daily window, in the agent's timezone, in which replies are sent; null = any time. Applies at once.","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/AgentHoursApiDto"}]},"idleExpiryDays":{"type":"number","description":"End a conversation the contact left idle for this many days; null = never. Applies at once.","minimum":1,"maximum":90,"nullable":true},"idleExpiryTag":{"type":"string","description":"Tag added to the contact when a conversation ends as idle; null = none. Applies at once.","maxLength":100,"nullable":true},"knowledgeCollectionIds":{"type":"array","description":"The COMPLETE list of knowledge collections the agent may search; empty means every collection the agent owns. Needs a publish.","items":{"type":"integer","minimum":1},"maxItems":50,"uniqueItems":true},"name":{"type":"string","description":"Internal name shown on the AI agents page","minLength":1,"maxLength":120,"example":"Front desk"},"template":{"type":"string","description":"What the agent is created from (the templates of agents_get_setup_options). Only \"booking\" today.","default":"booking","example":"booking"}},"required":["name"]},"AgentPublishedVersionApiRes":{"type":"object","properties":{"id":{"type":"number","description":"Version ID (integer)"},"versionNumber":{"type":"number","description":"Version number, counted per agent from 1"},"publishedAt":{"type":"string","format":"date-time","nullable":true}},"required":["id","versionNumber","publishedAt"]},"AgentQualifyingQuestionApiRes":{"type":"object","properties":{"id":{"type":"string","description":"Stable id of the question within this agent","example":"q1"},"question":{"type":"string","description":"The question the agent asks"},"required":{"type":"boolean","description":"Must be answered before a time is offered"},"qualificationCriteria":{"type":"string","description":"Plain-language rule a good answer meets; null = any answer qualifies","nullable":true},"followUpEnabled":{"type":"boolean","description":"Nudge the contact about this question when they go quiet (needs followUp)"}},"required":["id","question","required","qualificationCriteria","followUpEnabled"]},"AgentBookingHoursApiRes":{"type":"object","properties":{"start":{"type":"string","description":"Opens, HH:MM 24h","example":"09:00"},"end":{"type":"string","description":"Closes, HH:MM 24h","example":"21:00"},"days":{"description":"Weekdays, 0 = Sunday … 6 = Saturday","example":[1,2,3,4,5],"type":"array","items":{"type":"number"}},"timezone":{"type":"string","description":"IANA timezone the booking hours are in","example":"America/New_York"}},"required":["start","end","days","timezone"]},"AgentFollowUpApiRes":{"type":"object","properties":{"intervalValue":{"type":"number","description":"Wait between nudges","example":4},"intervalUnit":{"type":"string","enum":["minutes","hours","days"]},"maxFollowUps":{"type":"number","description":"Nudges per silence"},"jitterMinutes":{"type":"number","description":"Random minutes added or removed per nudge; 0 = exact"}},"required":["intervalValue","intervalUnit","maxFollowUps","jitterMinutes"]},"AgentHandoffApiRes":{"type":"object","properties":{"textContact":{"type":"boolean","description":"Text the contact when the agent hands the conversation to a person (the owner is alerted either way)"},"message":{"type":"string","description":"The text sent when textContact is true"}},"required":["textContact","message"]},"AgentReplyHoursApiRes":{"type":"object","properties":{"start":{"type":"string","description":"Opens, HH:MM 24h","example":"09:00"},"end":{"type":"string","description":"Closes, HH:MM 24h","example":"21:00"},"days":{"description":"Weekdays, 0 = Sunday … 6 = Saturday","example":[1,2,3,4,5],"type":"array","items":{"type":"number"}}},"required":["start","end","days"]},"AgentPhoneNumberChannelApiRes":{"type":"object","properties":{"id":{"type":"number","description":"Phone number ID (integer)"},"number":{"type":"string","description":"The number, E.164","example":"+15550100001"}},"required":["id","number"]},"AgentNamedChannelApiRes":{"type":"object","properties":{"id":{"type":"number","description":"Workflow or campaign ID (integer)"},"name":{"type":"string"},"status":{"type":"string","description":"Its status","example":"active"}},"required":["id","name","status"]},"AgentChannelsApiRes":{"type":"object","properties":{"phoneNumberIds":{"description":"Phone numbers the agent answers on (ids from phone_numbers_list)","type":"array","items":{"type":"number"}},"workflowIds":{"description":"Workflows whose replies the agent answers (ids from workflows_list)","type":"array","items":{"type":"number"}},"campaignIds":{"description":"SMS campaigns whose replies the agent answers (ids from campaigns_list)","type":"array","items":{"type":"number"}},"phoneNumbers":{"description":"The same phone numbers, with the number itself","type":"array","items":{"$ref":"#/components/schemas/AgentPhoneNumberChannelApiRes"}},"workflows":{"description":"The same workflows, with their names","type":"array","items":{"$ref":"#/components/schemas/AgentNamedChannelApiRes"}},"campaigns":{"description":"The same SMS campaigns, with their names","type":"array","items":{"$ref":"#/components/schemas/AgentNamedChannelApiRes"}}},"required":["phoneNumberIds","workflowIds","campaignIds","phoneNumbers","workflows","campaigns"]},"AgentGapFixApiRes":{"type":"object","properties":{"tool":{"type":"string","description":"The tool that closes it","example":"agents_update"},"field":{"type":"string","description":"The field of that tool to send","example":"calendlyEventTypeId"},"inApp":{"type":"boolean","description":"True when a person closes it in the app (see appUrl); no tool can"}}},"AgentReadinessGapApiRes":{"type":"object","properties":{"key":{"type":"string","description":"Stable id of the gap","example":"calendar_connection"},"label":{"type":"string","description":"What is missing, in words"},"appUrl":{"type":"string","description":"The place in the app where a person closes it"},"fixWith":{"description":"How it is closed","allOf":[{"$ref":"#/components/schemas/AgentGapFixApiRes"}]}},"required":["key","label","appUrl","fixWith"]},"AgentReadinessApiRes":{"type":"object","properties":{"ready":{"type":"boolean","description":"True when nothing blocks publishing the draft"},"gaps":{"description":"Everything that still blocks publishing; empty when ready","type":"array","items":{"$ref":"#/components/schemas/AgentReadinessGapApiRes"}}},"required":["ready","gaps"]},"AgentSummaryRowApiRes":{"type":"object","properties":{"label":{"type":"string","description":"The setting, as the app names it","example":"Calendar"},"value":{"type":"string","description":"Its value in words. Long text is cut here; the field of the same setting holds it in full."},"group":{"type":"string","description":"Set on the optional advanced settings","enum":["advanced"]},"changed":{"type":"boolean","description":"True on an advanced setting whose value is not the default"}},"required":["label","value"]},"AgentSummaryApiRes":{"type":"object","properties":{"headline":{"type":"string","description":"One or two sentences to read to the user: what happened and where the agent stands","example":"Created \"Front desk\" as a draft. It is not published and answers nobody yet."},"state":{"type":"string","description":"draft = never published, answers nobody; live_answering = published, on and attached to a channel; live_no_channel = published but attached to nothing; switched_off = published but its switch is off; archived","enum":["draft","live_answering","live_no_channel","switched_off","archived"]},"sections":{"description":"The setup as label and value rows, in reading order","type":"array","items":{"$ref":"#/components/schemas/AgentSummaryRowApiRes"}}},"required":["headline","state","sections"]},"AgentNextStepApiRes":{"type":"object","properties":{"tool":{"type":"string","description":"The tool to use","example":"agents_publish"},"inApp":{"type":"boolean","description":"True when a person does it in the app (see url); no tool can"},"url":{"type":"string","description":"The page in the app, for an inApp step"},"why":{"type":"string","description":"Why, in one sentence"}},"required":["why"]},"AgentCalendarApiRes":{"type":"object","properties":{"provider":{"type":"string","enum":["google","calendly"]},"label":{"type":"string","example":"Google Calendar"},"connected":{"type":"boolean","description":"Whether the account has this calendar connected"},"accountLabel":{"type":"string","description":"The connected calendar account (its email or name); null when not connected","nullable":true}},"required":["provider","label","connected","accountLabel"]},"AgentKnowledgeCollectionRefApiRes":{"type":"object","properties":{"id":{"type":"number","description":"Knowledge collection ID (integer)"},"name":{"type":"string"}},"required":["id","name"]},"AgentCreatedApiRes":{"type":"object","properties":{"id":{"type":"number","description":"Agent ID (integer)"},"name":{"type":"string","description":"Internal name shown on the AI agents page"},"kind":{"type":"string","enum":["custom","booking","support","sales","reengagement","faq"]},"status":{"type":"string","enum":["draft","active","archived"]},"description":{"type":"string","description":"Owner note","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"publishedVersion":{"description":"The version contacts are answered with; null when never published. The fields below describe the draft, which may be newer.","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/AgentPublishedVersionApiRes"}]},"hasUnpublishedChanges":{"type":"boolean","description":"The draft differs from the published version (publish to apply it)"},"draftId":{"type":"number","description":"ID of the draft these fields were read from. Send it back as expectedDraftId when editing, so an edit made on a stale read is refused."},"persona":{"type":"string","description":"Who the agent is"},"tone":{"type":"string","description":"How the agent sounds"},"language":{"type":"string","description":"\"auto\" (the language the contact writes in) or a BCP-47 tag","example":"en-US"},"timezone":{"type":"string","description":"The agent's business timezone (IANA): reply hours are in it. Applies at once, without a publish.","example":"America/New_York"},"instructions":{"type":"string","description":"The owner's instructions to the agent"},"qualifyingQuestions":{"description":"Asked before a time is offered, in order; an empty list books everyone. null unless kind is \"booking\".","nullable":true,"type":"array","items":{"$ref":"#/components/schemas/AgentQualifyingQuestionApiRes"}},"calendarProvider":{"type":"string","description":"Calendar the agent books on. null unless kind is \"booking\".","enum":["google","calendly"],"nullable":true},"calendlyEventTypeId":{"type":"number","description":"Calendly only: the event type booked (an id from agents_get_setup_options); null on Google Calendar","nullable":true},"appointmentTitle":{"type":"string","description":"What the appointment is called on the calendar","nullable":true},"appointmentDescription":{"type":"string","nullable":true},"durationMinutes":{"type":"number","description":"Appointment length in minutes","nullable":true},"lookAheadDays":{"type":"number","description":"How many days ahead times are offered","nullable":true},"maxSlotsToOffer":{"type":"number","description":"How many times one answer offers","nullable":true},"minimumNoticeMinutes":{"type":"number","description":"Minutes of notice before a same-day time is offered (0 = none). On a booking agent null means \"next day only\".","nullable":true},"bookingHours":{"description":"When appointments can be booked. null unless kind is \"booking\".","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/AgentBookingHoursApiRes"}]},"followUp":{"description":"Nudges for a contact who goes quiet: on a question with followUpEnabled, or after the agent offered times they have not picked from; null = no follow-ups","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/AgentFollowUpApiRes"}]},"wrapUpInstructions":{"type":"string","description":"How the agent wraps up when every question is answered but the lead is not clearly qualified; null = the built-in wording","nullable":true},"offTopicInstructions":{"type":"string","description":"How the agent steers an off-topic contact back; null = the built-in guidance","nullable":true},"handoff":{"description":"What the contact is told on a handoff. null unless kind is \"booking\".","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/AgentHandoffApiRes"}]},"enabled":{"type":"boolean","description":"The \"Agent on\" switch: when false the agent starts no new conversation. Applies at once, without a publish."},"requirePositiveSentiment":{"type":"boolean","description":"Start a conversation only when the contact's first message reads as positive"},"humanPacing":{"type":"boolean","description":"Wait a few minutes before each reply, as a person would"},"replyHours":{"description":"Daily window, in the agent's timezone, in which replies are sent; null = any time","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/AgentReplyHoursApiRes"}]},"idleExpiryDays":{"type":"number","description":"End a conversation the contact left idle for this many days; null = never","nullable":true},"idleExpiryTag":{"type":"string","description":"Tag added to the contact when a conversation ends as idle; null = none","nullable":true},"knowledgeCollectionIds":{"description":"Knowledge collections the agent may search","type":"array","items":{"type":"number"}},"channels":{"description":"Where the agent answers. Applies at once, without a publish.","allOf":[{"$ref":"#/components/schemas/AgentChannelsApiRes"}]},"answering":{"type":"boolean","description":"Whether the agent answers contacts right now: published, switched on and attached to at least one channel"},"readiness":{"description":"Whether the draft can be published and what is missing. null for kinds other than \"booking\".","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/AgentReadinessApiRes"}]},"summary":{"description":"The agent in words: a headline to read to the user, its state and the setup as rows","allOf":[{"$ref":"#/components/schemas/AgentSummaryApiRes"}]},"nextSteps":{"description":"What is left to do, in the order to do it (at most four). Empty when nothing is.","type":"array","items":{"$ref":"#/components/schemas/AgentNextStepApiRes"}},"appUrl":{"type":"string","description":"The agent in the app, to give to the user"},"calendar":{"description":"The calendar the agent books on and whether it is connected. null unless kind is \"booking\".","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/AgentCalendarApiRes"}]},"calendlyEventTypeName":{"type":"string","description":"Name of the Calendly event type booked; null on Google Calendar or when it could not be read","nullable":true},"timezoneLabel":{"type":"string","description":"The timezone in words","example":"Eastern Time (ET)"},"knowledgeCollections":{"description":"The knowledge collections of knowledgeCollectionIds, with their names","type":"array","items":{"$ref":"#/components/schemas/AgentKnowledgeCollectionRefApiRes"}},"warnings":{"description":"Caveats about the text given (for example instructions longer than the agent reads, or {placeholders} it never fills in). Nothing was refused.","type":"array","items":{"type":"string"}},"incomplete":{"description":"Fields that were NOT saved because a step after the creation failed; send them again with agents_update. Normally empty.","type":"array","items":{"type":"string"}}},"required":["id","name","kind","status","description","createdAt","updatedAt","publishedVersion","hasUnpublishedChanges","draftId","persona","tone","language","timezone","instructions","qualifyingQuestions","calendarProvider","calendlyEventTypeId","appointmentTitle","appointmentDescription","durationMinutes","lookAheadDays","maxSlotsToOffer","minimumNoticeMinutes","bookingHours","followUp","wrapUpInstructions","offTopicInstructions","handoff","enabled","requirePositiveSentiment","humanPacing","replyHours","idleExpiryDays","idleExpiryTag","knowledgeCollectionIds","channels","answering","readiness","summary","nextSteps","appUrl","calendar","calendlyEventTypeName","timezoneLabel","knowledgeCollections","warnings","incomplete"]},"AgentBuildStepApiRes":{"type":"object","properties":{"id":{"type":"string","description":"Stable id of the step","example":"preview"},"title":{"type":"string","example":"Show the proposal"},"what":{"type":"string","description":"What the step is, in one sentence"},"tools":{"description":"The tools the step uses; empty for a step done in conversation","type":"array","items":{"type":"string"}}},"required":["id","title","what","tools"]},"AgentBriefOptionApiRes":{"type":"object","properties":{"label":{"type":"string","description":"The choice, short enough for a button"},"description":{"type":"string","description":"What the choice means, in one line"},"recommended":{"type":"boolean","description":"True on the choice to suggest when the user has no preference; left out on the others"}},"required":["label"]},"AgentBriefItemApiRes":{"type":"object","properties":{"key":{"type":"string","example":"purpose"},"label":{"type":"string","description":"What the item settles"},"whyItMatters":{"type":"string","description":"What goes wrong when it is guessed"},"howToAsk":{"type":"string","description":"How to put the question to the user"},"question":{"type":"string","description":"The question itself, when it is always the same sentence"},"options":{"description":"Preset answers, the recommended one first; empty when there is none","type":"array","items":{"$ref":"#/components/schemas/AgentBriefOptionApiRes"}},"fields":{"description":"The fields of agents_create the answer settles","type":"array","items":{"type":"string"}}},"required":["key","label","whyItMatters","howToAsk","options","fields"]},"AgentSettingApiRes":{"type":"object","properties":{"field":{"type":"string","description":"The field of agents_create and agents_update (the channel lists are set with agents_set_channels, the default agent with agent_settings_update)","example":"minimumNoticeMinutes"},"label":{"type":"string","description":"What the app calls it","example":"Minimum notice"},"what":{"type":"string","description":"What it does, in one sentence"},"choices":{"type":"string","description":"The choices or the range, in words"},"default":{"type":"string","description":"The default, in words","example":"1 hour"},"applies":{"type":"string","description":"When a change takes effect","enum":["at once","after publish"]}},"required":["field","label","what","default","applies"]},"AgentAdvancedOfferApiRes":{"type":"object","properties":{"question":{"type":"string","example":"Want to check the advanced settings?"},"yesLabel":{"type":"string","description":"The answer for yes"},"noLabel":{"type":"string","description":"The answer for no"},"recommended":{"type":"string","description":"The answer to suggest: the one for no"},"note":{"type":"string","description":"One line listing what the advanced settings cover"},"optional":{"type":"string","description":"When the offer is made and what a yes or a no leads to"},"options":{"description":"The advanced settings with their defaults, listed after a yes","type":"array","items":{"$ref":"#/components/schemas/AgentSettingApiRes"}}},"required":["question","yesLabel","noLabel","recommended","note","optional","options"]},"AgentSettingGroupApiRes":{"type":"object","properties":{"id":{"type":"string","example":"appointment"},"label":{"type":"string","example":"Appointments"},"summary":{"type":"string","description":"What the group covers, in one line"},"options":{"type":"array","items":{"$ref":"#/components/schemas/AgentSettingApiRes"}}},"required":["id","label","summary","options"]},"AgentBuildGuideApiRes":{"type":"object","properties":{"steps":{"description":"The steps of building an agent with a user, in order","type":"array","items":{"$ref":"#/components/schemas/AgentBuildStepApiRes"}},"brief":{"description":"What is settled with the user before an agent is created: seven items, asked one at a time in this order","type":"array","items":{"$ref":"#/components/schemas/AgentBriefItemApiRes"}},"advancedOffer":{"description":"The one mention the advanced settings get: a single yes or no question after the last brief item","allOf":[{"$ref":"#/components/schemas/AgentAdvancedOfferApiRes"}]},"options":{"description":"Every other setting of an agent by group, in plain words, with its default and when a change takes effect","type":"array","items":{"$ref":"#/components/schemas/AgentSettingGroupApiRes"}},"writingRules":{"description":"How the persona, instructions and questions are written","type":"array","items":{"type":"string"}},"neverDo":{"description":"What is never done","type":"array","items":{"type":"string"}}},"required":["steps","brief","advancedOffer","options","writingRules","neverDo"]},"PreviewAgentApiDto":{"type":"object","properties":{"description":{"type":"string","description":"Owner note. Applies at once. null clears it.","maxLength":1000,"nullable":true},"persona":{"type":"string","description":"Who the agent is, one or two sentences. Needs a publish.","maxLength":2000},"tone":{"type":"string","description":"How the agent sounds. Needs a publish.","maxLength":500},"language":{"type":"string","description":"\"auto\" (the language the contact writes in) or a BCP-47 tag from agents_get_setup_options. Needs a publish.","maxLength":16,"example":"en-US"},"timezone":{"type":"string","description":"The agent's business timezone (IANA): reply hours are in it. Applies at once. On create it also sets the booking timezone unless bookingHours names one.","maxLength":64,"example":"America/New_York"},"instructions":{"type":"string","description":"The owner's instructions to the agent. The agent reads the first 8000 characters. Needs a publish.","maxLength":20000},"qualifyingQuestions":{"description":"The COMPLETE list of qualifying questions, in asking order (replaces the current list; an empty list books everyone). Needs a publish.","maxItems":25,"nullable":true,"type":"array","items":{"$ref":"#/components/schemas/AgentQuestionApiDto"}},"calendarProvider":{"type":"string","description":"Calendar the agent books on; it must be connected in the app (agents_get_setup_options says which are). Needs a publish.","enum":["google","calendly"],"nullable":true},"calendlyEventTypeId":{"type":"number","description":"Calendly only: the event type booked (an id from agents_get_setup_options); null clears it. Needs a publish.","minimum":1,"nullable":true},"appointmentTitle":{"type":"string","description":"What the appointment is called on the calendar (not blank). Needs a publish.","maxLength":200,"nullable":true},"appointmentDescription":{"type":"string","description":"Text added to the calendar event; null clears it. Needs a publish.","maxLength":1000,"nullable":true},"durationMinutes":{"type":"number","description":"Appointment length in minutes. Needs a publish.","minimum":5,"maximum":240,"nullable":true},"lookAheadDays":{"type":"number","description":"How many days ahead times are offered. Needs a publish.","minimum":1,"maximum":60,"nullable":true},"maxSlotsToOffer":{"type":"number","description":"How many times one answer offers. Needs a publish.","minimum":1,"maximum":10,"nullable":true},"minimumNoticeMinutes":{"type":"number","description":"Minutes of notice before a same-day time is offered (0 = none); null = next day only. Needs a publish.","minimum":0,"maximum":10080,"nullable":true},"bookingHours":{"description":"When appointments can be booked (start, end and days are sent together). Needs a publish.","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/AgentBookingHoursApiDto"}]},"followUp":{"description":"Nudges for a contact who goes quiet: on a question with followUpEnabled, or after the agent offered times they have not picked from; null = no follow-ups. On create, omitted = every 2 hours, up to 3 nudges, ±30 min. Needs a publish.","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/AgentFollowUpApiDto"}]},"wrapUpInstructions":{"type":"string","description":"How the agent wraps up when every question is answered but the lead is not clearly qualified; null = the built-in wording. Needs a publish.","maxLength":500,"nullable":true},"offTopicInstructions":{"type":"string","description":"How the agent steers an off-topic contact back; null = the built-in guidance. Needs a publish.","maxLength":500,"nullable":true},"handoff":{"description":"What the contact is told on a handoff; a field left out keeps its current value. Needs a publish.","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/AgentHandoffApiDto"}]},"enabled":{"type":"boolean","description":"The \"Agent on\" switch: when false the agent starts no new conversation. Applies at once."},"requirePositiveSentiment":{"type":"boolean","description":"Start a conversation only when the contact's first message reads as positive. Applies at once."},"humanPacing":{"type":"boolean","description":"Wait a few minutes before each reply, as a person would. Applies at once."},"replyHours":{"description":"Daily window, in the agent's timezone, in which replies are sent; null = any time. Applies at once.","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/AgentHoursApiDto"}]},"idleExpiryDays":{"type":"number","description":"End a conversation the contact left idle for this many days; null = never. Applies at once.","minimum":1,"maximum":90,"nullable":true},"idleExpiryTag":{"type":"string","description":"Tag added to the contact when a conversation ends as idle; null = none. Applies at once.","maxLength":100,"nullable":true},"knowledgeCollectionIds":{"type":"array","description":"The COMPLETE list of knowledge collections the agent may search; empty means every collection the agent owns. Needs a publish.","items":{"type":"integer","minimum":1},"maxItems":50,"uniqueItems":true},"name":{"type":"string","description":"Internal name shown on the AI agents page","minLength":1,"maxLength":120,"example":"Front desk"},"template":{"type":"string","description":"What the agent is created from (the templates of agents_get_setup_options). Only \"booking\" today.","default":"booking","example":"booking"},"phoneNumberIds":{"type":"array","description":"Phone numbers the agent would answer on (ids from agents_get_setup_options). Only named and checked here: agents_create does not take them, agents_set_channels does.","items":{"type":"integer","minimum":1},"maxItems":200,"uniqueItems":true},"workflowIds":{"type":"array","description":"Workflows whose replies the agent would answer; named and checked only","items":{"type":"integer","minimum":1},"maxItems":200,"uniqueItems":true},"campaignIds":{"type":"array","description":"SMS campaigns whose replies the agent would answer; named and checked only","items":{"type":"integer","minimum":1},"maxItems":200,"uniqueItems":true},"rationale":{"description":"Why this setup suits the user, one short reason per item; shown under \"Why:\" in the proposal","maxItems":6,"type":"array","items":{"type":"string"}},"unsupported":{"description":"What the user asked for that an agent cannot do, one item each; shown under \"Not supported:\" in the proposal","maxItems":4,"type":"array","items":{"type":"string"}}},"required":["name"]},"AgentPreviewIssueApiRes":{"type":"object","properties":{"path":{"type":"string","description":"The field, by the name agents_create takes (dotted for a nested one); \"channels\" for a channel id; empty when it is not one field","example":"bookingHours.end"},"message":{"type":"string","description":"What is wrong with it"}},"required":["path","message"]},"AgentPreviewQuestionApiRes":{"type":"object","properties":{"question":{"type":"string","description":"The question the agent asks"},"required":{"type":"boolean","description":"Must be answered before a time is offered"},"qualifiesWhen":{"type":"string","description":"The rule a good answer meets; null = any answer qualifies","nullable":true},"followUp":{"type":"boolean","description":"The contact is nudged about it when they go quiet"}},"required":["question","required","qualifiesWhen","followUp"]},"AgentProposalApiRes":{"type":"object","properties":{"title":{"type":"string","example":"Proposed AI agent: \"Front desk\""},"sections":{"description":"The setup as label and value rows, in reading order. The optional advanced settings come last (group \"advanced\"), with changed set on the ones that are not the default.","type":"array","items":{"$ref":"#/components/schemas/AgentSummaryRowApiRes"}},"questions":{"description":"The qualifying questions, in asking order","type":"array","items":{"$ref":"#/components/schemas/AgentPreviewQuestionApiRes"}},"followUpSummary":{"type":"string","description":"The follow-ups in words","example":"Nudge once after 1 hour"},"rationale":{"description":"The rationale given, unchanged","type":"array","items":{"type":"string"}},"unsupported":{"description":"The unsupported items given, unchanged","type":"array","items":{"type":"string"}}},"required":["title","sections","questions","followUpSummary","rationale","unsupported"]},"AgentPreviewAfterCreateApiRes":{"type":"object","properties":{"phoneNumberIds":{"type":"array","items":{"type":"number"}},"workflowIds":{"type":"array","items":{"type":"number"}},"campaignIds":{"type":"array","items":{"type":"number"}},"takeOver":{"type":"boolean","description":"True when one of them is held by another agent: agents_set_channels then needs takeOver, which moves it, so the user has to agree first"}},"required":["phoneNumberIds","workflowIds","campaignIds","takeOver"]},"AgentPreviewApiRes":{"type":"object","properties":{"status":{"type":"string","description":"ready_to_create = agents_create would accept these fields; not_creatable = it would refuse them, see issues","enum":["ready_to_create","not_creatable"]},"issues":{"description":"What stops the creation; empty when ready_to_create","type":"array","items":{"$ref":"#/components/schemas/AgentPreviewIssueApiRes"}},"proposal":{"$ref":"#/components/schemas/AgentProposalApiRes"},"warnings":{"description":"What the user should know before saying yes: what still blocks publishing, channels that would move from another agent, caveats about the text","type":"array","items":{"type":"string"}},"text":{"type":"string","description":"The whole proposal as plain text, written to be shown to the user as it is"},"createArguments":{"type":"object","description":"The fields to pass to agents_create unchanged once the user agrees; null when not_creatable","additionalProperties":true,"nullable":true},"afterCreate":{"description":"The channel ids to pass to agents_set_channels after the agent exists","allOf":[{"$ref":"#/components/schemas/AgentPreviewAfterCreateApiRes"}]}},"required":["status","issues","proposal","warnings","text","createArguments","afterCreate"]},"AgentChannelHolderApiRes":{"type":"object","properties":{"id":{"type":"number","description":"Agent ID (integer)"},"name":{"type":"string","description":"Its name"}},"required":["id","name"]},"AgentSetupPhoneNumberApiRes":{"type":"object","properties":{"id":{"type":"number","description":"The id phoneNumberIds takes (integer)"},"number":{"type":"string","description":"The number, E.164","example":"+15550100001"},"usedByAgent":{"description":"The agent that answers on it today; null when none does. Giving it to another agent moves it.","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/AgentChannelHolderApiRes"}]}},"required":["id","number","usedByAgent"]},"AgentSetupNamedChannelApiRes":{"type":"object","properties":{"id":{"type":"number","description":"The id workflowIds or campaignIds takes (integer)"},"name":{"type":"string"},"status":{"type":"string","description":"Its status","example":"active"},"usedByAgent":{"description":"The agent that answers its replies today; null when none does","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/AgentChannelHolderApiRes"}]}},"required":["id","name","status","usedByAgent"]},"AgentSetupCalendarApiRes":{"type":"object","properties":{"provider":{"type":"string","enum":["google","calendly"]},"label":{"type":"string","description":"Display name of the provider","example":"Google Calendar"},"connected":{"type":"boolean","description":"Whether the account has this calendar connected"},"accountLabel":{"type":"string","description":"The connected calendar account (its email or name); null when not connected","nullable":true}},"required":["provider","label","connected","accountLabel"]},"AgentSetupCalendlyEventTypeApiRes":{"type":"object","properties":{"id":{"type":"number","description":"The value to store as calendlyEventTypeId (integer)"},"name":{"type":"string"},"durationMinutes":{"type":"number","description":"Length in minutes as Calendly reports it; null when unknown","nullable":true}},"required":["id","name","durationMinutes"]},"AgentSetupOptionApiRes":{"type":"object","properties":{"id":{"type":"string","description":"The value to store"},"label":{"type":"string","description":"Display name"}},"required":["id","label"]},"AgentSetupRangeApiRes":{"type":"object","properties":{"min":{"type":"number"},"max":{"type":"number"}},"required":["min","max"]},"AgentSetupLimitsApiRes":{"type":"object","properties":{"nameMaxLength":{"type":"number","description":"Longest name, in characters"},"descriptionMaxLength":{"type":"number"},"personaMaxLength":{"type":"number"},"toneMaxLength":{"type":"number"},"instructionsMaxLength":{"type":"number"},"appointmentTitleMaxLength":{"type":"number"},"appointmentDescriptionMaxLength":{"type":"number"},"durationMinutes":{"$ref":"#/components/schemas/AgentSetupRangeApiRes"},"lookAheadDays":{"$ref":"#/components/schemas/AgentSetupRangeApiRes"},"maxSlotsToOffer":{"$ref":"#/components/schemas/AgentSetupRangeApiRes"},"minimumNoticeMinutes":{"description":"Minutes of notice before a same-day time is offered (0 = none). null, meaning \"next day only\", is also accepted and lies outside this range.","allOf":[{"$ref":"#/components/schemas/AgentSetupRangeApiRes"}]},"maxQuestions":{"type":"number","description":"Most qualifying questions an agent can ask"},"questionMaxLength":{"type":"number"},"qualificationCriteriaMaxLength":{"type":"number"},"maxChannelIdsPerKind":{"type":"number","description":"Most ids of one channel kind in one request"}},"required":["nameMaxLength","descriptionMaxLength","personaMaxLength","toneMaxLength","instructionsMaxLength","appointmentTitleMaxLength","appointmentDescriptionMaxLength","durationMinutes","lookAheadDays","maxSlotsToOffer","minimumNoticeMinutes","maxQuestions","questionMaxLength","qualificationCriteriaMaxLength","maxChannelIdsPerKind"]},"AgentSetupOptionsApiRes":{"type":"object","properties":{"summary":{"type":"string","description":"One line to read to the user: what is connected and what exists","example":"Google Calendar connected; 3 numbers, 2 workflows, no SMS campaigns"},"phoneNumbers":{"description":"The enabled phone numbers an agent can answer on, with who holds each","type":"array","items":{"$ref":"#/components/schemas/AgentSetupPhoneNumberApiRes"}},"workflows":{"description":"The workflows whose replies an agent can answer, with who holds each","type":"array","items":{"$ref":"#/components/schemas/AgentSetupNamedChannelApiRes"}},"smsCampaigns":{"description":"The SMS campaigns whose replies an agent can answer, with who holds each","type":"array","items":{"$ref":"#/components/schemas/AgentSetupNamedChannelApiRes"}},"calendars":{"type":"array","items":{"$ref":"#/components/schemas/AgentSetupCalendarApiRes"}},"calendlyEventTypes":{"description":"The account's active Calendly event types (empty without Calendly)","type":"array","items":{"$ref":"#/components/schemas/AgentSetupCalendlyEventTypeApiRes"}},"timezones":{"description":"Suggested business timezones. Any IANA timezone name is accepted; these are the ones the app offers first.","type":"array","items":{"$ref":"#/components/schemas/AgentSetupOptionApiRes"}},"defaultTimezone":{"type":"string","example":"America/New_York"},"languages":{"description":"Reply languages: \"auto\" answers in the language the contact writes in, the others are BCP-47 tags the agent always replies in.","type":"array","items":{"$ref":"#/components/schemas/AgentSetupOptionApiRes"}},"limits":{"$ref":"#/components/schemas/AgentSetupLimitsApiRes"},"templates":{"description":"Templates an agent can be created from","example":["booking"],"type":"array","items":{"type":"string"}},"connectCalendarUrl":{"type":"string","description":"App page where the account owner connects Google Calendar or Calendly (a person signs in there; it cannot be done through the API)."},"unavailable":{"description":"Lists that could not be read right now. An empty list named here is unknown, not \"none\"; call again.","type":"array","items":{"type":"string"}}},"required":["summary","phoneNumbers","workflows","smsCampaigns","calendars","calendlyEventTypes","timezones","defaultTimezone","languages","limits","templates","connectCalendarUrl","unavailable"]},"AgentDetailApiRes":{"type":"object","properties":{"id":{"type":"number","description":"Agent ID (integer)"},"name":{"type":"string","description":"Internal name shown on the AI agents page"},"kind":{"type":"string","enum":["custom","booking","support","sales","reengagement","faq"]},"status":{"type":"string","enum":["draft","active","archived"]},"description":{"type":"string","description":"Owner note","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"publishedVersion":{"description":"The version contacts are answered with; null when never published. The fields below describe the draft, which may be newer.","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/AgentPublishedVersionApiRes"}]},"hasUnpublishedChanges":{"type":"boolean","description":"The draft differs from the published version (publish to apply it)"},"draftId":{"type":"number","description":"ID of the draft these fields were read from. Send it back as expectedDraftId when editing, so an edit made on a stale read is refused."},"persona":{"type":"string","description":"Who the agent is"},"tone":{"type":"string","description":"How the agent sounds"},"language":{"type":"string","description":"\"auto\" (the language the contact writes in) or a BCP-47 tag","example":"en-US"},"timezone":{"type":"string","description":"The agent's business timezone (IANA): reply hours are in it. Applies at once, without a publish.","example":"America/New_York"},"instructions":{"type":"string","description":"The owner's instructions to the agent"},"qualifyingQuestions":{"description":"Asked before a time is offered, in order; an empty list books everyone. null unless kind is \"booking\".","nullable":true,"type":"array","items":{"$ref":"#/components/schemas/AgentQualifyingQuestionApiRes"}},"calendarProvider":{"type":"string","description":"Calendar the agent books on. null unless kind is \"booking\".","enum":["google","calendly"],"nullable":true},"calendlyEventTypeId":{"type":"number","description":"Calendly only: the event type booked (an id from agents_get_setup_options); null on Google Calendar","nullable":true},"appointmentTitle":{"type":"string","description":"What the appointment is called on the calendar","nullable":true},"appointmentDescription":{"type":"string","nullable":true},"durationMinutes":{"type":"number","description":"Appointment length in minutes","nullable":true},"lookAheadDays":{"type":"number","description":"How many days ahead times are offered","nullable":true},"maxSlotsToOffer":{"type":"number","description":"How many times one answer offers","nullable":true},"minimumNoticeMinutes":{"type":"number","description":"Minutes of notice before a same-day time is offered (0 = none). On a booking agent null means \"next day only\".","nullable":true},"bookingHours":{"description":"When appointments can be booked. null unless kind is \"booking\".","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/AgentBookingHoursApiRes"}]},"followUp":{"description":"Nudges for a contact who goes quiet: on a question with followUpEnabled, or after the agent offered times they have not picked from; null = no follow-ups","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/AgentFollowUpApiRes"}]},"wrapUpInstructions":{"type":"string","description":"How the agent wraps up when every question is answered but the lead is not clearly qualified; null = the built-in wording","nullable":true},"offTopicInstructions":{"type":"string","description":"How the agent steers an off-topic contact back; null = the built-in guidance","nullable":true},"handoff":{"description":"What the contact is told on a handoff. null unless kind is \"booking\".","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/AgentHandoffApiRes"}]},"enabled":{"type":"boolean","description":"The \"Agent on\" switch: when false the agent starts no new conversation. Applies at once, without a publish."},"requirePositiveSentiment":{"type":"boolean","description":"Start a conversation only when the contact's first message reads as positive"},"humanPacing":{"type":"boolean","description":"Wait a few minutes before each reply, as a person would"},"replyHours":{"description":"Daily window, in the agent's timezone, in which replies are sent; null = any time","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/AgentReplyHoursApiRes"}]},"idleExpiryDays":{"type":"number","description":"End a conversation the contact left idle for this many days; null = never","nullable":true},"idleExpiryTag":{"type":"string","description":"Tag added to the contact when a conversation ends as idle; null = none","nullable":true},"knowledgeCollectionIds":{"description":"Knowledge collections the agent may search","type":"array","items":{"type":"number"}},"channels":{"description":"Where the agent answers. Applies at once, without a publish.","allOf":[{"$ref":"#/components/schemas/AgentChannelsApiRes"}]},"answering":{"type":"boolean","description":"Whether the agent answers contacts right now: published, switched on and attached to at least one channel"},"readiness":{"description":"Whether the draft can be published and what is missing. null for kinds other than \"booking\".","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/AgentReadinessApiRes"}]},"summary":{"description":"The agent in words: a headline to read to the user, its state and the setup as rows","allOf":[{"$ref":"#/components/schemas/AgentSummaryApiRes"}]},"nextSteps":{"description":"What is left to do, in the order to do it (at most four). Empty when nothing is.","type":"array","items":{"$ref":"#/components/schemas/AgentNextStepApiRes"}},"appUrl":{"type":"string","description":"The agent in the app, to give to the user"},"calendar":{"description":"The calendar the agent books on and whether it is connected. null unless kind is \"booking\".","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/AgentCalendarApiRes"}]},"calendlyEventTypeName":{"type":"string","description":"Name of the Calendly event type booked; null on Google Calendar or when it could not be read","nullable":true},"timezoneLabel":{"type":"string","description":"The timezone in words","example":"Eastern Time (ET)"},"knowledgeCollections":{"description":"The knowledge collections of knowledgeCollectionIds, with their names","type":"array","items":{"$ref":"#/components/schemas/AgentKnowledgeCollectionRefApiRes"}}},"required":["id","name","kind","status","description","createdAt","updatedAt","publishedVersion","hasUnpublishedChanges","draftId","persona","tone","language","timezone","instructions","qualifyingQuestions","calendarProvider","calendlyEventTypeId","appointmentTitle","appointmentDescription","durationMinutes","lookAheadDays","maxSlotsToOffer","minimumNoticeMinutes","bookingHours","followUp","wrapUpInstructions","offTopicInstructions","handoff","enabled","requirePositiveSentiment","humanPacing","replyHours","idleExpiryDays","idleExpiryTag","knowledgeCollectionIds","channels","answering","readiness","summary","nextSteps","appUrl","calendar","calendlyEventTypeName","timezoneLabel","knowledgeCollections"]},"AgentVersionApiRes":{"type":"object","properties":{"id":{"type":"number","description":"Version ID (integer)"},"versionNumber":{"type":"number","description":"Version number, counted per agent from 1"},"publishedAt":{"type":"string","description":"When it was published; null for the draft","format":"date-time","nullable":true},"changelog":{"type":"string","description":"Note written when it was published","nullable":true},"isDraft":{"type":"boolean","description":"True for the one version still being edited"}},"required":["id","versionNumber","publishedAt","changelog","isDraft"]},"AgentVersionListApiRes":{"type":"object","properties":{"versions":{"description":"The newest versions, newest first","type":"array","items":{"$ref":"#/components/schemas/AgentVersionApiRes"}}},"required":["versions"]},"UpdateAgentApiDto":{"type":"object","properties":{"description":{"type":"string","description":"Owner note. Applies at once. null clears it.","maxLength":1000,"nullable":true},"persona":{"type":"string","description":"Who the agent is, one or two sentences. Needs a publish.","maxLength":2000},"tone":{"type":"string","description":"How the agent sounds. Needs a publish.","maxLength":500},"language":{"type":"string","description":"\"auto\" (the language the contact writes in) or a BCP-47 tag from agents_get_setup_options. Needs a publish.","maxLength":16,"example":"en-US"},"timezone":{"type":"string","description":"The agent's business timezone (IANA): reply hours are in it. Applies at once. On create it also sets the booking timezone unless bookingHours names one.","maxLength":64,"example":"America/New_York"},"instructions":{"type":"string","description":"The owner's instructions to the agent. The agent reads the first 8000 characters. Needs a publish.","maxLength":20000},"qualifyingQuestions":{"description":"The COMPLETE list of qualifying questions, in asking order (replaces the current list; an empty list books everyone). Needs a publish.","maxItems":25,"nullable":true,"type":"array","items":{"$ref":"#/components/schemas/AgentQuestionApiDto"}},"calendarProvider":{"type":"string","description":"Calendar the agent books on; it must be connected in the app (agents_get_setup_options says which are). Needs a publish.","enum":["google","calendly"],"nullable":true},"calendlyEventTypeId":{"type":"number","description":"Calendly only: the event type booked (an id from agents_get_setup_options); null clears it. Needs a publish.","minimum":1,"nullable":true},"appointmentTitle":{"type":"string","description":"What the appointment is called on the calendar (not blank). Needs a publish.","maxLength":200,"nullable":true},"appointmentDescription":{"type":"string","description":"Text added to the calendar event; null clears it. Needs a publish.","maxLength":1000,"nullable":true},"durationMinutes":{"type":"number","description":"Appointment length in minutes. Needs a publish.","minimum":5,"maximum":240,"nullable":true},"lookAheadDays":{"type":"number","description":"How many days ahead times are offered. Needs a publish.","minimum":1,"maximum":60,"nullable":true},"maxSlotsToOffer":{"type":"number","description":"How many times one answer offers. Needs a publish.","minimum":1,"maximum":10,"nullable":true},"minimumNoticeMinutes":{"type":"number","description":"Minutes of notice before a same-day time is offered (0 = none); null = next day only. Needs a publish.","minimum":0,"maximum":10080,"nullable":true},"bookingHours":{"description":"When appointments can be booked (start, end and days are sent together). Needs a publish.","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/AgentBookingHoursApiDto"}]},"followUp":{"description":"Nudges for a contact who goes quiet: on a question with followUpEnabled, or after the agent offered times they have not picked from; null = no follow-ups. On create, omitted = every 2 hours, up to 3 nudges, ±30 min. Needs a publish.","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/AgentFollowUpApiDto"}]},"wrapUpInstructions":{"type":"string","description":"How the agent wraps up when every question is answered but the lead is not clearly qualified; null = the built-in wording. Needs a publish.","maxLength":500,"nullable":true},"offTopicInstructions":{"type":"string","description":"How the agent steers an off-topic contact back; null = the built-in guidance. Needs a publish.","maxLength":500,"nullable":true},"handoff":{"description":"What the contact is told on a handoff; a field left out keeps its current value. Needs a publish.","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/AgentHandoffApiDto"}]},"enabled":{"type":"boolean","description":"The \"Agent on\" switch: when false the agent starts no new conversation. Applies at once."},"requirePositiveSentiment":{"type":"boolean","description":"Start a conversation only when the contact's first message reads as positive. Applies at once."},"humanPacing":{"type":"boolean","description":"Wait a few minutes before each reply, as a person would. Applies at once."},"replyHours":{"description":"Daily window, in the agent's timezone, in which replies are sent; null = any time. Applies at once.","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/AgentHoursApiDto"}]},"idleExpiryDays":{"type":"number","description":"End a conversation the contact left idle for this many days; null = never. Applies at once.","minimum":1,"maximum":90,"nullable":true},"idleExpiryTag":{"type":"string","description":"Tag added to the contact when a conversation ends as idle; null = none. Applies at once.","maxLength":100,"nullable":true},"knowledgeCollectionIds":{"type":"array","description":"The COMPLETE list of knowledge collections the agent may search; empty means every collection the agent owns. Needs a publish.","items":{"type":"integer","minimum":1},"maxItems":50,"uniqueItems":true},"name":{"type":"string","description":"Internal name shown on the AI agents page. Applies at once.","minLength":1,"maxLength":120},"expectedDraftId":{"type":"number","description":"The draftId the fields were read with (agents_get). When the draft is no longer that one, nothing is written and the call is refused.","minimum":1}}},"AgentUpdatedApiRes":{"type":"object","properties":{"id":{"type":"number","description":"Agent ID (integer)"},"name":{"type":"string","description":"Internal name shown on the AI agents page"},"kind":{"type":"string","enum":["custom","booking","support","sales","reengagement","faq"]},"status":{"type":"string","enum":["draft","active","archived"]},"description":{"type":"string","description":"Owner note","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"publishedVersion":{"description":"The version contacts are answered with; null when never published. The fields below describe the draft, which may be newer.","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/AgentPublishedVersionApiRes"}]},"hasUnpublishedChanges":{"type":"boolean","description":"The draft differs from the published version (publish to apply it)"},"draftId":{"type":"number","description":"ID of the draft these fields were read from. Send it back as expectedDraftId when editing, so an edit made on a stale read is refused."},"persona":{"type":"string","description":"Who the agent is"},"tone":{"type":"string","description":"How the agent sounds"},"language":{"type":"string","description":"\"auto\" (the language the contact writes in) or a BCP-47 tag","example":"en-US"},"timezone":{"type":"string","description":"The agent's business timezone (IANA): reply hours are in it. Applies at once, without a publish.","example":"America/New_York"},"instructions":{"type":"string","description":"The owner's instructions to the agent"},"qualifyingQuestions":{"description":"Asked before a time is offered, in order; an empty list books everyone. null unless kind is \"booking\".","nullable":true,"type":"array","items":{"$ref":"#/components/schemas/AgentQualifyingQuestionApiRes"}},"calendarProvider":{"type":"string","description":"Calendar the agent books on. null unless kind is \"booking\".","enum":["google","calendly"],"nullable":true},"calendlyEventTypeId":{"type":"number","description":"Calendly only: the event type booked (an id from agents_get_setup_options); null on Google Calendar","nullable":true},"appointmentTitle":{"type":"string","description":"What the appointment is called on the calendar","nullable":true},"appointmentDescription":{"type":"string","nullable":true},"durationMinutes":{"type":"number","description":"Appointment length in minutes","nullable":true},"lookAheadDays":{"type":"number","description":"How many days ahead times are offered","nullable":true},"maxSlotsToOffer":{"type":"number","description":"How many times one answer offers","nullable":true},"minimumNoticeMinutes":{"type":"number","description":"Minutes of notice before a same-day time is offered (0 = none). On a booking agent null means \"next day only\".","nullable":true},"bookingHours":{"description":"When appointments can be booked. null unless kind is \"booking\".","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/AgentBookingHoursApiRes"}]},"followUp":{"description":"Nudges for a contact who goes quiet: on a question with followUpEnabled, or after the agent offered times they have not picked from; null = no follow-ups","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/AgentFollowUpApiRes"}]},"wrapUpInstructions":{"type":"string","description":"How the agent wraps up when every question is answered but the lead is not clearly qualified; null = the built-in wording","nullable":true},"offTopicInstructions":{"type":"string","description":"How the agent steers an off-topic contact back; null = the built-in guidance","nullable":true},"handoff":{"description":"What the contact is told on a handoff. null unless kind is \"booking\".","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/AgentHandoffApiRes"}]},"enabled":{"type":"boolean","description":"The \"Agent on\" switch: when false the agent starts no new conversation. Applies at once, without a publish."},"requirePositiveSentiment":{"type":"boolean","description":"Start a conversation only when the contact's first message reads as positive"},"humanPacing":{"type":"boolean","description":"Wait a few minutes before each reply, as a person would"},"replyHours":{"description":"Daily window, in the agent's timezone, in which replies are sent; null = any time","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/AgentReplyHoursApiRes"}]},"idleExpiryDays":{"type":"number","description":"End a conversation the contact left idle for this many days; null = never","nullable":true},"idleExpiryTag":{"type":"string","description":"Tag added to the contact when a conversation ends as idle; null = none","nullable":true},"knowledgeCollectionIds":{"description":"Knowledge collections the agent may search","type":"array","items":{"type":"number"}},"channels":{"description":"Where the agent answers. Applies at once, without a publish.","allOf":[{"$ref":"#/components/schemas/AgentChannelsApiRes"}]},"answering":{"type":"boolean","description":"Whether the agent answers contacts right now: published, switched on and attached to at least one channel"},"readiness":{"description":"Whether the draft can be published and what is missing. null for kinds other than \"booking\".","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/AgentReadinessApiRes"}]},"summary":{"description":"The agent in words: a headline to read to the user, its state and the setup as rows","allOf":[{"$ref":"#/components/schemas/AgentSummaryApiRes"}]},"nextSteps":{"description":"What is left to do, in the order to do it (at most four). Empty when nothing is.","type":"array","items":{"$ref":"#/components/schemas/AgentNextStepApiRes"}},"appUrl":{"type":"string","description":"The agent in the app, to give to the user"},"calendar":{"description":"The calendar the agent books on and whether it is connected. null unless kind is \"booking\".","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/AgentCalendarApiRes"}]},"calendlyEventTypeName":{"type":"string","description":"Name of the Calendly event type booked; null on Google Calendar or when it could not be read","nullable":true},"timezoneLabel":{"type":"string","description":"The timezone in words","example":"Eastern Time (ET)"},"knowledgeCollections":{"description":"The knowledge collections of knowledgeCollectionIds, with their names","type":"array","items":{"$ref":"#/components/schemas/AgentKnowledgeCollectionRefApiRes"}},"publishRequired":{"type":"boolean","description":"True while contacts are not yet answered with what the draft says (never published, or the draft differs): agents_publish applies it"},"changedFields":{"description":"The fields whose stored value changed; empty when the call changed nothing","type":"array","items":{"type":"string"}},"warnings":{"description":"Caveats about the text given. Nothing was refused.","type":"array","items":{"type":"string"}}},"required":["id","name","kind","status","description","createdAt","updatedAt","publishedVersion","hasUnpublishedChanges","draftId","persona","tone","language","timezone","instructions","qualifyingQuestions","calendarProvider","calendlyEventTypeId","appointmentTitle","appointmentDescription","durationMinutes","lookAheadDays","maxSlotsToOffer","minimumNoticeMinutes","bookingHours","followUp","wrapUpInstructions","offTopicInstructions","handoff","enabled","requirePositiveSentiment","humanPacing","replyHours","idleExpiryDays","idleExpiryTag","knowledgeCollectionIds","channels","answering","readiness","summary","nextSteps","appUrl","calendar","calendlyEventTypeName","timezoneLabel","knowledgeCollections","publishRequired","changedFields","warnings"]},"AgentArchivedApiRes":{"type":"object","properties":{"id":{"type":"number","description":"Agent ID (integer)"},"status":{"type":"string","description":"Always \"archived\"","example":"archived"}},"required":["id","status"]},"AgentChannelsDetailApiRes":{"type":"object","properties":{"phoneNumbers":{"type":"array","items":{"$ref":"#/components/schemas/AgentPhoneNumberChannelApiRes"}},"workflows":{"type":"array","items":{"$ref":"#/components/schemas/AgentNamedChannelApiRes"}},"campaigns":{"type":"array","items":{"$ref":"#/components/schemas/AgentNamedChannelApiRes"}},"answering":{"type":"boolean","description":"Whether the agent answers contacts right now: published, switched on and attached to at least one channel"},"heldByOtherAgents":{"description":"Every number, workflow and campaign of the account that ANOTHER agent answers on: giving one to this agent needs takeOver","type":"array","items":{"$ref":"#/components/schemas/AgentsApiChannelHolderRes"}}},"required":["phoneNumbers","workflows","campaigns","answering","heldByOtherAgents"]},"SetAgentChannelsApiDto":{"type":"object","properties":{"phoneNumberIds":{"type":"array","description":"The COMPLETE list of phone numbers the agent answers on (ids from phone_numbers_list); left out keeps the current ones, [] removes all","items":{"type":"integer","minimum":1},"maxItems":200,"uniqueItems":true},"workflowIds":{"type":"array","description":"The COMPLETE list of workflows whose replies the agent answers (ids from workflows_list); left out keeps the current ones","items":{"type":"integer","minimum":1},"maxItems":200,"uniqueItems":true},"campaignIds":{"type":"array","description":"The COMPLETE list of SMS campaigns whose replies the agent answers (ids from campaigns_list); left out keeps the current ones","items":{"type":"integer","minimum":1},"maxItems":200,"uniqueItems":true},"takeOver":{"type":"boolean","description":"Move a number, workflow or campaign that another agent holds to this agent. Off: such a request is refused and lists who holds what.","default":false}}},"AgentChannelsSetApiRes":{"type":"object","properties":{"phoneNumbers":{"type":"array","items":{"$ref":"#/components/schemas/AgentPhoneNumberChannelApiRes"}},"workflows":{"type":"array","items":{"$ref":"#/components/schemas/AgentNamedChannelApiRes"}},"campaigns":{"type":"array","items":{"$ref":"#/components/schemas/AgentNamedChannelApiRes"}},"answering":{"type":"boolean","description":"Whether the agent answers contacts right now: published, switched on and attached to at least one channel"},"heldByOtherAgents":{"description":"Every number, workflow and campaign of the account that ANOTHER agent answers on: giving one to this agent needs takeOver","type":"array","items":{"$ref":"#/components/schemas/AgentsApiChannelHolderRes"}},"movedFromAgentIds":{"description":"Agents that lost a channel to this one (takeOver)","type":"array","items":{"type":"number"}},"summary":{"description":"The change in words: a headline to read to the user, the state of the agent and where it answers","allOf":[{"$ref":"#/components/schemas/AgentSummaryApiRes"}]},"nextSteps":{"description":"What is left to do, in order (at most four)","type":"array","items":{"$ref":"#/components/schemas/AgentNextStepApiRes"}},"appUrl":{"type":"string","description":"The agent in the app, to give to the user"}},"required":["phoneNumbers","workflows","campaigns","answering","heldByOtherAgents","movedFromAgentIds","summary","nextSteps","appUrl"]},"PublishAgentApiDto":{"type":"object","properties":{"changelog":{"type":"string","description":"A note on what changed, kept with the version","maxLength":2000,"nullable":true},"applyToLiveSessions":{"type":"boolean","description":"Also move the conversations the agent is in right now onto the new version (in the background). Off: they finish on the version they started with.","default":false}}},"AgentRolloutApiRes":{"type":"object","properties":{"id":{"type":"number","description":"Rollout ID (integer)"},"state":{"type":"string","enum":["running","completed","superseded","cancelled","failed"]},"total":{"type":"number","description":"Live conversations to move onto the new version"},"processed":{"type":"number","description":"Live conversations moved so far"}},"required":["id","state","total","processed"]},"AgentPublishedApiRes":{"type":"object","properties":{"agent":{"description":"The agent after the publish","allOf":[{"$ref":"#/components/schemas/AgentDetailApiRes"}]},"publishedVersion":{"description":"The version contacts are answered with from now on","allOf":[{"$ref":"#/components/schemas/AgentPublishedVersionApiRes"}]},"rollout":{"description":"The move of live conversations onto the new version; null without applyToLiveSessions or when no conversation is live","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/AgentRolloutApiRes"}]},"summary":{"description":"The publish in words: a headline to read to the user and the setup","allOf":[{"$ref":"#/components/schemas/AgentSummaryApiRes"}]},"nextSteps":{"description":"What is left to do, in order (at most four)","type":"array","items":{"$ref":"#/components/schemas/AgentNextStepApiRes"}},"appUrl":{"type":"string","description":"The agent in the app, to give to the user"}},"required":["agent","publishedVersion","rollout","summary","nextSteps","appUrl"]},"StartAgentSessionApiDto":{"type":"object","properties":{"conversationId":{"type":"integer","description":"The conversation to hand to the agent (integer id from conversations_list). Send this or contactUuid, not both."},"contactUuid":{"type":"string","description":"The contact whose existing conversation is handed to the agent (uuid from contacts_list). Send this or conversationId, not both. A contact with no conversation yet is refused: no conversation is created.","format":"uuid"},"phoneNumberId":{"type":"integer","description":"The phone number the agent texts from (integer id from phone_numbers_list). Left out: the number the conversation last used, else the agent's first phone number."},"replace":{"type":"boolean","description":"true ends the session of another agent that holds the conversation and hands it to this one; without it that case is refused","default":false},"idempotencyKey":{"type":"string","description":"Accepted and not needed: the call is idempotent by itself. Starting the same agent again on a conversation it already holds returns that session with created false.","maxLength":200}}},"AgentSessionOutcomeApiRes":{"type":"object","properties":{"id":{"type":"string","description":"Stable id of the outcome","example":"booked"},"label":{"type":"string","description":"Display name","example":"Appointment booked"}},"required":["id","label"]},"AgentSessionQualificationAnswerApiRes":{"type":"object","properties":{"questionId":{"type":"string","description":"Id of the qualifying question on the agent"},"question":{"type":"string","description":"The question as it was asked"},"answer":{"type":"string","description":"The contact's answer; null while unanswered","nullable":true},"qualified":{"type":"boolean","description":"Whether the answer met the question's rule; null when not evaluated","nullable":true}},"required":["questionId","question","answer","qualified"]},"AgentSessionQualificationApiRes":{"type":"object","properties":{"result":{"type":"string","description":"pending = still asking; qualified = the lead met the rules; review = answered, not clearly qualified, left for a person","enum":["pending","qualified","review"]},"answers":{"type":"array","items":{"$ref":"#/components/schemas/AgentSessionQualificationAnswerApiRes"}}},"required":["result","answers"]},"AgentSessionApiRes":{"type":"object","properties":{"id":{"type":"number","description":"Session ID (integer)"},"agentId":{"type":"number","description":"Agent ID (integer)"},"agentName":{"type":"string","description":"The agent's name; null when the agent no longer exists","nullable":true},"conversationId":{"type":"number","description":"Conversation ID (integer), as in conversations_get","nullable":true},"contactUuid":{"type":"string","description":"The contact's uuid, as in contacts_get","format":"uuid","nullable":true},"status":{"type":"string","description":"active, paused_by_user and paused_no_credits are live; completed, escalated, max_turns, expired and superseded have ended","enum":["active","paused_by_user","paused_no_credits","completed","escalated","max_turns","expired","superseded"]},"reasonCode":{"type":"string","description":"Why the session escalated or ended; null while it is live. The agent.escalated and agent.session_ended webhooks may carry a more specific code for the same session.","enum":["agent_escalated","review_needed","no_availability","follow_ups_exhausted","rate_limited","max_turns","opted_out","idle","superseded","completed"],"nullable":true},"reason":{"type":"string","description":"Why the session needs a person, in words; null when it does not","nullable":true},"needsAttention":{"type":"boolean","description":"A person should look at this session: it is flagged and not yet reviewed"},"outcome":{"description":"The result the session ended with; null while undecided","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/AgentSessionOutcomeApiRes"}]},"qualification":{"description":"What a booking agent learned about the lead; null for other agents","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/AgentSessionQualificationApiRes"}]},"turnCount":{"type":"number","description":"Turns the agent has taken"},"startedAt":{"type":"string","description":"When the session started","format":"date-time"},"lastAgentMessageAt":{"type":"string","format":"date-time","nullable":true},"lastContactMessageAt":{"type":"string","format":"date-time","nullable":true},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","agentId","agentName","conversationId","contactUuid","status","reasonCode","reason","needsAttention","outcome","qualification","turnCount","startedAt","lastAgentMessageAt","lastContactMessageAt","updatedAt"]},"AgentSessionStartedApiRes":{"type":"object","properties":{"session":{"description":"The session that now holds the conversation","allOf":[{"$ref":"#/components/schemas/AgentSessionApiRes"}]},"created":{"type":"boolean","description":"true = a session was started; false = this agent already held the conversation and that session is returned (it is switched back on when it was paused)"}},"required":["session","created"]},"AgentSettingsApiRes":{"type":"object","properties":{"defaultAgentId":{"type":"number","description":"The agent that answers a new conversation no other agent claims; null = none","nullable":true},"defaultEnabled":{"type":"boolean","description":"Whether the default agent is switched on"},"agentsPaused":{"type":"boolean","description":"Pause all: while true no agent of the account replies, follows up or sends"},"agentsPausedAt":{"type":"string","description":"When pause all was switched on; null while off","format":"date-time","nullable":true}},"required":["defaultAgentId","defaultEnabled","agentsPaused","agentsPausedAt"]},"UpdateAgentSettingsApiDto":{"type":"object","properties":{"defaultAgentId":{"type":"number","description":"The default agent: a published, active agent (an id from agents_list); null clears it","minimum":1,"nullable":true},"defaultEnabled":{"type":"boolean","description":"Switch the default agent on or off (on needs a default agent)"},"agentsPaused":{"type":"boolean","description":"Pause all: true stops every agent of the account at once"}}},"AgentKnowledgeCollectionApiRes":{"type":"object","properties":{"id":{"type":"number","description":"Collection ID (integer)"},"agentId":{"type":"number","description":"The agent that owns the collection"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"sourceCount":{"type":"number","description":"How many sources it holds"},"attached":{"type":"boolean","description":"Whether the draft of the agent searches this collection: its knowledgeCollectionIds is empty (every collection of the agent is searched) or names this one"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","agentId","name","description","sourceCount","attached","createdAt","updatedAt"]},"AgentKnowledgeCollectionListApiRes":{"type":"object","properties":{"collections":{"description":"Oldest first","type":"array","items":{"$ref":"#/components/schemas/AgentKnowledgeCollectionApiRes"}},"draftCollectionIds":{"description":"The knowledgeCollectionIds of the draft: empty means the agent searches every collection it owns","type":"array","items":{"type":"number"}}},"required":["collections","draftCollectionIds"]},"CreateAgentKnowledgeCollectionApiDto":{"type":"object","properties":{"name":{"type":"string","description":"Name shown in the app","minLength":1,"maxLength":120,"example":"Price list"},"description":{"type":"string","description":"What the collection holds, for the people who maintain it","maxLength":2000,"nullable":true},"attach":{"type":"boolean","description":"true (default) makes sure the draft of the agent searches the new collection: when the draft restricts the agent to a list of collections (knowledgeCollectionIds is not empty) the new id is added to it. false leaves that list as it is.","default":true}},"required":["name"]},"AgentKnowledgeCollectionCreatedApiRes":{"type":"object","properties":{"id":{"type":"number","description":"Collection ID (integer)"},"agentId":{"type":"number","description":"The agent that owns the collection"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"sourceCount":{"type":"number","description":"How many sources it holds"},"attached":{"type":"boolean","description":"Whether the draft of the agent searches this collection: its knowledgeCollectionIds is empty (every collection of the agent is searched) or names this one"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"publishRequired":{"type":"boolean","description":"true when the id was added to the knowledgeCollectionIds of the draft, which reaches contacts after agents_publish; false when nothing was written to the draft"},"warnings":{"description":"Caveats that did not stop the collection being created","type":"array","items":{"type":"string"}}},"required":["id","agentId","name","description","sourceCount","attached","createdAt","updatedAt","publishRequired","warnings"]},"AgentKnowledgeCollectionDeletedApiRes":{"type":"object","properties":{"id":{"type":"number","description":"ID of the collection that was deleted"},"deleted":{"type":"boolean","example":true},"detachedFromDraft":{"type":"boolean","description":"true when the id was also removed from the knowledgeCollectionIds of the draft"}},"required":["id","deleted","detachedFromDraft"]},"AgentKnowledgeSourceApiRes":{"type":"object","properties":{"id":{"type":"number","description":"Source ID (integer)"},"collectionId":{"type":"number","description":"The collection it belongs to"},"type":{"type":"string","description":"file sources are uploaded in the app and cannot be edited here","enum":["text","qa","table","file"]},"title":{"type":"string"},"status":{"type":"string","description":"ready = the agent can find it; failed = it was saved but could not be indexed (error says why); pending and processing = being indexed","enum":["pending","processing","ready","failed"]},"error":{"type":"string","description":"Why indexing failed, in words; null unless status is failed","nullable":true},"errorCode":{"type":"string","description":"KNOWLEDGE_INGEST_FAILED when status is failed; null otherwise","enum":["KNOWLEDGE_INGEST_FAILED"],"nullable":true},"passageCount":{"type":"number","description":"How many passages the source was split into"},"indexedAt":{"type":"string","format":"date-time","nullable":true},"createdAt":{"type":"string","format":"date-time"}},"required":["id","collectionId","type","title","status","error","errorCode","passageCount","indexedAt","createdAt"]},"AgentKnowledgeSourceListApiRes":{"type":"object","properties":{"sources":{"description":"Oldest first","type":"array","items":{"$ref":"#/components/schemas/AgentKnowledgeSourceApiRes"}}},"required":["sources"]},"AgentKnowledgeQaPairApiDto":{"type":"object","properties":{"question":{"type":"string","minLength":1,"maxLength":2000},"answer":{"type":"string","minLength":1,"maxLength":5000}},"required":["question","answer"]},"CreateAgentKnowledgeSourceApiDto":{"type":"object","properties":{"type":{"type":"string","description":"text = free text in content; qa = question and answer pairs in pairs; table = columns and rows","enum":["text","qa","table"]},"title":{"type":"string","description":"Title shown in the app and given to the agent with each passage","minLength":1,"maxLength":200,"example":"Prices 2026"},"content":{"type":"string","description":"type text: the text (1 to 50000 characters)","minLength":1,"maxLength":50000},"pairs":{"description":"type qa: 1 to 500 question and answer pairs","type":"array","items":{"$ref":"#/components/schemas/AgentKnowledgeQaPairApiDto"}},"columns":{"description":"type table: 1 to 50 column names","type":"array","items":{"type":"string"}},"rows":{"type":"array","description":"type table: 1 to 1000 rows, each a list with one text cell per column (a cell holds up to 2000 characters, the whole table up to 2 MB of text)","items":{"type":"array","items":{"type":"string"}}}},"required":["type","title"]},"UpdateAgentKnowledgeSourceApiDto":{"type":"object","properties":{"type":{"type":"string","description":"The type the source has (from agent_knowledge_list_sources). A source keeps its type.","enum":["text","qa","table"]},"title":{"type":"string","minLength":1,"maxLength":200},"content":{"type":"string","description":"type text: the new text, replacing the stored one","minLength":1,"maxLength":50000},"pairs":{"description":"type qa: the new pairs, replacing every stored pair","type":"array","items":{"$ref":"#/components/schemas/AgentKnowledgeQaPairApiDto"}},"columns":{"description":"type table: the new column names. Each stored or sent row needs one cell per column, so a change in the number of columns comes with rows.","type":"array","items":{"type":"string"}},"rows":{"type":"array","description":"type table: the new rows, replacing every stored row (up to 2 MB of text in all)","items":{"type":"array","items":{"type":"string"}}}},"required":["type"]},"AgentKnowledgeSourceDeletedApiRes":{"type":"object","properties":{"id":{"type":"number","description":"ID of the source that was deleted"},"deleted":{"type":"boolean","example":true}},"required":["id","deleted"]},"AgentSessionsPageMetadataApiRes":{"type":"object","properties":{"totalPages":{"type":"number","description":"Number of pages"},"totalItems":{"type":"number","description":"Number of sessions across every page, counted up to 10,000"},"itemsPerPage":{"type":"number","description":"Items per page (take)"},"currentPage":{"type":"number","description":"This page (1-based)"}},"required":["totalPages","totalItems","itemsPerPage","currentPage"]},"AgentSessionListApiRes":{"type":"object","properties":{"rows":{"description":"Newest first","type":"array","items":{"$ref":"#/components/schemas/AgentSessionApiRes"}},"metadata":{"$ref":"#/components/schemas/AgentSessionsPageMetadataApiRes"}},"required":["rows","metadata"]},"ConversationAgentApiRes":{"type":"object","properties":{"conversationId":{"type":"number","description":"Conversation ID (integer), as in conversations_get"},"agentPaused":{"type":"boolean","description":"true = no AI agent answers on this conversation until it is resumed (conversation_agent_resume). A teammate who texts the contact from the app pauses it as well."},"agentPausedAt":{"type":"string","description":"When it was paused; null while it is not","format":"date-time","nullable":true},"agentStatus":{"type":"string","description":"What the agent on this conversation is doing: bot_active = answering, paused = held back for a person, needs_review and escalated = waiting on a person, qualified = the lead met the rules, booked = an appointment was booked. null when no agent ever handled it.","enum":["bot_active","paused","needs_review","escalated","booked","qualified"],"nullable":true},"needsAttention":{"type":"boolean","description":"A person should look at this conversation: its agent session is flagged and not yet acknowledged (agent_sessions_acknowledge)"},"sessionId":{"type":"number","description":"The agent session behind agentStatus, as in agent_sessions_get","nullable":true},"agentId":{"type":"number","description":"The agent of that session, as in agents_get","nullable":true}},"required":["conversationId","agentPaused","agentPausedAt","agentStatus","needsAttention","sessionId","agentId"]},"CreateAgentTestSessionApiDto":{"type":"object","properties":{"contactUuid":{"type":"string","description":"The contact the test is played as (uuid from contacts_list). The agent reads this contact the way it would in a real conversation; the contact receives nothing.","format":"uuid"},"useDraft":{"type":"boolean","description":"true (default) tests the draft, with its unpublished edits; false tests the published version","default":true},"includeHistory":{"type":"boolean","description":"true lets the agent read the contact's real conversation so far before the test messages; false (default) starts from an empty conversation","default":false}},"required":["contactUuid"]},"AgentTestSessionApiRes":{"type":"object","properties":{"id":{"type":"number","description":"Test session ID (integer); the sessionId of the send and reset calls"},"agentId":{"type":"number","description":"Agent ID (integer)"},"contactUuid":{"type":"string","description":"The contact the test is played as","format":"uuid","nullable":true},"usesDraft":{"type":"boolean","description":"true = the draft is tested; false = the published version"},"status":{"type":"string","description":"active while the test conversation takes messages","enum":["active","paused_by_user","paused_no_credits","completed","escalated","max_turns","expired","superseded"]},"createdAt":{"type":"string","format":"date-time"}},"required":["id","agentId","contactUuid","usesDraft","status","createdAt"]},"SendAgentTestMessageApiDto":{"type":"object","properties":{"content":{"type":"string","description":"The message, as the contact would text it","minLength":1,"maxLength":2000,"example":"Hi, do you have anything on Thursday?"}},"required":["content"]},"AgentTestToolCallApiRes":{"type":"object","properties":{"toolId":{"type":"string","description":"The tool","example":"check_availability"},"ok":{"type":"boolean","description":"Whether the call succeeded"}},"required":["toolId","ok"]},"AgentTestTurnApiRes":{"type":"object","properties":{"reply":{"type":"string","description":"What the agent would have texted the contact; null when it sent nothing (skippedReason then says why, when the turn did not run)","nullable":true},"action":{"type":"string","description":"continue = the agent waits for the next message; complete = it ended the conversation with an outcome; escalate = it handed over to a person","enum":["continue","complete","escalate"]},"toolCalls":{"description":"The tools the agent used this turn, in order","type":"array","items":{"$ref":"#/components/schemas/AgentTestToolCallApiRes"}},"outcome":{"description":"The result the test conversation ended with; null while undecided","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/AgentSessionOutcomeApiRes"}]},"qualification":{"description":"What a booking agent has learned so far in this test; null for other agents","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/AgentSessionQualificationApiRes"}]},"sessionStatus":{"type":"string","description":"The test conversation after the turn. Anything but active takes no more messages: start over with agent_test_sessions_reset.","enum":["active","paused_by_user","paused_no_credits","completed","escalated","max_turns","expired","superseded"]},"creditsCharged":{"type":"number","description":"Credits this turn was charged, when the turn records it; null when it does not (the credit balance is always exact)","nullable":true},"turnNumber":{"type":"number","description":"Number of this turn in the test conversation (1-based)"},"skippedReason":{"type":"string","description":"Why the agent did not answer, when a rule stopped the turn before it ran (for example opted_out, max_turns, sentiment_not_positive, agents_paused, rate_limited); null for a turn that ran","nullable":true}},"required":["reply","action","toolCalls","outcome","qualification","sessionStatus","creditsCharged","turnNumber","skippedReason"]},"ComplianceCheckDto":{"type":"object","properties":{"messages":{"description":"The texts to check, each as it would be sent as the first message of a workflow or campaign. 1 to 10 texts, each 1 to 1600 characters.","minItems":1,"maxItems":10,"example":["Hi {firstName}, this is Acme Roofing. Reply STOP to opt out."],"type":"array","items":{"type":"string"}}},"required":["messages"]},"ComplianceCheckResultRes":{"type":"object","properties":{"message":{"type":"string","description":"The text that was checked, as sent"},"compliant":{"type":"boolean","description":"True when the text names the brand and gives opt-out wording, so a workflow or campaign with it as the first message can be published or started."},"issues":{"description":"What is wrong with the text; empty when it is compliant.","type":"array","items":{"type":"string"}},"suggestions":{"description":"How to fix the text; empty when it is compliant.","type":"array","items":{"type":"string"}},"mergeFieldWarnings":{"description":"Merge fields in this text that will not be filled as written: double braces such as {{firstName}}, a \"{\" with no \"}\", or a name that is not a contact field of this account. Not part of compliant. Present only when at least one is found.","type":"array","items":{"$ref":"#/components/schemas/MergeFieldWarningRes"}}},"required":["message","compliant","issues","suggestions"]},"ComplianceCheckRes":{"type":"object","properties":{"results":{"description":"One result per text, in the order of messages.","type":"array","items":{"$ref":"#/components/schemas/ComplianceCheckResultRes"}}},"required":["results"]},"ComplianceApiErrorRes":{"type":"object","properties":{"statusCode":{"type":"number","description":"HTTP status code, repeated in the body","example":422},"error":{"type":"string","description":"A stable machine-readable reason (branch on this, not on the message).","enum":["BRAND_REQUIRED","COMPLIANCE_UNAVAILABLE","Bad Request"]},"code":{"type":"string","description":"The same value as error.","enum":["BRAND_REQUIRED","COMPLIANCE_UNAVAILABLE"]},"message":{"description":"What was refused, in words. May be reworded.","oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]}},"required":["statusCode","error","code","message"]},"WebhookRes":{"type":"object","properties":{"extId":{"type":"string","description":"Webhook unique identifier","format":"uuid"},"url":{"type":"string","description":"The URL events are POSTed to","example":"https://example.com/webhooks"},"events":{"description":"List of event types this webhook is subscribed to","example":["contact.created","message.sent"],"type":"array","items":{"type":"string"}},"secret":{"type":"string","description":"Signing secret used to verify webhook payloads (HMAC-SHA256). Treat as sensitive.","example":"whsec_AbCdEf1234..."},"enabled":{"type":"boolean","description":"Whether the webhook is enabled","example":true},"failureCount":{"type":"number","description":"Number of consecutive failed deliveries since the last success","example":0},"lastTriggeredAt":{"type":"object","description":"ISO 8601 timestamp of the last delivery attempt","nullable":true,"example":"2026-04-27T14:30:00.000Z"},"failingSince":{"type":"object","description":"ISO 8601 timestamp of the first failed delivery in the current run of failures; null when the last delivery succeeded","nullable":true,"example":"2026-04-27T13:30:00.000Z"},"autoDisabledAt":{"type":"object","description":"ISO 8601 timestamp when the endpoint was disabled automatically after failing continuously for at least an hour; cleared when re-enabled","nullable":true,"example":"2026-04-27T14:30:00.000Z"},"createdAt":{"type":"string","description":"Creation timestamp (ISO 8601)","example":"2026-04-01T10:00:00.000Z"},"updatedAt":{"type":"string","description":"Last update timestamp (ISO 8601)","example":"2026-04-27T14:30:00.000Z"}},"required":["extId","url","events","secret","enabled","failureCount","lastTriggeredAt","failingSince","autoDisabledAt","createdAt","updatedAt"]},"CreateWebhookApiDto":{"type":"object","properties":{"url":{"type":"string","description":"The URL to send webhook events to","example":"https://example.com/webhooks"},"events":{"description":"List of event types to subscribe to","example":["contact.created","message.sent"],"type":"array","items":{"type":"string"}}},"required":["url","events"]},"UpdateWebhookApiDto":{"type":"object","properties":{"url":{"type":"string","description":"The URL to send webhook events to","example":"https://example.com/webhooks"},"events":{"description":"List of event types to subscribe to","example":["contact.created","message.sent"],"type":"array","items":{"type":"string"}},"enabled":{"type":"boolean","description":"Whether the webhook is enabled","example":true}}},"WebhookDeliveryRes":{"type":"object","properties":{"extId":{"type":"string","description":"Delivery unique identifier","format":"uuid"},"eventType":{"type":"string","description":"The event type that was delivered","example":"contact.created"},"payload":{"type":"object","description":"The payload sent to the webhook URL","additionalProperties":true},"responseStatus":{"type":"object","description":"HTTP status code returned by the webhook URL","nullable":true,"example":200},"responseBody":{"type":"object","description":"Response body returned by the webhook URL (truncated to 10 KB). Null if the request errored before a response was received.","nullable":true,"example":"OK"},"attempts":{"type":"number","description":"Number of delivery attempts made for this event","example":1},"duration":{"type":"object","description":"Total time taken for the delivery, in milliseconds","nullable":true,"example":142},"status":{"type":"string","description":"Outcome of the delivery","enum":["success","failed"],"example":"success"},"createdAt":{"type":"string","description":"Timestamp of the delivery attempt (ISO 8601)","example":"2026-04-27T14:30:00.000Z"}},"required":["extId","eventType","payload","responseStatus","responseBody","attempts","duration","status","createdAt"]},"WebhookEventSampleRes":{"type":"object","properties":{"event":{"type":"object","description":"Webhook event name","example":"contact.created"},"data":{"type":"object","description":"Sample data payload matching the production shape"},"timestamp":{"type":"string","description":"ISO 8601 timestamp the sample envelope was generated at","example":"2026-05-22T19:30:00.000Z"},"webhookId":{"type":"string","description":"Sentinel value — no real webhook subscription is involved","default":"sample"}},"required":["event","data","timestamp","webhookId"]},"AsyncOperationProgressRes":{"type":"object","properties":{"total":{"type":"number","description":"Items the operation will handle","minimum":0},"processed":{"type":"number","description":"Items handled so far","minimum":0},"percentage":{"type":"number","description":"processed as a share of total, 0 to 100","minimum":0},"successCount":{"type":"number","description":"Items handled successfully","minimum":0},"errorCount":{"type":"number","description":"Items that failed","minimum":0},"message":{"type":"string","description":"A short status line, for example \"Initializing...\" while a bulk delete counts its contacts, then \"Deleting contacts...\", then \"Deleted 190 of 190 contacts\". On a failed operation it carries the failure reason."}},"required":["total","processed","percentage","successCount","errorCount"]},"AsyncOperationRes":{"type":"object","properties":{"operationId":{"type":"string","description":"Async operation id","format":"uuid"},"operationType":{"type":"string","description":"What the operation does, for example import_contacts or bulk_contact_delete. POST /v1/scrubs/{scrubId}/remove answers the operationId of a bulk_contact_delete operation, POST /v1/contacts/restore (contacts_restore) that of a bulk_contact_restore operation."},"status":{"type":"string","description":"in_progress while it runs, then completed or failed. Poll until it is no longer in_progress.","enum":["pending","in_progress","completed","failed","cancelled"]},"progress":{"description":"Present while the operation runs and for 30 minutes after its last update. A completed operation read after that has no progress, only result and completedAt.","allOf":[{"$ref":"#/components/schemas/AsyncOperationProgressRes"}]},"result":{"type":"object","additionalProperties":true,"description":"The outcome of a completed operation. A bulk_contact_delete reports { deletedCount }; a bulk_contact_restore reports { restoredCount, skippedCount, listId }, listId only when the new list received contacts."},"createdAt":{"type":"string","description":"When the operation was created","format":"date-time"},"completedAt":{"type":"string","description":"When the operation completed or failed","format":"date-time"}},"required":["operationId","operationType","status","createdAt"]},"CreditsBalanceRes":{"type":"object","properties":{"billedBy":{"type":"string","description":"Who pays for this account. `organisation` means the organisation that owns the account buys its credits; money writes through this key are refused.","enum":["account","organisation"]},"remainingCredits":{"type":"number","description":"SMS credits available to spend"},"rechargeActive":{"type":"boolean","description":"Whether auto-recharge is currently armed"},"rechargeMinimum":{"type":"object","description":"Balance threshold below which auto-recharge fires","nullable":true},"rechargeProductId":{"type":"object","description":"Stripe product id used for auto-recharge purchases","nullable":true},"totalCreditsPurchased":{"type":"number","description":"Lifetime SMS credits the user has purchased"},"verificationCredits":{"type":"number","description":"Verification credits available to spend"},"totalVerificationCreditsPurchased":{"type":"number","description":"Lifetime verification credits the user has purchased"},"aiCredits":{"type":"number","description":"Purchased AI credits available to spend (for an account an organization owns, the organization pool). 0 when none. Present only when AI credits are enabled for the account (the AI credits feature); otherwise omitted."},"totalAiCreditsPurchased":{"type":"number","description":"Lifetime AI credits the account has purchased. 0 when none. Present only when AI credits are enabled for the account (the AI credits feature); otherwise omitted."},"monthlyFreeAiCreditsRemaining":{"type":"number","description":"What is left of the monthly free AI credits. 0 when none. Present only when AI credits are enabled for the account (the AI credits feature); otherwise omitted."},"monthlyReservedAiCreditsRemaining":{"type":"number","description":"What is left of the monthly reserved (subscription) AI credits. 0 when none. Present only when AI credits are enabled for the account (the AI credits feature); otherwise omitted."}},"required":["billedBy","remainingCredits","rechargeActive","rechargeMinimum","rechargeProductId","totalCreditsPurchased","verificationCredits","totalVerificationCreditsPurchased"]},"CreditTransferUserRes":{"type":"object","properties":{"id":{"type":"number"},"email":{"type":"string"}},"required":["id","email"]},"CreditTransferRes":{"type":"object","properties":{"id":{"type":"number"},"transferType":{"type":"string","description":"Transfer type. The refund types are credits removed from the account when a credit purchase was refunded.","enum":["team_transfer","admin_grant","feedback_reward","admin_refund","admin_ai_refund","admin_verification_refund"]},"amount":{"type":"number","description":"Number of credits, always positive. SMS credits, except on `admin_ai_refund` (AI credits) and `admin_verification_refund` (verification credits)"},"notes":{"type":"object","description":"Always null on a refund","nullable":true},"teamId":{"type":"object","nullable":true},"fromUser":{"description":"Sender of the transfer (null when the user is unknown)","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/CreditTransferUserRes"}]},"toUser":{"description":"Recipient of the transfer (null when the user is unknown, and on a refund)","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/CreditTransferUserRes"}]},"createdAt":{"type":"string","description":"ISO 8601 timestamp"}},"required":["id","transferType","amount","notes","teamId","fromUser","toUser","createdAt"]},"CreditTransfersMetadataRes":{"type":"object","properties":{"totalPages":{"type":"number"},"totalItems":{"type":"number"},"itemsPerPage":{"type":"number"},"currentPage":{"type":"number"}},"required":["totalPages","totalItems","itemsPerPage","currentPage"]},"CreditTransfersRes":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/CreditTransferRes"}},"metadata":{"$ref":"#/components/schemas/CreditTransfersMetadataRes"}},"required":["rows","metadata"]},"PurchaseCreditsReq":{"type":"object","properties":{"kind":{"type":"string","description":"Which credits the pack holds: `sms`, `verification` or `ai`, the `kind` of the pack in `GET /v1/credits/products`","enum":["sms","verification","ai"]},"productId":{"type":"string","description":"The `id` of a pack from `GET /v1/credits/products`","example":"prod_ABC123"},"lookupKey":{"type":"string","description":"The `lookupKey` of a pack from `GET /v1/credits/products` (for example `1000_sms` or `ai_pack_1000`)","example":"1000_sms"}},"required":["kind"]},"CreditPurchaseAmountRes":{"type":"object","properties":{"value":{"type":"number","description":"In the minor unit of `currency`"},"currency":{"type":"string","description":"ISO 4217 code, lower case"}},"required":["value","currency"]},"CreditPurchaseRes":{"type":"object","properties":{"id":{"type":"string","description":"The purchase id; poll `GET /v1/credits/purchases/{id}` with it"},"status":{"type":"string","enum":["pending","requires_action","succeeded","failed"],"description":"`succeeded` once Stripe took the money (the credits follow within seconds, see `creditsGranted`); `pending` while Stripe is still processing; `requires_action` while the bank wants the cardholder to confirm at `completeUrl`; `failed` when the charge will not go through."},"kind":{"type":"string","description":"Which credits the pack holds","enum":["sms","verification","ai"],"nullable":true},"credits":{"type":"number","description":"Credits the account receives once the charge succeeds"},"amount":{"$ref":"#/components/schemas/CreditPurchaseAmountRes"},"creditsGranted":{"type":"number","description":"Credits the account has actually received from this purchase; null until the payment has been confirmed and granted. Poll until it is set.","nullable":true},"completeUrl":{"type":"string","description":"Only while `requires_action`: the page where a signed-in user confirms the charge with their bank. Hand it to a person; it is not for the agent."},"statusUrl":{"type":"string","description":"Where to poll this purchase"},"createdAt":{"type":"string","description":"ISO 8601"}},"required":["id","status","kind","credits","amount","creditsGranted","statusUrl","createdAt"]},"CreditPurchaseRefusalRes":{"type":"object","properties":{"message":{"type":"string","description":"What was refused, in words. May be reworded."},"code":{"type":"string","description":"A stable machine-readable reason. Branch on this, not on the message.","enum":["AUTHENTICATION_REQUIRED","CARD_DECLINED","PRODUCT_NOT_FOUND","PURCHASE_NOT_FOUND","NO_PAYMENT_METHOD","IDEMPOTENCY_KEY_REUSED","campaign_not_approved"]},"purchase":{"description":"With `AUTHENTICATION_REQUIRED`: the purchase, carrying `completeUrl`. With `CARD_DECLINED`: the failed purchase, when Stripe recorded one.","allOf":[{"$ref":"#/components/schemas/CreditPurchaseRes"}]},"declineCode":{"type":"string","description":"With `CARD_DECLINED`: Stripe's decline code","nullable":true}},"required":["message","code"]},"CreditsApiErrorRes":{"type":"object","properties":{"message":{"type":"string","description":"What was refused, in words. May be reworded."},"code":{"type":"string","description":"A stable machine-readable reason. Branch on this, not on the message.","enum":["AUTHENTICATION_REQUIRED","CARD_DECLINED","PRODUCT_NOT_FOUND","PURCHASE_NOT_FOUND","NO_PAYMENT_METHOD","IDEMPOTENCY_KEY_REUSED","campaign_not_approved"]}},"required":["message","code"]},"UpdateAutoRechargeReq":{"type":"object","properties":{"kind":{"type":"string","description":"Which auto-recharge to set: `sms` (the default when omitted) or `ai` (AI credits). The two are independent; each has its own threshold and pack.","enum":["sms","ai"],"default":"sms"},"active":{"type":"boolean","description":"Arm (`true`) or disarm (`false`) auto-recharge. Arming SMS needs a carrier-accepted campaign, a card on file and an SMS pack on sale. Arming AI needs a threshold and an AI pack, supplied here or already stored (there is no cheapest-pack default)."},"threshold":{"type":"number","description":"Balance below which a recharge fires, in credits; omit to keep the current one. SMS: floored at 1000. AI: an integer from 10 to 1000.","minimum":1},"productId":{"type":"string","description":"The `id` of the pack to buy on each recharge, from `GET /v1/credits/products`, of the same kind as `kind` (an SMS pack by default, an AI pack with `kind: ai`); omit to keep the stored pack (for SMS, when none is stored, the cheapest).","example":"prod_ABC123"}},"required":["active"]},"AutoRechargeRes":{"type":"object","properties":{"rechargeActive":{"type":"boolean","description":"Whether auto-recharge is armed"},"rechargeMinimum":{"type":"number","description":"Balance below which a recharge fires, in credits","nullable":true},"rechargeProductId":{"type":"string","description":"The pack bought on each recharge (an AI pack for `kind: ai`)","nullable":true}},"required":["rechargeActive","rechargeMinimum","rechargeProductId"]},"CreditProductRes":{"type":"object","properties":{"id":{"type":"string","description":"Stripe product id"},"kind":{"type":"string","description":"Which balance the pack fills: SMS credits, verification credits or AI credits. AI credit packs require the AI credits feature on the account; without it AI packs are not listed and `kind: ai` is refused.","enum":["sms","verification","ai"]},"name":{"type":"string","description":"Product name as shown on the dashboard"},"credits":{"type":"number","description":"Credits granted when the pack is bought. For an AI pack this is the total, bonus included."},"unitAmount":{"type":"number","description":"Price in the smallest unit of the currency (cents for USD)"},"currency":{"type":"string","description":"ISO 4217 currency code, lower case","example":"usd"},"priceId":{"type":"string","description":"Stripe price id of the pack’s current price"},"lookupKey":{"type":"string","description":"Stable identifier of the price (for example `1000_sms`, `500_verification_credits`, `ai_pack_1000`)"}},"required":["id","kind","name","credits","unitAmount","currency","priceId","lookupKey"]},"CreditProductsRes":{"type":"object","properties":{"products":{"description":"Every pack on sale: SMS packs first, then verification packs, then AI packs, each kind in ascending credit order","type":"array","items":{"$ref":"#/components/schemas/CreditProductRes"}}},"required":["products"]},"CreditUsageDayRes":{"type":"object","properties":{"date":{"type":"string","description":"The day, YYYY-MM-DD (UTC)"},"campaignId":{"type":"object","nullable":true,"description":"Campaign the credits were spent by"},"workflowId":{"type":"object","nullable":true,"description":"Workflow the credits were spent by"},"creditsUsed":{"type":"number","description":"SMS credits spent that day"}},"required":["date","campaignId","workflowId","creditsUsed"]},"CreditUsageMetadataRes":{"type":"object","properties":{"totalPages":{"type":"number"},"totalItems":{"type":"number"},"itemsPerPage":{"type":"number"},"currentPage":{"type":"number"}},"required":["totalPages","totalItems","itemsPerPage","currentPage"]},"CreditUsageRes":{"type":"object","properties":{"campaignId":{"type":"object","nullable":true,"description":"The campaignId asked for, echoed back"},"workflowId":{"type":"object","nullable":true,"description":"The workflowId asked for, echoed back"},"creditsUsedToday":{"type":"number","description":"Credits spent so far today. Today is not in `rows` until the nightly roll-up; it is reported here regardless of the date range."},"rows":{"description":"One row per day, newest first","type":"array","items":{"$ref":"#/components/schemas/CreditUsageDayRes"}},"metadata":{"$ref":"#/components/schemas/CreditUsageMetadataRes"}},"required":["campaignId","workflowId","creditsUsedToday","rows","metadata"]},"OnboardingSummaryRes":{"type":"object","properties":{"hasSubscription":{"type":"boolean","description":"Whether the user has an active paid/trial subscription"},"hasBrand":{"type":"boolean","description":"Whether the user has registered a 10DLC brand"},"brandStatus":{"type":"string","description":"Lifecycle status of the 10DLC brand","enum":["none","pending","approved","failed"]},"campaignStatus":{"type":"string","description":"Lifecycle status of the 10DLC campaign approval","enum":["none","pending","approved","failed"]},"hasAcceptedCampaign":{"type":"boolean","description":"Whether the user has at least one carrier-accepted campaign"},"hasNumbers":{"type":"boolean","description":"Whether the user owns at least one active phone number"},"hasLinkedNumbers":{"type":"boolean","description":"Whether the user has a phone number linked to an accepted campaign"}},"required":["hasSubscription","hasBrand","brandStatus","campaignStatus","hasAcceptedCampaign","hasNumbers","hasLinkedNumbers"]},"BillingHealthRes":{"type":"object","properties":{"state":{"type":"string","description":"Highest-severity billing-health state, as the dashboard shows it","enum":["past_due","card_declined","no_card","up_to_date"]},"severity":{"type":"string","description":"Severity of the billing-health state","enum":["danger","warn","success"]}},"required":["state","severity"]},"CapabilityRes":{"type":"object","properties":{"allowed":{"type":"boolean","description":"Whether the capability is currently available"},"reason":{"type":"string","description":"Primary blocker when the capability is not available; null when allowed","enum":["no_subscription","plan_inactive","payment_past_due","payment_invalid","no_payment_method","billed_by_organisation","brand_not_approved","campaign_not_approved","no_phone_number"],"nullable":true}},"required":["allowed","reason"]},"CapabilitiesRes":{"type":"object","properties":{"send":{"description":"Sending SMS messages","allOf":[{"$ref":"#/components/schemas/CapabilityRes"}]},"purchase":{"description":"Purchasing SMS credits and phone numbers","allOf":[{"$ref":"#/components/schemas/CapabilityRes"}]},"vetting":{"description":"Submitting a 10DLC brand for vetting","allOf":[{"$ref":"#/components/schemas/CapabilityRes"}]},"campaignSubmit":{"description":"Submitting a 10DLC campaign","allOf":[{"$ref":"#/components/schemas/CapabilityRes"}]}},"required":["send","purchase","vetting","campaignSubmit"]},"BillingStatusRes":{"type":"object","properties":{"accountStatus":{"type":"string","description":"Account-status value, matching the onboarding tier the dashboard displays","enum":["no_subscription","subscription_no_10dlc","tcr_pending","approved_no_numbers","approved_unlinked","fully_active"]},"paymentMethodValid":{"type":"boolean","description":"Whether the customer has a valid payment method on file"},"onboarding":{"description":"Onboarding posture summary","allOf":[{"$ref":"#/components/schemas/OnboardingSummaryRes"}]},"billingHealth":{"description":"Billing-health summary","allOf":[{"$ref":"#/components/schemas/BillingHealthRes"}]},"capabilities":{"description":"Per-capability billing gating with reasons","allOf":[{"$ref":"#/components/schemas/CapabilitiesRes"}]}},"required":["accountStatus","paymentMethodValid","onboarding","billingHealth","capabilities"]},"PaymentMethodRes":{"type":"object","properties":{"id":{"type":"string","description":"Payment method id; what the default-card and detach calls take"},"brand":{"type":"string","description":"Card brand","example":"visa"},"last4":{"type":"string","description":"Last four digits of the card number"},"expMonth":{"type":"number","description":"Expiry month, 1 to 12"},"expYear":{"type":"number","description":"Expiry year, four digits"},"isDefault":{"type":"boolean","description":"Whether this card is charged by default"}},"required":["id","brand","last4","expMonth","expYear","isDefault"]},"PaymentMethodsRes":{"type":"object","properties":{"paymentMethods":{"description":"Saved cards only; other payment method types are not listed","type":"array","items":{"$ref":"#/components/schemas/PaymentMethodRes"}}},"required":["paymentMethods"]},"InvoiceRes":{"type":"object","properties":{"id":{"type":"string","description":"Invoice id; pass it as `startingAfter` to page"},"number":{"type":"object","description":"Human-readable invoice number","nullable":true},"status":{"type":"string","description":"Invoice status","enum":["draft","open","paid","uncollectible","void"],"nullable":true},"amountDue":{"type":"number","description":"Amount still owed, smallest currency unit"},"amountPaid":{"type":"number","description":"Amount paid, smallest currency unit"},"currency":{"type":"string","description":"ISO 4217 currency code, lower case","example":"usd"},"createdAt":{"type":"string","description":"ISO 8601 timestamp the invoice was created"},"hostedInvoiceUrl":{"type":"object","description":"Hosted page where a person can view and pay the invoice","nullable":true},"pdfUrl":{"type":"object","description":"Direct link to the invoice PDF","nullable":true}},"required":["id","number","status","amountDue","amountPaid","currency","createdAt","hostedInvoiceUrl","pdfUrl"]},"InvoicesRes":{"type":"object","properties":{"invoices":{"description":"Newest first","type":"array","items":{"$ref":"#/components/schemas/InvoiceRes"}},"hasMore":{"type":"boolean","description":"Whether another page follows"}},"required":["invoices","hasMore"]},"CardSetupLinkRes":{"type":"object","properties":{"url":{"type":"string","description":"A hosted Stripe page where a person adds a card. Hand it to a person; it is not for the agent. The card becomes the default once Stripe confirms it, usually within seconds of the form."},"expiresAt":{"type":"string","description":"ISO 8601; the link is dead after this"}},"required":["url","expiresAt"]},"SetDefaultPaymentMethodReq":{"type":"object","properties":{"paymentMethodId":{"type":"string","description":"The `id` of a saved card from `GET /v1/billing/payment-methods`","example":"pm_ABC123"}},"required":["paymentMethodId"]},"DefaultPaymentMethodRes":{"type":"object","properties":{"defaultPaymentMethodId":{"type":"string","description":"The card now charged by default"},"subscriptionsSynced":{"type":"number","description":"Subscriptions the default was fanned onto. Best effort: a subscription Stripe refused is logged, not reported, and the card is still the customer's default."}},"required":["defaultPaymentMethodId","subscriptionsSynced"]},"AccountRes":{"type":"object","properties":{"id":{"type":"number","description":"The account id, which is the tenant id everywhere else"},"name":{"type":"object","description":"The account's own name. Null when nobody has named it — an account owned by an organization has no person behind it to borrow a name from.","nullable":true},"status":{"type":"string","description":"Lifecycle/billing status of the account, the same value the dashboard shows."},"sandbox":{"type":"boolean","description":"Whether the account is a sandbox account"},"createdAt":{"type":"string","description":"ISO timestamp of when the account was created"}},"required":["id","name","status","sandbox","createdAt"]},"OrganisationRes":{"type":"object","properties":{"id":{"type":"number","description":"The organization id"},"name":{"type":"string","description":"The organization name"},"logoUrl":{"type":"object","description":"Public URL of the organization logo","nullable":true},"accountLimit":{"type":"number","description":"How many open accounts the organization may own"},"canCreateAccounts":{"type":"boolean","description":"Whether the organization is allowed to create accounts"},"createdAt":{"type":"string","description":"ISO timestamp of when the organization was created"}},"required":["id","name","logoUrl","accountLimit","canCreateAccounts","createdAt"]},"OrganisationAccountRes":{"type":"object","properties":{"id":{"type":"number","description":"The account id, which is the tenant id everywhere else"},"name":{"type":"object","description":"The account's own name","nullable":true},"status":{"type":"string","description":"Whether the account can run, derived from the organization: `suspended` while an administrator has suspended the organization, `active` while the organization's subscription is running, `no_subscription` otherwise.","enum":["active","no_subscription","suspended"]},"sandbox":{"type":"boolean","description":"Whether the account is a sandbox account"},"createdAt":{"type":"string","description":"ISO timestamp of when the account was created"},"spendingPolicyId":{"type":"object","description":"The spending policy attached to the account, or null for no limits","nullable":true},"paused":{"type":"boolean","description":"Whether the account is paused (its automations hold); the reasons are listed in pausedReasons"},"pausedReasons":{"type":"array","description":"Why the account is paused, oldest first; empty when it is not","items":{"type":"string","enum":["insufficient_credits","high_opt_out_rate","payment_failed","provider_filtering","admin_pause","compliance_changes_needed","organisation_suspended","plan_inactive","abuse_review"]}}},"required":["id","name","status","sandbox","createdAt","spendingPolicyId","paused","pausedReasons"]},"CreateAccountApiKeyReq":{"type":"object","properties":{"alias":{"type":"string","description":"A label for the key","minLength":4,"maxLength":30},"scopes":{"type":"array","description":"Account permission scopes to grant the key; defaults to none","items":{"type":"string","enum":["contacts:read","contacts:write","tags:read","tags:write","custom-fields:read","custom-fields:write","opt-outs:read","opt-outs:write","messages:read","messages:write","contact-lists:read","contact-lists:write","scrubs:read","scrubs:write","appointments:read","conversations:read","conversations:write","campaigns:read","campaigns:write","phone-numbers:read","phone-numbers:write","workflows:read","workflows:write","agents:read","agents:write","agents:publish","templates:read","templates:write","webhooks:read","webhooks:write","async-operations:read","credits:read","credits:write","accounts:read","billing:read","billing:write","brand:read","brand:write","tendlc-campaign:read","tendlc-campaign:write","tendlc-generation:read","tendlc-generation:write","full-access"]}}},"required":["alias"]},"CreateOrganisationAccountReq":{"type":"object","properties":{"name":{"type":"string","description":"The account name. The only handle anybody has on an account with no person behind it. Unique among your open accounts, ignoring case: a name already in use is refused with 409 `ACCOUNT_NAME_TAKEN`. Closing an account frees its name.","minLength":1,"maxLength":100},"sandbox":{"type":"boolean","description":"Create a sandbox account: born able to send, with mock numbers and no carrier registration. Not available in production; refused with 403 `SANDBOX_NOT_ENABLED` where it is off."},"userIds":{"description":"Member ids (`users.id`) to grant access to the new account, as members. Every id must belong to a member of your organization, or the whole request is refused with 400 `ASSIGNEE_NOT_A_MEMBER`.","maxItems":50,"type":"array","items":{"type":"number"}},"purchaseSeat":{"type":"boolean","description":"Your agreement to buy the account's seat. Every open account takes one seat on the organization's subscription; when no seat is free the request must send `true` or it is refused with 409 `SEAT_NOT_AGREED` and nothing is billed. Ignored when a seat is already free. The dashboard shows what a seat costs."},"spendingPolicyId":{"type":"number","description":"The spending policy to create the account under. Must be one of your organization’s own policies (400 `SPENDING_POLICY_NOT_IN_ORGANISATION` otherwise). Absent means no limits."},"apiKey":{"description":"An API key to mint on the new account in the same call. Its secret is returned once, in this response, and cannot be read again.","allOf":[{"$ref":"#/components/schemas/CreateAccountApiKeyReq"}]}},"required":["name"]},"AccountApiKeyWithSecretRes":{"type":"object","properties":{"extId":{"type":"string","description":"Stable public id of the key; the keyId in every key route"},"alias":{"type":"string","description":"The label the key was given"},"publicKey":{"type":"string","description":"The public half of the key pair"},"scopes":{"description":"The scopes the key holds","type":"array","items":{"type":"string"}},"regeneratedAt":{"type":"string","description":"ISO timestamp of when the secret was last generated"},"secretKey":{"type":"string","description":"The secret (sk_) to send as x-api-key. Returned once, in this response only; it is stored as a hash and cannot be read again."}},"required":["extId","alias","publicKey","scopes","regeneratedAt","secretKey"]},"CreatedOrganisationAccountRes":{"type":"object","properties":{"account":{"$ref":"#/components/schemas/OrganisationAccountRes"},"apiKey":{"description":"The key minted on the account when the request asked for one; null when it asked and minting failed (the account still exists, mint one with POST /accounts/{id}/api-keys). Absent when no key was requested. The secret is shown once.","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/AccountApiKeyWithSecretRes"}]}},"required":["account"]},"OrganisationApiErrorRes":{"type":"object","properties":{"message":{"type":"string","description":"What was refused, in words. May be reworded."},"code":{"type":"string","description":"A stable machine-readable reason. Branch on this, not on the message.","enum":["SEAT_NOT_AGREED","ACCOUNT_LIMIT_REACHED","ACCOUNT_NAME_TAKEN","MEMBER_AWAITING_ACCOUNT","MEMBER_SEATS_FULL","ACCOUNT_CREATION_NOT_GRANTED","SANDBOX_NOT_ENABLED","ASSIGNEE_NOT_A_MEMBER","ASSIGNEE_NOT_FOUND","SPENDING_POLICY_NOT_IN_ORGANISATION","ACCOUNT_NOT_FOUND","ORGANISATION_NOT_FOUND","SPENDING_POLICY_NOT_FOUND","WORKFLOW_ALREADY_SHARED","WORKFLOW_SHARE_NOT_FOUND","ACCOUNT_NOT_IN_ORGANISATION","TEMPLATE_ALREADY_SHARED","TEMPLATE_SHARE_NOT_FOUND","PRODUCT_NOT_FOUND","PURCHASE_NOT_FOUND","NO_ORGANISATION_CARD","AUTHENTICATION_REQUIRED","CARD_DECLINED","IDEMPOTENCY_KEY_REUSED"]}},"required":["message","code"]},"RenameOrganisationAccountReq":{"type":"object","properties":{"name":{"type":"string","description":"The new account name. Unique among your open accounts, ignoring case: a name another open account uses is refused with 409 `ACCOUNT_NAME_TAKEN`.","minLength":1,"maxLength":100}},"required":["name"]},"ClosedOrganisationAccountRes":{"type":"object","properties":{"accountId":{"type":"number","description":"The id of the account that was closed"},"numbersReleased":{"type":"number","description":"How many phone numbers were released back to the provider"}},"required":["accountId","numbersReleased"]},"AccountApiKeyRes":{"type":"object","properties":{"extId":{"type":"string","description":"Stable public id of the key; the keyId in every key route"},"alias":{"type":"string","description":"The label the key was given"},"publicKey":{"type":"string","description":"The public half of the key pair"},"scopes":{"description":"The scopes the key holds","type":"array","items":{"type":"string"}},"regeneratedAt":{"type":"string","description":"ISO timestamp of when the secret was last generated"}},"required":["extId","alias","publicKey","scopes","regeneratedAt"]},"SpendingPolicyRes":{"type":"object","properties":{"id":{"type":"number"},"name":{"type":"string"},"smsCadence":{"type":"string","enum":["hour","day","week","month","one_off"]},"verificationCadence":{"type":"string","enum":["hour","day","week","month","one_off"]},"aiCadence":{"type":"string","enum":["hour","day","week","month","one_off"]},"smsLimit":{"type":"object","nullable":true},"verificationLimit":{"type":"object","nullable":true},"aiLimit":{"type":"object","nullable":true},"phoneNumberLimit":{"type":"object","nullable":true},"attachedCount":{"type":"number","description":"How many of the organization’s accounts hold this policy"},"createdAt":{"type":"string","description":"ISO timestamp"},"updatedAt":{"type":"string","description":"ISO timestamp"}},"required":["id","name","smsCadence","verificationCadence","aiCadence","smsLimit","verificationLimit","aiLimit","phoneNumberLimit","attachedCount","createdAt","updatedAt"]},"SpendingPolicyReq":{"type":"object","properties":{"name":{"type":"string","description":"Unique within the organization","maxLength":80},"smsCadence":{"type":"string","enum":["hour","day","week","month","one_off"],"description":"How often the SMS limit refills"},"verificationCadence":{"type":"string","enum":["hour","day","week","month","one_off"],"description":"How often the verification limit refills"},"aiCadence":{"type":"string","enum":["hour","day","week","month","one_off"],"description":"How often the AI limit refills"},"smsLimit":{"type":"object","nullable":true,"description":"SMS credits per period; null is no limit"},"verificationLimit":{"type":"object","nullable":true,"description":"Verification credits per period; null is no limit"},"aiLimit":{"type":"object","nullable":true,"description":"AI credits per period; null is no limit"},"phoneNumberLimit":{"type":"object","nullable":true,"description":"Phone numbers the account may hold at once; null is no limit"}},"required":["name","smsCadence","verificationCadence","aiCadence","smsLimit","verificationLimit","aiLimit","phoneNumberLimit"]},"AttachSpendingPolicyReq":{"type":"object","properties":{"spendingPolicyId":{"type":"object","nullable":true,"description":"A policy of this organization to attach, or null to detach the current one"}},"required":["spendingPolicyId"]},"AttachedSpendingPolicyRes":{"type":"object","properties":{"id":{"type":"number"},"name":{"type":"string"}},"required":["id","name"]},"AccountSpendingPolicyRes":{"type":"object","properties":{"accountId":{"type":"number","description":"The account id"},"spendingPolicy":{"nullable":true,"description":"The policy now attached, or null when the account has no limits","type":"object","allOf":[{"$ref":"#/components/schemas/AttachedSpendingPolicyRes"}]}},"required":["accountId","spendingPolicy"]},"PoolSpendingStateRes":{"type":"object","properties":{"limit":{"type":"number","description":"Credits the policy allows per period"},"consumed":{"type":"number","description":"Credits drawn in the current period"},"remaining":{"type":"number","description":"Credits left before the account is paused"},"cadence":{"type":"string","enum":["hour","day","week","month","one_off"],"description":"How often the limit refills"},"resetAt":{"type":"string","description":"When the current period ends (ISO 8601) and the limit refills; null for a one-off limit. A period is a rolling duration from the first debit, not a calendar unit.","nullable":true}},"required":["limit","consumed","remaining","cadence","resetAt"]},"NumberSpendingStateRes":{"type":"object","properties":{"limit":{"type":"number","description":"Phone numbers the account may hold at once; null is no limit","nullable":true},"held":{"type":"number","description":"Phone numbers it holds now"},"remaining":{"type":"number","description":"Numbers it may still buy; null when unlimited","nullable":true}},"required":["limit","held","remaining"]},"AccountSpendingStateRes":{"type":"object","properties":{"id":{"type":"number","description":"The account id"},"policy":{"nullable":true,"description":"The policy the account is under, or null when it has no limits","type":"object","allOf":[{"$ref":"#/components/schemas/AttachedSpendingPolicyRes"}]},"sms":{"nullable":true,"description":"SMS credits under the policy; null when that pool is unlimited","type":"object","allOf":[{"$ref":"#/components/schemas/PoolSpendingStateRes"}]},"verification":{"nullable":true,"description":"Verification credits under the policy; null when unlimited","type":"object","allOf":[{"$ref":"#/components/schemas/PoolSpendingStateRes"}]},"ai":{"nullable":true,"description":"AI credits under the policy; null when unlimited","type":"object","allOf":[{"$ref":"#/components/schemas/PoolSpendingStateRes"}]},"numbers":{"$ref":"#/components/schemas/NumberSpendingStateRes"}},"required":["id","policy","sms","verification","ai","numbers"]},"AccountAccessGrantRes":{"type":"object","properties":{"accountId":{"type":"number"},"userId":{"type":"number","description":"A user id, never an account id"},"email":{"type":"string"},"displayName":{"type":"object","nullable":true},"role":{"type":"object","description":"The role the grant row confers"},"outrankedBy":{"type":"string","nullable":true,"enum":["owner","organisation"],"description":"An ownership rule that already gives this person more than the grant does, or null"},"createdAt":{"type":"string","description":"ISO timestamp"}},"required":["accountId","userId","email","displayName","role","outrankedBy","createdAt"]},"GrantAccountAccessReq":{"type":"object","properties":{"userIds":{"description":"User ids of organization members","type":"array","items":{"type":"number"}},"role":{"type":"string","enum":["admin","member"],"default":"member"}},"required":["userIds"]},"SkippedGrantRes":{"type":"object","properties":{"userId":{"type":"number"},"reason":{"type":"string","enum":["already_granted","owns_the_account"]}},"required":["userId","reason"]},"GrantAccountAccessRes":{"type":"object","properties":{"granted":{"type":"array","items":{"$ref":"#/components/schemas/AccountAccessGrantRes"}},"skipped":{"description":"People who already had access","type":"array","items":{"$ref":"#/components/schemas/SkippedGrantRes"}}},"required":["granted","skipped"]},"UpdateAccountAccessRoleReq":{"type":"object","properties":{"role":{"type":"string","enum":["admin","member"]}},"required":["role"]},"OrganisationCreditsRes":{"type":"object","properties":{"remainingCredits":{"type":"number","description":"SMS credits left in the organization pool"},"verificationCredits":{"type":"number","description":"Phone verification credits left in the pool"},"aiCredits":{"type":"number","description":"AI credits left in the pool. Present only when AI credits are enabled for the organization."},"totalCreditsPurchased":{"type":"number","description":"SMS credits ever bought into the pool, purchases and auto-recharges together"},"totalAiCreditsPurchased":{"type":"number","description":"AI credits ever bought into the pool. Present only when AI credits are enabled for the organization."},"totalCreditPurchaseSpend":{"type":"number","description":"What those purchases cost, in the minor unit of the currency (cents for USD), every pool together"},"rechargeActive":{"type":"boolean","description":"Whether the pool recharges itself when SMS credits run low"},"rechargeMinimum":{"type":"number","description":"SMS balance below which the recharge triggers; null when none is set","nullable":true},"rechargeProductId":{"type":"string","description":"The credit pack the recharge buys, as listed by `GET /v1/organisation/credits/products`; null when none is chosen","nullable":true},"asOf":{"type":"string","description":"When this answer was computed (ISO 8601). Answers are cached for a few seconds, so this may be slightly earlier than the request."}},"required":["remainingCredits","verificationCredits","totalCreditsPurchased","totalCreditPurchaseSpend","rechargeActive","rechargeMinimum","rechargeProductId","asOf"]},"OrganisationCreditProductRes":{"type":"object","properties":{"id":{"type":"string","description":"The pack, as `rechargeProductId` and a purchase name it"},"kind":{"type":"string","description":"Which pool the pack fills","enum":["sms","verification","ai"]},"name":{"type":"string","description":"The pack’s name"},"credits":{"type":"number","description":"Credits the pool receives when the pack is paid for, bonus included"},"unitAmount":{"type":"number","description":"Price in the minor unit of `currency`; null when the pack has no fixed price","nullable":true},"currency":{"type":"string","description":"ISO 4217 code, lower case, as Stripe reports it"},"priceId":{"type":"string","description":"The price to pay for"}},"required":["id","kind","name","credits","unitAmount","currency","priceId"]},"OrganisationAccountRefRes":{"type":"object","properties":{"id":{"type":"number","description":"The account id"}},"required":["id"]},"OrganisationCreditMovementRes":{"type":"object","properties":{"id":{"type":"number","description":"Movement id; ids grow with time"},"kind":{"type":"string","description":"Why the credits moved","enum":["purchase","recharge","refund","grant"]},"pool":{"type":"string","description":"Which pool they went into","enum":["sms","verification","ai"]},"amount":{"type":"number","description":"Credits added to the pool"},"account":{"description":"The account the movement was for, when one applies (a refund of its send)","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/OrganisationAccountRefRes"}]},"reference":{"type":"string","description":"The Stripe PaymentIntent id for a purchase or recharge, to tie it to an invoice; null otherwise","nullable":true},"createdAt":{"type":"string","description":"ISO 8601"}},"required":["id","kind","pool","amount","account","reference","createdAt"]},"OrganisationCreditMovementsRes":{"type":"object","properties":{"movements":{"description":"Newest first","type":"array","items":{"$ref":"#/components/schemas/OrganisationCreditMovementRes"}},"nextCursor":{"type":"number","description":"Pass as `before` for the next page; null when this was the last","nullable":true}},"required":["movements","nextCursor"]},"OrganisationUsageAccountRes":{"type":"object","properties":{"id":{"type":"number","description":"The account id"},"name":{"type":"string","description":"Its name; null when it has none","nullable":true},"closedAt":{"type":"string","description":"When the account was closed (ISO 8601); null while it is open. Closed accounts keep their figures.","nullable":true}},"required":["id","name","closedAt"]},"OrganisationCreditUsageRowRes":{"type":"object","properties":{"account":{"description":"The account that drew the credits","allOf":[{"$ref":"#/components/schemas/OrganisationUsageAccountRes"}]},"pool":{"type":"string","description":"Which pool it drew from","enum":["sms","verification","ai"]},"amount":{"type":"number","description":"Credits drawn over the window, or over `day`"},"day":{"type":"string","description":"The UTC day this row sums (YYYY-MM-DD) with `granularity=day`; null for a total","nullable":true}},"required":["account","pool","amount","day"]},"OrganisationCreditsUsageRes":{"type":"object","properties":{"days":{"type":"number","description":"The window’s length in days: `days` as asked, or the inclusive span of `from` to `to`"},"from":{"type":"string","description":"First UTC day summed, inclusive (YYYY-MM-DD)"},"to":{"type":"string","description":"Last UTC day summed, inclusive (YYYY-MM-DD)"},"granularity":{"type":"string","enum":["total","day"]},"asOf":{"type":"string","description":"When this answer was computed (ISO 8601). The per-account rollup runs hourly, so figures may trail the balance by up to an hour."},"usage":{"type":"array","items":{"$ref":"#/components/schemas/OrganisationCreditUsageRowRes"}}},"required":["days","from","to","granularity","asOf","usage"]},"PurchaseOrganisationCreditsReq":{"type":"object","properties":{"productId":{"type":"string","description":"The `id` of a pack from `GET /v1/organisation/credits/products`","example":"prod_ABC123"},"priceId":{"type":"string","description":"The `priceId` of a pack from `GET /v1/organisation/credits/products`","example":"price_ABC123"}}},"OrganisationPurchaseAmountRes":{"type":"object","properties":{"value":{"type":"number","description":"In the minor unit of `currency`"},"currency":{"type":"string","description":"ISO 4217 code, lower case"}},"required":["value","currency"]},"OrganisationCreditPurchaseRes":{"type":"object","properties":{"id":{"type":"string","description":"The purchase id; poll `GET /v1/organisation/credits/purchases/{id}` with it"},"status":{"type":"string","enum":["pending","requires_action","succeeded","failed"],"description":"`succeeded` once Stripe took the money (the credits follow within seconds, see `creditsGranted`); `pending` while Stripe is still processing; `requires_action` while the bank wants the cardholder to confirm at `completeUrl`; `failed` when the charge will not go through."},"kind":{"type":"string","description":"Which pool the pack fills","enum":["sms","verification","ai"],"nullable":true},"credits":{"type":"number","description":"Credits the pool receives once the charge succeeds, bonus included"},"amount":{"$ref":"#/components/schemas/OrganisationPurchaseAmountRes"},"creditsGranted":{"type":"number","description":"Credits the pool has actually received from this purchase; null until the payment has been confirmed and granted. Poll until it is set.","nullable":true},"completeUrl":{"type":"string","description":"Only while `requires_action`: the page where a signed-in owner confirms the charge with their bank. Hand it to a person; it is not for the agent."},"statusUrl":{"type":"string","description":"Where to poll this purchase"},"createdAt":{"type":"string","description":"ISO 8601"}},"required":["id","status","kind","credits","amount","creditsGranted","statusUrl","createdAt"]},"OrganisationPurchaseRefusalRes":{"type":"object","properties":{"message":{"type":"string","description":"What was refused, in words. May be reworded."},"code":{"type":"string","description":"A stable machine-readable reason. Branch on this, not on the message.","enum":["SEAT_NOT_AGREED","ACCOUNT_LIMIT_REACHED","ACCOUNT_NAME_TAKEN","MEMBER_AWAITING_ACCOUNT","MEMBER_SEATS_FULL","ACCOUNT_CREATION_NOT_GRANTED","SANDBOX_NOT_ENABLED","ASSIGNEE_NOT_A_MEMBER","ASSIGNEE_NOT_FOUND","SPENDING_POLICY_NOT_IN_ORGANISATION","ACCOUNT_NOT_FOUND","ORGANISATION_NOT_FOUND","SPENDING_POLICY_NOT_FOUND","WORKFLOW_ALREADY_SHARED","WORKFLOW_SHARE_NOT_FOUND","ACCOUNT_NOT_IN_ORGANISATION","TEMPLATE_ALREADY_SHARED","TEMPLATE_SHARE_NOT_FOUND","PRODUCT_NOT_FOUND","PURCHASE_NOT_FOUND","NO_ORGANISATION_CARD","AUTHENTICATION_REQUIRED","CARD_DECLINED","IDEMPOTENCY_KEY_REUSED"]},"purchase":{"description":"With `AUTHENTICATION_REQUIRED`: the purchase, carrying `completeUrl`","allOf":[{"$ref":"#/components/schemas/OrganisationCreditPurchaseRes"}]},"declineCode":{"type":"string","description":"With `CARD_DECLINED`: Stripe's decline code","nullable":true}},"required":["message","code"]},"UpdateOrganisationRechargeReq":{"type":"object","properties":{"rechargeActive":{"type":"boolean","description":"Whether the pool refills itself when SMS credits run low"},"rechargeMinimum":{"type":"number","description":"SMS balance below which the recharge triggers; null clears it","nullable":true,"minimum":0},"rechargeProductId":{"type":"string","description":"The SMS pack the recharge buys: an `id` of kind `sms` from `GET /v1/organisation/credits/products`; null clears it","nullable":true}}},"ShareOrganisationWorkflowReq":{"type":"object","properties":{"accountId":{"type":"number","description":"The account the item belongs to; it must be owned by your organization"},"workflowId":{"type":"number","description":"The workflow to share; it must belong to accountId"},"notes":{"type":"string","description":"A note shown with the share in the library, up to 500 characters","maxLength":500}},"required":["accountId","workflowId"]},"CopyOrganisationWorkflowReq":{"type":"object","properties":{"accountId":{"type":"number","description":"The account the copy is created in; it must be owned by your organization"},"newName":{"type":"string","description":"Name of the copy, up to 100 characters; defaults to the shared name with \"(Copy)\"","maxLength":100},"newDescription":{"type":"string","description":"Description of the copy, up to 500 characters; defaults to the shared description","maxLength":500}},"required":["accountId"]},"SharedTemplateBodyRes":{"type":"object","properties":{"id":{"type":"number"},"name":{"type":"string"},"content":{"type":"string","description":"The full template text"}},"required":["id","name","content"]},"OrganisationSharedTemplateRes":{"type":"object","properties":{"id":{"type":"number","description":"The share id: what get, copy, stats and withdraw take"},"organisationId":{"type":"number"},"templateId":{"type":"number","description":"The shared (source) template"},"sourceAccountId":{"type":"number","description":"The account that owns the source template"},"sharedBy":{"nullable":true,"description":"The person who shared it; null when an API key did","type":"object","allOf":[{"$ref":"#/components/schemas/SharingPersonRes"}]},"sharedByApiKey":{"nullable":true,"description":"The API key that shared it; null when a person did","type":"object","allOf":[{"$ref":"#/components/schemas/SharingApiKeyRes"}]},"sharedAt":{"type":"string","description":"ISO timestamp"},"notes":{"type":"string","nullable":true},"copiedCount":{"type":"number","description":"How many accounts copied it"},"lastCopiedAt":{"type":"string","nullable":true,"description":"ISO timestamp"},"audiences":{"type":"array","items":{"$ref":"#/components/schemas/SharingAudienceRes"}},"template":{"$ref":"#/components/schemas/SharedTemplateBodyRes"},"alreadyCopied":{"type":"boolean","description":"The calling account already holds a copy. Always false for an organization key, which acts in no account"},"canWithdraw":{"type":"boolean","description":"The caller may withdraw this share"},"canSeeStats":{"type":"boolean","description":"The caller may read who copied it"}},"required":["id","organisationId","templateId","sourceAccountId","sharedBy","sharedByApiKey","sharedAt","notes","copiedCount","lastCopiedAt","audiences","template","alreadyCopied","canWithdraw","canSeeStats"]},"ShareOrganisationTemplateReq":{"type":"object","properties":{"accountId":{"type":"number","description":"The account the item belongs to; it must be owned by your organization"},"templateId":{"type":"number","description":"The message template to share; it must belong to accountId"},"notes":{"type":"string","description":"A note shown with the share in the library, up to 500 characters","maxLength":500}},"required":["accountId","templateId"]},"CopyOrganisationTemplateReq":{"type":"object","properties":{"accountId":{"type":"number","description":"The account the copy is created in; it must be owned by your organization"}},"required":["accountId"]},"OrganisationTemplateCopyRes":{"type":"object","properties":{"templateId":{"type":"number","description":"The copy in the target account, new or pre-existing"},"alreadyExisted":{"type":"boolean","description":"The account already had a copy of this share; nothing was created"}},"required":["templateId","alreadyExisted"]},"SharedTemplateCopyRes":{"type":"object","properties":{"targetAccountId":{"type":"number"},"targetAccountAlias":{"type":"string","nullable":true},"copiedBy":{"nullable":true,"description":"The person who copied it; null when an API key did","type":"object","allOf":[{"$ref":"#/components/schemas/SharingPersonRes"}]},"copiedByApiKey":{"nullable":true,"description":"The API key that copied it; null when a person did","type":"object","allOf":[{"$ref":"#/components/schemas/SharingApiKeyRes"}]},"copiedAt":{"type":"string","description":"ISO timestamp"},"copyTemplateId":{"type":"number","nullable":true,"description":"null once the copy was deleted"},"copyTemplateName":{"type":"string","nullable":true}},"required":["targetAccountId","targetAccountAlias","copiedBy","copiedByApiKey","copiedAt","copyTemplateId","copyTemplateName"]},"OrganisationTemplateShareStatsRes":{"type":"object","properties":{"shareId":{"type":"number"},"templateId":{"type":"number"},"templateName":{"type":"string"},"copiedCount":{"type":"number"},"copies":{"description":"Newest copy first","type":"array","items":{"$ref":"#/components/schemas/SharedTemplateCopyRes"}}},"required":["shareId","templateId","templateName","copiedCount","copies"]},"CreateTemplateDto":{"type":"object","properties":{"name":{"type":"string","description":"Template name","example":"Welcome message","minLength":1,"maxLength":255},"content":{"type":"string","description":"Template content. Supports merge fields in single braces, like {firstName}. Double braces such as {{firstName}} are not merge fields.","example":"Hi {firstName}, thanks for signing up!","minLength":1}},"required":["name","content"]},"UpdateTemplateDto":{"type":"object","properties":{"name":{"type":"string","description":"Template name","minLength":1,"maxLength":255},"content":{"type":"string","description":"Template content. Supports merge fields in single braces, like {firstName}. Double braces such as {{firstName}} are not merge fields.","minLength":1}}},"ShareTemplateWithOrganisationReq":{"type":"object","properties":{"templateId":{"type":"number","description":"The message template to share; it must be this account's"},"notes":{"type":"string","description":"A note shown with the share in the library, up to 500 characters","maxLength":500}},"required":["templateId"]},"CreateBrandDto":{"type":"object","properties":{"entityType":{"type":"string","description":"TCR entity type. Decides the required fields: PRIVATE_PROFIT, NON_PROFIT and GOVERNMENT need companyName, ein, brandRelationship and vertical; PUBLIC_PROFIT also needs stockSymbol and stockExchange; SOLE_PROPRIETOR needs firstName, lastName and mobilePhone.","enum":["PRIVATE_PROFIT","PUBLIC_PROFIT","NON_PROFIT","GOVERNMENT","SOLE_PROPRIETOR"],"example":"PRIVATE_PROFIT"},"displayName":{"type":"string","description":"Brand display name (DBA)","example":"Acme Co","minLength":1,"maxLength":255},"companyName":{"type":"string","description":"Legal company name. Required unless entityType is SOLE_PROPRIETOR.","example":"Acme Inc","maxLength":255},"ein":{"type":"string","description":"Tax ID / EIN (XX-XXXXXXX, dash optional). Required unless entityType is SOLE_PROPRIETOR.","example":"12-3456789"},"einIssuingCountry":{"type":"string","description":"EIN issuing country (ISO 3166-1 alpha-2)","example":"US","minLength":2,"maxLength":2},"firstName":{"type":"string","description":"First name. Required for SOLE_PROPRIETOR.","maxLength":100},"lastName":{"type":"string","description":"Last name. Required for SOLE_PROPRIETOR.","maxLength":100},"phone":{"type":"string","description":"Brand contact phone (E.164)","example":"+15551234567","maxLength":20},"mobilePhone":{"type":"string","description":"Mobile phone (E.164) for sole-proprietor OTP verification. Required for SOLE_PROPRIETOR.","example":"+15557654321"},"street":{"type":"string","description":"Street address","maxLength":100},"city":{"type":"string","description":"City","maxLength":100},"state":{"type":"string","description":"State / province","maxLength":20},"postalCode":{"type":"string","description":"Postal code","maxLength":10},"country":{"type":"string","description":"Country (ISO 3166-1 alpha-2)","example":"US","minLength":2,"maxLength":2},"email":{"type":"string","description":"Brand contact email","maxLength":100},"stockSymbol":{"type":"string","description":"Stock symbol. Required for PUBLIC_PROFIT.","maxLength":10},"stockExchange":{"type":"string","description":"Stock exchange. Required for PUBLIC_PROFIT."},"website":{"type":"string","description":"Brand website URL (http or https)","example":"https://acme.example","maxLength":100},"brandRelationship":{"type":"string","description":"Brand relationship to TCR. Required unless entityType is SOLE_PROPRIETOR."},"vertical":{"type":"string","description":"Industry vertical. Required unless entityType is SOLE_PROPRIETOR."},"provider":{"type":"string","description":"Messaging provider to register the brand on. Messaging provider as a numeric ID: 1 = default, 2 = V2; the aliases 'default' and 'v2' are also accepted ('legacy' is a deprecated alias for 'default').","enum":[1,2,"default","v2","legacy"],"example":2}},"required":["entityType","displayName","phone","street","city","state","postalCode","country","email"]},"ResubmitBrandDto":{"type":"object","properties":{"companyName":{"type":"string","description":"Legal company name"},"ein":{"type":"string","description":"Tax ID / EIN","example":"12-3456789"},"phone":{"type":"string","description":"Brand contact phone (E.164)"},"street":{"type":"string","description":"Street address"},"city":{"type":"string","description":"City"},"state":{"type":"string","description":"State / province"},"postalCode":{"type":"string","description":"Postal code"},"country":{"type":"string","description":"Country (ISO 3166-1 alpha-2)"},"email":{"type":"string","description":"Brand contact email"},"website":{"type":"string","description":"Brand website URL"},"vertical":{"type":"string","description":"Industry vertical"}}},"UpdateBrandDbaDto":{"type":"object","properties":{"dba":{"type":"string","description":"New brand display name (DBA)","example":"Acme Co LLC","minLength":1,"maxLength":255}},"required":["dba"]},"RequestVettingDto":{"type":"object","properties":{"vettingClass":{"type":"string","description":"External vetting class to order","enum":["STANDARD","ENHANCED"]},"paymentIntentId":{"type":"string","description":"Payment intent returned in the body of a failed vetting request. Send it on the retry to reuse that authorisation instead of starting a new charge.","example":"pi_3Nk2cS2eZvKYlo2C0x1y2z3a"},"acknowledgedAlignmentRules":{"description":"Brand alignment rules you have seen and accept. Vetting a brand whose details fail a rule is refused with a 422 that lists the `findings`; send each finding's `rule` here to order the vetting anyway.","example":["email-domain-matches-website"],"type":"array","items":{"type":"string"}}},"required":["vettingClass"]},"RequestVettingRes":{"type":"object","properties":{"vettingId":{"type":"object","description":"Provider vetting ID, when returned at order time","nullable":true},"vettingClass":{"type":"string","description":"External vetting class ordered","example":"STANDARD"},"vettingStatus":{"type":"object","description":"Vetting status at order time (typically pending)","nullable":true},"submittedAt":{"type":"string","description":"When the vetting order was submitted (ISO 8601)"}},"required":["vettingId","vettingClass","vettingStatus","submittedAt"]},"CreateTenDlcCampaignDto":{"type":"object","properties":{"subscriberOptin":{"type":"boolean","description":"Whether subscribers can opt in"},"subscriberOptout":{"type":"boolean","description":"Whether subscribers can opt out"},"subscriberHelp":{"type":"boolean","description":"Whether subscribers can request help"},"embeddedLink":{"type":"boolean","description":"Campaign contains an embedded link"},"embeddedPhone":{"type":"boolean","description":"Campaign contains an embedded phone number"},"numberPool":{"type":"boolean","description":"Campaign uses a number pool"},"ageGated":{"type":"boolean","description":"Campaign is age-gated"},"directLending":{"type":"boolean","description":"Campaign involves direct lending"},"autoRenewal":{"type":"boolean","description":"Auto-renew the campaign registration"},"affiliateMarketing":{"type":"boolean","description":"Campaign involves affiliate marketing"},"sample1":{"type":"object","description":"Sample message 1","nullable":true},"sample2":{"type":"object","description":"Sample message 2","nullable":true},"sample3":{"type":"object","description":"Sample message 3","nullable":true},"sample4":{"type":"object","description":"Sample message 4","nullable":true},"sample5":{"type":"object","description":"Sample message 5","nullable":true},"termsAndConditionsLink":{"type":"object","description":"Terms and conditions link (http or https URL, or blank)","nullable":true},"privacyPolicyLink":{"type":"object","description":"Privacy policy link (http or https URL, or blank)","nullable":true},"messageFlow":{"type":"object","description":"Message flow / call-to-action","nullable":true},"helpKeywords":{"type":"object","description":"HELP keywords (comma-separated)","nullable":true},"helpMessage":{"type":"object","description":"HELP auto-reply message","nullable":true},"optinKeywords":{"type":"object","description":"Opt-in keywords (comma-separated)","nullable":true},"optinMessage":{"type":"object","description":"Opt-in auto-reply message","nullable":true},"optoutKeywords":{"type":"object","description":"Opt-out keywords (comma-separated)","nullable":true},"optoutMessage":{"type":"object","description":"Opt-out auto-reply message","nullable":true},"mnoIds":{"description":"Carrier (MNO) ids to target","type":"array","items":{"type":"string"}},"referenceId":{"type":"object","description":"Caller-supplied reference id","nullable":true},"brandId":{"type":"string","description":"Provider brand id the campaign belongs to"},"usecase":{"type":"string","description":"Primary campaign use case"},"subUsecases":{"description":"Secondary use cases (at least one)","type":"array","items":{"type":"string"}},"description":{"type":"string","description":"Human-readable campaign description. At least one of sample1..sample5 must also be sent."}},"required":["brandId","usecase","subUsecases","description"]},"UpdateTenDlcCampaignDto":{"type":"object","properties":{"subscriberOptin":{"type":"boolean","description":"Whether subscribers can opt in"},"subscriberOptout":{"type":"boolean","description":"Whether subscribers can opt out"},"subscriberHelp":{"type":"boolean","description":"Whether subscribers can request help"},"embeddedLink":{"type":"boolean","description":"Campaign contains an embedded link"},"embeddedPhone":{"type":"boolean","description":"Campaign contains an embedded phone number"},"numberPool":{"type":"boolean","description":"Campaign uses a number pool"},"ageGated":{"type":"boolean","description":"Campaign is age-gated"},"directLending":{"type":"boolean","description":"Campaign involves direct lending"},"autoRenewal":{"type":"boolean","description":"Auto-renew the campaign registration"},"affiliateMarketing":{"type":"boolean","description":"Campaign involves affiliate marketing"},"sample1":{"type":"object","description":"Sample message 1","nullable":true},"sample2":{"type":"object","description":"Sample message 2","nullable":true},"sample3":{"type":"object","description":"Sample message 3","nullable":true},"sample4":{"type":"object","description":"Sample message 4","nullable":true},"sample5":{"type":"object","description":"Sample message 5","nullable":true},"termsAndConditionsLink":{"type":"object","description":"Terms and conditions link","nullable":true},"privacyPolicyLink":{"type":"object","description":"Privacy policy link","nullable":true},"messageFlow":{"type":"object","description":"Message flow / call-to-action","nullable":true},"helpKeywords":{"type":"object","description":"HELP keywords (comma-separated)","nullable":true},"helpMessage":{"type":"object","description":"HELP auto-reply message","nullable":true},"optinKeywords":{"type":"object","description":"Opt-in keywords (comma-separated)","nullable":true},"optinMessage":{"type":"object","description":"Opt-in auto-reply message","nullable":true},"optoutKeywords":{"type":"object","description":"Opt-out keywords (comma-separated)","nullable":true},"optoutMessage":{"type":"object","description":"Opt-out auto-reply message","nullable":true},"mnoIds":{"description":"Carrier (MNO) ids to target","type":"array","items":{"type":"string"}},"referenceId":{"type":"object","description":"Caller-supplied reference id","nullable":true},"description":{"type":"string","description":"Updated campaign description"},"usecase":{"type":"string","description":"Updated primary use case"},"subUsecases":{"description":"Updated secondary use cases","type":"array","items":{"type":"string"}}}},"ResubmitCampaignDto":{"type":"object","properties":{"subscriberOptin":{"type":"boolean","description":"Whether subscribers can opt in"},"subscriberOptout":{"type":"boolean","description":"Whether subscribers can opt out"},"subscriberHelp":{"type":"boolean","description":"Whether subscribers can request help"},"embeddedLink":{"type":"boolean","description":"Campaign contains an embedded link"},"embeddedPhone":{"type":"boolean","description":"Campaign contains an embedded phone number"},"numberPool":{"type":"boolean","description":"Campaign uses a number pool"},"ageGated":{"type":"boolean","description":"Campaign is age-gated"},"directLending":{"type":"boolean","description":"Campaign involves direct lending"},"autoRenewal":{"type":"boolean","description":"Auto-renew the campaign registration"},"affiliateMarketing":{"type":"boolean","description":"Campaign involves affiliate marketing"},"sample1":{"type":"object","description":"Sample message 1","nullable":true},"sample2":{"type":"object","description":"Sample message 2","nullable":true},"sample3":{"type":"object","description":"Sample message 3","nullable":true},"sample4":{"type":"object","description":"Sample message 4","nullable":true},"sample5":{"type":"object","description":"Sample message 5","nullable":true},"termsAndConditionsLink":{"type":"object","description":"Terms and conditions link","nullable":true},"privacyPolicyLink":{"type":"object","description":"Privacy policy link","nullable":true},"messageFlow":{"type":"object","description":"Message flow / call-to-action","nullable":true},"helpKeywords":{"type":"object","description":"HELP keywords (comma-separated)","nullable":true},"helpMessage":{"type":"object","description":"HELP auto-reply message","nullable":true},"optinKeywords":{"type":"object","description":"Opt-in keywords (comma-separated)","nullable":true},"optinMessage":{"type":"object","description":"Opt-in auto-reply message","nullable":true},"optoutKeywords":{"type":"object","description":"Opt-out keywords (comma-separated)","nullable":true},"optoutMessage":{"type":"object","description":"Opt-out auto-reply message","nullable":true},"mnoIds":{"description":"Carrier (MNO) ids to target","type":"array","items":{"type":"string"}},"referenceId":{"type":"object","description":"Caller-supplied reference id","nullable":true},"description":{"type":"string","description":"Updated campaign description"},"usecase":{"type":"string","description":"Updated primary use case"},"subUsecases":{"description":"Updated secondary use cases","type":"array","items":{"type":"string"}}}},"AttachPhoneDto":{"type":"object","properties":{"phoneNumberIds":{"description":"Internal phone-number ids to attach to the campaign","type":"array","items":{"type":"string"}}},"required":["phoneNumberIds"]},"GenerationRes":{"type":"object","properties":{"id":{"type":"number","description":"Generation id"},"generationStatus":{"type":"string","description":"Raw generation status column","enum":["in_progress","review","complete","failed"]},"state":{"type":"object","description":"Normalized lifecycle state derived from the generation status, for one-field polling."},"progress":{"type":"string","description":"Current pipeline step","enum":["website","brand","campaign","complete"]},"provider":{"type":"object","description":"Messaging provider backing the generation, as a numeric ID: 1 = default, 2 = V2","example":2,"nullable":true},"website":{"type":"object","description":"Provisioned website URL, once a domain has been secured","nullable":true},"failedReason":{"type":"object","description":"Reason the generation last failed, if any","nullable":true},"createdAt":{"type":"string","description":"ISO 8601 creation timestamp"},"updatedAt":{"type":"string","description":"ISO 8601 last-update timestamp"}},"required":["id","generationStatus","state","progress","provider","website","failedReason","createdAt","updatedAt"]},"RetryGenerationRes":{"type":"object","properties":{"generation":{"description":"The updated generation, or null if it could not be re-read","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/GenerationRes"}]},"scheduled":{"type":"boolean","description":"Whether a worker job was scheduled (false when retry only reset state)"}},"required":["generation","scheduled"]},"SetGenerationDomainDto":{"type":"object","properties":{"domain":{"type":"string","description":"The domain to secure for the generation (e.g. \"example.com\")."}},"required":["domain"]},"SetGenerationDomainRes":{"type":"object","properties":{"success":{"type":"boolean"},"domain":{"type":"string","description":"The secured domain"},"website":{"type":"string","description":"The provisioned website URL"},"email":{"type":"string","description":"The provisioned contact email"}},"required":["success","domain","website","email"]},"EnumValuesRes":{"type":"object","properties":{"type":{"type":"string","description":"The enum type that was resolved","example":"usecases"},"values":{"type":"array","description":"Provider-supplied enum values for the requested type","items":{"type":"object"}}},"required":["type","values"]},"CheckDisplayNameRes":{"type":"object","properties":{"available":{"type":"boolean","description":"Whether the requested display name is available. Display names are no longer required to be unique, so this is always true for a non-empty name (kept for backward compatibility)."}},"required":["available"]},"ProviderStatusRes":{"type":"object","properties":{"hasDefault":{"type":"boolean","description":"User has at least one default-provider brand"},"hasV2":{"type":"boolean","description":"User has at least one V2-provider brand"},"needsUpgrade":{"type":"boolean","description":"User should be prompted to upgrade to the V2 provider"}},"required":["hasDefault","hasV2","needsUpgrade"]}}},"webhooks":{"guide":{"post":{"summary":"Intro","description":"Webhooks let you receive real-time HTTP callbacks when events happen in your PitchPrfct account.\nInstead of polling the API, you register a URL and we `POST` a JSON payload to it whenever a\nsubscribed event fires.\n\n### Available Events\n\n| Event | Description |\n|-------|-------------|\n| `contact.created` | A new contact was added |\n| `contact.updated` | A contact's information was modified |\n| `contact.deleted` | A contact was permanently removed |\n| `contact.opted_out` | A contact opted out of messages |\n| `contact.opted_in` | A contact was opted back in |\n| `tag.created` | A new tag was created |\n| `tag.applied` | Tags were applied to a contact |\n| `tag.removed` | A tag was removed from a contact |\n| `message.sent` | An outbound SMS was successfully sent |\n| `message.delivered` | An outbound SMS was confirmed delivered |\n| `message.failed` | An outbound SMS failed to send |\n| `message.undelivered` | An outbound SMS was undelivered |\n| `message.received` | An inbound SMS was received from a contact |\n| `campaign.started` | A campaign began processing enrollments |\n| `campaign.paused` | A running campaign was paused |\n| `campaign.completed` | A campaign finished all enrollments |\n| `campaign.contact_processed` | A contact in a campaign was processed |\n| `workflow.contact_enrolled` | A contact was enrolled in a workflow |\n| `workflow.contact_completed` | A contact completed a workflow |\n| `workflow.contact_failed` | A contact failed during workflow execution |\n| `conversation.reply_received` | A reply was received in a conversation |\n| `appointment.booked` | A new appointment was booked |\n| `appointment.cancelled` | An appointment was cancelled |\n| `appointment.completed` | An appointment was marked as completed |\n| `appointment.no_show` | An appointment was marked as a no-show |\n| `agent.session_started` | An AI agent started a conversation with a contact |\n| `agent.lead_qualified` | A contact met an AI agent's qualifying rules |\n| `agent.escalated` | An AI agent handed a conversation to a person |\n| `agent.session_ended` | An AI agent session ended |\n| `async_operation.created` | A long-running operation was created (e.g. bulk delete, import) |\n| `scrub.started` | A phone scrub started checking numbers, or a retry of a scrub was queued |\n| `scrub.completed` | A phone scrub checked every number |\n| `scrub.failed` | A phone scrub ended without checking every number (see `failureCode`) |\n\n### Payload Format\n\nEvery webhook delivery is a `POST` request with a JSON body:\n\n```json\n{\n  \"event\": \"contact.created\",\n  \"data\": { ... },\n  \"timestamp\": \"2026-02-11T14:30:00.000Z\",\n  \"webhookId\": \"550e8400-e29b-41d4-a716-446655440000\"\n}\n```\n\n| Field | Type | Description |\n|-------|------|-------------|\n| `event` | string | The event type (e.g. `contact.created`) |\n| `data` | object | Event-specific payload |\n| `timestamp` | string | ISO 8601 timestamp of when the event occurred |\n| `webhookId` | string | UUID of the webhook endpoint |\n\n### Duplicates and ordering\n\nA delivery can arrive more than once, and deliveries can arrive out of order. The\n`x-webhook-id` header changes on every attempt, so it cannot identify a repeat.\n\nFor scrub events (`scrub.started`, `scrub.completed`, `scrub.failed`):\n\n- **Subscribe to each name.** A subscription matches exact event names: list\n  `scrub.started`, `scrub.completed` and `scrub.failed`. There is no wildcard, so `scrub.*`\n  matches nothing.\n- **Deduplicate on `data.id` + `event` + `timestamp`.** The envelope `timestamp` is the\n  time of the scrub's change of state, so a repeated delivery of the same change carries the same value.\n  Order a scrub's events by `timestamp`, not by arrival.\n- **A scrub can start and end more than once.** A retry reopens a finished scrub, which then sends\n  `scrub.started` again and a second `scrub.completed` or `scrub.failed`. `data.id` + `event`\n  alone would drop the later run.\n- **`scrub.failed` can arrive without `scrub.started`.** A scrub that ends before it starts\n  checking numbers (stopped while pending, not enough credits, spending limit reached, no contacts)\n  sends only `scrub.failed`.\n- **`data` is a snapshot** of the scrub when the event was sent. `GET /v1/scrubs/{scrubId}` returns\n  its current state.\n- **Every scrub sends these events**, whether it was started through the API, in the app or after an\n  import.\n- **A scrub does not send `async_operation.created`.** Subscribe to the three scrub events instead.\n- **Contacts removed by a scrub do not send `contact.deleted`**, whether automatic removal or a\n  remove of the results deleted them. Read `counts.removed`, or `removed` and `removedAt` on\n  the scrub's results.\n\n### AI Agent Events\n\nThe four `agent.*` events share one `data` shape, so you can read them with the same code. Fields that don't apply yet are `null`, never missing. Each event includes the contact's `uuid`, name and phone number, so you can match the lead without another API call.\n\n- **An escalation delivers two events.** When an agent hands a conversation to a person, you receive `agent.escalated` and `agent.session_ended` for the same `sessionId`. Act on one of them if you only want one action per escalation.\n- **Deduplicate retries.** A delivery can reach you more than once. `sessionId` + `event` + `turnNumber` stays the same across retries of one event, so use it as your key. One exception: if you reopen an escalated session and it escalates again before the agent takes another turn, the second escalation has the same key.\n- **Test conversations are never delivered.** Sessions you run in the agent builder's test panel do not fire webhooks.\n- **Appointments booked by an agent.** `appointment.*` events carry `agentId` and `sessionId` when an agent made the change (`source` is `agent`), and `null` otherwise.\n\n`reasonCode` says why a session was escalated or ended:\n\n| `reasonCode` | Meaning |\n|--------------|---------|\n| `agent_escalated` | The agent decided the conversation needs a person. |\n| `review_needed` | The agent finished and left the conversation for you to review. |\n| `no_availability` | The lead qualified, but there was no open time to offer. |\n| `follow_ups_exhausted` | The contact did not answer any of the follow-up messages. |\n| `rate_limited` | The agent could not reply because a sending limit was reached. |\n| `max_turns` | The agent reached its turn limit for one conversation. |\n| `opted_out` | The contact opted out or replied negatively. |\n| `idle` | The contact did not reply within the time the agent waits. |\n| `superseded` | A workflow, a campaign or another agent took over the conversation. |\n| `completed` | The session ended with an outcome. |\n\n### Headers\n\nEach delivery includes these headers for verification:\n\n| Header | Description | Example |\n|--------|-------------|---------|\n| `Content-Type` | Always `application/json` | `application/json` |\n| `x-webhook-signature` | HMAC-SHA256 hex signature | `a7c4f8e1b2d9...` |\n| `x-webhook-timestamp` | Unix timestamp (seconds) | `1739284200` |\n| `x-webhook-id` | Unique delivery UUID | `550e8400-...` |\n\n### Signature Verification\n\nEvery delivery is signed with your webhook's signing secret so you can verify it came from PitchPrfct.\n\n1. Extract the `x-webhook-timestamp` and `x-webhook-signature` headers.\n2. Build the signed content: `{timestamp}.{raw_body}`\n3. Compute the HMAC-SHA256 using your signing secret.\n4. Compare the result to the signature header.\n\n```javascript\nimport crypto from 'node:crypto';\n\nfunction verifyWebhook(req, secret) {\n  const timestamp = req.headers['x-webhook-timestamp'];\n  const signature = req.headers['x-webhook-signature'];\n  const body = JSON.stringify(req.body);\n\n  const expected = crypto\n    .createHmac('sha256', secret)\n    .update(`${timestamp}.${body}`)\n    .digest('hex');\n\n  return crypto.timingSafeEqual(\n    Buffer.from(signature),\n    Buffer.from(expected)\n  );\n}\n```\n\n### Retries & Failure Handling\n\n| Behavior | Detail |\n|----------|--------|\n| **Attempts** | Each delivery is tried up to **5 times** |\n| **Backoff** | Exponential — 20 s, 40 s, 80 s, 160 s |\n| **Timeout** | Your endpoint must respond within **10 seconds** |\n| **Success** | Any `2xx` status ends the current run of failures and resets the failure counter |\n| **Failure** | Non-2xx responses or timeouts count once per delivery, after all retries are exhausted |\n| **Auto-disable** | An endpoint is disabled automatically only when every delivery has failed for **at least 1 hour** and that run holds **at least 5 failed deliveries**. A single successful delivery ends the run. The response exposes `failingSince` and `autoDisabledAt`. Re-enable with `PATCH /v1/webhooks/{id}` and `{ \"enabled\": true }`, which also resets the counter. |\n\n> If you notice a high failure count or a `failingSince` timestamp, check that your endpoint is reachable and responding with a 2xx status before the run reaches an hour.\n\n### Limits\n\n| Limit | Value |\n|-------|-------|\n| Webhooks per account | **10** |\n| Delivery timeout | **10 seconds** |\n| Max response body stored | **10 KB** |\n| Throughput | Up to **500 deliveries/minute** |\n","responses":{"200":{"description":"Your server should return a 2xx status to acknowledge receipt."}}}},"contactCreated":{"post":{"summary":"Contact Created","description":"Fired when a new contact is added to your account.","operationId":"webhook_contact_created","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["event","data","timestamp","webhookId"],"properties":{"event":{"type":"string","enum":["contact.created"],"description":"The event type that triggered this webhook."},"data":{"type":"object","required":["uuid","firstName","lastName","phoneNumber","email","company","address","city","state","zipCode","tags","customFields","optedOut","optedOutAt","starred","folderId","createdAt","updatedAt"],"properties":{"uuid":{"type":"string","format":"uuid","description":"Unique contact identifier. Use this in all API calls."},"firstName":{"type":"string","nullable":true},"lastName":{"type":"string","nullable":true},"phoneNumber":{"type":"string","description":"Contact phone number in E.164 format."},"email":{"type":"string","nullable":true},"company":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"city":{"type":"string","nullable":true},"state":{"type":"string","nullable":true},"zipCode":{"type":"string","nullable":true},"tags":{"type":"array","items":{"type":"string"},"description":"Human-readable tag names applied to the contact."},"customFields":{"type":"object","additionalProperties":{"type":"string"},"description":"Custom field values keyed by field name."},"optedOut":{"type":"boolean"},"optedOutAt":{"type":"string","format":"date-time","nullable":true,"description":"ISO 8601 timestamp when the contact opted out, if applicable."},"starred":{"type":"boolean"},"folderId":{"type":"integer","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"timestamp":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of when the event occurred."},"webhookId":{"type":"string","format":"uuid","description":"The ID of the webhook endpoint that received this event."}}},"example":{"event":"contact.created","data":{"uuid":"550e8400-e29b-41d4-a716-446655440000","firstName":"Sam","lastName":"Rivera","phoneNumber":"+15559876543","email":"sam@example.com","company":"Example Co","address":"123 Main St","city":"Austin","state":"TX","zipCode":"78701","tags":["vip","newsletter"],"customFields":{"lead_source":"referral","account_tier":"gold"},"optedOut":false,"optedOutAt":null,"starred":false,"folderId":null,"createdAt":"2026-02-11T14:30:00.000Z","updatedAt":"2026-02-11T14:30:00.000Z"},"timestamp":"2026-02-11T14:30:00.000Z","webhookId":"550e8400-e29b-41d4-a716-446655440000"}}}},"responses":{"200":{"description":"Your server should return a 2xx status to acknowledge receipt."}}}},"contactUpdated":{"post":{"summary":"Contact Updated","description":"Fired when a contact's information is modified.","operationId":"webhook_contact_updated","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["event","data","timestamp","webhookId"],"properties":{"event":{"type":"string","enum":["contact.updated"],"description":"The event type that triggered this webhook."},"data":{"type":"object","required":["uuid","firstName","lastName","phoneNumber","email","company","address","city","state","zipCode","tags","customFields","optedOut","optedOutAt","starred","folderId","createdAt","updatedAt"],"properties":{"uuid":{"type":"string","format":"uuid","description":"Unique contact identifier. Use this in all API calls."},"firstName":{"type":"string","nullable":true},"lastName":{"type":"string","nullable":true},"phoneNumber":{"type":"string","description":"Contact phone number in E.164 format."},"email":{"type":"string","nullable":true},"company":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"city":{"type":"string","nullable":true},"state":{"type":"string","nullable":true},"zipCode":{"type":"string","nullable":true},"tags":{"type":"array","items":{"type":"string"},"description":"Human-readable tag names applied to the contact."},"customFields":{"type":"object","additionalProperties":{"type":"string"},"description":"Custom field values keyed by field name."},"optedOut":{"type":"boolean"},"optedOutAt":{"type":"string","format":"date-time","nullable":true,"description":"ISO 8601 timestamp when the contact opted out, if applicable."},"starred":{"type":"boolean"},"folderId":{"type":"integer","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"timestamp":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of when the event occurred."},"webhookId":{"type":"string","format":"uuid","description":"The ID of the webhook endpoint that received this event."}}},"example":{"event":"contact.updated","data":{"uuid":"550e8400-e29b-41d4-a716-446655440000","firstName":"Sam","lastName":"Rivera","phoneNumber":"+15559876543","email":"sam@example.com","company":"Example Co","address":"123 Main St","city":"Austin","state":"TX","zipCode":"78701","tags":["vip","newsletter"],"customFields":{"lead_source":"referral","account_tier":"gold"},"optedOut":false,"optedOutAt":null,"starred":false,"folderId":null,"createdAt":"2026-02-11T14:30:00.000Z","updatedAt":"2026-02-11T14:30:00.000Z"},"timestamp":"2026-02-11T14:30:00.000Z","webhookId":"550e8400-e29b-41d4-a716-446655440000"}}}},"responses":{"200":{"description":"Your server should return a 2xx status to acknowledge receipt."}}}},"contactDeleted":{"post":{"summary":"Contact Deleted","description":"Fired when a contact is permanently removed. Contacts removed by a scrub (automatic removal or a remove of its results) do not send this event; read the scrub's `counts.removed`, or `removed` and `removedAt` on its results.","operationId":"webhook_contact_deleted","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["event","data","timestamp","webhookId"],"properties":{"event":{"type":"string","enum":["contact.deleted"],"description":"The event type that triggered this webhook."},"data":{"type":"object","required":["uuid"],"properties":{"uuid":{"type":"string","format":"uuid","description":"UUID of the contact that was deleted."}}},"timestamp":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of when the event occurred."},"webhookId":{"type":"string","format":"uuid","description":"The ID of the webhook endpoint that received this event."}}},"example":{"event":"contact.deleted","data":{"uuid":"550e8400-e29b-41d4-a716-446655440000"},"timestamp":"2026-02-11T14:30:00.000Z","webhookId":"550e8400-e29b-41d4-a716-446655440000"}}}},"responses":{"200":{"description":"Your server should return a 2xx status to acknowledge receipt."}}}},"contactOpted_out":{"post":{"summary":"Contact Opted Out","description":"Fired when a contact opts out of receiving messages.","operationId":"webhook_contact_opted_out","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["event","data","timestamp","webhookId"],"properties":{"event":{"type":"string","enum":["contact.opted_out"],"description":"The event type that triggered this webhook."},"data":{"type":"object","required":["uuid","firstName","lastName","phoneNumber","optedOut","optedOutAt"],"properties":{"uuid":{"type":"string","format":"uuid"},"firstName":{"type":"string","nullable":true},"lastName":{"type":"string","nullable":true},"phoneNumber":{"type":"string"},"optedOut":{"type":"boolean"},"optedOutAt":{"type":"string","format":"date-time","nullable":true,"description":"ISO 8601 timestamp when the opt-out status changed."}}},"timestamp":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of when the event occurred."},"webhookId":{"type":"string","format":"uuid","description":"The ID of the webhook endpoint that received this event."}}},"example":{"event":"contact.opted_out","data":{"uuid":"550e8400-e29b-41d4-a716-446655440000","firstName":"Sam","lastName":"Rivera","phoneNumber":"+15559876543","optedOut":true,"optedOutAt":"2026-02-11T14:30:00.000Z"},"timestamp":"2026-02-11T14:30:00.000Z","webhookId":"550e8400-e29b-41d4-a716-446655440000"}}}},"responses":{"200":{"description":"Your server should return a 2xx status to acknowledge receipt."}}}},"contactOpted_in":{"post":{"summary":"Contact Opted In","description":"Fired when a previously opted-out contact is opted back in.","operationId":"webhook_contact_opted_in","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["event","data","timestamp","webhookId"],"properties":{"event":{"type":"string","enum":["contact.opted_in"],"description":"The event type that triggered this webhook."},"data":{"type":"object","required":["uuid","firstName","lastName","phoneNumber","optedOut","optedOutAt"],"properties":{"uuid":{"type":"string","format":"uuid"},"firstName":{"type":"string","nullable":true},"lastName":{"type":"string","nullable":true},"phoneNumber":{"type":"string"},"optedOut":{"type":"boolean"},"optedOutAt":{"type":"string","format":"date-time","nullable":true,"description":"ISO 8601 timestamp when the opt-out status changed."}}},"timestamp":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of when the event occurred."},"webhookId":{"type":"string","format":"uuid","description":"The ID of the webhook endpoint that received this event."}}},"example":{"event":"contact.opted_in","data":{"uuid":"550e8400-e29b-41d4-a716-446655440000","firstName":"Sam","lastName":"Rivera","phoneNumber":"+15559876543","optedOut":false,"optedOutAt":null},"timestamp":"2026-02-11T14:30:00.000Z","webhookId":"550e8400-e29b-41d4-a716-446655440000"}}}},"responses":{"200":{"description":"Your server should return a 2xx status to acknowledge receipt."}}}},"tagCreated":{"post":{"summary":"Tag Created","description":"Fired when a new tag is created.","operationId":"webhook_tag_created","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["event","data","timestamp","webhookId"],"properties":{"event":{"type":"string","enum":["tag.created"],"description":"The event type that triggered this webhook."},"data":{"type":"object","required":["id","name","color","source","createdAt","updatedAt"],"properties":{"id":{"type":"integer","description":"Internal numeric ID of the tag."},"name":{"type":"string","description":"Tag name."},"color":{"type":"string","description":"Hex color code associated with the tag."},"source":{"type":"string","description":"Origin of the tag (e.g. user, system, api)."},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"timestamp":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of when the event occurred."},"webhookId":{"type":"string","format":"uuid","description":"The ID of the webhook endpoint that received this event."}}},"example":{"event":"tag.created","data":{"id":142,"name":"vip","color":"#FFD700","source":"user","createdAt":"2026-02-11T14:30:00.000Z","updatedAt":"2026-02-11T14:30:00.000Z"},"timestamp":"2026-02-11T14:30:00.000Z","webhookId":"550e8400-e29b-41d4-a716-446655440000"}}}},"responses":{"200":{"description":"Your server should return a 2xx status to acknowledge receipt."}}}},"tagApplied":{"post":{"summary":"Tag Applied","description":"Fired when one or more tags are applied to a contact.\n\nA change on one contact sends `contactUuid` and `tags`.\n\nA bulk change (a bulk tag action, the bulk tag endpoints, a workflow tag step, an agent or the assistant) sends one notice for many contacts, with `contactUuids`, `tags` and `tagIds`. A bulk notice has at most 5,000 contacts; a larger operation sends more than one notice. A bulk removal sends this same event with `removed: true`.\n\n```json\n{\n  \"contactUuids\": [\"550e8400-e29b-41d4-a716-446655440000\", \"7c9e6679-7425-40de-944b-e07fc1f90ae7\"],\n  \"tags\": [\"vip\"],\n  \"tagIds\": [142],\n  \"contactIds\": [48213, 48214]\n}\n```\n\n**Deprecated:** `contactIds` (internal contact numbers) will be removed from the bulk notice. Read `contactUuids`.","operationId":"webhook_tag_applied","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["event","data","timestamp","webhookId"],"properties":{"event":{"type":"string","enum":["tag.applied"],"description":"The event type that triggered this webhook."},"data":{"oneOf":[{"title":"One contact","type":"object","required":["contactUuid","tags"],"properties":{"contactUuid":{"type":"string","format":"uuid","description":"UUID of the contact the tags were applied to."},"tags":{"type":"array","items":{"type":"string"},"description":"Names of the tags applied."}}},{"title":"Bulk change","type":"object","required":["contactUuids","tags","tagIds"],"properties":{"contactUuids":{"type":"array","items":{"type":"string","format":"uuid"},"description":"UUIDs of the contacts of this notice. A contact deleted before the notice was built is not listed."},"tags":{"type":"array","items":{"type":"string"},"description":"Names of the tags applied or removed."},"tagIds":{"type":"array","items":{"type":"integer"},"description":"IDs of the tags applied or removed."},"removed":{"type":"boolean","description":"Present and `true` when the tags were removed from the contacts. Absent when they were applied."},"contactIds":{"type":"array","items":{"type":"integer"},"deprecated":true,"description":"Deprecated: internal contact numbers, to be removed. Read `contactUuids`. The order is not guaranteed to match `contactUuids`."}}}]},"timestamp":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of when the event occurred."},"webhookId":{"type":"string","format":"uuid","description":"The ID of the webhook endpoint that received this event."}}},"example":{"event":"tag.applied","data":{"contactUuid":"550e8400-e29b-41d4-a716-446655440000","tags":["vip","newsletter"]},"timestamp":"2026-02-11T14:30:00.000Z","webhookId":"550e8400-e29b-41d4-a716-446655440000"}}}},"responses":{"200":{"description":"Your server should return a 2xx status to acknowledge receipt."}}}},"tagRemoved":{"post":{"summary":"Tag Removed","description":"Fired when a tag is removed from a contact.","operationId":"webhook_tag_removed","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["event","data","timestamp","webhookId"],"properties":{"event":{"type":"string","enum":["tag.removed"],"description":"The event type that triggered this webhook."},"data":{"type":"object","required":["contactUuid","tagId"],"properties":{"contactUuid":{"type":"string","format":"uuid","description":"UUID of the contact the tag was removed from."},"tagId":{"type":"integer","description":"Internal numeric ID of the tag that was removed."}}},"timestamp":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of when the event occurred."},"webhookId":{"type":"string","format":"uuid","description":"The ID of the webhook endpoint that received this event."}}},"example":{"event":"tag.removed","data":{"contactUuid":"550e8400-e29b-41d4-a716-446655440000","tagId":142},"timestamp":"2026-02-11T14:30:00.000Z","webhookId":"550e8400-e29b-41d4-a716-446655440000"}}}},"responses":{"200":{"description":"Your server should return a 2xx status to acknowledge receipt."}}}},"messageSent":{"post":{"summary":"Message Sent","description":"Fired when an outbound SMS message is successfully sent.","operationId":"webhook_message_sent","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["event","data","timestamp","webhookId"],"properties":{"event":{"type":"string","enum":["message.sent"],"description":"The event type that triggered this webhook."},"data":{"type":"object","required":["from","to"],"properties":{"messageId":{"type":"integer","description":"Internal ID of the sent message record."},"conversationId":{"type":"integer","description":"ID of the conversation this message belongs to."},"contactUuid":{"type":"string","format":"uuid","description":"UUID of the contact the message was sent to. Omitted when unavailable in the emitting context."},"providerMessageId":{"type":"string","description":"Provider-assigned message SID."},"from":{"type":"string","description":"Sender phone number in E.164 format."},"to":{"type":"string","description":"Recipient phone number in E.164 format."},"content":{"type":"string","description":"The text body of the message sent to the recipient."}}},"timestamp":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of when the event occurred."},"webhookId":{"type":"string","format":"uuid","description":"The ID of the webhook endpoint that received this event."}}},"example":{"event":"message.sent","data":{"messageId":482931,"conversationId":10293,"contactUuid":"550e8400-e29b-41d4-a716-446655440000","providerMessageId":"SM1a2b3c4d5e6f","from":"+15551234567","to":"+15559876543","content":"Hey Sam, just checking in about your appointment tomorrow."},"timestamp":"2026-02-11T14:30:00.000Z","webhookId":"550e8400-e29b-41d4-a716-446655440000"}}}},"responses":{"200":{"description":"Your server should return a 2xx status to acknowledge receipt."}}}},"messageDelivered":{"post":{"summary":"Message Delivered","description":"Fired when an outbound SMS message is confirmed delivered by the carrier.","operationId":"webhook_message_delivered","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["event","data","timestamp","webhookId"],"properties":{"event":{"type":"string","enum":["message.delivered"],"description":"The event type that triggered this webhook."},"data":{"type":"object","required":["messageId","providerMessageId","from","to"],"properties":{"messageId":{"type":"integer","description":"Internal ID of the delivered message record."},"providerMessageId":{"type":"string","description":"Provider-assigned message SID used to correlate with message.sent."},"from":{"type":"string","description":"Sender phone number in E.164 format."},"to":{"type":"string","description":"Recipient phone number in E.164 format."}}},"timestamp":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of when the event occurred."},"webhookId":{"type":"string","format":"uuid","description":"The ID of the webhook endpoint that received this event."}}},"example":{"event":"message.delivered","data":{"messageId":2230378,"providerMessageId":"SM1a2b3c4d5e6f","from":"+14808100663","to":"+17177540358"},"timestamp":"2026-02-11T14:30:00.000Z","webhookId":"550e8400-e29b-41d4-a716-446655440000"}}}},"responses":{"200":{"description":"Your server should return a 2xx status to acknowledge receipt."}}}},"messageFailed":{"post":{"summary":"Message Failed","description":"Fired when an outbound SMS message fails to send.","operationId":"webhook_message_failed","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["event","data","timestamp","webhookId"],"properties":{"event":{"type":"string","enum":["message.failed"],"description":"The event type that triggered this webhook."},"data":{"type":"object","required":["messageId","providerMessageId","from","to","statusDetail"],"properties":{"messageId":{"type":"integer","description":"Internal ID of the failed message record."},"providerMessageId":{"type":"string","description":"Provider-assigned message SID."},"from":{"type":"string","description":"Sender phone number in E.164 format."},"to":{"type":"string","description":"Recipient phone number in E.164 format."},"statusDetail":{"type":"string","nullable":true,"description":"Provider-reported failure reason (e.g. invalid number, blocked)."}}},"timestamp":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of when the event occurred."},"webhookId":{"type":"string","format":"uuid","description":"The ID of the webhook endpoint that received this event."}}},"example":{"event":"message.failed","data":{"messageId":482931,"providerMessageId":"SM1a2b3c4d5e6f","from":"+15551234567","to":"+15559876543","statusDetail":"Invalid destination number"},"timestamp":"2026-02-11T14:30:00.000Z","webhookId":"550e8400-e29b-41d4-a716-446655440000"}}}},"responses":{"200":{"description":"Your server should return a 2xx status to acknowledge receipt."}}}},"messageUndelivered":{"post":{"summary":"Message Undelivered","description":"Fired when an outbound SMS message is undelivered by the carrier.","operationId":"webhook_message_undelivered","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["event","data","timestamp","webhookId"],"properties":{"event":{"type":"string","enum":["message.undelivered"],"description":"The event type that triggered this webhook."},"data":{"type":"object","required":["messageId","providerMessageId","from","to","statusDetail"],"properties":{"messageId":{"type":"integer","description":"Internal ID of the undelivered message record."},"providerMessageId":{"type":"string","description":"Provider-assigned message SID."},"from":{"type":"string","description":"Sender phone number in E.164 format."},"to":{"type":"string","description":"Recipient phone number in E.164 format."},"statusDetail":{"type":"string","nullable":true,"description":"Provider-reported undelivered reason."}}},"timestamp":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of when the event occurred."},"webhookId":{"type":"string","format":"uuid","description":"The ID of the webhook endpoint that received this event."}}},"example":{"event":"message.undelivered","data":{"messageId":482931,"providerMessageId":"SM1a2b3c4d5e6f","from":"+15551234567","to":"+15559876543","statusDetail":"Carrier rejected message"},"timestamp":"2026-02-11T14:30:00.000Z","webhookId":"550e8400-e29b-41d4-a716-446655440000"}}}},"responses":{"200":{"description":"Your server should return a 2xx status to acknowledge receipt."}}}},"messageReceived":{"post":{"summary":"Message Received","description":"Fired when an inbound SMS message is received from a contact.","operationId":"webhook_message_received","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["event","data","timestamp","webhookId"],"properties":{"event":{"type":"string","enum":["message.received"],"description":"The event type that triggered this webhook."},"data":{"type":"object","required":["messageId","conversationId","from","to","content"],"properties":{"messageId":{"type":"integer","description":"Internal ID of the inbound message record."},"conversationId":{"type":"integer","description":"ID of the conversation this message belongs to."},"contactUuid":{"type":"string","format":"uuid","description":"UUID of the contact that sent the reply."},"from":{"type":"string","description":"Contact phone number in E.164 format."},"to":{"type":"string","description":"Your phone number that received the message, in E.164 format."},"content":{"type":"string","description":"The text body of the inbound message."}}},"timestamp":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of when the event occurred."},"webhookId":{"type":"string","format":"uuid","description":"The ID of the webhook endpoint that received this event."}}},"example":{"event":"message.received","data":{"messageId":482944,"conversationId":10293,"contactUuid":"550e8400-e29b-41d4-a716-446655440000","from":"+15559876543","to":"+15551234567","content":"Yes, I'll be there at 10am."},"timestamp":"2026-02-11T14:30:00.000Z","webhookId":"550e8400-e29b-41d4-a716-446655440000"}}}},"responses":{"200":{"description":"Your server should return a 2xx status to acknowledge receipt."}}}},"campaignStarted":{"post":{"summary":"Campaign Started","description":"Fired when a campaign begins processing enrollments.","operationId":"webhook_campaign_started","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["event","data","timestamp","webhookId"],"properties":{"event":{"type":"string","enum":["campaign.started"],"description":"The event type that triggered this webhook."},"data":{"type":"object","required":["id","name"],"properties":{"id":{"type":"integer","description":"Internal numeric ID of the campaign."},"name":{"type":"string","description":"Campaign name."}}},"timestamp":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of when the event occurred."},"webhookId":{"type":"string","format":"uuid","description":"The ID of the webhook endpoint that received this event."}}},"example":{"event":"campaign.started","data":{"id":57,"name":"Spring Outreach 2026"},"timestamp":"2026-02-11T14:30:00.000Z","webhookId":"550e8400-e29b-41d4-a716-446655440000"}}}},"responses":{"200":{"description":"Your server should return a 2xx status to acknowledge receipt."}}}},"campaignPaused":{"post":{"summary":"Campaign Paused","description":"Fired when a running campaign is paused.","operationId":"webhook_campaign_paused","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["event","data","timestamp","webhookId"],"properties":{"event":{"type":"string","enum":["campaign.paused"],"description":"The event type that triggered this webhook."},"data":{"type":"object","required":["id","name"],"properties":{"id":{"type":"integer","description":"Internal numeric ID of the campaign."},"name":{"type":"string","description":"Campaign name."}}},"timestamp":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of when the event occurred."},"webhookId":{"type":"string","format":"uuid","description":"The ID of the webhook endpoint that received this event."}}},"example":{"event":"campaign.paused","data":{"id":57,"name":"Spring Outreach 2026"},"timestamp":"2026-02-11T14:30:00.000Z","webhookId":"550e8400-e29b-41d4-a716-446655440000"}}}},"responses":{"200":{"description":"Your server should return a 2xx status to acknowledge receipt."}}}},"campaignCompleted":{"post":{"summary":"Campaign Completed","description":"Fired when a campaign finishes all enrollments.","operationId":"webhook_campaign_completed","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["event","data","timestamp","webhookId"],"properties":{"event":{"type":"string","enum":["campaign.completed"],"description":"The event type that triggered this webhook."},"data":{"type":"object","required":["id","name"],"properties":{"id":{"type":"integer","description":"Internal numeric ID of the campaign."},"name":{"type":"string","description":"Campaign name."}}},"timestamp":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of when the event occurred."},"webhookId":{"type":"string","format":"uuid","description":"The ID of the webhook endpoint that received this event."}}},"example":{"event":"campaign.completed","data":{"id":57,"name":"Spring Outreach 2026"},"timestamp":"2026-02-11T14:30:00.000Z","webhookId":"550e8400-e29b-41d4-a716-446655440000"}}}},"responses":{"200":{"description":"Your server should return a 2xx status to acknowledge receipt."}}}},"campaignContact_processed":{"post":{"summary":"Campaign Contact Processed","description":"Fired when a batch of contacts in a campaign is processed. This is a batch-level summary — it reports how many contacts were processed, not individual contact identities.","operationId":"webhook_campaign_contact_processed","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["event","data","timestamp","webhookId"],"properties":{"event":{"type":"string","enum":["campaign.contact_processed"],"description":"The event type that triggered this webhook."},"data":{"type":"object","required":["campaignId","batchId","contactsProcessed"],"properties":{"campaignId":{"type":"integer","description":"Internal ID of the campaign."},"batchId":{"type":"integer","description":"Internal ID of the processed batch."},"contactsProcessed":{"type":"integer","description":"Number of contacts processed in this batch."}}},"timestamp":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of when the event occurred."},"webhookId":{"type":"string","format":"uuid","description":"The ID of the webhook endpoint that received this event."}}},"example":{"event":"campaign.contact_processed","data":{"campaignId":57,"batchId":1248,"contactsProcessed":42},"timestamp":"2026-02-11T14:30:00.000Z","webhookId":"550e8400-e29b-41d4-a716-446655440000"}}}},"responses":{"200":{"description":"Your server should return a 2xx status to acknowledge receipt."}}}},"workflowContact_enrolled":{"post":{"summary":"Workflow Contact Enrolled","description":"Fired when a contact is enrolled in a workflow.","operationId":"webhook_workflow_contact_enrolled","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["event","data","timestamp","webhookId"],"properties":{"event":{"type":"string","enum":["workflow.contact_enrolled"],"description":"The event type that triggered this webhook."},"data":{"type":"object","required":["enrollmentId"],"properties":{"workflowId":{"type":"integer","description":"ID of the workflow the contact was enrolled in."},"enrollmentId":{"type":"integer","description":"Internal ID of the enrollment record."},"contactUuid":{"type":"string","format":"uuid","description":"UUID of the enrolled contact. Omitted when unavailable in the emitting context."}}},"timestamp":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of when the event occurred."},"webhookId":{"type":"string","format":"uuid","description":"The ID of the webhook endpoint that received this event."}}},"example":{"event":"workflow.contact_enrolled","data":{"workflowId":42,"enrollmentId":9831,"contactUuid":"550e8400-e29b-41d4-a716-446655440000"},"timestamp":"2026-02-11T14:30:00.000Z","webhookId":"550e8400-e29b-41d4-a716-446655440000"}}}},"responses":{"200":{"description":"Your server should return a 2xx status to acknowledge receipt."}}}},"workflowContact_completed":{"post":{"summary":"Workflow Contact Completed","description":"Fired when a contact completes all steps in a workflow.","operationId":"webhook_workflow_contact_completed","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["event","data","timestamp","webhookId"],"properties":{"event":{"type":"string","enum":["workflow.contact_completed"],"description":"The event type that triggered this webhook."},"data":{"type":"object","required":["workflowId","enrollmentId"],"properties":{"workflowId":{"type":"integer","description":"ID of the workflow the contact completed."},"enrollmentId":{"type":"integer","description":"Internal ID of the enrollment record."},"contactUuid":{"type":"string","format":"uuid","description":"UUID of the contact. Omitted when unavailable in the emitting context."}}},"timestamp":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of when the event occurred."},"webhookId":{"type":"string","format":"uuid","description":"The ID of the webhook endpoint that received this event."}}},"example":{"event":"workflow.contact_completed","data":{"workflowId":42,"enrollmentId":9831,"contactUuid":"550e8400-e29b-41d4-a716-446655440000"},"timestamp":"2026-02-11T14:30:00.000Z","webhookId":"550e8400-e29b-41d4-a716-446655440000"}}}},"responses":{"200":{"description":"Your server should return a 2xx status to acknowledge receipt."}}}},"workflowContact_failed":{"post":{"summary":"Workflow Contact Failed","description":"Fired when a contact fails during workflow execution.","operationId":"webhook_workflow_contact_failed","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["event","data","timestamp","webhookId"],"properties":{"event":{"type":"string","enum":["workflow.contact_failed"],"description":"The event type that triggered this webhook."},"data":{"type":"object","required":["workflowId","enrollmentId","reason"],"properties":{"workflowId":{"type":"integer","description":"ID of the workflow the contact was enrolled in."},"enrollmentId":{"type":"integer","description":"Internal ID of the failed enrollment record."},"reason":{"type":"string","description":"Human-readable description of why the enrollment failed."},"contactUuid":{"type":"string","format":"uuid","description":"UUID of the contact. Omitted when unavailable in the emitting context."}}},"timestamp":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of when the event occurred."},"webhookId":{"type":"string","format":"uuid","description":"The ID of the webhook endpoint that received this event."}}},"example":{"event":"workflow.contact_failed","data":{"workflowId":42,"enrollmentId":9831,"reason":"Message send failed"},"timestamp":"2026-02-11T14:30:00.000Z","webhookId":"550e8400-e29b-41d4-a716-446655440000"}}}},"responses":{"200":{"description":"Your server should return a 2xx status to acknowledge receipt."}}}},"conversationReply_received":{"post":{"summary":"Conversation Reply Received","description":"Fired when a reply is received in a conversation.","operationId":"webhook_conversation_reply_received","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["event","data","timestamp","webhookId"],"properties":{"event":{"type":"string","enum":["conversation.reply_received"],"description":"The event type that triggered this webhook."},"data":{"type":"object","required":["conversationId","messageId"],"properties":{"conversationId":{"type":"integer","description":"ID of the conversation that received the reply."},"messageId":{"type":"integer","description":"Internal ID of the inbound message record."},"contactUuid":{"type":"string","format":"uuid","description":"UUID of the contact that sent the reply."},"content":{"type":"string","description":"The text body of the reply."},"createdAt":{"type":"string","format":"date-time","description":"ISO-8601 timestamp when the inbound message was recorded."}}},"timestamp":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of when the event occurred."},"webhookId":{"type":"string","format":"uuid","description":"The ID of the webhook endpoint that received this event."}}},"example":{"event":"conversation.reply_received","data":{"conversationId":10293,"messageId":482944,"contactUuid":"550e8400-e29b-41d4-a716-446655440000","content":"Yes, I'll be there at 10am."},"timestamp":"2026-02-11T14:30:00.000Z","webhookId":"550e8400-e29b-41d4-a716-446655440000"}}}},"responses":{"200":{"description":"Your server should return a 2xx status to acknowledge receipt."}}}},"appointmentBooked":{"post":{"summary":"Appointment Booked","description":"Fired when a new appointment is booked: in PitchPrfct, through the API, by a booking agent, or in the connected calendar. Appointments that already exist when a calendar is connected do not fire this event.","operationId":"webhook_appointment_booked","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["event","data","timestamp","webhookId"],"properties":{"event":{"type":"string","enum":["appointment.booked"],"description":"The event type that triggered this webhook."},"data":{"type":"object","required":["appointmentId","contactUuids","source","provider","startsAt","endsAt","agentId","sessionId"],"properties":{"appointmentId":{"type":"integer","description":"ID of the appointment in PitchPrfct."},"contactUuids":{"type":"array","items":{"type":"string","format":"uuid"},"description":"UUIDs of the contacts invited to the appointment (the organizer is not included). Empty when no invitee is linked to one of your contacts."},"source":{"type":"string","enum":["user","provider","agent"],"description":"Who made the change: `user` (in PitchPrfct or through the API), `provider` (in the connected calendar, such as Google Calendar or Calendly) or `agent` (a booking agent)."},"provider":{"type":"string","enum":["google","calendly","cal"],"nullable":true,"description":"The calendar the appointment belongs to."},"startsAt":{"type":"string","format":"date-time","description":"ISO-8601 start time of the appointment."},"endsAt":{"type":"string","format":"date-time","nullable":true,"description":"ISO-8601 end time of the appointment."},"agentId":{"type":"integer","nullable":true,"description":"ID of the AI agent that made the change. Null unless `source` is `agent`."},"sessionId":{"type":"integer","nullable":true,"description":"ID of the AI agent session the change happened in, the same `sessionId` the `agent.*` events carry. Null unless `source` is `agent`."}}},"timestamp":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of when the event occurred."},"webhookId":{"type":"string","format":"uuid","description":"The ID of the webhook endpoint that received this event."}}},"example":{"event":"appointment.booked","data":{"appointmentId":5821,"contactUuids":["550e8400-e29b-41d4-a716-446655440000"],"source":"provider","provider":"google","startsAt":"2026-11-03T15:00:00.000Z","endsAt":"2026-11-03T15:30:00.000Z","agentId":null,"sessionId":null},"timestamp":"2026-02-11T14:30:00.000Z","webhookId":"550e8400-e29b-41d4-a716-446655440000"}}}},"responses":{"200":{"description":"Your server should return a 2xx status to acknowledge receipt."}}}},"appointmentCancelled":{"post":{"summary":"Appointment Cancelled","description":"Fired when an appointment is cancelled, or when an upcoming appointment is deleted. When `rescheduled` is true, the appointment was moved to a new time and an `appointment.booked` event follows for the new time.","operationId":"webhook_appointment_cancelled","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["event","data","timestamp","webhookId"],"properties":{"event":{"type":"string","enum":["appointment.cancelled"],"description":"The event type that triggered this webhook."},"data":{"type":"object","required":["appointmentId","contactUuids","source","provider","startsAt","endsAt","agentId","sessionId","rescheduled"],"properties":{"appointmentId":{"type":"integer","description":"ID of the appointment in PitchPrfct."},"contactUuids":{"type":"array","items":{"type":"string","format":"uuid"},"description":"UUIDs of the contacts invited to the appointment (the organizer is not included). Empty when no invitee is linked to one of your contacts."},"source":{"type":"string","enum":["user","provider","agent"],"description":"Who made the change: `user` (in PitchPrfct or through the API), `provider` (in the connected calendar, such as Google Calendar or Calendly) or `agent` (a booking agent)."},"provider":{"type":"string","enum":["google","calendly","cal"],"nullable":true,"description":"The calendar the appointment belongs to."},"startsAt":{"type":"string","format":"date-time","description":"ISO-8601 start time of the appointment."},"endsAt":{"type":"string","format":"date-time","nullable":true,"description":"ISO-8601 end time of the appointment."},"agentId":{"type":"integer","nullable":true,"description":"ID of the AI agent that made the change. Null unless `source` is `agent`."},"sessionId":{"type":"integer","nullable":true,"description":"ID of the AI agent session the change happened in, the same `sessionId` the `agent.*` events carry. Null unless `source` is `agent`."},"rescheduled":{"type":"boolean","description":"True when this cancellation is the old time of a rescheduled appointment."}}},"timestamp":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of when the event occurred."},"webhookId":{"type":"string","format":"uuid","description":"The ID of the webhook endpoint that received this event."}}},"example":{"event":"appointment.cancelled","data":{"appointmentId":5821,"contactUuids":["550e8400-e29b-41d4-a716-446655440000"],"source":"provider","provider":"google","startsAt":"2026-11-03T15:00:00.000Z","endsAt":"2026-11-03T15:30:00.000Z","agentId":null,"sessionId":null,"rescheduled":false},"timestamp":"2026-02-11T14:30:00.000Z","webhookId":"550e8400-e29b-41d4-a716-446655440000"}}}},"responses":{"200":{"description":"Your server should return a 2xx status to acknowledge receipt."}}}},"appointmentCompleted":{"post":{"summary":"Appointment Completed","description":"Fired when an appointment is marked as completed.","operationId":"webhook_appointment_completed","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["event","data","timestamp","webhookId"],"properties":{"event":{"type":"string","enum":["appointment.completed"],"description":"The event type that triggered this webhook."},"data":{"type":"object","required":["appointmentId","contactUuids","source","provider","startsAt","endsAt","agentId","sessionId"],"properties":{"appointmentId":{"type":"integer","description":"ID of the appointment in PitchPrfct."},"contactUuids":{"type":"array","items":{"type":"string","format":"uuid"},"description":"UUIDs of the contacts invited to the appointment (the organizer is not included). Empty when no invitee is linked to one of your contacts."},"source":{"type":"string","enum":["user","provider","agent"],"description":"Who made the change: `user` (in PitchPrfct or through the API), `provider` (in the connected calendar, such as Google Calendar or Calendly) or `agent` (a booking agent)."},"provider":{"type":"string","enum":["google","calendly","cal"],"nullable":true,"description":"The calendar the appointment belongs to."},"startsAt":{"type":"string","format":"date-time","description":"ISO-8601 start time of the appointment."},"endsAt":{"type":"string","format":"date-time","nullable":true,"description":"ISO-8601 end time of the appointment."},"agentId":{"type":"integer","nullable":true,"description":"ID of the AI agent that made the change. Null unless `source` is `agent`."},"sessionId":{"type":"integer","nullable":true,"description":"ID of the AI agent session the change happened in, the same `sessionId` the `agent.*` events carry. Null unless `source` is `agent`."}}},"timestamp":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of when the event occurred."},"webhookId":{"type":"string","format":"uuid","description":"The ID of the webhook endpoint that received this event."}}},"example":{"event":"appointment.completed","data":{"appointmentId":5821,"contactUuids":["550e8400-e29b-41d4-a716-446655440000"],"source":"user","provider":"google","startsAt":"2026-11-03T15:00:00.000Z","endsAt":"2026-11-03T15:30:00.000Z","agentId":null,"sessionId":null},"timestamp":"2026-02-11T14:30:00.000Z","webhookId":"550e8400-e29b-41d4-a716-446655440000"}}}},"responses":{"200":{"description":"Your server should return a 2xx status to acknowledge receipt."}}}},"appointmentNo_show":{"post":{"summary":"Appointment No-Show","description":"Fired when an appointment is marked as a no-show, in PitchPrfct or in Calendly. Removing the mark does not fire an event.","operationId":"webhook_appointment_no_show","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["event","data","timestamp","webhookId"],"properties":{"event":{"type":"string","enum":["appointment.no_show"],"description":"The event type that triggered this webhook."},"data":{"type":"object","required":["appointmentId","contactUuids","source","provider","startsAt","endsAt","agentId","sessionId"],"properties":{"appointmentId":{"type":"integer","description":"ID of the appointment in PitchPrfct."},"contactUuids":{"type":"array","items":{"type":"string","format":"uuid"},"description":"UUIDs of the contacts invited to the appointment (the organizer is not included). Empty when no invitee is linked to one of your contacts."},"source":{"type":"string","enum":["user","provider","agent"],"description":"Who made the change: `user` (in PitchPrfct or through the API), `provider` (in the connected calendar, such as Google Calendar or Calendly) or `agent` (a booking agent)."},"provider":{"type":"string","enum":["google","calendly","cal"],"nullable":true,"description":"The calendar the appointment belongs to."},"startsAt":{"type":"string","format":"date-time","description":"ISO-8601 start time of the appointment."},"endsAt":{"type":"string","format":"date-time","nullable":true,"description":"ISO-8601 end time of the appointment."},"agentId":{"type":"integer","nullable":true,"description":"ID of the AI agent that made the change. Null unless `source` is `agent`."},"sessionId":{"type":"integer","nullable":true,"description":"ID of the AI agent session the change happened in, the same `sessionId` the `agent.*` events carry. Null unless `source` is `agent`."}}},"timestamp":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of when the event occurred."},"webhookId":{"type":"string","format":"uuid","description":"The ID of the webhook endpoint that received this event."}}},"example":{"event":"appointment.no_show","data":{"appointmentId":5821,"contactUuids":["550e8400-e29b-41d4-a716-446655440000"],"source":"user","provider":"google","startsAt":"2026-11-03T15:00:00.000Z","endsAt":"2026-11-03T15:30:00.000Z","agentId":null,"sessionId":null},"timestamp":"2026-02-11T14:30:00.000Z","webhookId":"550e8400-e29b-41d4-a716-446655440000"}}}},"responses":{"200":{"description":"Your server should return a 2xx status to acknowledge receipt."}}}},"agentSession_started":{"post":{"summary":"AI Agent Session Started","description":"Fired when an AI agent starts a conversation with a contact. `reasonCode`, `reason` and `outcome` are null at this point. Test conversations in the agent builder do not fire this event.","operationId":"webhook_agent_session_started","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["event","data","timestamp","webhookId"],"properties":{"event":{"type":"string","enum":["agent.session_started"],"description":"The event type that triggered this webhook."},"data":{"type":"object","required":["sessionId","agentId","agentName","conversationId","turnNumber","status","contact","reasonCode","reason","outcome","qualification"],"properties":{"sessionId":{"type":"integer","description":"ID of the agent session. One session is one conversation an agent has with one contact."},"agentId":{"type":"integer","description":"ID of the AI agent."},"agentName":{"type":"string","nullable":true,"description":"Name of the AI agent."},"conversationId":{"type":"integer","description":"ID of the conversation the session runs in."},"turnNumber":{"type":"integer","description":"Number of turns the agent has taken in this session. 0 when the session just started."},"status":{"type":"string","enum":["active","paused_by_user","paused_no_credits","completed","escalated","max_turns","expired","superseded"],"description":"Status of the session at the time of the event."},"contact":{"type":"object","required":["uuid","firstName","lastName","phone"],"description":"The contact the agent is talking to.","properties":{"uuid":{"type":"string","format":"uuid","description":"Unique contact identifier. Use this in all API calls."},"firstName":{"type":"string","nullable":true},"lastName":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true,"description":"Contact phone number in E.164 format."}}},"reasonCode":{"type":"string","nullable":true,"enum":["agent_escalated","review_needed","no_availability","follow_ups_exhausted","rate_limited","max_turns","opted_out","idle","superseded","completed",null],"description":"Why the session was escalated or ended. Null while the session is running (`agent.session_started`, `agent.lead_qualified`). See the webhook guide for what each value means."},"reason":{"type":"string","nullable":true,"description":"A short explanation of why the conversation needs your attention, when there is one."},"outcome":{"type":"object","nullable":true,"required":["id","label"],"description":"The outcome the agent recorded for the session, from the outcomes set up on the agent. Null when no outcome was recorded.","properties":{"id":{"type":"string","description":"Identifier of the outcome."},"label":{"type":"string","description":"Name of the outcome."}}},"qualification":{"type":"object","nullable":true,"required":["result","answers"],"description":"What the agent learned from its qualifying questions. Null for agents that don't ask qualifying questions.","properties":{"result":{"type":"string","enum":["pending","qualified","review"],"description":"`pending` while questions are still open, `qualified` when the lead met your rules, `review` when the answers need a person to decide."},"answers":{"type":"array","description":"One entry per qualifying question the agent has recorded.","items":{"type":"object","required":["questionId","question","answer","qualified"],"properties":{"questionId":{"type":"string","description":"Identifier of the question on the agent."},"question":{"type":"string","description":"The question text."},"answer":{"type":"string","nullable":true,"description":"The contact's answer. Null when not answered yet."},"qualified":{"type":"boolean","nullable":true,"description":"Whether the answer met the question's rule. Null when the answer was not checked against a rule."}}}}}}}},"timestamp":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of when the event occurred."},"webhookId":{"type":"string","format":"uuid","description":"The ID of the webhook endpoint that received this event."}}},"example":{"event":"agent.session_started","data":{"sessionId":9042,"agentId":17,"agentName":"Inbound Booking Agent","conversationId":10293,"turnNumber":0,"status":"active","contact":{"uuid":"550e8400-e29b-41d4-a716-446655440000","firstName":"Sam","lastName":"Rivera","phone":"+15559876543"},"reasonCode":null,"reason":null,"outcome":null,"qualification":null},"timestamp":"2026-02-11T14:30:00.000Z","webhookId":"550e8400-e29b-41d4-a716-446655440000"}}}},"responses":{"200":{"description":"Your server should return a 2xx status to acknowledge receipt."}}}},"agentLead_qualified":{"post":{"summary":"AI Agent Lead Qualified","description":"Fired when a contact's answers meet the agent's qualifying rules. `qualification.result` is `qualified` and `qualification.answers` holds each question and answer. The session is usually still running, so `agent.session_ended` follows later.","operationId":"webhook_agent_lead_qualified","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["event","data","timestamp","webhookId"],"properties":{"event":{"type":"string","enum":["agent.lead_qualified"],"description":"The event type that triggered this webhook."},"data":{"type":"object","required":["sessionId","agentId","agentName","conversationId","turnNumber","status","contact","reasonCode","reason","outcome","qualification"],"properties":{"sessionId":{"type":"integer","description":"ID of the agent session. One session is one conversation an agent has with one contact."},"agentId":{"type":"integer","description":"ID of the AI agent."},"agentName":{"type":"string","nullable":true,"description":"Name of the AI agent."},"conversationId":{"type":"integer","description":"ID of the conversation the session runs in."},"turnNumber":{"type":"integer","description":"Number of turns the agent has taken in this session. 0 when the session just started."},"status":{"type":"string","enum":["active","paused_by_user","paused_no_credits","completed","escalated","max_turns","expired","superseded"],"description":"Status of the session at the time of the event."},"contact":{"type":"object","required":["uuid","firstName","lastName","phone"],"description":"The contact the agent is talking to.","properties":{"uuid":{"type":"string","format":"uuid","description":"Unique contact identifier. Use this in all API calls."},"firstName":{"type":"string","nullable":true},"lastName":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true,"description":"Contact phone number in E.164 format."}}},"reasonCode":{"type":"string","nullable":true,"enum":["agent_escalated","review_needed","no_availability","follow_ups_exhausted","rate_limited","max_turns","opted_out","idle","superseded","completed",null],"description":"Why the session was escalated or ended. Null while the session is running (`agent.session_started`, `agent.lead_qualified`). See the webhook guide for what each value means."},"reason":{"type":"string","nullable":true,"description":"A short explanation of why the conversation needs your attention, when there is one."},"outcome":{"type":"object","nullable":true,"required":["id","label"],"description":"The outcome the agent recorded for the session, from the outcomes set up on the agent. Null when no outcome was recorded.","properties":{"id":{"type":"string","description":"Identifier of the outcome."},"label":{"type":"string","description":"Name of the outcome."}}},"qualification":{"type":"object","nullable":true,"required":["result","answers"],"description":"What the agent learned from its qualifying questions. Null for agents that don't ask qualifying questions.","properties":{"result":{"type":"string","enum":["pending","qualified","review"],"description":"`pending` while questions are still open, `qualified` when the lead met your rules, `review` when the answers need a person to decide."},"answers":{"type":"array","description":"One entry per qualifying question the agent has recorded.","items":{"type":"object","required":["questionId","question","answer","qualified"],"properties":{"questionId":{"type":"string","description":"Identifier of the question on the agent."},"question":{"type":"string","description":"The question text."},"answer":{"type":"string","nullable":true,"description":"The contact's answer. Null when not answered yet."},"qualified":{"type":"boolean","nullable":true,"description":"Whether the answer met the question's rule. Null when the answer was not checked against a rule."}}}}}}}},"timestamp":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of when the event occurred."},"webhookId":{"type":"string","format":"uuid","description":"The ID of the webhook endpoint that received this event."}}},"example":{"event":"agent.lead_qualified","data":{"sessionId":9042,"agentId":17,"agentName":"Inbound Booking Agent","conversationId":10293,"turnNumber":4,"status":"active","contact":{"uuid":"550e8400-e29b-41d4-a716-446655440000","firstName":"Sam","lastName":"Rivera","phone":"+15559876543"},"reasonCode":null,"reason":null,"outcome":null,"qualification":{"result":"qualified","answers":[{"questionId":"budget","question":"What is your monthly budget?","answer":"Around $2,000","qualified":true},{"questionId":"timeline","question":"When are you looking to start?","answer":"Within the next month","qualified":true}]}},"timestamp":"2026-02-11T14:30:00.000Z","webhookId":"550e8400-e29b-41d4-a716-446655440000"}}}},"responses":{"200":{"description":"Your server should return a 2xx status to acknowledge receipt."}}}},"agentEscalated":{"post":{"summary":"AI Agent Escalated","description":"Fired when an AI agent hands the conversation to a person. `reasonCode` says why and `reason` carries a short explanation when there is one. The session also ends at this point, so an `agent.session_ended` event is delivered for the same session.","operationId":"webhook_agent_escalated","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["event","data","timestamp","webhookId"],"properties":{"event":{"type":"string","enum":["agent.escalated"],"description":"The event type that triggered this webhook."},"data":{"type":"object","required":["sessionId","agentId","agentName","conversationId","turnNumber","status","contact","reasonCode","reason","outcome","qualification"],"properties":{"sessionId":{"type":"integer","description":"ID of the agent session. One session is one conversation an agent has with one contact."},"agentId":{"type":"integer","description":"ID of the AI agent."},"agentName":{"type":"string","nullable":true,"description":"Name of the AI agent."},"conversationId":{"type":"integer","description":"ID of the conversation the session runs in."},"turnNumber":{"type":"integer","description":"Number of turns the agent has taken in this session. 0 when the session just started."},"status":{"type":"string","enum":["active","paused_by_user","paused_no_credits","completed","escalated","max_turns","expired","superseded"],"description":"Status of the session at the time of the event."},"contact":{"type":"object","required":["uuid","firstName","lastName","phone"],"description":"The contact the agent is talking to.","properties":{"uuid":{"type":"string","format":"uuid","description":"Unique contact identifier. Use this in all API calls."},"firstName":{"type":"string","nullable":true},"lastName":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true,"description":"Contact phone number in E.164 format."}}},"reasonCode":{"type":"string","nullable":true,"enum":["agent_escalated","review_needed","no_availability","follow_ups_exhausted","rate_limited","max_turns","opted_out","idle","superseded","completed",null],"description":"Why the session was escalated or ended. Null while the session is running (`agent.session_started`, `agent.lead_qualified`). See the webhook guide for what each value means."},"reason":{"type":"string","nullable":true,"description":"A short explanation of why the conversation needs your attention, when there is one."},"outcome":{"type":"object","nullable":true,"required":["id","label"],"description":"The outcome the agent recorded for the session, from the outcomes set up on the agent. Null when no outcome was recorded.","properties":{"id":{"type":"string","description":"Identifier of the outcome."},"label":{"type":"string","description":"Name of the outcome."}}},"qualification":{"type":"object","nullable":true,"required":["result","answers"],"description":"What the agent learned from its qualifying questions. Null for agents that don't ask qualifying questions.","properties":{"result":{"type":"string","enum":["pending","qualified","review"],"description":"`pending` while questions are still open, `qualified` when the lead met your rules, `review` when the answers need a person to decide."},"answers":{"type":"array","description":"One entry per qualifying question the agent has recorded.","items":{"type":"object","required":["questionId","question","answer","qualified"],"properties":{"questionId":{"type":"string","description":"Identifier of the question on the agent."},"question":{"type":"string","description":"The question text."},"answer":{"type":"string","nullable":true,"description":"The contact's answer. Null when not answered yet."},"qualified":{"type":"boolean","nullable":true,"description":"Whether the answer met the question's rule. Null when the answer was not checked against a rule."}}}}}}}},"timestamp":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of when the event occurred."},"webhookId":{"type":"string","format":"uuid","description":"The ID of the webhook endpoint that received this event."}}},"example":{"event":"agent.escalated","data":{"sessionId":9042,"agentId":17,"agentName":"Inbound Booking Agent","conversationId":10293,"turnNumber":3,"status":"escalated","contact":{"uuid":"550e8400-e29b-41d4-a716-446655440000","firstName":"Sam","lastName":"Rivera","phone":"+15559876543"},"reasonCode":"agent_escalated","reason":"The contact asked to speak with a person about pricing.","outcome":null,"qualification":null},"timestamp":"2026-02-11T14:30:00.000Z","webhookId":"550e8400-e29b-41d4-a716-446655440000"}}}},"responses":{"200":{"description":"Your server should return a 2xx status to acknowledge receipt."}}}},"agentSession_ended":{"post":{"summary":"AI Agent Session Ended","description":"Fired when an AI agent session ends for any reason: it reached an outcome, was escalated, the contact stopped replying or opted out, or something else took over the conversation. `status` and `reasonCode` say which.","operationId":"webhook_agent_session_ended","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["event","data","timestamp","webhookId"],"properties":{"event":{"type":"string","enum":["agent.session_ended"],"description":"The event type that triggered this webhook."},"data":{"type":"object","required":["sessionId","agentId","agentName","conversationId","turnNumber","status","contact","reasonCode","reason","outcome","qualification"],"properties":{"sessionId":{"type":"integer","description":"ID of the agent session. One session is one conversation an agent has with one contact."},"agentId":{"type":"integer","description":"ID of the AI agent."},"agentName":{"type":"string","nullable":true,"description":"Name of the AI agent."},"conversationId":{"type":"integer","description":"ID of the conversation the session runs in."},"turnNumber":{"type":"integer","description":"Number of turns the agent has taken in this session. 0 when the session just started."},"status":{"type":"string","enum":["active","paused_by_user","paused_no_credits","completed","escalated","max_turns","expired","superseded"],"description":"Status of the session at the time of the event."},"contact":{"type":"object","required":["uuid","firstName","lastName","phone"],"description":"The contact the agent is talking to.","properties":{"uuid":{"type":"string","format":"uuid","description":"Unique contact identifier. Use this in all API calls."},"firstName":{"type":"string","nullable":true},"lastName":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true,"description":"Contact phone number in E.164 format."}}},"reasonCode":{"type":"string","nullable":true,"enum":["agent_escalated","review_needed","no_availability","follow_ups_exhausted","rate_limited","max_turns","opted_out","idle","superseded","completed",null],"description":"Why the session was escalated or ended. Null while the session is running (`agent.session_started`, `agent.lead_qualified`). See the webhook guide for what each value means."},"reason":{"type":"string","nullable":true,"description":"A short explanation of why the conversation needs your attention, when there is one."},"outcome":{"type":"object","nullable":true,"required":["id","label"],"description":"The outcome the agent recorded for the session, from the outcomes set up on the agent. Null when no outcome was recorded.","properties":{"id":{"type":"string","description":"Identifier of the outcome."},"label":{"type":"string","description":"Name of the outcome."}}},"qualification":{"type":"object","nullable":true,"required":["result","answers"],"description":"What the agent learned from its qualifying questions. Null for agents that don't ask qualifying questions.","properties":{"result":{"type":"string","enum":["pending","qualified","review"],"description":"`pending` while questions are still open, `qualified` when the lead met your rules, `review` when the answers need a person to decide."},"answers":{"type":"array","description":"One entry per qualifying question the agent has recorded.","items":{"type":"object","required":["questionId","question","answer","qualified"],"properties":{"questionId":{"type":"string","description":"Identifier of the question on the agent."},"question":{"type":"string","description":"The question text."},"answer":{"type":"string","nullable":true,"description":"The contact's answer. Null when not answered yet."},"qualified":{"type":"boolean","nullable":true,"description":"Whether the answer met the question's rule. Null when the answer was not checked against a rule."}}}}}}}},"timestamp":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of when the event occurred."},"webhookId":{"type":"string","format":"uuid","description":"The ID of the webhook endpoint that received this event."}}},"example":{"event":"agent.session_ended","data":{"sessionId":9042,"agentId":17,"agentName":"Inbound Booking Agent","conversationId":10293,"turnNumber":6,"status":"completed","contact":{"uuid":"550e8400-e29b-41d4-a716-446655440000","firstName":"Sam","lastName":"Rivera","phone":"+15559876543"},"reasonCode":"completed","reason":null,"outcome":{"id":"booked","label":"Appointment booked"},"qualification":{"result":"qualified","answers":[{"questionId":"budget","question":"What is your monthly budget?","answer":"Around $2,000","qualified":true},{"questionId":"timeline","question":"When are you looking to start?","answer":"Within the next month","qualified":true}]}},"timestamp":"2026-02-11T14:30:00.000Z","webhookId":"550e8400-e29b-41d4-a716-446655440000"}}}},"responses":{"200":{"description":"Your server should return a 2xx status to acknowledge receipt."}}}},"async_operationCreated":{"post":{"summary":"Async Operation Created","description":"Fired when a long-running operation is created (e.g. bulk delete, import). Use the operationId to poll for progress via the Async Operations API.","operationId":"webhook_async_operation_created","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["event","data","timestamp","webhookId"],"properties":{"event":{"type":"string","enum":["async_operation.created"],"description":"The event type that triggered this webhook."},"data":{"type":"object","required":["operationId","operationType","entityType","count"],"properties":{"operationId":{"type":"string","description":"Unique identifier for the async operation."},"operationType":{"type":"string","description":"The type of operation (e.g. bulk_delete, import)."},"entityType":{"type":"string","description":"The entity type being operated on (e.g. contact, tag)."},"count":{"type":"integer","description":"Number of entities affected by the operation."}}},"timestamp":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of when the event occurred."},"webhookId":{"type":"string","format":"uuid","description":"The ID of the webhook endpoint that received this event."}}},"example":{"event":"async_operation.created","data":{"operationId":"op_abc123","operationType":"bulk_delete","entityType":"contact","count":1500},"timestamp":"2026-02-11T14:30:00.000Z","webhookId":"550e8400-e29b-41d4-a716-446655440000"}}}},"responses":{"200":{"description":"Your server should return a 2xx status to acknowledge receipt."}}}},"scrubStarted":{"post":{"summary":"Scrub Started","description":"Fired when a phone scrub starts checking numbers: its contacts are gathered and the verification credits charged. Also fired when a retry of a finished scrub is queued. A scrub that ends before it starts sends only `scrub.failed`. The envelope `timestamp` is the time the scrub started.","operationId":"webhook_scrub_started","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["event","data","timestamp","webhookId"],"properties":{"event":{"type":"string","enum":["scrub.started"],"description":"The event type that triggered this webhook."},"data":{"type":"object","required":["id","status","failureCode","autoRemoveBadLines","counts","credits","createdAt","completedAt"],"properties":{"id":{"type":"string","format":"uuid","description":"The scrub id."},"status":{"type":"string","enum":["pending","in_progress","completed","failed"]},"failureCode":{"type":"string","enum":["stopped","worker_lost","insufficient_credits","spend_cap_reached","no_contacts","error"],"nullable":true,"description":"Why the scrub failed. `null` unless `status` is `failed`."},"autoRemoveBadLines":{"type":"boolean","description":"Whether the scrub removes automatically the contacts whose number is a landline, a VoIP line or a number with no line."},"counts":{"type":"object","required":["total","processed","lineTypes","doNotCall","lists","failed","removed"],"properties":{"total":{"type":"integer","minimum":0,"description":"Contacts in the scrub. Exact once the scrub has started. A `scrub.failed` sent before the scrub started (stopped while pending, not enough credits, spending limit reached) carries the estimate made when it was submitted."},"processed":{"type":"integer","minimum":0,"description":"Contacts that have a result or a failure so far."},"lineTypes":{"type":"object","required":["mobile","landline","voip","unknown"],"properties":{"mobile":{"type":"integer","minimum":0},"landline":{"type":"integer","minimum":0},"voip":{"type":"integer","minimum":0},"unknown":{"type":"integer","minimum":0,"description":"Numbers with no line, and numbers whose line type could not be determined. With `autoRemoveBadLines` on, the contacts with no line are removed and the undetermined ones are kept."}}},"doNotCall":{"type":"object","required":["clean","flagged","unknown"],"description":"Each checked contact counts in exactly one of `clean`, `flagged` and `unknown`.","properties":{"clean":{"type":"integer","minimum":0,"description":"Contacts found on no do-not-call or litigator list."},"flagged":{"type":"integer","minimum":0,"description":"Contacts found on a do-not-call or litigator list."},"unknown":{"type":"integer","minimum":0,"description":"Contacts whose list check gave no answer."}}},"lists":{"type":"object","nullable":true,"additionalProperties":{"type":"integer","minimum":0},"description":"Contacts matched per list. The keys are `tcpa`, `troll`, `dnc_complainers`, `federal_dnc`, `state_dnc`, `nra` and `other`; only lists with at least one match appear. A contact on two lists counts in both. `null` for scrubs that ran before per-list results were recorded."},"failed":{"type":"integer","minimum":0,"description":"Contacts that could not be checked. Retry the scrub to check them."},"removed":{"type":"integer","minimum":0,"description":"Contacts the scrub removed automatically."}}},"credits":{"type":"object","required":["charged","returned"],"properties":{"charged":{"type":"integer","minimum":0,"description":"Verification credits charged."},"returned":{"type":"integer","minimum":0,"description":"Verification credits returned for numbers that were not checked."}}},"createdAt":{"type":"string","format":"date-time"},"completedAt":{"type":"string","format":"date-time","nullable":true,"description":"Set only when `status` is `completed`."}}},"timestamp":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of when the event occurred."},"webhookId":{"type":"string","format":"uuid","description":"The ID of the webhook endpoint that received this event."}}},"example":{"event":"scrub.started","data":{"id":"0b7f6c1e-5d1c-4a55-9f0e-3c2a7d9e4b10","status":"in_progress","failureCode":null,"autoRemoveBadLines":true,"counts":{"total":1500,"processed":0,"lineTypes":{"mobile":0,"landline":0,"voip":0,"unknown":0},"doNotCall":{"clean":0,"flagged":0,"unknown":0},"lists":null,"failed":0,"removed":0},"credits":{"charged":1380,"returned":0},"createdAt":"2026-11-17T15:01:48.000Z","completedAt":null},"timestamp":"2026-11-17T15:02:11.398Z","webhookId":"550e8400-e29b-41d4-a716-446655440000"}}}},"responses":{"200":{"description":"Your server should return a 2xx status to acknowledge receipt."}}}},"scrubCompleted":{"post":{"summary":"Scrub Completed","description":"Fired when a phone scrub has checked every number. The envelope `timestamp` is the time the scrub completed.","operationId":"webhook_scrub_completed","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["event","data","timestamp","webhookId"],"properties":{"event":{"type":"string","enum":["scrub.completed"],"description":"The event type that triggered this webhook."},"data":{"type":"object","required":["id","status","failureCode","autoRemoveBadLines","counts","credits","createdAt","completedAt"],"properties":{"id":{"type":"string","format":"uuid","description":"The scrub id."},"status":{"type":"string","enum":["pending","in_progress","completed","failed"]},"failureCode":{"type":"string","enum":["stopped","worker_lost","insufficient_credits","spend_cap_reached","no_contacts","error"],"nullable":true,"description":"Why the scrub failed. `null` unless `status` is `failed`."},"autoRemoveBadLines":{"type":"boolean","description":"Whether the scrub removes automatically the contacts whose number is a landline, a VoIP line or a number with no line."},"counts":{"type":"object","required":["total","processed","lineTypes","doNotCall","lists","failed","removed"],"properties":{"total":{"type":"integer","minimum":0,"description":"Contacts in the scrub. Exact once the scrub has started. A `scrub.failed` sent before the scrub started (stopped while pending, not enough credits, spending limit reached) carries the estimate made when it was submitted."},"processed":{"type":"integer","minimum":0,"description":"Contacts that have a result or a failure so far."},"lineTypes":{"type":"object","required":["mobile","landline","voip","unknown"],"properties":{"mobile":{"type":"integer","minimum":0},"landline":{"type":"integer","minimum":0},"voip":{"type":"integer","minimum":0},"unknown":{"type":"integer","minimum":0,"description":"Numbers with no line, and numbers whose line type could not be determined. With `autoRemoveBadLines` on, the contacts with no line are removed and the undetermined ones are kept."}}},"doNotCall":{"type":"object","required":["clean","flagged","unknown"],"description":"Each checked contact counts in exactly one of `clean`, `flagged` and `unknown`.","properties":{"clean":{"type":"integer","minimum":0,"description":"Contacts found on no do-not-call or litigator list."},"flagged":{"type":"integer","minimum":0,"description":"Contacts found on a do-not-call or litigator list."},"unknown":{"type":"integer","minimum":0,"description":"Contacts whose list check gave no answer."}}},"lists":{"type":"object","nullable":true,"additionalProperties":{"type":"integer","minimum":0},"description":"Contacts matched per list. The keys are `tcpa`, `troll`, `dnc_complainers`, `federal_dnc`, `state_dnc`, `nra` and `other`; only lists with at least one match appear. A contact on two lists counts in both. `null` for scrubs that ran before per-list results were recorded."},"failed":{"type":"integer","minimum":0,"description":"Contacts that could not be checked. Retry the scrub to check them."},"removed":{"type":"integer","minimum":0,"description":"Contacts the scrub removed automatically."}}},"credits":{"type":"object","required":["charged","returned"],"properties":{"charged":{"type":"integer","minimum":0,"description":"Verification credits charged."},"returned":{"type":"integer","minimum":0,"description":"Verification credits returned for numbers that were not checked."}}},"createdAt":{"type":"string","format":"date-time"},"completedAt":{"type":"string","format":"date-time","nullable":true,"description":"Set only when `status` is `completed`."}}},"timestamp":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of when the event occurred."},"webhookId":{"type":"string","format":"uuid","description":"The ID of the webhook endpoint that received this event."}}},"example":{"event":"scrub.completed","data":{"id":"0b7f6c1e-5d1c-4a55-9f0e-3c2a7d9e4b10","status":"completed","failureCode":null,"autoRemoveBadLines":true,"counts":{"total":1500,"processed":1500,"lineTypes":{"mobile":1210,"landline":190,"voip":62,"unknown":26},"doNotCall":{"clean":1391,"flagged":97,"unknown":0},"lists":{"tcpa":12,"federal_dnc":81,"state_dnc":9},"failed":12,"removed":258},"credits":{"charged":1380,"returned":12},"createdAt":"2026-11-17T15:01:48.000Z","completedAt":"2026-11-17T15:09:40.101Z"},"timestamp":"2026-11-17T15:09:40.101Z","webhookId":"550e8400-e29b-41d4-a716-446655440000"}}}},"responses":{"200":{"description":"Your server should return a 2xx status to acknowledge receipt."}}}},"scrubFailed":{"post":{"summary":"Scrub Failed","description":"Fired when a phone scrub ends without checking every number. `failureCode` says why: `stopped` (stopped by a user or an API call), `worker_lost` (the scrub stopped making progress and was closed), `insufficient_credits`, `spend_cap_reached` (the account spending limit refused the charge), `no_contacts` (the target matched no contacts with a phone number) or `error`. Numbers that were not checked count as `failed`, and the credits paid for them are returned. Retry the scrub to check them. The envelope `timestamp` is the time the scrub failed.","operationId":"webhook_scrub_failed","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["event","data","timestamp","webhookId"],"properties":{"event":{"type":"string","enum":["scrub.failed"],"description":"The event type that triggered this webhook."},"data":{"type":"object","required":["id","status","failureCode","autoRemoveBadLines","counts","credits","createdAt","completedAt"],"properties":{"id":{"type":"string","format":"uuid","description":"The scrub id."},"status":{"type":"string","enum":["pending","in_progress","completed","failed"]},"failureCode":{"type":"string","enum":["stopped","worker_lost","insufficient_credits","spend_cap_reached","no_contacts","error"],"nullable":true,"description":"Why the scrub failed. `null` unless `status` is `failed`."},"autoRemoveBadLines":{"type":"boolean","description":"Whether the scrub removes automatically the contacts whose number is a landline, a VoIP line or a number with no line."},"counts":{"type":"object","required":["total","processed","lineTypes","doNotCall","lists","failed","removed"],"properties":{"total":{"type":"integer","minimum":0,"description":"Contacts in the scrub. Exact once the scrub has started. A `scrub.failed` sent before the scrub started (stopped while pending, not enough credits, spending limit reached) carries the estimate made when it was submitted."},"processed":{"type":"integer","minimum":0,"description":"Contacts that have a result or a failure so far."},"lineTypes":{"type":"object","required":["mobile","landline","voip","unknown"],"properties":{"mobile":{"type":"integer","minimum":0},"landline":{"type":"integer","minimum":0},"voip":{"type":"integer","minimum":0},"unknown":{"type":"integer","minimum":0,"description":"Numbers with no line, and numbers whose line type could not be determined. With `autoRemoveBadLines` on, the contacts with no line are removed and the undetermined ones are kept."}}},"doNotCall":{"type":"object","required":["clean","flagged","unknown"],"description":"Each checked contact counts in exactly one of `clean`, `flagged` and `unknown`.","properties":{"clean":{"type":"integer","minimum":0,"description":"Contacts found on no do-not-call or litigator list."},"flagged":{"type":"integer","minimum":0,"description":"Contacts found on a do-not-call or litigator list."},"unknown":{"type":"integer","minimum":0,"description":"Contacts whose list check gave no answer."}}},"lists":{"type":"object","nullable":true,"additionalProperties":{"type":"integer","minimum":0},"description":"Contacts matched per list. The keys are `tcpa`, `troll`, `dnc_complainers`, `federal_dnc`, `state_dnc`, `nra` and `other`; only lists with at least one match appear. A contact on two lists counts in both. `null` for scrubs that ran before per-list results were recorded."},"failed":{"type":"integer","minimum":0,"description":"Contacts that could not be checked. Retry the scrub to check them."},"removed":{"type":"integer","minimum":0,"description":"Contacts the scrub removed automatically."}}},"credits":{"type":"object","required":["charged","returned"],"properties":{"charged":{"type":"integer","minimum":0,"description":"Verification credits charged."},"returned":{"type":"integer","minimum":0,"description":"Verification credits returned for numbers that were not checked."}}},"createdAt":{"type":"string","format":"date-time"},"completedAt":{"type":"string","format":"date-time","nullable":true,"description":"Set only when `status` is `completed`."}}},"timestamp":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of when the event occurred."},"webhookId":{"type":"string","format":"uuid","description":"The ID of the webhook endpoint that received this event."}}},"example":{"event":"scrub.failed","data":{"id":"0b7f6c1e-5d1c-4a55-9f0e-3c2a7d9e4b10","status":"failed","failureCode":"stopped","autoRemoveBadLines":true,"counts":{"total":1500,"processed":1500,"lineTypes":{"mobile":410,"landline":61,"voip":22,"unknown":7},"doNotCall":{"clean":468,"flagged":32,"unknown":0},"lists":{"tcpa":4,"federal_dnc":28},"failed":1000,"removed":85},"credits":{"charged":1380,"returned":920},"createdAt":"2026-11-17T15:01:48.000Z","completedAt":null},"timestamp":"2026-11-17T15:05:02.640Z","webhookId":"550e8400-e29b-41d4-a716-446655440000"}}}},"responses":{"200":{"description":"Your server should return a 2xx status to acknowledge receipt."}}}}}}