{"swagger":"2.0","info":{"description":"Referencia de la API REST de CRM - Agente con IA. Las guías de uso están en /docs.","version":"1.0.0","title":"API de CRM - Agente con IA","x-logo":{"url":"https://crm.chatsell.net/brand-assets/logo_thumbnail.svg","altText":"CRM - Agente con IA","href":"/docs"},"contact":{"name":"CRM - Agente con IA","url":"https://crm.chatsell.net"}},"host":"crm.chatsell.net","basePath":"/","schemes":["https"],"produces":["application/json; charset=utf-8"],"consumes":["application/json; charset=utf-8"],"securityDefinitions":{"userApiKey":{"type":"apiKey","in":"header","name":"api_access_token","description":"This token can be obtained by visiting the profile page or via rails console. Provides access to  endpoints based on the user permissions levels. This token can be saved by an external system when user is created via API, to perform activities on behalf of the user."},"agentBotApiKey":{"type":"apiKey","in":"header","name":"api_access_token","description":"This token should be provided by system admin or obtained via rails console. This token can be used to build bot integrations and can only access limited apis."}},"security":[{"userApiKey":[]}],"paths":{"/public/api/v1/inboxes/{inbox_identifier}":{"parameters":[{"$ref":"#/parameters/public_inbox_identifier"}],"get":{"tags":["Inbox API"],"operationId":"get-details-of-a-inbox","summary":"Inbox details","description":"Get the details of an inbox","security":[],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/public_inbox"}},"401":{"description":"Unauthorized"},"404":{"description":"The given inbox does not exist"}}}},"/public/api/v1/inboxes/{inbox_identifier}/contacts":{"parameters":[{"$ref":"#/parameters/public_inbox_identifier"}],"post":{"tags":["Contacts API"],"operationId":"create-a-contact","summary":"Create a contact","description":"Create a contact","security":[],"parameters":[{"name":"data","in":"body","required":true,"schema":{"$ref":"#/definitions/public_contact_create_update_payload"}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/public_contact"}},"401":{"description":"Unauthorized"}}}},"/public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}":{"parameters":[{"$ref":"#/parameters/public_inbox_identifier"},{"$ref":"#/parameters/public_contact_identifier"}],"get":{"tags":["Contacts API"],"operationId":"get-details-of-a-contact","summary":"Get a contact","description":"Get the details of a contact","security":[],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/public_contact"}},"401":{"description":"Unauthorized"},"404":{"description":"The given contact does not exist"}}},"patch":{"tags":["Contacts API"],"operationId":"update-a-contact","summary":"Update a contact","description":"Update a contact's attributes","security":[],"parameters":[{"name":"data","in":"body","required":true,"schema":{"$ref":"#/definitions/public_contact_create_update_payload"}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/public_contact"}},"401":{"description":"Unauthorized"}}}},"/public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations":{"parameters":[{"$ref":"#/parameters/public_inbox_identifier"},{"$ref":"#/parameters/public_contact_identifier"}],"post":{"tags":["Conversations API"],"operationId":"create-a-conversation","summary":"Create a conversation","description":"Create a conversation","security":[],"parameters":[{"name":"data","in":"body","required":true,"schema":{"$ref":"#/definitions/public_conversation_create_payload"}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/public_conversation"}},"401":{"description":"Unauthorized"}}},"get":{"tags":["Conversations API"],"operationId":"list-all-contact-conversations","summary":"List all conversations","description":"List all conversations for the contact","responses":{"200":{"description":"Success","schema":{"type":"array","description":"Array of conversations","items":{"$ref":"#/definitions/public_conversation"}}},"401":{"description":"Unauthorized"}}}},"/public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations/{conversation_id}":{"parameters":[{"$ref":"#/parameters/public_inbox_identifier"},{"$ref":"#/parameters/public_contact_identifier"},{"$ref":"#/parameters/conversation_id"}],"get":{"tags":["Conversations API"],"operationId":"get-single-conversation","summary":"Get a single conversation","description":"Retrieves the details of a specific conversation","responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/public_conversation"}},"401":{"description":"Unauthorized"},"404":{"description":"Conversation not found"}}}},"/public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations/{conversation_id}/toggle_status":{"parameters":[{"$ref":"#/parameters/public_inbox_identifier"},{"$ref":"#/parameters/public_contact_identifier"},{"$ref":"#/parameters/conversation_id"}],"post":{"tags":["Conversations API"],"operationId":"resolve-conversation","summary":"Resolve a conversation","description":"Marks a conversation as resolved","responses":{"200":{"description":"Conversation resolved successfully","schema":{"$ref":"#/definitions/public_conversation"}},"401":{"description":"Unauthorized"},"404":{"description":"Conversation not found"}}}},"/public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations/{conversation_id}/toggle_typing":{"parameters":[{"$ref":"#/parameters/public_inbox_identifier"},{"$ref":"#/parameters/public_contact_identifier"},{"$ref":"#/parameters/conversation_id"}],"post":{"tags":["Conversations API"],"operationId":"toggle-typing-status","summary":"Toggle typing status","description":"Toggles the typing status in a conversation","parameters":[{"name":"typing_status","in":"query","required":true,"type":"string","description":"Typing status, either 'on' or 'off'"}],"responses":{"200":{"description":"Typing status toggled successfully"},"401":{"description":"Unauthorized"},"404":{"description":"Conversation not found"}}}},"/public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations/{conversation_id}/update_last_seen":{"parameters":[{"$ref":"#/parameters/public_inbox_identifier"},{"$ref":"#/parameters/public_contact_identifier"},{"$ref":"#/parameters/conversation_id"}],"post":{"tags":["Conversations API"],"operationId":"update-last-seen","summary":"Update last seen","description":"Updates the last seen time of the contact in a conversation","responses":{"200":{"description":"Last seen updated successfully"},"401":{"description":"Unauthorized"},"404":{"description":"Conversation not found"}}}},"/public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations/{conversation_id}/messages":{"parameters":[{"$ref":"#/parameters/public_inbox_identifier"},{"$ref":"#/parameters/public_contact_identifier"},{"$ref":"#/parameters/conversation_id"}],"post":{"tags":["Messages API"],"operationId":"create-a-message","summary":"Create a message","description":"Create a message","security":[],"parameters":[{"name":"data","in":"body","required":true,"schema":{"$ref":"#/definitions/public_message_create_payload"}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/public_message"}},"401":{"description":"Unauthorized"}}},"get":{"tags":["Messages API"],"operationId":"list-all-converation-messages","summary":"List all messages","description":"List all messages in the conversation","responses":{"200":{"description":"Success","schema":{"type":"array","description":"Array of messages","items":{"$ref":"#/definitions/public_message"}}},"401":{"description":"Unauthorized"}}}},"/public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations/{conversation_id}/messages/{message_id}":{"parameters":[{"$ref":"#/parameters/public_inbox_identifier"},{"$ref":"#/parameters/public_contact_identifier"},{"$ref":"#/parameters/conversation_id"},{"$ref":"#/parameters/message_id"}],"patch":{"tags":["Messages API"],"operationId":"update-a-message","summary":"Update a message","description":"Update a message","security":[],"parameters":[{"name":"data","in":"body","required":true,"schema":{"$ref":"#/definitions/public_message_update_payload"}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/public_message"}},"401":{"description":"Unauthorized"}}}},"/api/v1/accounts/{account_id}/contacts/{contact_identifier}/labels":{"parameters":[{"$ref":"#/parameters/account_id"},{"$ref":"#/parameters/public_contact_identifier"}],"get":{"tags":["Contact Labels"],"operationId":"list-all-labels-of-a-contact","summary":"List Labels","description":"Lists all the labels of a contact","responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/contact_labels"}},"404":{"description":"Contact not found"},"401":{"description":"Unauthorized"}}},"post":{"tags":["Contact Labels"],"operationId":"contact-add-labels","summary":"Add Labels","description":"Add labels to a contact. Note that this API would overwrite the existing list of labels associated to the conversation.","parameters":[{"name":"data","in":"body","required":true,"schema":{"type":"object","properties":{"labels":{"type":"array","description":"Array of labels (comma-separated strings)","items":{"type":"string"}}}}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/contact_labels"}},"404":{"description":"Contact not found"},"401":{"description":"Unauthorized"}}}},"/survey/responses/{conversation_uuid}":{"parameters":[{"$ref":"#/parameters/conversation_uuid"}],"get":{"tags":["CSAT Survey Page"],"operationId":"get-csat-survey-page","summary":"Get CSAT survey page","description":"You can redirect the client to this URL, instead of implementing the CSAT survey component yourself.","security":[],"responses":{"200":{"description":"Success"}}}},"/api/v1/accounts/{account_id}/agent_bots":{"parameters":[{"$ref":"#/parameters/account_id"}],"get":{"tags":["Account AgentBots"],"operationId":"list-all-account-agent-bots","summary":"List all AgentBots","description":"List all agent bots available for the current account","responses":{"200":{"description":"Success","schema":{"type":"array","description":"Array of agent bots","items":{"$ref":"#/definitions/agent_bot"}}},"401":{"description":"Unauthorized"}}},"post":{"tags":["Account AgentBots"],"operationId":"create-an-account-agent-bot","summary":"Create an Agent Bot","description":"Create an agent bot in the account","parameters":[{"$ref":"#/parameters/account_id"},{"name":"data","in":"body","required":true,"schema":{"$ref":"#/definitions/agent_bot_create_update_payload"}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/agent_bot"}},"401":{"description":"Unauthorized"}}}},"/api/v1/accounts/{account_id}/agent_bots/{id}":{"parameters":[{"$ref":"#/parameters/account_id"},{"$ref":"#/parameters/agent_bot_id"}],"get":{"tags":["Account AgentBots"],"operationId":"get-details-of-a-single-account-agent-bot","summary":"Get an agent bot details","description":"Get the details of an agent bot in the account","responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/agent_bot"}},"401":{"description":"Unauthorized"},"404":{"description":"The given agent bot ID does not exist in the account"}}},"patch":{"tags":["Account AgentBots"],"operationId":"update-an-account-agent-bot","summary":"Update an agent bot","description":"Update an agent bot's attributes","parameters":[{"name":"data","in":"body","required":true,"schema":{"$ref":"#/definitions/agent_bot_create_update_payload"}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/agent_bot"}},"401":{"description":"Unauthorized"}}},"delete":{"tags":["Account AgentBots"],"operationId":"delete-an-account-agent-bot","summary":"Delete an AgentBot","description":"Delete an AgentBot from the account","responses":{"200":{"description":"Success"},"401":{"description":"Unauthorized"},"404":{"description":"The agent bot does not exist in the account"}}}},"/api/v1/accounts/{account_id}/agents":{"parameters":[{"$ref":"#/parameters/account_id"}],"get":{"tags":["Agents"],"operationId":"get-account-agents","summary":"List Agents in Account","description":"Get Details of Agents in an Account","security":[{"userApiKey":[]}],"responses":{"200":{"description":"Success","schema":{"type":"array","description":"Array of all active agents","items":{"$ref":"#/definitions/agent"}}},"403":{"description":"Access denied"}}},"post":{"tags":["Agents"],"operationId":"add-new-agent-to-account","summary":"Add a New Agent","description":"Add a new Agent to Account","security":[{"userApiKey":[]}],"parameters":[{"name":"data","in":"body","required":true,"schema":{"type":"object","required":["name","email","role"],"properties":{"name":{"type":"string","description":"Full Name of the agent"},"email":{"type":"string","description":"Email of the Agent"},"role":{"type":"string","enum":["agent","administrator"],"description":"Whether its administrator or agent"},"availability_status":{"type":"string","enum":["available","busy","offline"],"description":"The availability setting of the agent."},"auto_offline":{"type":"boolean","description":"Whether the availability status of agent is configured to go offline automatically when away."}}}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/agent"}},"403":{"description":"Access denied"}}}},"/api/v1/accounts/{account_id}/agents/{id}":{"parameters":[{"$ref":"#/parameters/account_id"}],"patch":{"tags":["Agents"],"operationId":"update-agent-in-account","summary":"Update Agent in Account","description":"Update an Agent in Account","security":[{"userApiKey":[]}],"parameters":[{"in":"path","name":"id","type":"integer","required":true,"description":"The ID of the agent to be updated."},{"name":"data","in":"body","required":true,"schema":{"type":"object","required":["role"],"properties":{"role":{"type":"string","enum":["agent","administrator"],"description":"Whether its administrator or agent"},"availability":{"type":"string","enum":["available","busy","offline"],"description":"The availability setting of the agent."},"auto_offline":{"type":"boolean","description":"Whether the availability status of agent is configured to go offline automatically when away."}}}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/agent"}},"404":{"description":"Agent not found"},"403":{"description":"Access denied"}}},"delete":{"tags":["Agents"],"operationId":"delete-agent-from-account","summary":"Remove an Agent from Account","description":"Remove an Agent from Account","security":[{"userApiKey":[]}],"parameters":[{"in":"path","name":"id","type":"integer","required":true,"description":"The ID of the agent to be deleted"}],"responses":{"200":{"description":"Success"},"404":{"description":"Agent not found"},"403":{"description":"Access denied"}}}},"/api/v1/accounts/{account_id}/canned_responses":{"parameters":[{"$ref":"#/parameters/account_id"}],"get":{"tags":["Canned Responses"],"operationId":"get-account-canned-response","summary":"List all Canned Responses in an Account","description":"Get Details of Canned Responses in an Account","security":[{"userApiKey":[]}],"responses":{"200":{"description":"Success","schema":{"type":"array","description":"Array of all canned responses","items":{"$ref":"#/definitions/canned_response"}}},"403":{"description":"Access denied"}}},"post":{"tags":["Canned Responses"],"operationId":"add-new-canned-response-to-account","summary":"Add a New Canned Response","description":"Add a new Canned Response to Account","security":[{"userApiKey":[]}],"parameters":[{"name":"data","in":"body","required":true,"schema":{"$ref":"#/definitions/canned_response_create_update_payload"}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/canned_response"}},"403":{"description":"Access denied"}}}},"/api/v1/accounts/{account_id}/canned_responses/{id}":{"parameters":[{"$ref":"#/parameters/account_id"}],"patch":{"tags":["Canned Responses"],"operationId":"update-canned-response-in-account","summary":"Update Canned Response in Account","description":"Update a Canned Response in Account","security":[{"userApiKey":[]}],"parameters":[{"in":"path","name":"id","type":"integer","required":true,"description":"The ID of the canned response to be updated."},{"name":"data","in":"body","required":true,"schema":{"$ref":"#/definitions/canned_response_create_update_payload"}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/canned_response"}},"404":{"description":"Agent not found"},"403":{"description":"Access denied"}}},"delete":{"tags":["Canned Responses"],"operationId":"delete-canned-response-from-account","summary":"Remove a Canned Response from Account","description":"Remove a Canned Response from Account","security":[{"userApiKey":[]}],"parameters":[{"in":"path","name":"id","type":"integer","required":true,"description":"The ID of the canned response to be deleted"}],"responses":{"200":{"description":"Success"},"404":{"description":"Canned Response not found"},"403":{"description":"Access denied"}}}},"/api/v1/accounts/{account_id}/custom_attribute_definitions":{"parameters":[{"$ref":"#/parameters/account_id"}],"get":{"tags":["Custom Attributes"],"operationId":"get-account-custom-attribute","summary":"List all custom attributes in an account","parameters":[{"name":"attribute_model","in":"query","type":"string","enum":["0","1"],"description":"conversation_attribute(0)/contact_attribute(1)","required":true}],"description":"Get details of custom attributes in an Account","security":[{"userApiKey":[]}],"responses":{"200":{"description":"Success","schema":{"type":"array","description":"Array of all custom attributes","items":{"$ref":"#/definitions/custom_attribute"}}},"403":{"description":"Access denied"}}},"post":{"tags":["Custom Attributes"],"operationId":"add-new-custom-attribute-to-account","summary":"Add a new custom attribute","description":"Add a new custom attribute to account","security":[{"userApiKey":[]}],"parameters":[{"name":"data","in":"body","required":true,"schema":{"$ref":"#/definitions/custom_attribute_create_update_payload"}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/custom_attribute"}},"403":{"description":"Access denied"}}}},"/api/v1/accounts/{account_id}/custom_attribute_definitions/{id}":{"parameters":[{"$ref":"#/parameters/account_id"},{"name":"id","in":"path","type":"number","description":"ID of the custom attribute","required":true}],"get":{"tags":["Custom Attributes"],"operationId":"get-details-of-a-single-custom-attribute","summary":"Get a custom attribute details","description":"Get the details of a custom attribute in the account","parameters":[{"$ref":"#/parameters/account_id"},{"in":"path","name":"id","type":"integer","required":true,"description":"The ID of the custom attribute to be updated."}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/custom_attribute"}},"401":{"description":"Unauthorized"},"404":{"description":"The given attribute ID does not exist in the account"}}},"patch":{"tags":["Custom Attributes"],"operationId":"update-custom-attribute-in-account","summary":"Update custom attribute in Account","description":"Update a custom attribute in account","security":[{"userApiKey":[]}],"parameters":[{"in":"path","name":"id","type":"integer","required":true,"description":"The ID of the custom attribute to be updated."},{"name":"data","in":"body","required":true,"schema":{"$ref":"#/definitions/custom_attribute_create_update_payload"}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/custom_attribute"}},"404":{"description":"Agent not found"},"403":{"description":"Access denied"}}},"delete":{"tags":["Custom Attributes"],"operationId":"delete-custom-attribute-from-account","summary":"Remove a custom attribute from account","description":"Remove a custom attribute from account","security":[{"userApiKey":[]}],"parameters":[{"$ref":"#/parameters/account_id"},{"in":"path","name":"id","type":"integer","required":true,"description":"The ID of the custom attribute to be deleted"}],"responses":{"200":{"description":"Success"},"404":{"description":"Custom attribute not found"},"403":{"description":"Access denied"}}}},"/api/v1/accounts/{account_id}/contacts":{"get":{"tags":["Contacts"],"operationId":"contactList","description":"Listing all the resolved contacts with pagination (Page size = 15) . Resolved contacts are the ones with a value for identifier, email or phone number","summary":"List Contacts","parameters":[{"$ref":"#/parameters/account_id"},{"$ref":"#/parameters/contact_sort_param"},{"$ref":"#/parameters/page"}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/contact_list"}},"400":{"description":"Bad Request Error","schema":{"$ref":"#/definitions/bad_request_error"}}}},"post":{"tags":["Contacts"],"operationId":"contactCreate","description":"Create a new Contact","summary":"Create Contact","parameters":[{"$ref":"#/parameters/account_id"},{"name":"data","in":"body","required":true,"schema":{"$ref":"#/definitions/contact_create"}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/extended_contact"}},"400":{"description":"Bad Request Error","schema":{"$ref":"#/definitions/bad_request_error"}}}}},"/api/v1/accounts/{account_id}/contacts/{id}":{"parameters":[{"$ref":"#/parameters/account_id"},{"name":"id","in":"path","type":"number","description":"ID of the contact","required":true}],"get":{"tags":["Contacts"],"operationId":"contactDetails","summary":"Show Contact","description":"Get a contact belonging to the account using ID","responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/extended_contact"}},"404":{"description":"Contact not found"},"403":{"description":"Access denied"}}},"put":{"tags":["Contacts"],"operationId":"contactUpdate","summary":"Update Contact","description":"Update a contact belonging to the account using ID","parameters":[{"name":"data","in":"body","required":true,"schema":{"$ref":"#/definitions/contact_update"}}],"responses":{"204":{"description":"Success","schema":{"$ref":"#/definitions/contact_base"}},"404":{"description":"Contact not found"},"403":{"description":"Access denied"}}},"delete":{"tags":["Contacts"],"operationId":"contactDelete","summary":"Delete Contact","responses":{"200":{"description":"Success"},"401":{"description":"Unauthorized"},"404":{"description":"Contact not found"}}}},"/api/v1/accounts/{account_id}/contacts/{id}/conversations":{"get":{"tags":["Contacts"],"operationId":"contactConversations","summary":"Contact Conversations","description":"Get conversations associated to that contact","parameters":[{"$ref":"#/parameters/account_id"},{"name":"id","in":"path","type":"number","description":"ID of the contact","required":true}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/contact_conversations"}},"404":{"description":"Contact not found"},"403":{"description":"Access denied"}}}},"/api/v1/accounts/{account_id}/contacts/search":{"get":{"tags":["Contacts"],"operationId":"contactSearch","description":"Search the resolved contacts using a search key, currently supports email search (Page size = 15). Resolved contacts are the ones with a value for identifier, email or phone number","summary":"Search Contacts","parameters":[{"$ref":"#/parameters/account_id"},{"name":"q","in":"query","type":"string","description":"Search using contact `name`, `identifier`, `email` or `phone number`"},{"$ref":"#/parameters/contact_sort_param"},{"$ref":"#/parameters/page"}],"responses":{"200":{"description":"Success","schema":{"type":"object","properties":{"payload":{"$ref":"#/definitions/contact_list"}}}},"401":{"description":"Authentication error","schema":{"$ref":"#/definitions/bad_request_error"}}}}},"/api/v1/accounts/{account_id}/contacts/filter":{"parameters":[{"$ref":"#/parameters/account_id"}],"post":{"tags":["Contacts"],"operationId":"contactFilter","description":"Filter contacts with custom filter options and pagination","summary":"Contact Filter","security":[{"userApiKey":[]},{"agentBotApiKey":[]}],"parameters":[{"name":"page","in":"query","type":"integer"},{"name":"body","in":"body","required":true,"schema":{"type":"object","properties":{"payload":{"type":"array","items":{"type":"object","properties":{"attribute_key":{"type":"string","description":"filter attribute name"},"filter_operator":{"type":"string","description":"filter operator name","enum":["equal_to","not_equal_to","contains","does_not_contain"]},"values":{"type":"array","items":{"type":"string"},"description":"array of the attribute values to filter"},"query_operator":{"type":"string","description":"query operator name","enum":["AND","OR"]}}},"example":[{"attribute_key":"name","filter_operator":"equal_to","values":["en"],"query_operator":"AND"},{"attribute_key":"country_code","filter_operator":"equal_to","values":["us"],"query_operator":null}]}}}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/contact_list"}},"400":{"description":"Bad Request Error","schema":{"$ref":"#/definitions/bad_request_error"}}}}},"/api/v1/accounts/{account_id}/contacts/{id}/contact_inboxes":{"post":{"tags":["Contacts"],"operationId":"contactInboxCreation","description":"Create a contact inbox record for an inbox","summary":"Create contact inbox","parameters":[{"$ref":"#/parameters/account_id"},{"name":"id","in":"path","type":"number","description":"ID of the contact","required":true},{"name":"data","in":"body","required":true,"schema":{"type":"object","required":["inbox_id"],"properties":{"inbox_id":{"type":"number","description":"The ID of the inbox"},"source_id":{"type":"string","description":"Contact Inbox Source Id"}}}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/contact_inboxes"}},"401":{"description":"Authentication error","schema":{"$ref":"#/definitions/bad_request_error"}},"422":{"description":"Incorrect payload"}}}},"/api/v1/accounts/{account_id}/contacts/{id}/contactable_inboxes":{"get":{"tags":["Contacts"],"operationId":"contactableInboxesGet","description":"Get List of contactable Inboxes","summary":"Get Contactable Inboxes","parameters":[{"$ref":"#/parameters/account_id"},{"name":"id","in":"path","type":"number","description":"ID of the contact","required":true}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/contactable_inboxes"}},"401":{"description":"Authentication error","schema":{"$ref":"#/definitions/bad_request_error"}},"422":{"description":"Incorrect payload"}}}},"/api/v1/accounts/{account_id}/automation_rules":{"parameters":[{"$ref":"#/parameters/account_id"}],"get":{"tags":["Automation Rule"],"operationId":"get-account-automation-rule","summary":"List all automation rules in an account","parameters":[{"$ref":"#/parameters/account_id"},{"$ref":"#/parameters/page"}],"description":"Get details of automation rules in an Account","security":[{"userApiKey":[]}],"responses":{"200":{"description":"Success","schema":{"type":"array","description":"Array of all automation rules","items":{"$ref":"#/definitions/automation_rule"}}},"403":{"description":"Access denied"}}},"post":{"tags":["Automation Rule"],"operationId":"add-new-automation-rule-to-account","summary":"Add a new automation rule","description":"Add a new automation rule to account","security":[{"userApiKey":[]}],"parameters":[{"name":"data","in":"body","required":true,"schema":{"$ref":"#/definitions/automation_rule_create_update_payload"}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/automation_rule"}},"403":{"description":"Access denied"}}}},"/api/v1/accounts/{account_id}/automation_rules/{id}":{"parameters":[{"$ref":"#/parameters/account_id"},{"name":"id","in":"path","type":"number","description":"ID of the Automation Rule","required":true}],"get":{"tags":["Automation Rule"],"operationId":"get-details-of-a-single-automation-rule","summary":"Get a automation rule details","description":"Get the details of a automation rule in the account","parameters":[{"in":"path","name":"id","type":"integer","required":true,"description":"The ID of the automation rule to be updated."}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/automation_rule"}},"401":{"description":"Unauthorized"},"404":{"description":"The given rule ID does not exist in the account"}}},"patch":{"tags":["Automation Rule"],"operationId":"update-automation-rule-in-account","summary":"Update automation rule in Account","description":"Update a automation rule in account","security":[{"userApiKey":[]}],"parameters":[{"in":"path","name":"id","type":"integer","required":true,"description":"The ID of the automation rule to be updated."},{"name":"data","in":"body","required":true,"schema":{"$ref":"#/definitions/automation_rule_create_update_payload"}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/automation_rule"}},"403":{"description":"Access denied"},"404":{"description":"Rule not found"}}},"delete":{"tags":["Automation Rule"],"operationId":"delete-automation-rule-from-account","summary":"Remove a automation rule from account","description":"Remove a automation rule from account","security":[{"userApiKey":[]}],"parameters":[{"in":"path","name":"id","type":"integer","required":true,"description":"The ID of the automation rule to be deleted"}],"responses":{"200":{"description":"Success"},"403":{"description":"Access denied"},"404":{"description":"automation rule not found"}}}},"/api/v1/accounts/{account_id}/portals":{"parameters":[{"$ref":"#/parameters/account_id"}],"post":{"tags":["Help Center"],"operationId":"add-new-portal-to-account","summary":"Add a new portal","description":"Add a new portal to account","security":[{"userApiKey":[]}],"parameters":[{"name":"data","in":"body","required":true,"schema":{"$ref":"#/definitions/portal_create_update_payload"}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/portal"}},"403":{"description":"Access denied"}}},"get":{"tags":["Help Center"],"operationId":"get-portal","summary":"List all portals in an account","parameters":[{"$ref":"#/parameters/account_id"}],"description":"Get details of portals in an Account","security":[{"userApiKey":[]}],"responses":{"200":{"description":"Success","schema":{"type":"array","description":"Array of all portals","items":{"$ref":"#/definitions/portal"}}},"403":{"description":"Access denied"}}},"patch":{"tags":["Help Center"],"operationId":"update-new-portal-to-account","summary":"update a new portal","description":"update a new portal to account","security":[{"userApiKey":[]}],"parameters":[{"name":"data","in":"body","required":true,"schema":{"$ref":"#/definitions/portal_create_update_payload"}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/portal"}},"403":{"description":"Access denied"}}}},"/api/v1/accounts/{account_id}/portals/{portal_id}/categories":{"parameters":[{"$ref":"#/parameters/account_id"},{"$ref":"#/parameters/portal_id"}],"post":{"tags":["Help Center"],"operationId":"add-new-category-to-account","summary":"Add a new category","description":"Add a new category to portal","security":[{"userApiKey":[]}],"parameters":[{"name":"data","in":"body","required":true,"schema":{"$ref":"#/definitions/category_create_update_payload"}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/category"}},"403":{"description":"Access denied"}}}},"/api/v1/accounts/{account_id}/portals/{portal_id}/articles":{"parameters":[{"$ref":"#/parameters/account_id"},{"$ref":"#/parameters/portal_id"}],"post":{"tags":["Help Center"],"operationId":"add-new-article-to-account","summary":"Add a new article","description":"Add a new article to portal","security":[{"userApiKey":[]}],"parameters":[{"name":"data","in":"body","required":true,"schema":{"$ref":"#/definitions/article_create_update_payload"}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/article"}},"403":{"description":"Access denied"}}}},"/api/v1/accounts/{account_id}/conversations/meta":{"parameters":[{"$ref":"#/parameters/account_id"}],"get":{"tags":["Conversations"],"operationId":"conversationListMeta","description":"Get open, unassigned and all Conversation counts","summary":"Get Conversation Counts","parameters":[{"name":"status","in":"query","type":"string","enum":["all","open","resolved","pending","snoozed"],"default":"open","description":"Filter by conversation status."},{"name":"q","in":"query","type":"string","description":"Filters conversations with messages containing the search term"},{"name":"inbox_id","in":"query","type":"integer"},{"name":"team_id","in":"query","type":"integer"},{"name":"labels","in":"query","type":"array","items":{"type":"string"}}],"responses":{"200":{"description":"Success","schema":{"type":"object","properties":{"meta":{"type":"object","properties":{"mine_count":{"type":"number"},"unassigned_count":{"type":"number"},"assigned_count":{"type":"number"},"all_count":{"type":"number"}}}}}},"400":{"description":"Bad Request Error","schema":{"$ref":"#/definitions/bad_request_error"}}}}},"/api/v1/accounts/{account_id}/conversations":{"parameters":[{"$ref":"#/parameters/account_id"}],"get":{"tags":["Conversations"],"operationId":"conversationList","description":"List all the conversations with pagination","summary":"Conversations List","parameters":[{"name":"assignee_type","in":"query","type":"string","enum":["me","unassigned","all","assigned"],"default":"all","description":"Filter conversations by assignee type."},{"name":"status","in":"query","type":"string","enum":["all","open","resolved","pending","snoozed"],"default":"open","description":"Filter by conversation status."},{"name":"q","in":"query","type":"string","description":"Filters conversations with messages containing the search term"},{"name":"inbox_id","in":"query","type":"integer"},{"name":"team_id","in":"query","type":"integer"},{"name":"labels","in":"query","type":"array","items":{"type":"string"}},{"name":"page","in":"query","type":"integer","default":1,"description":"paginate through conversations"}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/conversation_list"}},"400":{"description":"Bad Request Error","schema":{"$ref":"#/definitions/bad_request_error"}}}},"post":{"tags":["Conversations"],"operationId":"newConversation","summary":"Create New Conversation","description":"Create or reuse a conversation. Provide inbox_id and contact_id; supported native channels can derive source_id. For an existing channel identity, reuse source_id from contactable inboxes. API inboxes and inboxes configured for a single conversation can reopen an existing conversation.","security":[{"userApiKey":[]},{"agentBotApiKey":[]}],"parameters":[{"name":"data","in":"body","required":true,"schema":{"type":"object","required":["inbox_id","contact_id"],"properties":{"source_id":{"type":"string","description":"Conversation source id"},"inbox_id":{"type":"integer","description":"Id of inbox in which the conversation is created \u003cbr/\u003e Allowed Inbox Types: Website, Phone, Api, Email "},"contact_id":{"type":"integer","description":"Contact Id for which conversation is created"},"additional_attributes":{"type":"object","description":"Lets you specify attributes like browser information"},"custom_attributes":{"type":"object","description":"The object to save custom attributes for conversation, accepts custom attributes key and value","example":{"attribute_key":"attribute_value","priority_conversation_number":3}},"status":{"type":"string","enum":["open","resolved","pending","snoozed"],"description":"Specify the conversation whether it's pending, open, closed"},"assignee_id":{"type":"integer","description":"Agent Id for assigning a conversation to an agent"},"team_id":{"type":"integer","description":"Team Id for assigning a conversation to a team"},"message":{"type":"object","description":"The initial message to be sent to the conversation","required":["content"],"properties":{"content":{"type":"string","description":"The content of the message"},"template_params":{"type":"object","description":"The template params for the message in case of whatsapp Channel","properties":{"name":{"type":"string","description":"Name of the template","example":"sample_issue_resolution"},"category":{"type":"string","description":"Category of the template","example":"UTILITY"},"language":{"type":"string","description":"Language of the template","example":"en_US"},"processed_params":{"type":"object","description":"The processed param values for template variables in template","example":{"1":"Example"}}}}}}}}}],"responses":{"200":{"description":"Success","schema":{"type":"object","properties":{"id":{"type":"number","description":"ID of the conversation"},"account_id":{"type":"number","description":"Account Id"},"inbox_id":{"type":"number","description":"ID of the inbox"}}}},"403":{"description":"Access denied"}}}},"/api/v1/accounts/{account_id}/conversations/filter":{"parameters":[{"$ref":"#/parameters/account_id"}],"post":{"tags":["Conversations"],"operationId":"conversationFilter","description":"Filter conversations with custom filter options and pagination","summary":"Conversations Filter","security":[{"userApiKey":[]},{"agentBotApiKey":[]}],"parameters":[{"name":"page","in":"query","type":"integer"},{"name":"body","in":"body","required":true,"schema":{"type":"object","properties":{"payload":{"type":"array","items":{"type":"object","properties":{"attribute_key":{"type":"string","description":"filter attribute name"},"filter_operator":{"type":"string","description":"filter operator name","enum":["equal_to","not_equal_to","contains","does_not_contain","is_present","is_not_present","is_greater_than","is_less_than","days_before"]},"values":{"type":"array","items":{"type":"string"},"description":"array of the attribute values to filter"},"query_operator":{"type":"string","description":"query operator name","enum":["AND","OR"]}}},"example":[{"attribute_key":"browser_language","filter_operator":"not_equal_to","values":["en"],"query_operator":"AND"},{"attribute_key":"status","filter_operator":"equal_to","values":["pending"],"query_operator":null}]}}}}],"responses":{"200":{"description":"Success","schema":{"type":"object","properties":{"meta":{"type":"object","description":"Conversation counters including all_count."},"payload":{"type":"array","items":{"$ref":"#/definitions/conversation_show"}}}}},"400":{"description":"Bad Request Error","schema":{"$ref":"#/definitions/bad_request_error"}}}}},"/api/v1/accounts/{account_id}/conversations/{conversation_id}":{"parameters":[{"$ref":"#/parameters/account_id"},{"$ref":"#/parameters/conversation_id"}],"get":{"tags":["Conversations"],"operationId":"get-details-of-a-conversation","summary":"Conversation Details","description":"Get all details regarding a conversation with all messages in the conversation","responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/conversation_show"}},"404":{"description":"Conversation not found"},"403":{"description":"Access denied"}}},"patch":{"tags":["Conversations"],"operationId":"update-conversation","summary":"Update Conversation","description":"Update Conversation Attributes","security":[{"userApiKey":[]},{"agentBotApiKey":[]}],"parameters":[{"name":"data","in":"body","required":true,"schema":{"type":"object","properties":{"priority":{"type":"string","enum":["urgent","high","medium","low","none"],"description":"The priority of the conversation"},"sla_policy_id":{"type":"number","description":"The ID of the SLA policy (Available only in Enterprise edition)"}}}}],"responses":{"200":{"description":"Success"},"404":{"description":"Conversation not found"},"401":{"description":"Unauthorized"}}}},"/api/v1/accounts/{account_id}/conversations/{conversation_id}/toggle_status":{"parameters":[{"$ref":"#/parameters/account_id"},{"$ref":"#/parameters/conversation_id"}],"post":{"tags":["Conversations"],"operationId":"toggle-status-of-a-conversation","summary":"Toggle Status","description":"Toggles the status of the conversation between open and resolved","security":[{"userApiKey":[]},{"agentBotApiKey":[]}],"parameters":[{"name":"data","in":"body","required":true,"schema":{"type":"object","required":["status"],"properties":{"status":{"type":"string","enum":["open","resolved","pending"],"description":"The status of the conversation"}}}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/conversation_status_toggle"}},"404":{"description":"Conversation not found"},"401":{"description":"Unauthorized"}}}},"/api/v1/accounts/{account_id}/conversations/{conversation_id}/toggle_priority":{"parameters":[{"$ref":"#/parameters/account_id"},{"$ref":"#/parameters/conversation_id"}],"post":{"tags":["Conversations"],"operationId":"toggle-priority-of-a-conversation","summary":"Toggle Priority","description":"Toggles the priority of conversation","security":[{"userApiKey":[]},{"agentBotApiKey":[]}],"parameters":[{"name":"data","in":"body","required":true,"schema":{"type":"object","required":["priority"],"properties":{"priority":{"type":"string","enum":["urgent","high","medium","low","none"],"description":"The priority of the conversation"}}}}],"responses":{"200":{"description":"Success"},"404":{"description":"Conversation not found"},"401":{"description":"Unauthorized"}}}},"/api/v1/accounts/{account_id}/conversations/{conversation_id}/assignments":{"parameters":[{"$ref":"#/parameters/account_id"},{"$ref":"#/parameters/conversation_id"}],"post":{"tags":["Conversation Assignment"],"operationId":"assign-a-conversation","summary":"Assign Conversation","description":"Assign a conversation to an agent or a team","security":[{"userApiKey":[]},{"agentBotApiKey":[]}],"parameters":[{"name":"data","in":"body","required":true,"schema":{"type":"object","properties":{"assignee_id":{"type":"number","description":"Id of the assignee user"},"team_id":{"type":"number","description":"Id of the team. If the assignee_id is present, this param would be ignored"}}}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/user"}},"404":{"description":"Conversation not found"},"401":{"description":"Unauthorized"}}}},"/api/v1/accounts/{account_id}/conversations/{conversation_id}/labels":{"parameters":[{"$ref":"#/parameters/account_id"},{"$ref":"#/parameters/conversation_id"}],"get":{"tags":["Conversation Labels"],"operationId":"list-all-labels-of-a-conversation","summary":"List Labels","description":"Lists all the labels of a conversation","responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/conversation_labels"}},"404":{"description":"Conversation not found"},"401":{"description":"Unauthorized"}}},"post":{"tags":["Conversation Labels"],"operationId":"conversation-add-labels","summary":"Add Labels","description":"Replaces the existing labels by default. Set mode to append to add labels without removing the existing ones.","parameters":[{"name":"data","in":"body","required":true,"schema":{"type":"object","properties":{"mode":{"type":"string","enum":["append"],"description":"Omit to replace the complete label list; append preserves existing labels."},"labels":{"type":"array","description":"Array of labels (comma-separated strings)","items":{"type":"string"}}}}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/conversation_labels"}},"404":{"description":"Conversation not found"},"401":{"description":"Unauthorized"}}}},"/api/v1/accounts/{account_id}/inboxes":{"get":{"tags":["Inboxes"],"operationId":"listAllInboxes","summary":"List all inboxes","description":"List all inboxes available in the current account","parameters":[{"$ref":"#/parameters/account_id"}],"responses":{"200":{"description":"Success","schema":{"type":"array","description":"Array of inboxes","items":{"$ref":"#/definitions/inbox"}}},"404":{"description":"Inbox not found"},"403":{"description":"Access denied"}}}},"/api/v1/accounts/{account_id}/inboxes/{id}/":{"get":{"tags":["Inboxes"],"operationId":"GetInbox","summary":"Get an inbox","description":"Get an inbox available in the current account","parameters":[{"$ref":"#/parameters/account_id"},{"name":"id","in":"path","type":"number","description":"ID of the inbox","required":true}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/inbox"}},"404":{"description":"Inbox not found"},"403":{"description":"Access denied"}}}},"/api/v1/accounts/{account_id}/inboxes/":{"post":{"tags":["Inboxes"],"operationId":"inboxCreation","summary":"Create an inbox","description":"You can create more than one website inbox in each account","parameters":[{"$ref":"#/parameters/account_id"},{"name":"data","in":"body","required":true,"schema":{"type":"object","properties":{"name":{"type":"string","description":"The name of the inbox"},"avatar":{"type":"string","format":"binary","description":"File for avatar image"},"channel":{"type":"object","properties":{"type":{"type":"string","enum":["web_widget"]},"website_url":{"type":"string","description":"URL at which the widget will be loaded"},"welcome_title":{"type":"string","description":"Welcome title to be displayed on the widget"},"welcome_tagline":{"type":"string","description":"Welcome tagline to be displayed on the widget"},"agent_away_message":{"type":"string","description":"A message which will be sent if there is not agent available. This is not available if agentbot is connected"},"widget_color":{"type":"string","description":"A Hex-color string used to customize the widget"}}}}}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/inbox"}},"404":{"description":"Inbox not found"},"403":{"description":"Access denied"}}}},"/api/v1/accounts/{account_id}/inboxes/{id}":{"patch":{"tags":["Inboxes"],"operationId":"updateInbox","summary":"Update Inbox","description":"Add avatar and disable auto assignment for an inbox","parameters":[{"$ref":"#/parameters/account_id"},{"name":"id","in":"path","type":"number","description":"ID of the inbox","required":true},{"name":"data","in":"body","required":true,"schema":{"type":"object","required":["enable_auto_assignment"],"properties":{"name":{"type":"string","description":"The name of the inbox"},"enable_auto_assignment":{"type":"boolean","description":"Enable Auto Assignment"},"avatar":{"type":"string","format":"binary","description":"Image file for avatar"},"channel":{"type":"object","properties":{"website_url":{"type":"string","description":"URL at which the widget will be loaded"},"welcome_title":{"type":"string","description":"Welcome title to be displayed on the widget"},"welcome_tagline":{"type":"string","description":"Welcome tagline to be displayed on the widget"},"agent_away_message":{"type":"string","description":"A message which will be sent if there is not agent available. This is not available if agentbot is connected"},"widget_color":{"type":"string","description":"A Hex-color string used to customize the widget"}}}}}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/inbox"}},"404":{"description":"Inbox not found"},"403":{"description":"Access denied"}}}},"/api/v1/accounts/{account_id}/inboxes/{id}/agent_bot":{"get":{"tags":["Inboxes"],"operationId":"getInboxAgentBot","summary":"Show Inbox Agent Bot","description":"See if an agent bot is associated to the Inbox","parameters":[{"$ref":"#/parameters/account_id"},{"name":"id","in":"path","type":"number","description":"ID of the inbox","required":true}],"responses":{"204":{"description":"Success","schema":{"$ref":"#/definitions/agent_bot"}},"404":{"description":"Inbox not found, Agent bot not found"},"403":{"description":"Access denied"}}}},"/api/v1/accounts/{account_id}/inboxes/{id}/set_agent_bot":{"post":{"tags":["Inboxes"],"operationId":"updateAgentBot","summary":"Add or remove agent bot","description":"To add an agent bot pass agent_bot id, to remove agent bot from an inbox pass null","parameters":[{"$ref":"#/parameters/account_id"},{"name":"id","in":"path","type":"number","description":"ID of the inbox","required":true},{"name":"data","in":"body","required":true,"schema":{"type":"object","required":["agent_bot"],"properties":{"agent_bot":{"type":"number","description":"Agent bot ID"}}}}],"responses":{"204":{"description":"Success"},"404":{"description":"Inbox not found, Agent bot not found"},"403":{"description":"Access denied"}}}},"/api/v1/accounts/{account_id}/inbox_members/{inbox_id}":{"parameters":[{"$ref":"#/parameters/account_id"},{"$ref":"#/parameters/inbox_id"}],"get":{"tags":["Inboxes"],"operationId":"get-inbox-members","summary":"List Agents in Inbox","description":"Get Details of Agents in an Inbox","security":[{"userApiKey":[]}],"parameters":[{"$ref":"#/parameters/inbox_id"}],"responses":{"200":{"description":"Success","schema":{"type":"array","description":"Array of all active agents","items":{"$ref":"#/definitions/agent"}}},"404":{"description":"Inbox not found"},"403":{"description":"Access denied"}}}},"/api/v1/accounts/{account_id}/inbox_members":{"parameters":[{"$ref":"#/parameters/account_id"}],"post":{"tags":["Inboxes"],"operationId":"add-new-agent-to-inbox","summary":"Add a New Agent","description":"Add a new Agent to Inbox","security":[{"userApiKey":[]}],"parameters":[{"name":"data","in":"body","required":true,"schema":{"type":"object","required":["inbox_id","user_ids"],"properties":{"inbox_id":{"type":"string","description":"The ID of the inbox"},"user_ids":{"type":"array","items":{"type":"integer"},"description":"IDs of users to be added to the inbox"}}}}],"responses":{"200":{"description":"Success","schema":{"type":"array","description":"Array of all active agents","items":{"$ref":"#/definitions/agent"}}},"404":{"description":"Inbox not found"},"403":{"description":"Access denied"},"422":{"description":"User must exist"}}},"patch":{"tags":["Inboxes"],"operationId":"update-agents-in-inbox","summary":"Update Agents in Inbox","description":"All agents except the one passed in params will be removed","security":[{"userApiKey":[]}],"parameters":[{"name":"data","in":"body","required":true,"schema":{"type":"object","required":["inbox_id","user_ids"],"properties":{"inbox_id":{"type":"string","description":"The ID of the inbox"},"user_ids":{"type":"array","items":{"type":"integer"},"description":"IDs of users to be added to the inbox"}}}}],"responses":{"200":{"description":"Success","schema":{"type":"array","description":"Array of all active agents","items":{"$ref":"#/definitions/agent"}}},"404":{"description":"Inbox not found"},"403":{"description":"Access denied"},"422":{"description":"User must exist"}}},"delete":{"tags":["Inboxes"],"operationId":"delete-agent-in-inbox","summary":"Remove an Agent from Inbox","description":"Remove an Agent from Inbox","security":[{"userApiKey":[]}],"parameters":[{"name":"data","in":"body","required":true,"schema":{"type":"object","required":["inbox_id","user_ids"],"properties":{"inbox_id":{"type":"string","description":"The ID of the inbox"},"user_ids":{"type":"array","items":{"type":"integer"},"description":"IDs of users to be deleted from the inbox"}}}}],"responses":{"200":{"description":"Success"},"404":{"description":"Inbox not found"},"403":{"description":"Access denied"},"422":{"description":"User must exist"}}}},"/api/v1/accounts/{account_id}/conversations/{conversation_id}/messages":{"parameters":[{"$ref":"#/parameters/account_id"},{"$ref":"#/parameters/conversation_id"}],"get":{"tags":["Messages"],"operationId":"list-all-messages","summary":"Get messages","description":"Read a conversation message page in payload, with context in meta. Defaults to the latest 20 messages ordered by creation time. For exhaustive exports use history_scan=true and before=min(payload[].id) until payload is empty; this orders by ID to preserve imported messages.","parameters":[{"name":"before","in":"query","type":"integer","description":"Exclusive upper message ID cursor."},{"name":"after","in":"query","type":"integer","description":"Exclusive lower ID cursor alone (up to 100 messages). With before, includes after \u003c= id \u003c before, up to 1000 messages ordered by creation time ascending. Ignored by history_scan."},{"name":"history_scan","in":"query","type":"boolean","default":false,"description":"Read up to 100 messages by ID, with optional before cursor. Ignores after."},{"name":"filter_internal_messages","in":"query","type":"boolean","description":"Omit this parameter to include private notes and activity messages. When supplied with a nonblank value, internal messages are excluded."}],"responses":{"200":{"description":"Success","schema":{"type":"object","properties":{"meta":{"type":"object","description":"Conversation labels, contact, assignee and additional attributes."},"payload":{"type":"array","items":{"allOf":[{"$ref":"#/definitions/generic_id"},{"$ref":"#/definitions/message"}]}}}}},"404":{"description":"Conversation not found"},"401":{"description":"Unauthorized"}}},"post":{"tags":["Messages"],"operationId":"create-a-new-message-in-a-conversation","summary":"Create New Message","description":"Create a new message in the conversation","security":[{"userApiKey":[]},{"agentBotApiKey":[]}],"parameters":[{"name":"data","in":"body","required":true,"schema":{"$ref":"#/definitions/conversation_message_create"}}],"responses":{"200":{"description":"Success","schema":{"allOf":[{"$ref":"#/definitions/generic_id"},{"$ref":"#/definitions/message"}]}},"404":{"description":"Conversation not found"},"403":{"description":"Access denied"}}}},"/api/v1/accounts/{account_id}/conversations/{conversation_id}/messages/{message_id}":{"parameters":[{"$ref":"#/parameters/account_id"},{"$ref":"#/parameters/conversation_id"},{"$ref":"#/parameters/message_id"}],"delete":{"tags":["Messages"],"operationId":"delete-a-message","summary":"Delete a message","description":"Delete a message and it's attachments from the conversation.","responses":{"200":{"description":"Success"},"401":{"description":"Unauthorized"},"404":{"description":"The message or conversation does not exist in the account"}}}},"/api/v1/accounts/{account_id}/integrations/apps":{"parameters":[{"$ref":"#/parameters/account_id"}],"get":{"tags":["Integrations"],"operationId":"get-details-of-all-integrations","summary":"List all the Integrations","description":"Get the details of all Integrations available for the account","responses":{"200":{"description":"Success","schema":{"type":"array","description":"Array of Integration apps","items":{"$ref":"#/definitions/integrations_app"}}},"401":{"description":"Unauthorized"},"404":{"description":"Url not found"}}}},"/api/v1/accounts/{account_id}/integrations/hooks":{"post":{"tags":["Integrations"],"operationId":"create-an-integration-hook","summary":"Create an integration hook","description":"Create an integration hook","parameters":[{"$ref":"#/parameters/account_id"},{"name":"data","in":"body","required":true,"schema":{"$ref":"#/definitions/integrations_hook_create_payload"}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/integrations_hook"}},"401":{"description":"Unauthorized"}}}},"/api/v1/accounts/{account_id}/integrations/hooks/{hook_id}":{"patch":{"tags":["Integrations"],"operationId":"update-an-integrations-hook","summary":"Update an Integration Hook","description":"Update an Integration Hook","parameters":[{"$ref":"#/parameters/account_id"},{"$ref":"#/parameters/hook_id"},{"name":"data","in":"body","required":true,"schema":{"$ref":"#/definitions/integrations_hook_update_payload"}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/integrations_hook"}},"401":{"description":"Unauthorized"}}},"delete":{"tags":["Integrations"],"operationId":"delete-an-integration-hook","summary":"Delete an Integration Hook","description":"Delete an Integration Hook","parameters":[{"$ref":"#/parameters/account_id"},{"$ref":"#/parameters/hook_id"}],"responses":{"200":{"description":"Success"},"401":{"description":"Unauthorized"},"404":{"description":"The hook does not exist in the account"}}}},"/api/v1/profile":{"get":{"tags":["Profile"],"operationId":"fetchProfile","summary":"Fetch user profile","description":"Get the user profile details","responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/user"}},"401":{"description":"Unauthorized"}}}},"/api/v1/accounts/{account_id}/teams":{"parameters":[{"$ref":"#/parameters/account_id"}],"get":{"tags":["Teams"],"operationId":"list-all-teams","summary":"List all teams","description":"List all teams available in the current account","responses":{"200":{"description":"Success","schema":{"type":"array","description":"Array of teams","items":{"$ref":"#/definitions/team"}}},"401":{"description":"Unauthorized"}}},"post":{"tags":["Teams"],"operationId":"create-a-team","summary":"Create a team","description":"Create a team in the account","parameters":[{"$ref":"#/parameters/account_id"},{"name":"data","in":"body","required":true,"schema":{"$ref":"#/definitions/team_create_update_payload"}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/team"}},"401":{"description":"Unauthorized"}}}},"/api/v1/accounts/{account_id}/teams/{team_id}":{"parameters":[{"$ref":"#/parameters/account_id"},{"$ref":"#/parameters/team_id"}],"get":{"tags":["Teams"],"operationId":"get-details-of-a-single-team","summary":"Get a team details","description":"Get the details of a team in the account","responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/team"}},"401":{"description":"Unauthorized"},"404":{"description":"The given team ID does not exist in the account"}}},"patch":{"tags":["Teams"],"operationId":"update-a-team","summary":"Update a team","description":"Update a team's attributes","parameters":[{"name":"data","in":"body","required":true,"schema":{"$ref":"#/definitions/team_create_update_payload"}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/team"}},"401":{"description":"Unauthorized"}}},"delete":{"tags":["Teams"],"operationId":"delete-a-team","summary":"Delete a team","description":"Delete a team from the account","responses":{"200":{"description":"Success"},"401":{"description":"Unauthorized"},"404":{"description":"The team does not exist in the account"}}}},"/api/v1/accounts/{account_id}/teams/{team_id}/team_members":{"parameters":[{"$ref":"#/parameters/account_id"},{"$ref":"#/parameters/team_id"}],"get":{"tags":["Teams"],"operationId":"get-team-members","summary":"List Agents in Team","description":"Get Details of Agents in an Team","security":[{"userApiKey":[]}],"parameters":[{"$ref":"#/parameters/account_id"},{"$ref":"#/parameters/team_id"}],"responses":{"200":{"description":"Success","schema":{"type":"array","description":"Array of all agents in the team","items":{"$ref":"#/definitions/agent"}}},"404":{"description":"Inbox not found"},"403":{"description":"Access denied"}}},"post":{"tags":["Teams"],"operationId":"add-new-agent-to-team","summary":"Add a New Agent","description":"Add a new Agent to Team","security":[{"userApiKey":[]}],"parameters":[{"name":"data","in":"body","required":true,"schema":{"type":"object","required":["user_ids"],"properties":{"user_ids":{"type":"array","items":{"type":"integer"},"description":"IDs of users to be added to the team"}}}}],"responses":{"200":{"description":"Success","schema":{"type":"array","description":"Array of all active agents","items":{"$ref":"#/definitions/agent"}}},"404":{"description":"Team not found"},"403":{"description":"Access denied"},"422":{"description":"User must exist"}}},"patch":{"tags":["Teams"],"operationId":"update-agents-in-team","summary":"Update Agents in Team","description":"All agents except the one passed in params will be removed","security":[{"userApiKey":[]}],"parameters":[{"name":"data","in":"body","required":true,"schema":{"type":"object","required":["user_ids"],"properties":{"user_ids":{"type":"array","items":{"type":"integer"},"description":"IDs of users to be added to the team"}}}}],"responses":{"200":{"description":"Success","schema":{"type":"array","description":"Array of all agents in the team","items":{"$ref":"#/definitions/agent"}}},"404":{"description":"Team not found"},"403":{"description":"Access denied"},"422":{"description":"User must exist"}}},"delete":{"tags":["Teams"],"operationId":"delete-agent-in-team","summary":"Remove an Agent from Team","description":"Remove an Agent from Team","security":[{"userApiKey":[]}],"parameters":[{"name":"data","in":"body","required":true,"schema":{"type":"object","required":["team_id","user_ids"],"properties":{"user_ids":{"type":"array","items":{"type":"integer"},"description":"IDs of users to be deleted from the team"}}}}],"responses":{"200":{"description":"Success"},"404":{"description":"Team not found"},"403":{"description":"Access denied"},"422":{"description":"User must exist"}}}},"/api/v1/accounts/{account_id}/custom_filters":{"parameters":[{"$ref":"#/parameters/account_id"},{"in":"query","name":"filter_type","type":"string","enum":["conversation","contact","report"],"required":false,"description":"The type of custom filter"}],"get":{"tags":["Custom Filters"],"operationId":"list-all-filters","summary":"List all custom filters","description":"List all custom filters in a category of a user","responses":{"200":{"description":"Success","schema":{"type":"array","description":"Array of custom filters","items":{"$ref":"#/definitions/custom_filter"}}},"401":{"description":"Unauthorized"}}},"post":{"tags":["Custom Filters"],"operationId":"create-a-custom-filter","summary":"Create a custom filter","description":"Create a custom filter in the account","parameters":[{"$ref":"#/parameters/account_id"},{"name":"data","in":"body","required":true,"schema":{"$ref":"#/definitions/custom_filter_create_update_payload"}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/custom_filter"}},"401":{"description":"Unauthorized"}}}},"/api/v1/accounts/{account_id}/custom_filters/{custom_filter_id}":{"parameters":[{"$ref":"#/parameters/account_id"},{"$ref":"#/parameters/custom_filter_id"}],"get":{"tags":["Custom Filters"],"operationId":"get-details-of-a-single-custom-filter","summary":"Get a custom filter details","description":"Get the details of a custom filter in the account","responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/custom_filter"}},"401":{"description":"Unauthorized"},"404":{"description":"The given team ID does not exist in the account"}}},"patch":{"tags":["Custom Filters"],"operationId":"update-a-custom-filter","summary":"Update a custom filter","description":"Update a custom filter's attributes","parameters":[{"name":"data","in":"body","required":true,"schema":{"$ref":"#/definitions/custom_filter_create_update_payload"}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/custom_filter"}},"401":{"description":"Unauthorized"}}},"delete":{"tags":["Custom Filters"],"operationId":"delete-a-custom-filter","summary":"Delete a custom filter","description":"Delete a custom filter from the account","responses":{"200":{"description":"Success"},"401":{"description":"Unauthorized"},"404":{"description":"The custom filter does not exist in the account"}}}},"/api/v1/accounts/{account_id}/webhooks":{"parameters":[{"$ref":"#/parameters/account_id"}],"get":{"tags":["Webhooks"],"operationId":"list-all-webhooks","summary":"List all webhooks","description":"List all webhooks in the account","responses":{"200":{"description":"Success","schema":{"type":"array","description":"Array of webhook objects","items":{"$ref":"#/definitions/webhook"}}},"401":{"description":"Unauthorized"}}},"post":{"tags":["Webhooks"],"operationId":"create-a-webhook","summary":"Add a webhook","description":"Add a webhook subscription to the account","parameters":[{"$ref":"#/parameters/account_id"},{"name":"data","in":"body","required":true,"schema":{"$ref":"#/definitions/webhook_create_update_payload"}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/webhook"}},"401":{"description":"Unauthorized"}}}},"/api/v1/accounts/{account_id}/webhooks/{webhook_id}":{"parameters":[{"$ref":"#/parameters/account_id"},{"$ref":"#/parameters/webhook_id"}],"patch":{"tags":["Webhooks"],"operationId":"update-a-webhook","summary":"Update a webhook object","description":"Update a webhook object in the account","parameters":[{"$ref":"#/parameters/account_id"},{"name":"data","in":"body","required":true,"schema":{"$ref":"#/definitions/webhook_create_update_payload"}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/webhook"}},"401":{"description":"Unauthorized"}}},"delete":{"tags":["Webhooks"],"operationId":"delete-a-webhook","summary":"Delete a webhook","description":"Delete a webhook from the account","responses":{"200":{"description":"Success"},"401":{"description":"Unauthorized"},"404":{"description":"The webhook does not exist in the account"}}}},"/api/v2/accounts/{account_id}/reports":{"parameters":[{"$ref":"#/parameters/account_id"},{"$ref":"#/parameters/report_metric"},{"$ref":"#/parameters/report_type"},{"in":"query","name":"id","type":"string","description":"The Id of specific object in case of agent/inbox/label"},{"in":"query","name":"since","type":"string","description":"The timestamp from where report should start."},{"in":"query","name":"until","type":"string","description":"The timestamp from where report should stop."}],"get":{"tags":["Reports"],"operationId":"list-all-conversation-statistics","summary":"Get Account reports","description":"Get Account reports for a specific type, metric and date range","responses":{"200":{"description":"Success","schema":{"type":"array","description":"Array of date based conversation statistics","items":{"type":"object","properties":{"value":{"type":"string"},"timestamp":{"type":"number"}}}}},"404":{"description":"reports not found"},"403":{"description":"Access denied"}}}},"/api/v2/accounts/{account_id}/reports/summary":{"parameters":[{"$ref":"#/parameters/account_id"},{"$ref":"#/parameters/report_type"},{"in":"query","name":"id","type":"string","description":"The Id of specific object in case of agent/inbox/label"},{"in":"query","name":"since","type":"string","description":"The timestamp from where report should start."},{"in":"query","name":"until","type":"string","description":"The timestamp from where report should stop."}],"get":{"tags":["Reports"],"operationId":"list-all-conversation-statistics-summary","summary":"Get Account reports summary","description":"Get Account reports summary for a specific type and date range","responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/account_summary"}},"404":{"description":"reports not found"},"403":{"description":"Access denied"}}}},"/api/v2/accounts/{account_id}/reports/conversations":{"parameters":[{"$ref":"#/parameters/account_id"},{"in":"query","name":"type","type":"string","enum":["account"],"required":true,"description":"Type of report"}],"get":{"tags":["Reports"],"operationId":"get-account-conversation-metrics","summary":"Account Conversation Metrics","description":"Get conversation metrics for Account","responses":{"200":{"description":"Success","schema":{"type":"object","description":"Object of account conversation metrics","properties":{"open":{"type":"number"},"unattended":{"type":"number"},"unassigned":{"type":"number"}}}},"404":{"description":"reports not found"},"403":{"description":"Access denied"}}}},"/api/v2/accounts/{account_id}/reports/conversations/":{"parameters":[{"$ref":"#/parameters/account_id"},{"in":"query","name":"type","type":"string","enum":["agent"],"required":true,"description":"Type of report"},{"in":"query","name":"user_id","type":"string","description":"The numeric ID of the user"}],"get":{"tags":["Reports"],"operationId":"get-agent-conversation-metrics","summary":"Agent Conversation Metrics","description":"Get conversation metrics for Agent","responses":{"200":{"description":"Success","schema":{"type":"array","description":"Array of agent based conversation metrics","items":{"$ref":"#/definitions/agent_conversation_metrics"}}},"404":{"description":"reports not found"},"403":{"description":"Access denied"}}}},"/api/v1/accounts/{account_id}/conversations/{conversation_id}/transcript":{"parameters":[{"$ref":"#/parameters/account_id"},{"$ref":"#/parameters/conversation_id"}],"post":{"tags":["Conversations"],"operationId":"send-conversation-transcript","summary":"Send Transcript","description":"Emails a transcript of the conversation to the given address. The email is delivered asynchronously.","security":[{"userApiKey":[]}],"parameters":[{"name":"data","in":"body","required":true,"schema":{"type":"object","required":["email"],"properties":{"email":{"type":"string","description":"The email address the transcript is sent to"}}}}],"responses":{"200":{"description":"Success"},"422":{"description":"The email parameter is missing"},"404":{"description":"Conversation not found"},"401":{"description":"Unauthorized"}}}},"/api/v1/accounts/{account_id}/contacts/{contact_id}/notes":{"parameters":[{"$ref":"#/parameters/account_id"},{"name":"contact_id","in":"path","type":"integer","description":"The numeric ID of the contact","required":true}],"get":{"tags":["Contact Notes"],"operationId":"list-all-notes-of-a-contact","summary":"List Notes","description":"Lists all the notes of a contact, most recent first","security":[{"userApiKey":[]}],"responses":{"200":{"description":"Success","schema":{"type":"array","description":"Array of notes","items":{"$ref":"#/definitions/note"}}},"404":{"description":"Contact not found"},"401":{"description":"Unauthorized"}}},"post":{"tags":["Contact Notes"],"operationId":"create-a-contact-note","summary":"Create Note","description":"Adds a note to a contact. The note is authored by the user making the request.","security":[{"userApiKey":[]}],"parameters":[{"name":"data","in":"body","required":true,"schema":{"$ref":"#/definitions/note_create_update_payload"}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/note"}},"422":{"description":"The content is missing"},"404":{"description":"Contact not found"},"401":{"description":"Unauthorized"}}}},"/api/v1/accounts/{account_id}/contacts/{contact_id}/notes/{id}":{"parameters":[{"$ref":"#/parameters/account_id"},{"name":"contact_id","in":"path","type":"integer","description":"The numeric ID of the contact","required":true}],"get":{"tags":["Contact Notes"],"operationId":"get-details-of-a-single-contact-note","summary":"Show Note","description":"Get the details of a note of a contact","security":[{"userApiKey":[]}],"parameters":[{"in":"path","name":"id","type":"integer","required":true,"description":"The ID of the note"}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/note"}},"404":{"description":"Contact or note not found"},"401":{"description":"Unauthorized"}}},"patch":{"tags":["Contact Notes"],"operationId":"update-a-contact-note","summary":"Update Note","description":"Update the content of a note of a contact. The note author is set to the user making the request.","security":[{"userApiKey":[]}],"parameters":[{"in":"path","name":"id","type":"integer","required":true,"description":"The ID of the note"},{"name":"data","in":"body","required":true,"schema":{"$ref":"#/definitions/note_create_update_payload"}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/note"}},"404":{"description":"Contact or note not found"},"401":{"description":"Unauthorized"}}},"delete":{"tags":["Contact Notes"],"operationId":"delete-a-contact-note","summary":"Delete Note","description":"Delete a note of a contact","security":[{"userApiKey":[]}],"parameters":[{"in":"path","name":"id","type":"integer","required":true,"description":"The ID of the note"}],"responses":{"200":{"description":"Success"},"404":{"description":"Contact or note not found"},"401":{"description":"Unauthorized"}}}},"/api/v1/accounts/{account_id}/contacts/bulk_delete":{"parameters":[{"$ref":"#/parameters/account_id"}],"post":{"tags":["Contacts"],"operationId":"contactBulkDelete","summary":"Bulk delete contacts","description":"Delete up to 50 contacts of the account in one request. IDs that do not belong to the account are reported in failed_contacts and do not abort the request","security":[{"userApiKey":[]}],"parameters":[{"name":"data","in":"body","required":true,"schema":{"type":"object","required":["contact_ids"],"properties":{"contact_ids":{"type":"array","items":{"type":"number"},"description":"IDs of the contacts to delete (1 to 50)"}}}}],"responses":{"200":{"description":"Success","schema":{"type":"object","properties":{"deleted_count":{"type":"integer"},"failed_count":{"type":"integer"},"failed_contacts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"number"},"reason":{"type":"string"}}}}}}},"400":{"description":"contact_ids is missing or has more than 50 entries","schema":{"$ref":"#/definitions/bad_request_error"}},"401":{"description":"Unauthorized"}}}},"/api/v1/accounts/{account_id}/contacts/bulk_label":{"parameters":[{"$ref":"#/parameters/account_id"}],"post":{"tags":["Contacts"],"operationId":"contactBulkLabel","summary":"Bulk add labels to contacts","description":"Add one or more labels to up to 50 contacts in one request. Existing labels of the contacts are kept. IDs that do not belong to the account are reported in failed_contacts and do not abort the request","security":[{"userApiKey":[]}],"parameters":[{"name":"data","in":"body","required":true,"schema":{"type":"object","required":["contact_ids","labels"],"properties":{"contact_ids":{"type":"array","items":{"type":"number"},"description":"IDs of the contacts to label (1 to 50)"},"labels":{"type":"array","items":{"type":"string"},"description":"Label titles to add to each contact"}}}}],"responses":{"200":{"description":"Success","schema":{"type":"object","properties":{"labeled_count":{"type":"integer"},"failed_count":{"type":"integer"},"failed_contacts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"number"},"reason":{"type":"string"}}}}}}},"400":{"description":"contact_ids or labels is missing, or contact_ids has more than 50 entries","schema":{"$ref":"#/definitions/bad_request_error"}},"401":{"description":"Unauthorized"}}}},"/api/v1/accounts/{account_id}/contacts/export":{"parameters":[{"$ref":"#/parameters/account_id"}],"post":{"tags":["Contacts"],"operationId":"contactExport","summary":"Export contacts","description":"Queue an asynchronous CSV export of contacts. The request returns immediately; when the file is ready a download link is emailed to the requesting user. The set of exported contacts is chosen by the first of contact_ids, payload (a filter as accepted by the contact filter endpoint) or label; with none of them, all resolved contacts of the account are exported","security":[{"userApiKey":[]}],"parameters":[{"name":"data","in":"body","required":false,"schema":{"type":"object","properties":{"column_names":{"type":"array","items":{"type":"string"},"description":"Contact columns to include in the CSV. Unknown columns are ignored. Defaults to id, name, email and phone_number","example":["id","name","email","phone_number"]},"contact_ids":{"type":"array","items":{"type":"number"},"description":"Export only these contacts"},"payload":{"type":"array","description":"Filter conditions in the same format as the contact filter endpoint","items":{"type":"object","properties":{"attribute_key":{"type":"string"},"filter_operator":{"type":"string"},"values":{"type":"array","items":{"type":"string"}},"query_operator":{"type":"string","enum":["AND","OR"]}}}},"label":{"type":"string","description":"Export only contacts with this label"}}}}],"responses":{"200":{"description":"Export queued; a download link will be emailed to the requesting user"},"401":{"description":"Unauthorized"}}}},"/api/v1/accounts/{account_id}/labels":{"parameters":[{"$ref":"#/parameters/account_id"}],"get":{"tags":["Labels"],"operationId":"list-all-labels","summary":"List all labels","description":"List all the labels available in the account, ordered by title","security":[{"userApiKey":[]}],"responses":{"200":{"description":"Success","schema":{"type":"object","properties":{"payload":{"type":"array","description":"Array of labels","items":{"$ref":"#/definitions/label"}}}}},"401":{"description":"Unauthorized"}}},"post":{"tags":["Labels"],"operationId":"create-a-label","summary":"Create a label","description":"Create a label in the account. Only administrators can create labels.","security":[{"userApiKey":[]}],"parameters":[{"name":"data","in":"body","required":true,"schema":{"$ref":"#/definitions/label_create_update_payload"}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/label"}},"422":{"description":"The title is missing, contains invalid characters or already exists in the account"},"401":{"description":"Unauthorized"}}}},"/api/v1/accounts/{account_id}/labels/{id}":{"parameters":[{"$ref":"#/parameters/account_id"}],"get":{"tags":["Labels"],"operationId":"get-details-of-a-single-label","summary":"Get a label details","description":"Get the details of a label in the account. Only administrators can view a single label.","security":[{"userApiKey":[]}],"parameters":[{"in":"path","name":"id","type":"integer","required":true,"description":"The ID of the label"}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/label"}},"401":{"description":"Unauthorized"},"404":{"description":"The label does not exist in the account"}}},"patch":{"tags":["Labels"],"operationId":"update-a-label","summary":"Update a label","description":"Update a label's attributes. Only administrators can update labels. Renaming a label also updates the conversations and contacts tagged with it.","security":[{"userApiKey":[]}],"parameters":[{"in":"path","name":"id","type":"integer","required":true,"description":"The ID of the label"},{"name":"data","in":"body","required":true,"schema":{"$ref":"#/definitions/label_create_update_payload"}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/label"}},"422":{"description":"The title is missing, contains invalid characters or already exists in the account"},"401":{"description":"Unauthorized"},"404":{"description":"The label does not exist in the account"}}},"delete":{"tags":["Labels"],"operationId":"delete-a-label","summary":"Delete a label","description":"Delete a label from the account. Only administrators can delete labels.","security":[{"userApiKey":[]}],"parameters":[{"in":"path","name":"id","type":"integer","required":true,"description":"The ID of the label"}],"responses":{"200":{"description":"Success"},"401":{"description":"Unauthorized"},"404":{"description":"The label does not exist in the account"}}}},"/api/v1/accounts/{account_id}/macros":{"parameters":[{"$ref":"#/parameters/account_id"}],"get":{"tags":["Macros"],"operationId":"list-all-macros","summary":"List all macros","description":"List the macros visible to the current user, ordered by ID. This includes every global macro of the account plus the personal macros created by the user.","security":[{"userApiKey":[]}],"responses":{"200":{"description":"Success","schema":{"type":"object","properties":{"payload":{"type":"array","description":"Array of macros","items":{"$ref":"#/definitions/macro"}}}}},"401":{"description":"Unauthorized"}}},"post":{"tags":["Macros"],"operationId":"create-a-macro","summary":"Create a macro","description":"Create a macro in the account. The current user is recorded as its creator. Agents can only create personal macros; administrators can also create global ones.","security":[{"userApiKey":[]}],"parameters":[{"name":"data","in":"body","required":true,"schema":{"$ref":"#/definitions/macro_create_update_payload"}}],"responses":{"200":{"description":"Success","schema":{"type":"object","properties":{"payload":{"$ref":"#/definitions/macro"}}}},"422":{"description":"The macro is invalid, for example the name is missing or an action is malformed. The response contains an error object keyed by attribute"},"401":{"description":"Unauthorized"}}}},"/api/v1/accounts/{account_id}/macros/{id}":{"parameters":[{"$ref":"#/parameters/account_id"}],"get":{"tags":["Macros"],"operationId":"get-details-of-a-single-macro","summary":"Get a macro details","description":"Get the details of a macro. A personal macro can only be viewed by its creator.","security":[{"userApiKey":[]}],"parameters":[{"in":"path","name":"id","type":"integer","required":true,"description":"The ID of the macro"}],"responses":{"200":{"description":"Success","schema":{"type":"object","properties":{"payload":{"$ref":"#/definitions/macro"}}}},"401":{"description":"Unauthorized"},"404":{"description":"The macro does not exist in the account"}}},"patch":{"tags":["Macros"],"operationId":"update-a-macro","summary":"Update a macro","description":"Update a macro's attributes. Allowed for the creator of the macro, and for administrators on global macros. The current user is recorded as the last editor.","security":[{"userApiKey":[]}],"parameters":[{"in":"path","name":"id","type":"integer","required":true,"description":"The ID of the macro"},{"name":"data","in":"body","required":true,"schema":{"$ref":"#/definitions/macro_create_update_payload"}}],"responses":{"200":{"description":"Success","schema":{"type":"object","properties":{"payload":{"$ref":"#/definitions/macro"}}}},"422":{"description":"The macro could not be updated. The response contains an error object keyed by attribute"},"401":{"description":"Unauthorized"},"404":{"description":"The macro does not exist in the account"}}},"delete":{"tags":["Macros"],"operationId":"delete-a-macro","summary":"Delete a macro","description":"Delete a macro from the account. Allowed for the creator of the macro, and for administrators on global macros whose creator no longer exists.","security":[{"userApiKey":[]}],"parameters":[{"in":"path","name":"id","type":"integer","required":true,"description":"The ID of the macro"}],"responses":{"200":{"description":"Success"},"401":{"description":"Unauthorized"},"404":{"description":"The macro does not exist in the account"}}}},"/api/v1/accounts/{account_id}/macros/{id}/execute":{"parameters":[{"$ref":"#/parameters/account_id"}],"post":{"tags":["Macros"],"operationId":"execute-a-macro","summary":"Execute a macro","description":"Run the actions of a macro on one or more conversations. The actions are executed asynchronously in the background on behalf of the current user; conversations that do not belong to the account are ignored. A personal macro can only be executed by its creator.","security":[{"userApiKey":[]}],"parameters":[{"in":"path","name":"id","type":"integer","required":true,"description":"The ID of the macro"},{"name":"data","in":"body","required":true,"schema":{"type":"object","required":["conversation_ids"],"properties":{"conversation_ids":{"type":"array","description":"Display IDs of the conversations the macro is applied to","items":{"type":"integer"}}}}}],"responses":{"200":{"description":"Success. The macro has been queued for execution"},"401":{"description":"Unauthorized"},"404":{"description":"The macro does not exist in the account"}}}},"/api/v1/accounts/{account_id}/csat_survey_responses":{"parameters":[{"$ref":"#/parameters/account_id"}],"get":{"tags":["CSAT Survey Responses"],"operationId":"list-csat-survey-responses","summary":"List CSAT survey responses","description":"List the customer satisfaction survey responses recorded in the account, 25 per page. Only administrators can access survey responses.","security":[{"userApiKey":[]}],"parameters":[{"in":"query","name":"since","type":"string","description":"Unix timestamp (seconds) from which responses are included. Both since and until must be given for the date filter to apply"},{"in":"query","name":"until","type":"string","description":"Unix timestamp (seconds) until which responses are included. Both since and until must be given for the date filter to apply"},{"in":"query","name":"user_ids","type":"array","items":{"type":"integer"},"collectionFormat":"multi","description":"Restrict to responses whose conversation was assigned to any of these agents"},{"in":"query","name":"inbox_id","type":"integer","description":"Restrict to responses from conversations of this inbox"},{"in":"query","name":"team_id","type":"integer","description":"Restrict to responses from conversations assigned to this team"},{"in":"query","name":"rating","type":"integer","description":"Restrict to responses with this rating (1 to 5)"},{"in":"query","name":"sort","type":"string","description":"Sort order. Use created_at for ascending or -created_at for descending"},{"$ref":"#/parameters/page"}],"responses":{"200":{"description":"Success","schema":{"type":"array","description":"Array of survey responses","items":{"$ref":"#/definitions/csat_survey_response"}}},"401":{"description":"Unauthorized"}}}},"/api/v1/accounts/{account_id}/csat_survey_responses/metrics":{"parameters":[{"$ref":"#/parameters/account_id"}],"get":{"tags":["CSAT Survey Responses"],"operationId":"get-csat-survey-metrics","summary":"Get CSAT metrics","description":"Get aggregate customer satisfaction metrics for the account. The response counts honour all the filters; the number of surveys sent only honours the date range. Only administrators can access survey metrics.","security":[{"userApiKey":[]}],"parameters":[{"in":"query","name":"since","type":"string","description":"Unix timestamp (seconds) from which responses and sent surveys are counted. Both since and until must be given for the date filter to apply"},{"in":"query","name":"until","type":"string","description":"Unix timestamp (seconds) until which responses and sent surveys are counted. Both since and until must be given for the date filter to apply"},{"in":"query","name":"user_ids","type":"array","items":{"type":"integer"},"collectionFormat":"multi","description":"Restrict to responses whose conversation was assigned to any of these agents"},{"in":"query","name":"inbox_id","type":"integer","description":"Restrict to responses from conversations of this inbox"},{"in":"query","name":"team_id","type":"integer","description":"Restrict to responses from conversations assigned to this team"},{"in":"query","name":"rating","type":"integer","description":"Restrict to responses with this rating (1 to 5)"}],"responses":{"200":{"description":"Success","schema":{"type":"object","properties":{"total_count":{"type":"integer","description":"Number of survey responses matching the filters"},"ratings_count":{"type":"object","description":"Number of responses per rating, keyed by the rating value (1 to 5)","additionalProperties":{"type":"integer"}},"total_sent_messages_count":{"type":"integer","description":"Number of survey messages sent in the date range"}}}},"401":{"description":"Unauthorized"}}}},"/api/v1/accounts/{account_id}/csat_survey_responses/download":{"parameters":[{"$ref":"#/parameters/account_id"}],"get":{"tags":["CSAT Survey Responses"],"operationId":"download-csat-survey-responses","summary":"Download CSAT report","description":"Download a CSV of the survey responses matching the filters. Columns are the agent name and email, rating, feedback, contact name, contact email, contact phone number, a link to the conversation and the time the response was recorded. The last line holds the reported period. Only administrators can download the report.","security":[{"userApiKey":[]}],"produces":["text/csv"],"parameters":[{"in":"query","name":"since","type":"string","required":false,"description":"Unix timestamp (seconds) from which responses are included"},{"in":"query","name":"until","type":"string","required":false,"description":"Unix timestamp (seconds) until which responses are included"},{"in":"query","name":"user_ids","type":"array","items":{"type":"integer"},"collectionFormat":"multi","description":"Restrict to responses whose conversation was assigned to any of these agents"},{"in":"query","name":"inbox_id","type":"integer","description":"Restrict to responses from conversations of this inbox"},{"in":"query","name":"team_id","type":"integer","description":"Restrict to responses from conversations assigned to this team"},{"in":"query","name":"rating","type":"integer","description":"Restrict to responses with this rating (1 to 5)"},{"in":"query","name":"sort","type":"string","description":"Sort order. Use created_at for ascending or -created_at for descending"}],"responses":{"200":{"description":"Success. CSV file returned as an attachment named csat_report.csv","schema":{"type":"string"}},"401":{"description":"Unauthorized"}}}},"/api/v1/accounts/{account_id}/applied_slas":{"parameters":[{"$ref":"#/parameters/account_id"}],"get":{"tags":["Applied SLAs"],"operationId":"list-applied-slas","summary":"List breached SLAs","description":"List the SLAs applied to conversations of the account that have been missed (status missed or active_with_misses), 25 per page, together with the conversation and the breach events. Only administrators can access this endpoint.","security":[{"userApiKey":[]}],"parameters":[{"in":"query","name":"since","type":"string","description":"Unix timestamp (seconds) from which applied SLAs are included, based on when the SLA was applied. Both since and until must be given for the date filter to apply"},{"in":"query","name":"until","type":"string","description":"Unix timestamp (seconds) until which applied SLAs are included. Both since and until must be given for the date filter to apply"},{"in":"query","name":"inbox_id","type":"integer","description":"Restrict to conversations of this inbox"},{"in":"query","name":"team_id","type":"integer","description":"Restrict to conversations assigned to this team"},{"in":"query","name":"sla_policy_id","type":"integer","description":"Restrict to this SLA policy"},{"in":"query","name":"label_list","type":"string","description":"Restrict to conversations whose labels contain this text"},{"in":"query","name":"assigned_agent_id","type":"integer","description":"Restrict to conversations assigned to this agent"},{"in":"query","name":"sort","type":"string","description":"Sort order. Use created_at for ascending or -created_at for descending"},{"$ref":"#/parameters/page"}],"responses":{"200":{"description":"Success","schema":{"type":"object","properties":{"payload":{"type":"array","description":"Array of breached applied SLAs","items":{"type":"object","properties":{"applied_sla":{"$ref":"#/definitions/applied_sla"},"conversation":{"type":"object","properties":{"id":{"type":"integer","description":"The internal ID of the conversation"},"contact":{"type":"object","properties":{"name":{"type":"string"}}},"labels":{"type":"string","description":"Comma-separated list of the conversation labels"},"assignee":{"type":"object","description":"The assigned agent, when any","properties":{"id":{"type":"integer"},"name":{"type":"string"},"available_name":{"type":"string"},"avatar_url":{"type":"string"},"type":{"type":"string"},"availability_status":{"type":"string"},"thumbnail":{"type":"string"}}}}},"sla_events":{"type":"array","description":"The thresholds breached on this conversation","items":{"$ref":"#/definitions/sla_event"}}}}},"meta":{"type":"object","properties":{"count":{"type":"integer","description":"Total number of breached applied SLAs matching the filters"},"current_page":{"type":"integer"}}}}}},"401":{"description":"Unauthorized"}}}},"/api/v1/accounts/{account_id}/applied_slas/metrics":{"parameters":[{"$ref":"#/parameters/account_id"}],"get":{"tags":["Applied SLAs"],"operationId":"get-applied-sla-metrics","summary":"Get SLA metrics","description":"Get the number of SLAs applied to conversations matching the filters, how many were missed and the resulting hit rate. Only administrators can access this endpoint.","security":[{"userApiKey":[]}],"parameters":[{"in":"query","name":"since","type":"string","description":"Unix timestamp (seconds) from which applied SLAs are included. Both since and until must be given for the date filter to apply"},{"in":"query","name":"until","type":"string","description":"Unix timestamp (seconds) until which applied SLAs are included. Both since and until must be given for the date filter to apply"},{"in":"query","name":"inbox_id","type":"integer","description":"Restrict to conversations of this inbox"},{"in":"query","name":"team_id","type":"integer","description":"Restrict to conversations assigned to this team"},{"in":"query","name":"sla_policy_id","type":"integer","description":"Restrict to this SLA policy"},{"in":"query","name":"label_list","type":"string","description":"Restrict to conversations whose labels contain this text"},{"in":"query","name":"assigned_agent_id","type":"integer","description":"Restrict to conversations assigned to this agent"}],"responses":{"200":{"description":"Success","schema":{"type":"object","properties":{"total_applied_slas":{"type":"integer","description":"Number of applied SLAs matching the filters"},"number_of_sla_misses":{"type":"integer","description":"Number of those with status missed or active_with_misses"},"hit_rate":{"type":"string","description":"Percentage of applied SLAs that were not missed, formatted as a string such as \"87.5%\""}}}},"401":{"description":"Unauthorized"}}}},"/api/v1/accounts/{account_id}/applied_slas/download":{"parameters":[{"$ref":"#/parameters/account_id"}],"get":{"tags":["Applied SLAs"],"operationId":"download-breached-slas-report","summary":"Download breached SLAs report","description":"Download a CSV of the conversations whose SLA was missed, matching the filters. Columns are the conversation display ID, the breached SLA policy name, assignee, team, inbox, labels, a link to the conversation and the breached thresholds. Only administrators can download the report.","security":[{"userApiKey":[]}],"produces":["text/csv"],"parameters":[{"in":"query","name":"since","type":"string","description":"Unix timestamp (seconds) from which applied SLAs are included. Both since and until must be given for the date filter to apply"},{"in":"query","name":"until","type":"string","description":"Unix timestamp (seconds) until which applied SLAs are included. Both since and until must be given for the date filter to apply"},{"in":"query","name":"inbox_id","type":"integer","description":"Restrict to conversations of this inbox"},{"in":"query","name":"team_id","type":"integer","description":"Restrict to conversations assigned to this team"},{"in":"query","name":"sla_policy_id","type":"integer","description":"Restrict to this SLA policy"},{"in":"query","name":"label_list","type":"string","description":"Restrict to conversations whose labels contain this text"},{"in":"query","name":"assigned_agent_id","type":"integer","description":"Restrict to conversations assigned to this agent"},{"in":"query","name":"sort","type":"string","description":"Sort order. Use created_at for ascending or -created_at for descending"}],"responses":{"200":{"description":"Success. CSV file returned as an attachment named breached_conversation.csv","schema":{"type":"string"}},"401":{"description":"Unauthorized"}}}},"/api/v1/accounts/{account_id}/inboxes/{id}/sync_templates":{"post":{"tags":["Inboxes"],"operationId":"syncInboxTemplates","summary":"Sync WhatsApp message templates","description":"Fetch the approved message templates of a WhatsApp inbox from the provider and store them on the channel. The sync runs synchronously. Only available for WhatsApp inboxes","parameters":[{"$ref":"#/parameters/account_id"},{"name":"id","in":"path","type":"number","description":"ID of the inbox","required":true}],"responses":{"200":{"description":"Success","schema":{"type":"object","properties":{"message":{"type":"string","example":"Template sync completed"}}}},"403":{"description":"Access denied"},"404":{"description":"Inbox not found"},"422":{"description":"The inbox is not a WhatsApp inbox","schema":{"$ref":"#/definitions/bad_request_error"}},"500":{"description":"The provider sync failed","schema":{"$ref":"#/definitions/bad_request_error"}}}}},"/api/v1/accounts/{account_id}/inboxes/{id}/disconnect":{"post":{"tags":["Inboxes"],"operationId":"disconnectInbox","summary":"Disconnect a Facebook or Instagram inbox","description":"Mark a Facebook / Instagram inbox as manually disconnected and unsubscribe its page from webhook events, so the platform stops receiving messages for it. The inbox and its conversations are kept and the inbox can be reconnected later through the OAuth flow. Only available for Facebook and Instagram inboxes","parameters":[{"$ref":"#/parameters/account_id"},{"name":"id","in":"path","type":"number","description":"ID of the inbox","required":true}],"responses":{"200":{"description":"Success","schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string","example":"Inbox disconnected successfully"}}}},"403":{"description":"Access denied"},"404":{"description":"Inbox not found"},"422":{"description":"The inbox is not a Facebook or Instagram inbox","schema":{"$ref":"#/definitions/bad_request_error"}}}}},"/api/v1/accounts/{account_id}/inboxes/{inbox_id}/history_import":{"post":{"tags":["Inboxes"],"operationId":"importInboxHistory","summary":"Import WhatsApp conversation history","description":"Import past WhatsApp conversations into a WhatsApp inbox from a history payload in the provider's history-sync format (chunks of threads of messages). Contacts and conversations are created as needed and existing messages are skipped. Only text, image, video and document messages are imported. The request body is limited to 10 MB. Administrators only","parameters":[{"$ref":"#/parameters/account_id"},{"$ref":"#/parameters/inbox_id"},{"name":"data","in":"body","required":true,"schema":{"type":"object","required":["history"],"properties":{"metadata":{"type":"object","properties":{"display_phone_number":{"type":"string","description":"The business phone number of the inbox, used to tell incoming from outgoing messages"},"phone_number_id":{"type":"string"}}},"history":{"type":"array","description":"History chunks","items":{"type":"object","properties":{"metadata":{"type":"object","properties":{"phase":{"type":"string"},"chunk_order":{"type":"integer"},"progress":{"type":"integer"}}},"threads":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"The phone number of the customer in the thread"},"messages":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Provider message ID"},"from":{"type":"string"},"to":{"type":"string"},"timestamp":{"type":"string","description":"UNIX timestamp of the message"},"type":{"type":"string","enum":["text","image","video","document"]},"text":{"type":"object","properties":{"body":{"type":"string"}}},"image":{"type":"object","properties":{"caption":{"type":"string"}}},"video":{"type":"object","properties":{"caption":{"type":"string"}}},"document":{"type":"object","properties":{"filename":{"type":"string"}}}}}}}}}}}}}}}],"responses":{"200":{"description":"Success","schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"stats":{"type":"object","properties":{"threads":{"type":"integer"},"messages":{"type":"integer"},"contacts_created":{"type":"integer"},"conversations_created":{"type":"integer"},"skipped_threads":{"type":"integer"},"truncated_threads":{"type":"integer"},"media_imported":{"type":"integer"},"media_failed":{"type":"integer"},"thread_errors":{"type":"array","items":{"type":"object","properties":{"thread_id":{"type":"string"},"error":{"type":"string"}}}}}}}}},"400":{"description":"The history payload is missing or invalid"},"403":{"description":"Access denied (administrators only)"},"404":{"description":"Inbox not found"},"413":{"description":"Request body larger than 10 MB"},"422":{"description":"The inbox is not a WhatsApp inbox, or the import failed"}}}},"/api/v1/accounts/{account_id}/custom_roles":{"parameters":[{"$ref":"#/parameters/account_id"}],"get":{"tags":["Custom Roles"],"operationId":"list-all-custom-roles","summary":"List all custom roles","description":"List the custom roles of the account. Administrators only","security":[{"userApiKey":[]}],"responses":{"200":{"description":"Success","schema":{"type":"array","description":"Array of custom roles","items":{"$ref":"#/definitions/custom_role"}}},"401":{"description":"Unauthorized"},"403":{"description":"Access denied"}}},"post":{"tags":["Custom Roles"],"operationId":"create-a-custom-role","summary":"Create a custom role","description":"Create a custom role in the account. A custom role is a named set of permissions that can be assigned to agents. Administrators only","security":[{"userApiKey":[]}],"parameters":[{"name":"data","in":"body","required":true,"schema":{"$ref":"#/definitions/custom_role_create_update_payload"}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/custom_role"}},"401":{"description":"Unauthorized"},"403":{"description":"Access denied"},"422":{"description":"Validation error, e.g. missing name or unknown permission","schema":{"$ref":"#/definitions/bad_request_error"}}}}},"/api/v1/accounts/{account_id}/custom_roles/{id}":{"parameters":[{"$ref":"#/parameters/account_id"},{"name":"id","in":"path","type":"number","description":"ID of the custom role","required":true}],"get":{"tags":["Custom Roles"],"operationId":"get-details-of-a-single-custom-role","summary":"Get a custom role","description":"Get a custom role of the account. Administrators only","security":[{"userApiKey":[]}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/custom_role"}},"401":{"description":"Unauthorized"},"403":{"description":"Access denied"}}},"patch":{"tags":["Custom Roles"],"operationId":"update-a-custom-role","summary":"Update a custom role","description":"Update a custom role of the account. Administrators only","security":[{"userApiKey":[]}],"parameters":[{"name":"data","in":"body","required":true,"schema":{"$ref":"#/definitions/custom_role_create_update_payload"}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/custom_role"}},"401":{"description":"Unauthorized"},"403":{"description":"Access denied"},"422":{"description":"Validation error","schema":{"$ref":"#/definitions/bad_request_error"}}}},"delete":{"tags":["Custom Roles"],"operationId":"delete-a-custom-role","summary":"Delete a custom role","description":"Delete a custom role of the account. Agents assigned to the role lose it. Administrators only","security":[{"userApiKey":[]}],"responses":{"200":{"description":"Success"},"401":{"description":"Unauthorized"},"403":{"description":"Access denied"}}}},"/api/v1/accounts/{account_id}/pipelines":{"parameters":[{"$ref":"#/parameters/account_id"}],"get":{"tags":["Pipelines"],"operationId":"list-all-pipelines","summary":"List all pipelines","description":"List all active pipelines of the account. Stages are not embedded; fetch a single pipeline to get its stages","security":[{"userApiKey":[]}],"responses":{"200":{"description":"Success","schema":{"type":"array","description":"Array of pipelines","items":{"$ref":"#/definitions/pipeline"}}},"401":{"description":"Unauthorized"}}},"post":{"tags":["Pipelines"],"operationId":"create-a-pipeline","summary":"Create a pipeline","description":"Create a pipeline in the account. When the pipeline type is sales, a default set of six stages (lead, qualified, proposal, negotiation, won, lost) is created automatically","security":[{"userApiKey":[]}],"parameters":[{"name":"data","in":"body","required":true,"schema":{"$ref":"#/definitions/pipeline_create_update_payload"}}],"responses":{"201":{"description":"Created","schema":{"$ref":"#/definitions/pipeline"}},"401":{"description":"Unauthorized"},"422":{"description":"Validation error, e.g. missing name or a second default pipeline","schema":{"$ref":"#/definitions/bad_request_error"}}}}},"/api/v1/accounts/{account_id}/pipelines/{id}":{"parameters":[{"$ref":"#/parameters/account_id"},{"name":"id","in":"path","type":"number","description":"ID of the pipeline","required":true}],"get":{"tags":["Pipelines"],"operationId":"get-details-of-a-single-pipeline","summary":"Get a pipeline","description":"Get a pipeline of the account together with its stages ordered by position","security":[{"userApiKey":[]}],"responses":{"200":{"description":"Success","schema":{"allOf":[{"$ref":"#/definitions/pipeline"},{"type":"object","properties":{"stages":{"type":"array","items":{"$ref":"#/definitions/pipeline_stage"}}}}]}},"401":{"description":"Unauthorized"},"404":{"description":"The pipeline does not exist in the account"}}},"patch":{"tags":["Pipelines"],"operationId":"update-a-pipeline","summary":"Update a pipeline","description":"Update a pipeline of the account. Only the provided attributes are changed","security":[{"userApiKey":[]}],"parameters":[{"name":"data","in":"body","required":true,"schema":{"$ref":"#/definitions/pipeline_create_update_payload"}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/pipeline"}},"401":{"description":"Unauthorized"},"404":{"description":"The pipeline does not exist in the account"},"422":{"description":"Validation error","schema":{"$ref":"#/definitions/bad_request_error"}}}},"delete":{"tags":["Pipelines"],"operationId":"delete-a-pipeline","summary":"Delete a pipeline","description":"Delete a pipeline of the account. Its stages, contact stage records and stage history are deleted as well","security":[{"userApiKey":[]}],"responses":{"204":{"description":"Success"},"401":{"description":"Unauthorized"},"404":{"description":"The pipeline does not exist in the account"}}}},"/api/v1/accounts/{account_id}/pipelines/{id}/duplicate":{"parameters":[{"$ref":"#/parameters/account_id"},{"name":"id","in":"path","type":"number","description":"ID of the pipeline","required":true}],"post":{"tags":["Pipelines"],"operationId":"duplicate-a-pipeline","summary":"Duplicate a pipeline","description":"Create a copy of the pipeline and all of its stages. The copy is named \"\u003cname\u003e (Copy)\" and is never marked as default. Contacts are not copied","security":[{"userApiKey":[]}],"responses":{"201":{"description":"Created","schema":{"$ref":"#/definitions/pipeline"}},"401":{"description":"Unauthorized"},"404":{"description":"The pipeline does not exist in the account"}}}},"/api/v1/accounts/{account_id}/pipelines/{id}/reorder_stages":{"parameters":[{"$ref":"#/parameters/account_id"},{"name":"id","in":"path","type":"number","description":"ID of the pipeline","required":true}],"post":{"tags":["Pipelines"],"operationId":"reorder-pipeline-stages","summary":"Reorder stages","description":"Set the order of the stages of the pipeline. Stages are assigned positions 1..n following the order of the given IDs","security":[{"userApiKey":[]}],"parameters":[{"name":"data","in":"body","required":true,"schema":{"type":"object","required":["stage_ids"],"properties":{"stage_ids":{"type":"array","items":{"type":"number"},"description":"IDs of the stages of the pipeline in the desired order","example":[12,10,11]}}}}],"responses":{"200":{"description":"Success","schema":{"allOf":[{"$ref":"#/definitions/pipeline"},{"type":"object","properties":{"stages":{"type":"array","items":{"$ref":"#/definitions/pipeline_stage"}}}}]}},"401":{"description":"Unauthorized"},"404":{"description":"The pipeline or one of the stages does not exist"}}}},"/api/v1/accounts/{account_id}/pipelines/{pipeline_id}/stages":{"parameters":[{"$ref":"#/parameters/account_id"},{"name":"pipeline_id","in":"path","type":"number","description":"ID of the pipeline","required":true}],"get":{"tags":["Pipeline Stages"],"operationId":"list-all-pipeline-stages","summary":"List all stages","description":"List the stages of a pipeline ordered by position. Pass include_contacts=true to embed, for each stage, the contacts currently in it (limited to per_page per stage, most recently entered first) and the total count","security":[{"userApiKey":[]}],"parameters":[{"name":"include_contacts","in":"query","type":"string","enum":["true"],"required":false,"description":"When \"true\", each stage includes its contacts and contacts_count"},{"name":"per_page","in":"query","type":"integer","required":false,"description":"Maximum number of contacts returned per stage when include_contacts is set (default 50, max 200)"},{"name":"search","in":"query","type":"string","required":false,"description":"Filter the embedded contacts by name, email, phone number, identifier or company_name (case-insensitive substring match)"},{"name":"entered_after","in":"query","type":"integer","required":false,"description":"Only include contacts that entered on or after this UNIX timestamp (seconds)"},{"name":"entered_before","in":"query","type":"integer","required":false,"description":"Only include contacts that entered on or before this UNIX timestamp (seconds)"},{"name":"date_basis","in":"query","type":"string","enum":["pipeline","stage"],"required":false,"description":"What entered_after/entered_before apply to. \"pipeline\" (default) uses the first entry of the contact into the pipeline; \"stage\" uses the entry into this stage"}],"responses":{"200":{"description":"Success","schema":{"type":"array","items":{"allOf":[{"$ref":"#/definitions/pipeline_stage"},{"type":"object","properties":{"contacts":{"type":"array","description":"Only present when include_contacts=true","items":{"$ref":"#/definitions/pipeline_contact"}},"contacts_count":{"type":"integer","description":"Total number of contacts in the stage matching the filters. Only present when include_contacts=true"}}}]}}},"401":{"description":"Unauthorized"},"404":{"description":"The pipeline does not exist in the account"}}},"post":{"tags":["Pipeline Stages"],"operationId":"create-a-pipeline-stage","summary":"Create a stage","description":"Create a stage in the pipeline. The stage is appended after the last existing stage","security":[{"userApiKey":[]}],"parameters":[{"name":"data","in":"body","required":true,"schema":{"$ref":"#/definitions/pipeline_stage_create_update_payload"}}],"responses":{"201":{"description":"Created","schema":{"$ref":"#/definitions/pipeline_stage"}},"401":{"description":"Unauthorized"},"404":{"description":"The pipeline does not exist in the account"},"422":{"description":"Validation error, e.g. missing name, invalid color or stage_type","schema":{"$ref":"#/definitions/bad_request_error"}}}}},"/api/v1/accounts/{account_id}/pipelines/{pipeline_id}/stages/{id}":{"parameters":[{"$ref":"#/parameters/account_id"},{"name":"pipeline_id","in":"path","type":"number","description":"ID of the pipeline","required":true},{"name":"id","in":"path","type":"number","description":"ID of the stage","required":true}],"get":{"tags":["Pipeline Stages"],"operationId":"get-details-of-a-single-pipeline-stage","summary":"Get a stage","description":"Get a stage of the pipeline","security":[{"userApiKey":[]}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/pipeline_stage"}},"401":{"description":"Unauthorized"},"404":{"description":"The pipeline or the stage does not exist"}}},"patch":{"tags":["Pipeline Stages"],"operationId":"update-a-pipeline-stage","summary":"Update a stage","description":"Update a stage of the pipeline. Changing the position shifts the other stages at or after the new position","security":[{"userApiKey":[]}],"parameters":[{"name":"data","in":"body","required":true,"schema":{"$ref":"#/definitions/pipeline_stage_create_update_payload"}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/pipeline_stage"}},"401":{"description":"Unauthorized"},"404":{"description":"The pipeline or the stage does not exist"},"422":{"description":"Validation error","schema":{"$ref":"#/definitions/bad_request_error"}}}},"delete":{"tags":["Pipeline Stages"],"operationId":"delete-a-pipeline-stage","summary":"Delete a stage","description":"Delete a stage of the pipeline together with its contact stage records","security":[{"userApiKey":[]}],"responses":{"204":{"description":"Success"},"401":{"description":"Unauthorized"},"404":{"description":"The pipeline or the stage does not exist"}}}},"/api/v1/accounts/{account_id}/pipelines/{pipeline_id}/stages/{id}/move_contact":{"parameters":[{"$ref":"#/parameters/account_id"},{"name":"pipeline_id","in":"path","type":"number","description":"ID of the pipeline","required":true},{"name":"id","in":"path","type":"number","description":"ID of the stage","required":true}],"post":{"tags":["Pipeline Stages"],"operationId":"move-contact-to-pipeline-stage","summary":"Move a contact into a stage","description":"Place a contact in this stage. Any active stage of the contact within the same pipeline is closed first, and a stage history entry is recorded","security":[{"userApiKey":[]}],"parameters":[{"name":"data","in":"body","required":true,"schema":{"type":"object","required":["contact_id"],"properties":{"contact_id":{"type":"number","description":"The ID of the contact to move"},"notes":{"type":"string","description":"Optional notes stored on the contact stage record"}}}}],"responses":{"200":{"description":"Success","schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"stage":{"$ref":"#/definitions/pipeline_stage"},"contact_stage":{"$ref":"#/definitions/contact_stage"},"contact":{"$ref":"#/definitions/pipeline_contact"}}}},"401":{"description":"Unauthorized"},"404":{"description":"The pipeline, the stage or the contact does not exist"},"422":{"description":"The contact is already in this stage","schema":{"$ref":"#/definitions/bad_request_error"}}}}},"/api/v1/accounts/{account_id}/pipelines/{pipeline_id}/stages/{id}/bulk_move_contacts":{"parameters":[{"$ref":"#/parameters/account_id"},{"name":"pipeline_id","in":"path","type":"number","description":"ID of the pipeline","required":true},{"name":"id","in":"path","type":"number","description":"ID of the stage","required":true}],"post":{"tags":["Pipeline Stages"],"operationId":"bulk-move-contacts-to-pipeline-stage","summary":"Move several contacts into a stage","description":"Place several contacts in this stage in one request. Contacts already in the stage are skipped; contacts that fail are counted but do not abort the request","security":[{"userApiKey":[]}],"parameters":[{"name":"data","in":"body","required":true,"schema":{"type":"object","required":["contact_ids"],"properties":{"contact_ids":{"type":"array","items":{"type":"number"},"description":"IDs of the contacts to move"},"notes":{"type":"string","description":"Optional notes stored on each contact stage record"}}}}],"responses":{"200":{"description":"Success","schema":{"type":"object","properties":{"success":{"type":"boolean"},"moved_count":{"type":"integer","description":"Number of contacts moved into the stage"},"already_in_stage_count":{"type":"integer","description":"Number of contacts that were already in the stage"},"failed_count":{"type":"integer","description":"Number of contacts that could not be moved"},"stage":{"$ref":"#/definitions/pipeline_stage"}}}},"401":{"description":"Unauthorized"},"404":{"description":"The pipeline or the stage does not exist"}}}},"/api/v1/accounts/{account_id}/pipelines/{pipeline_id}/stages/{id}/import_all_contacts":{"parameters":[{"$ref":"#/parameters/account_id"},{"name":"pipeline_id","in":"path","type":"number","description":"ID of the pipeline","required":true},{"name":"id","in":"path","type":"number","description":"ID of the stage","required":true}],"post":{"tags":["Pipeline Stages"],"operationId":"import-all-contacts-to-pipeline-stage","summary":"Import all contacts into a stage","description":"Place every contact of the account that is not yet in this pipeline into this stage. The request is synchronous and may take a while on large accounts","security":[{"userApiKey":[]}],"responses":{"200":{"description":"Success","schema":{"type":"object","properties":{"success":{"type":"boolean"},"imported_count":{"type":"integer","description":"Number of contacts added to the stage"},"failed_count":{"type":"integer","description":"Number of contacts that could not be added"},"skipped_count":{"type":"integer","description":"Number of contacts skipped because they were already in the pipeline"},"total_contacts":{"type":"integer","description":"Total number of contacts in the account"},"stage":{"$ref":"#/definitions/pipeline_stage"}}}},"401":{"description":"Unauthorized"},"404":{"description":"The pipeline or the stage does not exist"}}}},"/api/v1/accounts/{account_id}/pipelines/{pipeline_id}/stages/{id}/remove_contact":{"parameters":[{"$ref":"#/parameters/account_id"},{"name":"pipeline_id","in":"path","type":"number","description":"ID of the pipeline","required":true},{"name":"id","in":"path","type":"number","description":"ID of the stage","required":true}],"delete":{"tags":["Pipeline Stages"],"operationId":"remove-contact-from-pipeline-stage","summary":"Remove a contact from a stage","description":"Close the active stage record of the contact in this stage, taking the contact out of the pipeline. The contact ID is sent in the request body","security":[{"userApiKey":[]}],"parameters":[{"name":"data","in":"body","required":true,"schema":{"type":"object","required":["contact_id"],"properties":{"contact_id":{"type":"number","description":"The ID of the contact to remove"}}}}],"responses":{"200":{"description":"Success","schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"stage":{"$ref":"#/definitions/pipeline_stage"},"contact_id":{"type":"number"}}}},"401":{"description":"Unauthorized"},"404":{"description":"The pipeline, the stage or the contact does not exist"},"422":{"description":"The contact is not in this stage","schema":{"$ref":"#/definitions/bad_request_error"}}}}},"/api/v1/accounts/{account_id}/pipelines/{pipeline_id}/stages/{id}/contacts":{"parameters":[{"$ref":"#/parameters/account_id"},{"name":"pipeline_id","in":"path","type":"number","description":"ID of the pipeline","required":true},{"name":"id","in":"path","type":"number","description":"ID of the stage","required":true}],"get":{"tags":["Pipeline Stages"],"operationId":"list-contacts-in-pipeline-stage","summary":"List contacts in a stage","description":"Paginated list of the contacts currently in the stage, most recently entered first","security":[{"userApiKey":[]}],"parameters":[{"name":"page","in":"query","type":"integer","required":false,"description":"Page number (default 1)"},{"name":"per_page","in":"query","type":"integer","required":false,"description":"Number of contacts per page (default 50, max 200)"},{"name":"entered_after","in":"query","type":"integer","required":false,"description":"Only include contacts that entered on or after this UNIX timestamp (seconds)"},{"name":"entered_before","in":"query","type":"integer","required":false,"description":"Only include contacts that entered on or before this UNIX timestamp (seconds)"},{"name":"date_basis","in":"query","type":"string","enum":["pipeline","stage"],"required":false,"description":"What entered_after/entered_before apply to. \"pipeline\" (default) uses the first entry of the contact into the pipeline; \"stage\" uses the entry into this stage"}],"responses":{"200":{"description":"Success","schema":{"type":"object","properties":{"contacts":{"type":"array","items":{"$ref":"#/definitions/pipeline_contact"}},"total_count":{"type":"integer","description":"Total number of contacts in the stage matching the filters"},"page":{"type":"integer"},"per_page":{"type":"integer"}}}},"401":{"description":"Unauthorized"},"404":{"description":"The pipeline or the stage does not exist"}}}},"/api/v1/accounts/{account_id}/contacts/{contact_id}/stages":{"parameters":[{"$ref":"#/parameters/account_id"},{"name":"contact_id","in":"path","type":"number","description":"ID of the contact","required":true}],"get":{"tags":["Contact Stages"],"operationId":"list-contact-stages","summary":"List stage records of a contact","description":"List every stage record of the contact across all pipelines, most recently entered first. Each record embeds a summary of its pipeline stage","security":[{"userApiKey":[]}],"responses":{"200":{"description":"Success","schema":{"type":"array","items":{"allOf":[{"$ref":"#/definitions/contact_stage"},{"type":"object","properties":{"pipeline_stage":{"type":"object","properties":{"id":{"type":"number"},"name":{"type":"string"},"color":{"type":"string"},"pipeline_id":{"type":"number"},"position":{"type":"integer"},"stage_type":{"type":"string"},"is_win_stage":{"type":"boolean"},"is_lose_stage":{"type":"boolean"}}}}}]}}},"401":{"description":"Unauthorized"},"404":{"description":"The contact does not exist in the account"}}}},"/api/v1/accounts/{account_id}/contacts/{contact_id}/stages/current":{"parameters":[{"$ref":"#/parameters/account_id"},{"name":"contact_id","in":"path","type":"number","description":"ID of the contact","required":true}],"get":{"tags":["Contact Stages"],"operationId":"get-current-contact-stage","summary":"Get the current stage of a contact","description":"Get the stage the contact is currently in within a pipeline. When pipeline_id is omitted the default pipeline of the account is used; if the account has no default pipeline, pipeline fields are null and in_pipeline is false","security":[{"userApiKey":[]}],"parameters":[{"name":"pipeline_id","in":"query","type":"integer","required":false,"description":"The ID of the pipeline. Defaults to the default pipeline of the account"}],"responses":{"200":{"description":"Success","schema":{"type":"object","properties":{"contact_id":{"type":"number"},"pipeline_id":{"type":"number"},"pipeline_name":{"type":"string"},"current_stage":{"$ref":"#/definitions/pipeline_stage"},"in_pipeline":{"type":"boolean","description":"Whether the contact has an active stage in the pipeline"}}}},"401":{"description":"Unauthorized"},"404":{"description":"The contact or the pipeline does not exist in the account"}}}},"/api/v1/accounts/{account_id}/contacts/{contact_id}/stages/move":{"parameters":[{"$ref":"#/parameters/account_id"},{"name":"contact_id","in":"path","type":"number","description":"ID of the contact","required":true}],"post":{"tags":["Contact Stages"],"operationId":"move-contact-to-stage","summary":"Move a contact to a stage","description":"Place the contact in the given stage. Any active stage of the contact within the same pipeline is closed first, and a stage history entry is recorded","security":[{"userApiKey":[]}],"parameters":[{"name":"data","in":"body","required":true,"schema":{"type":"object","required":["stage_id"],"properties":{"stage_id":{"type":"number","description":"The ID of the pipeline stage to move the contact to"},"notes":{"type":"string","description":"Optional notes stored on the contact stage record"}}}}],"responses":{"200":{"description":"Success","schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"stage":{"$ref":"#/definitions/pipeline_stage"},"contact_stage":{"$ref":"#/definitions/contact_stage"}}}},"401":{"description":"Unauthorized"},"404":{"description":"The contact or the stage does not exist in the account"},"422":{"description":"The contact could not be moved, e.g. it is already in the stage","schema":{"$ref":"#/definitions/bad_request_error"}}}}},"/api/v1/accounts/{account_id}/contacts/{contact_id}/stages/history":{"parameters":[{"$ref":"#/parameters/account_id"},{"name":"contact_id","in":"path","type":"number","description":"ID of the contact","required":true}],"get":{"tags":["Contact Stages"],"operationId":"get-contact-stage-history","summary":"Get the stage history of a contact","description":"List the last 50 stage transitions of the contact across all pipelines, most recent first. Each transition embeds the source stage, the target stage and the user who performed it","security":[{"userApiKey":[]}],"responses":{"200":{"description":"Success","schema":{"type":"array","items":{"$ref":"#/definitions/stage_transition"}}},"401":{"description":"Unauthorized"},"404":{"description":"The contact does not exist in the account"}}}},"/api/v1/accounts/{account_id}/contacts/{contact_id}/stages/{id}/mark_stuck":{"parameters":[{"$ref":"#/parameters/account_id"},{"name":"contact_id","in":"path","type":"number","description":"ID of the contact","required":true},{"name":"id","in":"path","type":"number","description":"ID of the active contact stage record","required":true}],"post":{"tags":["Contact Stages"],"operationId":"mark-contact-stage-stuck","summary":"Mark a contact as stuck","description":"Flag the active stage record of the contact as stuck. The assignee of the most relevant conversation of the contact receives a notification","security":[{"userApiKey":[]}],"parameters":[{"name":"data","in":"body","required":false,"schema":{"type":"object","properties":{"reason":{"type":"string","description":"Why the contact is stuck"}}}}],"responses":{"200":{"description":"Success","schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"contact_stage":{"$ref":"#/definitions/contact_stage"}}}},"401":{"description":"Unauthorized"},"404":{"description":"The contact does not exist, or the stage record is not an active stage of the contact"}}}},"/api/v1/accounts/{account_id}/contacts/{contact_id}/stages/{id}/unstuck":{"parameters":[{"$ref":"#/parameters/account_id"},{"name":"contact_id","in":"path","type":"number","description":"ID of the contact","required":true},{"name":"id","in":"path","type":"number","description":"ID of the active contact stage record","required":true}],"post":{"tags":["Contact Stages"],"operationId":"unmark-contact-stage-stuck","summary":"Unmark a contact as stuck","description":"Clear the stuck flag and reason of the active stage record of the contact","security":[{"userApiKey":[]}],"responses":{"200":{"description":"Success","schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"contact_stage":{"$ref":"#/definitions/contact_stage"}}}},"401":{"description":"Unauthorized"},"404":{"description":"The contact does not exist, or the stage record is not an active stage of the contact"}}}},"/api/v2/accounts/{account_id}/reports/bot_summary":{"parameters":[{"$ref":"#/parameters/account_id"}],"get":{"tags":["Reports"],"operationId":"get-bot-reports-summary","summary":"Get bot reports summary","description":"Get the bot resolution and handoff counts for a specific type and date range, together with the same counts for the immediately preceding period of equal length.","security":[{"userApiKey":[]}],"parameters":[{"$ref":"#/parameters/report_type"},{"in":"query","name":"id","type":"string","description":"The ID of the specific agent, inbox, label or team when the type is not account"},{"in":"query","name":"since","type":"string","required":true,"description":"Unix timestamp (seconds) from which the report starts"},{"in":"query","name":"until","type":"string","required":true,"description":"Unix timestamp (seconds) at which the report ends"},{"in":"query","name":"business_hours","type":"boolean","description":"Whether to compute the metrics only within the configured business hours"},{"in":"query","name":"timezone_offset","type":"number","description":"Offset in hours from UTC used to bucket the data"}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/bot_summary"}},"404":{"description":"reports not found"},"403":{"description":"Access denied"}}}},"/api/v2/accounts/{account_id}/reports/bot_metrics":{"parameters":[{"$ref":"#/parameters/account_id"}],"get":{"tags":["Reports"],"operationId":"get-bot-metrics","summary":"Get bot metrics","description":"Get aggregate metrics for conversations handled in inboxes that have an active bot, within a date range. Rates are percentages of the bot conversations created in the period.","security":[{"userApiKey":[]}],"parameters":[{"in":"query","name":"since","type":"string","required":true,"description":"Unix timestamp (seconds) from which the report starts"},{"in":"query","name":"until","type":"string","required":true,"description":"Unix timestamp (seconds) at which the report ends"}],"responses":{"200":{"description":"Success","schema":{"type":"object","description":"Object of bot metrics","properties":{"conversation_count":{"type":"number","description":"Number of conversations created in bot-enabled inboxes in the period"},"message_count":{"type":"number","description":"Number of outgoing messages sent in those conversations in the period"},"resolution_rate":{"type":"number","description":"Percentage of those conversations resolved by the bot, rounded down to an integer"},"handoff_rate":{"type":"number","description":"Percentage of those conversations handed off to a human agent, rounded down to an integer"}}}},"404":{"description":"reports not found"},"403":{"description":"Access denied"}}}},"/api/v2/accounts/{account_id}/reports/conversation_traffic":{"parameters":[{"$ref":"#/parameters/account_id"}],"get":{"tags":["Reports"],"operationId":"download-conversation-traffic-report","summary":"Download conversation traffic report","description":"Download a CSV heatmap of the number of conversations created per hour of the day over the last 7 days, computed in the given timezone. The first line holds the timezone used, followed by a header row with the dates and one row per hour of the day.","security":[{"userApiKey":[]}],"produces":["text/csv"],"parameters":[{"in":"query","name":"timezone_offset","type":"number","description":"Offset in hours from UTC used to compute the day boundaries and bucket the conversations. Defaults to 0"}],"responses":{"200":{"description":"Success. CSV file returned as an attachment named conversation_traffic_reports.csv","schema":{"type":"string"}},"404":{"description":"reports not found"},"403":{"description":"Access denied"}}}},"/api/v2/accounts/{account_id}/reports/contacts":{"parameters":[{"$ref":"#/parameters/account_id"}],"get":{"tags":["Reports"],"operationId":"get-contacts-report","summary":"Get contacts report","description":"Get the number of contacts created per period (day, week, month or year) within a date range, optionally restricted to the contacts of an inbox, a team or a label.","security":[{"userApiKey":[]}],"parameters":[{"in":"query","name":"since","type":"string","required":true,"description":"Unix timestamp (seconds) from which the report starts"},{"in":"query","name":"until","type":"string","required":true,"description":"Unix timestamp (seconds) at which the report ends"},{"in":"query","name":"type","type":"string","enum":["inbox","team","label"],"description":"Restrict the report to the contacts of a specific inbox, team or label. Omit for the whole account"},{"in":"query","name":"id","type":"string","description":"The ID of the inbox, team or label when type is given. Must belong to the account"},{"in":"query","name":"group_by","type":"string","enum":["day","week","month","year"],"default":"month","description":"The period used to bucket the counts"},{"in":"query","name":"timezone_offset","type":"number","description":"Offset in hours from UTC used to bucket the data. Defaults to 0"}],"responses":{"200":{"description":"Success","schema":{"type":"object","properties":{"data":{"type":"array","description":"Array of date based contact counts","items":{"type":"object","properties":{"value":{"type":"number","description":"Number of contacts created in the bucket"},"timestamp":{"type":"number","description":"Unix timestamp of the start of the bucket in the requested timezone"}}}}}}},"400":{"description":"Invalid type, or the given inbox, team or label does not belong to the account"},"404":{"description":"reports not found"},"403":{"description":"Access denied"}}}},"/api/v2/accounts/{account_id}/reports/contacts_summary":{"parameters":[{"$ref":"#/parameters/account_id"}],"get":{"tags":["Reports"],"operationId":"get-contacts-report-summary","summary":"Get contacts report summary","description":"Get the number of contacts created within a date range, optionally restricted to the contacts of an inbox, a team or a label, together with the account-wide count for the immediately preceding period of equal length.","security":[{"userApiKey":[]}],"parameters":[{"in":"query","name":"since","type":"string","required":true,"description":"Unix timestamp (seconds) from which the report starts"},{"in":"query","name":"until","type":"string","required":true,"description":"Unix timestamp (seconds) at which the report ends"},{"in":"query","name":"type","type":"string","enum":["inbox","team","label"],"description":"Restrict the current-period count to the contacts of a specific inbox, team or label. Omit for the whole account"},{"in":"query","name":"id","type":"string","description":"The ID of the inbox, team or label when type is given. Must belong to the account"},{"in":"query","name":"timezone_offset","type":"number","description":"Offset in hours from UTC. Defaults to 0"}],"responses":{"200":{"description":"Success","schema":{"type":"object","properties":{"contacts_created":{"type":"object","properties":{"value":{"type":"number","description":"Number of contacts created in the requested period"},"previous":{"type":"number","description":"Number of contacts created in the account in the preceding period of equal length. The type and id filters are not applied to this value"}}}}}},"400":{"description":"Invalid type, or the given inbox, team or label does not belong to the account"},"404":{"description":"reports not found"},"403":{"description":"Access denied"}}}},"/api/v2/accounts/{account_id}/reports/contacts_csv":{"parameters":[{"$ref":"#/parameters/account_id"}],"get":{"tags":["Reports"],"operationId":"download-contacts-report","summary":"Download contacts report","description":"Download a CSV listing the contacts created within a date range, grouped by month. Each contact row contains the creation date and time, name, email, phone number and the name of the first inbox the contact is associated with. The export is limited to 10,000 contacts.","security":[{"userApiKey":[]}],"produces":["text/csv"],"parameters":[{"in":"query","name":"since","type":"string","required":true,"description":"Unix timestamp (seconds) from which the report starts"},{"in":"query","name":"until","type":"string","required":true,"description":"Unix timestamp (seconds) at which the report ends"},{"in":"query","name":"type","type":"string","enum":["inbox","team","label"],"description":"Restrict the export to the contacts of a specific inbox, team or label. Omit for the whole account"},{"in":"query","name":"id","type":"string","description":"The ID of the inbox, team or label when type is given. Must belong to the account"},{"in":"query","name":"timezone_offset","type":"number","description":"Offset in hours from UTC used to render dates. Defaults to 0"}],"responses":{"200":{"description":"Success. CSV file returned as an attachment named contacts_report.csv","schema":{"type":"string"}},"400":{"description":"Invalid type, the given inbox, team or label does not belong to the account, or more than 10,000 contacts match the filters"},"404":{"description":"reports not found"},"403":{"description":"Access denied"}}}},"/api/v2/accounts/{account_id}/reports/agents":{"parameters":[{"$ref":"#/parameters/account_id"}],"get":{"tags":["Reports"],"operationId":"download-agents-report","summary":"Download agents report","description":"Download a CSV with one row per day and agent within the date range. The first line holds the reported period, followed by a header row and the data rows. Columns are the date, the agent name, the number of conversations, incoming messages, outgoing messages, the average first response time, the average resolution time, the average customer waiting time and the number of resolutions.","security":[{"userApiKey":[]}],"produces":["text/csv"],"parameters":[{"in":"query","name":"since","type":"string","required":true,"description":"Unix timestamp (seconds) from which the report starts"},{"in":"query","name":"until","type":"string","required":true,"description":"Unix timestamp (seconds) at which the report ends"},{"in":"query","name":"business_hours","type":"boolean","description":"Whether the average times are computed only within the configured business hours"},{"in":"query","name":"timezone_offset","type":"number","description":"Offset in hours from UTC used to bucket the data by day. Defaults to 0"}],"responses":{"200":{"description":"Success. CSV file returned as an attachment named agents_report.csv","schema":{"type":"string"}},"404":{"description":"reports not found"},"403":{"description":"Access denied"}}}},"/api/v2/accounts/{account_id}/reports/inboxes":{"parameters":[{"$ref":"#/parameters/account_id"}],"get":{"tags":["Reports"],"operationId":"download-inboxes-report","summary":"Download inboxes report","description":"Download a CSV with one row per day and inbox within the date range. The first line holds the reported period, followed by a header row and the data rows. Columns are the date, the inbox name, the inbox channel type, the number of conversations, incoming messages, outgoing messages, the average first response time, the average resolution time, the average customer waiting time and the number of resolutions.","security":[{"userApiKey":[]}],"produces":["text/csv"],"parameters":[{"in":"query","name":"since","type":"string","required":true,"description":"Unix timestamp (seconds) from which the report starts"},{"in":"query","name":"until","type":"string","required":true,"description":"Unix timestamp (seconds) at which the report ends"},{"in":"query","name":"business_hours","type":"boolean","description":"Whether the average times are computed only within the configured business hours"},{"in":"query","name":"timezone_offset","type":"number","description":"Offset in hours from UTC used to bucket the data by day. Defaults to 0"}],"responses":{"200":{"description":"Success. CSV file returned as an attachment named inboxes_report.csv","schema":{"type":"string"}},"404":{"description":"reports not found"},"403":{"description":"Access denied"}}}},"/api/v2/accounts/{account_id}/reports/labels":{"parameters":[{"$ref":"#/parameters/account_id"}],"get":{"tags":["Reports"],"operationId":"download-labels-report","summary":"Download labels report","description":"Download a CSV with one row per day and label within the date range. The first line holds the reported period, followed by a header row and the data rows. Columns are the date, the label name, the number of conversations, incoming messages, outgoing messages, the average first response time, the average resolution time, the average customer waiting time and the number of resolutions.","security":[{"userApiKey":[]}],"produces":["text/csv"],"parameters":[{"in":"query","name":"since","type":"string","required":true,"description":"Unix timestamp (seconds) from which the report starts"},{"in":"query","name":"until","type":"string","required":true,"description":"Unix timestamp (seconds) at which the report ends"},{"in":"query","name":"business_hours","type":"boolean","description":"Whether the average times are computed only within the configured business hours"},{"in":"query","name":"timezone_offset","type":"number","description":"Offset in hours from UTC used to bucket the data by day. Defaults to 0"}],"responses":{"200":{"description":"Success. CSV file returned as an attachment named labels_report.csv","schema":{"type":"string"}},"404":{"description":"reports not found"},"403":{"description":"Access denied"}}}},"/api/v2/accounts/{account_id}/reports/teams":{"parameters":[{"$ref":"#/parameters/account_id"}],"get":{"tags":["Reports"],"operationId":"download-teams-report","summary":"Download teams report","description":"Download a CSV with one row per day and team within the date range. The first line holds the reported period, followed by a header row and the data rows. Columns are the date, the team name, the number of conversations, incoming messages, outgoing messages, the average first response time, the average resolution time, the average customer waiting time and the number of resolutions.","security":[{"userApiKey":[]}],"produces":["text/csv"],"parameters":[{"in":"query","name":"since","type":"string","required":true,"description":"Unix timestamp (seconds) from which the report starts"},{"in":"query","name":"until","type":"string","required":true,"description":"Unix timestamp (seconds) at which the report ends"},{"in":"query","name":"business_hours","type":"boolean","description":"Whether the average times are computed only within the configured business hours"},{"in":"query","name":"timezone_offset","type":"number","description":"Offset in hours from UTC used to bucket the data by day. Defaults to 0"}],"responses":{"200":{"description":"Success. CSV file returned as an attachment named teams_report.csv","schema":{"type":"string"}},"404":{"description":"reports not found"},"403":{"description":"Access denied"}}}},"/api/v1/accounts/{account_id}/conversations/{conversation_id}/custom_attributes":{"parameters":[{"$ref":"#/parameters/account_id"},{"$ref":"#/parameters/conversation_id"}],"post":{"tags":["Conversations"],"operationId":"conversation-custom-attributes","summary":"Replace conversation custom attributes","description":"Replaces the complete custom_attributes object. Read and merge existing attributes before writing to preserve other keys. Concurrent read-modify-write operations are not atomic.","parameters":[{"name":"data","in":"body","required":true,"schema":{"type":"object","required":["custom_attributes"],"properties":{"custom_attributes":{"type":"object","example":{"numero_pedido":"ERP-2048"}}}}}],"responses":{"200":{"description":"Updated conversation attributes.","schema":{"type":"object","properties":{"custom_attributes":{"type":"object"}}}},"401":{"description":"Unauthorized"},"404":{"description":"Conversation not found"},"422":{"description":"Invalid attributes"}}}}},"definitions":{"bad_request_error":{"title":"data","type":"object","properties":{"description":{"type":"string"},"errors":{"type":"array","items":{"$ref":"#/definitions/request_error"}}}},"request_error":{"type":"object","properties":{"field":{"type":"string"},"message":{"type":"string"},"code":{"type":"string"}}},"generic_id":{"type":"object","properties":{"id":{"type":"number"}}},"canned_response":{"type":"object","properties":{"id":{"type":"integer","description":"ID of the canned response"},"content":{"type":"string","description":"Message content for canned response"},"short_code":{"type":"string","description":"Short Code for quick access of the canned response"},"account_id":{"type":"integer","description":"Account Id"}}},"custom_attribute":{"type":"object","properties":{"id":{"type":"integer","description":"Identifier"},"attribute_display_name":{"type":"string","description":"Attribute display name"},"attribute_display_type":{"type":"string","description":"Attribute display type (text, number, currency, percent, link, date, list, checkbox)"},"attribute_description":{"type":"string","description":"Attribute description"},"attribute_key":{"type":"string","description":"Attribute unique key value"},"attribute_values":{"type":"string","description":"Attribute values"},"default_value":{"type":"string","description":"Attribute default value"},"attribute_model":{"type":"string","description":"Attribute type(conversation_attribute/contact_attribute)"},"account_id":{"type":"integer","description":"Account Id"}}},"automation_rule":{"type":"object","properties":{"event_name":{"type":"string","description":"Automation Rule event, on which we call the actions(conversation_created, conversation_updated, message_created)","enum":["conversation_created","conversation_updated","message_created"],"example":"message_created"},"name":{"type":"string","description":"The name of the rule","example":"Add label on message create event"},"description":{"type":"string","description":"Description to give more context about the rule","example":"Add label support and sales on message create event if incoming message content contains text help"},"active":{"type":"boolean","description":"Enable/disable automation rule"},"actions":{"type":"array","description":"Array of actions which we perform when condition matches","items":{"type":"object","example":{"action_name":"add_label","action_params":["support","sales"]}}},"conditions":{"type":"array","description":"Array of conditions on which conversation/message filter would work","items":{"type":"object","example":{"attribute_key":"content","filter_operator":"contains","values":["help"],"query_operator":"nil"}}},"account_id":{"type":"integer","description":"Account Id"}}},"portal":{"type":"object","properties":{"id":{"type":"integer"},"archived":{"type":"boolean"},"color":{"type":"string"},"config":{"type":"object","description":"Save information about locales, allowed_locales and default portal/help-center locale"},"custom_domain":{"type":"string"},"header_text":{"type":"string","description":"The text content."},"homepage_link":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"page_title":{"type":"string"},"account_id":{"type":"integer"},"categories":{"type":"array","items":{"$ref":"#/definitions/category"}},"articles":{"type":"array","items":{"$ref":"#/definitions/article"}}}},"category":{"type":"object","properties":{"id":{"type":"integer"},"description":{"type":"string","description":"The text content."},"locale":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"position":{"type":"integer"},"portal_id":{"type":"integer"},"account_id":{"type":"integer"},"associated_category_id":{"type":"integer","description":"To associate similar categories to each other, e.g same category of product documentation in different languages"},"parent_category_id":{"type":"integer","description":"To define parent category, e.g product documentation has multiple level features in sales category or in engineering category."}}},"article":{"type":"object","properties":{"id":{"type":"integer"},"content":{"type":"string","description":"The text content."},"meta":{"type":"object"},"position":{"type":"integer"},"status":{"type":"integer","enum":["draft","published","archived"]},"title":{"type":"string"},"slug":{"type":"string"},"views":{"type":"integer"},"portal_id":{"type":"integer"},"account_id":{"type":"integer"},"author_id":{"type":"integer"},"category_id":{"type":"integer"},"folder_id":{"type":"integer"},"associated_article_id":{"type":"integer","description":"To associate similar articles to each other, e.g to provide the link for the reference."}}},"contact":{"type":"object","properties":{"payload":{"type":"object","properties":{"contact":{"type":"object","properties":{"email":{"type":"string","description":"Email address of the contact"},"name":{"type":"string","description":"The name of the contact"},"phone_number":{"type":"string","description":"Phone number of the contact"},"thumbnail":{"type":"string","description":"Avatar URL of the contact"},"additional_attributes":{"type":"object","description":"The object containing additional attributes related to the contact"},"custom_attributes":{"type":"object","description":"The object to save custom attributes for contact, accepts custom attributes key and value","example":{"attribute_key":"attribute_value","signed_up_at":"dd/mm/yyyy"}},"contact_inboxes":{"type":"array","items":{"$ref":"#/definitions/contact_inboxes"}}}}}}}},"conversation":{"type":"object","properties":{"id":{"type":"number","description":"Public conversation ID, scoped to the account. Use this ID in account API routes."},"messages":{"type":"array","items":{"$ref":"#/definitions/message"}},"account_id":{"type":"number","description":"Account Id"},"inbox_id":{"type":"number","description":"ID of the inbox"},"status":{"type":"string","enum":["open","resolved","pending","snoozed"],"description":"The status of the conversation"},"timestamp":{"type":"integer","description":"Last activity time as epoch seconds."},"created_at":{"type":"integer","description":"Creation time as epoch seconds."},"last_activity_at":{"type":"integer","description":"Last activity time as epoch seconds."},"history_revision":{"type":"string","description":"Opaque history revision when supported. Compare equality; it is not a pagination cursor."},"can_reply":{"type":"boolean"},"labels":{"type":"array","items":{"type":"string"}},"priority":{"type":"string","x-nullable":true,"enum":["urgent","high","medium","low"]},"contact_last_seen_at":{"type":"integer"},"agent_last_seen_at":{"type":"integer"},"unread_count":{"type":"number","description":"The number of unread messages"},"additional_attributes":{"type":"object","description":"Additional attributes of the conversation (browser info, referer, ad origin, etc.)","properties":{"referer":{"type":"string","description":"Page URL the conversation started from (website channel)"},"meta_referral":{"type":"object","description":"Current Meta referral, when captured. Native WhatsApp Cloud captures it on new conversations; native Messenger and Instagram can replace it when a different ad is clicked on the same conversation. It is not a complete click history. Keys that Meta did not send are omitted. WhatsApp adds ctwa_clid, source_url, media_type, body and thumbnail_url; Messenger and Instagram add ref, type, channel, psid/igsid and page_id/ig_account_id.","properties":{"source_type":{"type":"string","description":"`ad` for ads; otherwise the lower-cased Meta source (`post`, `shortlink`, ...)"},"source_id":{"type":"string","description":"Meta ad id (or post id)"},"headline":{"type":"string","description":"Ad headline / title"},"body":{"type":"string","description":"Ad body text (WhatsApp)"},"source_url":{"type":"string","description":"URL of the ad or post (WhatsApp)"},"ctwa_clid":{"type":"string","description":"Click-to-WhatsApp click id, usable for Conversions API attribution (WhatsApp)"},"media_type":{"type":"string","description":"`image` or `video` (WhatsApp)"},"image_url":{"type":"string"},"video_url":{"type":"string"},"thumbnail_url":{"type":"string","description":"WhatsApp only"},"ref":{"type":"string","description":"`ref` parameter of the ad or m.me link (Messenger / Instagram)"},"type":{"type":"string","description":"`OPEN_THREAD` (Messenger / Instagram)"},"channel":{"type":"string","description":"`messenger` or `instagram`"},"psid":{"type":"string","description":"Page-scoped id of the sender (Messenger)"},"page_id":{"type":"string","description":"Facebook page id (Messenger)"},"igsid":{"type":"string","description":"Instagram-scoped id of the sender (Instagram)"},"ig_account_id":{"type":"string","description":"Instagram account id (Instagram)"},"captured_at":{"type":"string","description":"ISO 8601 timestamp of when the referral was stored"}}}}},"custom_attributes":{"type":"object","description":"The object to save custom attributes for conversation, accepts custom attributes key and value","example":{"attribute_key":"attribute_value","priority_conversation_number":3}}}},"message":{"type":"object","properties":{"content":{"type":"string","description":"The text content of the message"},"content_type":{"type":"string","enum":["text","input_select","cards","form"],"description":"The type of the template message"},"content_attributes":{"type":"object","description":"The content attributes for each content_type"},"message_type":{"type":"integer","enum":[0,1,2,3],"description":"REST response: 0 incoming, 1 outgoing, 2 activity, 3 template. Message webhooks use strings instead."},"created_at":{"type":"integer","description":"The time at which message was created"},"private":{"type":"boolean","description":"The flags which shows whether the message is private or not"},"status":{"type":"string","enum":["sent","delivered","read","failed"],"description":"Delivery status reported by the channel; creation success is not proof of delivery."},"attachments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"file_type":{"type":"string"},"data_url":{"type":"string"},"thumb_url":{"type":"string"}}}},"sender":{"type":"object","description":"User/Agent/AgentBot object"},"conversation_id":{"type":"number","description":"ID of the conversation"}}},"user":{"type":"object","properties":{"id":{"type":"number"},"uid":{"type":"string"},"name":{"type":"string"},"available_name":{"type":"string"},"display_name":{"type":"string"},"email":{"type":"string"},"account_id":{"type":"number"},"role":{"type":"string","enum":["agent","administrator"]},"confirmed":{"type":"boolean"},"custom_attributes":{"type":"object","description":"Available for users who are created through platform APIs and has custom attributes associated."},"accounts":{"type":"array","items":{"$ref":"#/definitions/account"}}}},"agent":{"type":"object","properties":{"id":{"type":"integer"},"uid":{"type":"string"},"name":{"type":"string"},"available_name":{"type":"string"},"display_name":{"type":"string"},"email":{"type":"string"},"account_id":{"type":"integer"},"role":{"type":"string","enum":["agent","administrator"]},"confirmed":{"type":"boolean"},"availability_status":{"type":"string","enum":["available","busy","offline"],"description":"The availability status of the agent computed by the platform."},"auto_offline":{"type":"boolean","description":"Whether the availability status of agent is configured to go offline automatically when away."},"custom_attributes":{"type":"object","description":"Available for users who are created through platform APIs and has custom attributes associated."}}},"inbox":{"type":"object","properties":{"id":{"type":"number","description":"ID of the inbox"},"name":{"type":"string","description":"The name of the inbox"},"website_url":{"type":"string","description":"Website URL"},"channel_type":{"type":"string","description":"The type of the inbox"},"avatar_url":{"type":"string","description":"The avatar image of the inbox"},"widget_color":{"type":"string","description":"Widget Color used for customization of the widget"},"website_token":{"type":"string","description":"Website Token"},"enable_auto_assignment":{"type":"boolean","description":"The flag which shows whether Auto Assignment is enabled or not"},"web_widget_script":{"type":"string","description":"Script used to load the website widget"},"welcome_title":{"type":"string","description":"Welcome title to be displayed on the widget"},"welcome_tagline":{"type":"string","description":"Welcome tagline to be displayed on the widget"},"greeting_enabled":{"type":"boolean","description":"The flag which shows whether greeting is enabled"},"greeting_message":{"type":"string","description":"A greeting message when the user starts the conversation"}}},"agent_bot":{"type":"object","properties":{"id":{"type":"number","description":"ID of the agent bot"},"name":{"type":"string","description":"The name of the agent bot"},"description":{"type":"string","description":"The description about the agent bot"},"account_id":{"type":"number","description":"Account ID if it's an account specific bot"},"outgoing_url":{"type":"string","description":"The webhook URL for the bot"}}},"contact_inboxes":{"type":"object","properties":{"source_id":{"type":"string","description":"Contact Inbox Source Id"},"inbox":{"$ref":"#/definitions/inbox"}}},"contactable_inboxes":{"type":"object","properties":{"source_id":{"type":"string","description":"Contact Inbox Source Id"},"inbox":{"$ref":"#/definitions/inbox"}}},"custom_filter":{"type":"object","properties":{"id":{"type":"number","description":"The ID of the custom filter"},"name":{"type":"string","description":"The name of the custom filter"},"type":{"type":"string","enum":["conversation","contact","report"],"description":"The description about the custom filter"},"query":{"type":"object","description":"A query that needs to be saved as a custom filter"},"created_at":{"type":"string","format":"date-time","description":"The time at which the custom filter was created"},"updated_at":{"type":"string","format":"date-time","description":"The time at which the custom filter was updated"}}},"webhook":{"type":"object","properties":{"id":{"type":"number","description":"The ID of the webhook"},"url":{"type":"string","description":"The url to which the events will be send"},"subscriptions":{"type":"array","items":{"type":"string","enum":["conversation_created","conversation_status_changed","conversation_updated","contact_created","contact_updated","message_created","message_updated","webwidget_triggered"]},"description":"The list of subscribed events"},"account_id":{"type":"number","description":"The id of the account which the webhook object belongs to"}}},"account":{"type":"object","properties":{"id":{"type":"number","description":"Account ID"},"name":{"type":"string","description":"Name of the account"},"role":{"type":"string","enum":["administrator","agent"],"description":"The user role in the account"}}},"platform_account":{"type":"object","properties":{"id":{"type":"number","description":"Account ID"},"name":{"type":"string","description":"Name of the account"}}},"team":{"type":"object","properties":{"id":{"type":"number","description":"The ID of the team"},"name":{"type":"string","description":"The name of the team"},"description":{"type":"string","description":"The description about the team"},"allow_auto_assign":{"type":"boolean","description":"If this setting is turned on, the system would automatically assign the conversation to an agent in the team while assigning the conversation to a team"},"account_id":{"type":"number","description":"The ID of the account with the team is a part of"},"is_member":{"type":"boolean","description":"This field shows whether the current user is a part of the team"}}},"integrations_app":{"type":"object","properties":{"id":{"type":"string","description":"The ID of the integration"},"name":{"type":"string","description":"The name of the integration"},"description":{"type":"string","description":"The description about the team"},"hook_type":{"type":"string","description":"Whether the integration is an account or inbox integration"},"enabled":{"type":"boolean","description":"Whether the integration is enabled for the account"},"allow_multiple_hooks":{"type":"boolean","description":"Whether multiple hooks can be created for the integration"},"hooks":{"type":"array","items":{"type":"object"},"description":"If there are any hooks created for this integration"}}},"integrations_hook":{"type":"object","properties":{"id":{"type":"string","description":"The ID of the integration hook"},"app_id":{"type":"string","description":"The ID of the integration app"},"inbox_id":{"type":"string","description":"Inbox ID if its an Inbox integration"},"account_id":{"type":"string","description":"Account ID of the integration"},"status":{"type":"boolean","description":"Whether the integration hook is enabled for the account"},"hook_type":{"type":"boolean","description":"Whether its an account or inbox integration hook"},"settings":{"type":"object","description":"The associated settings for the integration"}}},"public_contact":{"type":"object","properties":{"id":{"type":"integer","description":"Id of the contact"},"source_id":{"type":"string","description":"The session identifier of the contact"},"name":{"type":"string","description":"Name of the contact"},"email":{"type":"string","description":"Email of the contact"},"pubsub_token":{"type":"string","description":"The token to be used to connect to the websocket"}}},"public_conversation":{"type":"object","properties":{"id":{"type":"integer","description":"Id of the conversation"},"inbox_id":{"type":"string","description":"The inbox id of the conversation"},"messages":{"type":"array","items":{"$ref":"#/definitions/message"},"description":"Messages in the conversation"},"contact":{"type":"object","description":"The contact information associated to the conversation"}}},"public_message":{"type":"object","properties":{"id":{"type":"string","description":"Id of the message"},"content":{"type":"string","description":"Text content of the message"},"message_type":{"type":"string","description":"Denotes the message type"},"content_type":{"type":"string","description":"Content type of the message"},"content_attributes":{"type":"string","description":"Additional content attributes of the message"},"created_at":{"type":"string","description":"Created at time stamp of the message"},"conversation_id":{"type":"string","description":"Conversation Id of the message"},"attachments":{"type":"array","items":{"type":"object"},"description":"Attachments if any"},"sender":{"type":"object","description":"Details of the sender"}}},"public_inbox":{"type":"object","properties":{"identifier":{"type":"string","description":"Inbox identifier"},"name":{"type":"string","description":"Name of the inbox"},"timezone":{"type":"string","description":"The timezone defined on the inbox"},"working_hours":{"type":"array","description":"The working hours defined on the inbox","items":{"type":"object","properties":{"day_of_week":{"type":"integer","description":"Day of the week as a number. Sunday -\u003e 0, Saturday -\u003e 6"},"open_all_day":{"type":"boolean","description":"Whether or not the business is open the whole day"},"closed_all_day":{"type":"boolean","description":"Whether or not the business is closed the whole day"},"open_hour":{"type":"integer","description":"Opening hour. Can be null if closed all day"},"open_minutes":{"type":"integer","description":"Opening minute. Can be null if closed all day"},"close_hour":{"type":"integer","description":"Closing hour. Can be null if closed all day"},"close_minutes":{"type":"integer","description":"Closing minute. Can be null if closed all day"}}}},"working_hours_enabled":{"type":"boolean","description":"Whether of not the working hours are enabled on the inbox"},"csat_survey_enabled":{"type":"boolean","description":"Whether of not the Customer Satisfaction survey is enabled on the inbox"},"greeting_enabled":{"type":"boolean","description":"Whether of not the Greeting Message is enabled on the inbox"},"identity_validation_enabled":{"type":"boolean","description":"Whether of not the User Identity Validation is enforced on the inbox"}}},"account_create_update_payload":{"type":"object","properties":{"name":{"type":"string","description":"Name of the account"}}},"agent_bot_create_update_payload":{"type":"object","properties":{"name":{"type":"string","description":"The name of the agent bot"},"description":{"type":"string","description":"The description about the agent bot"},"outgoing_url":{"type":"string","description":"The webhook URL for the bot"}}},"user_create_update_payload":{"type":"object","properties":{"name":{"type":"string","description":"Name of the user"},"email":{"type":"string","description":"Email of the user"},"password":{"type":"string","description":"Password must contain uppercase, lowercase letters, number and a special character"},"custom_attributes":{"type":"object","description":"Custom attributes you want to associate with the user"}}},"canned_response_create_update_payload":{"type":"object","properties":{"content":{"type":"string","description":"Message content for canned response"},"short_code":{"type":"string","description":"Short Code for quick access of the canned response"}}},"custom_attribute_create_update_payload":{"type":"object","properties":{"attribute_display_name":{"type":"string","description":"Attribute display name"},"attribute_display_type":{"type":"integer","description":"Attribute display type (text- 0, number- 1, currency- 2, percent- 3, link- 4, date- 5, list- 6, checkbox- 7)"},"attribute_description":{"type":"string","description":"Attribute description"},"attribute_key":{"type":"string","description":"Attribute unique key value"},"attribute_values":{"type":"array","description":"Attribute values","items":{"type":"string"}},"attribute_model":{"type":"integer","description":"Attribute type(conversation_attribute- 0, contact_attribute- 1)"}}},"contact_create":{"type":"object","required":["inbox_id"],"properties":{"inbox_id":{"type":"number"},"name":{"type":"string","description":"name of the contact"},"email":{"type":"string","description":"email of the contact"},"phone_number":{"type":"string","description":"phone number of the contact"},"avatar":{"type":"string","format":"binary","description":"Send the form data with the avatar image binary or use the avatar_url"},"avatar_url":{"type":"string","description":"The url to a jpeg, png file for the contact avatar"},"identifier":{"type":"string","description":"A unique identifier for the contact in external system"},"custom_attributes":{"type":"object","description":"An object where you can store custom attributes for contact. example {\"type\":\"customer\", \"age\":30}"}}},"contact_update":{"type":"object","properties":{"name":{"type":"string","description":"name of the contact"},"email":{"type":"string","description":"email of the contact"},"phone_number":{"type":"string","description":"phone number of the contact"},"avatar":{"type":"string","format":"binary","description":"Send the form data with the avatar image binary or use the avatar_url"},"avatar_url":{"type":"string","description":"The url to a jpeg, png file for the contact avatar"},"identifier":{"type":"string","description":"A unique identifier for the contact in external system"},"custom_attributes":{"type":"object","description":"An object where you can store custom attributes for contact. example {\"type\":\"customer\", \"age\":30}"}}},"conversation_message_create":{"type":"object","required":["content"],"properties":{"content":{"type":"string","description":"The content of the message"},"message_type":{"type":"string","enum":["outgoing","incoming"]},"private":{"type":"boolean","description":"Flag to identify if it is a private note"},"content_type":{"type":"string","enum":["text","input_email","cards","input_select","form","article"],"example":"cards","description":"if you want to create custom message types"},"content_attributes":{"type":"object","description":"attributes based on your content type"},"template_params":{"type":"object","description":"The template params for the message in case of whatsapp Channel","properties":{"name":{"type":"string","description":"Name of the template","example":"sample_issue_resolution"},"category":{"type":"string","description":"Category of the template","example":"UTILITY"},"language":{"type":"string","description":"Language of the template","example":"en_US"},"processed_params":{"type":"object","description":"The processed param values for template variables in template","example":{"1":"Example"}}}}}},"team_create_update_payload":{"type":"object","properties":{"name":{"type":"string","description":"The name of the team"},"description":{"type":"string","description":"The description of the team"},"allow_auto_assign":{"type":"boolean","description":"If this setting is turned on, the system would automatically assign the conversation to an agent in the team while assigning the conversation to a team"}}},"custom_filter_create_update_payload":{"type":"object","properties":{"name":{"type":"string","description":"The name of the custom filter"},"type":{"type":"string","enum":["conversation","contact","report"],"description":"The description about the custom filter"},"query":{"type":"object","description":"A query that needs to be saved as a custom filter"}}},"webhook_create_update_payload":{"type":"object","required":["webhook"],"properties":{"webhook":{"type":"object","description":"Required wrapper for both create and update requests. Create requires url and subscriptions.","properties":{"url":{"type":"string","description":"HTTPS URL of your event receiver."},"subscriptions":{"type":"array","minItems":1,"items":{"type":"string","enum":["conversation_created","conversation_status_changed","conversation_updated","message_created","message_updated","contact_created","contact_updated","inbox_created","inbox_updated","webwidget_triggered"]}}}}}},"integrations_hook_create_payload":{"type":"object","properties":{"app_id":{"type":"string","description":"The ID of app for which integration hook is being created"},"inbox_id":{"type":"string","description":"The inbox ID, if the hook is an inbox hook"},"settings":{"type":"object","description":"The settings required by the integration"}}},"integrations_hook_update_payload":{"type":"object","properties":{"settings":{"type":"object","description":"The settings required by the integration"}}},"automation_rule_create_update_payload":{"type":"object","properties":{"name":{"type":"string","description":"Rule name","example":"Add label on message create event"},"description":{"type":"string","description":"The description about the automation and actions","example":"Add label support and sales on message create event if incoming message content contains text help"},"event_name":{"type":"string","enum":["conversation_created","conversation_updated","message_created"],"example":"message_created","description":"The event when you want to execute the automation actions"},"active":{"type":"boolean","description":"Enable/disable automation rule"},"actions":{"type":"array","description":"Array of actions which you want to perform when condition matches, e.g add label support if message contains content help.","items":{"type":"object","example":{"action_name":"add_label","action_params":["support"]}}},"conditions":{"type":"array","description":"Array of conditions on which conversation filter would work, e.g message content contains text help.","items":{"type":"object","example":{"attribute_key":"content","filter_operator":"contains","query_operator":"nil","values":["help"]}}}}},"portal_create_update_payload":{"type":"object","properties":{"archived":{"type":"boolean","description":"Status to check if portal is live"},"color":{"type":"string","description":"Header color for help-center","example":"add color HEX string, \"#fffff\""},"config":{"type":"object","description":"Configuration about supporting locales","example":{"allowed_locales":["en","es"],"default_locale":"en"}},"custom_domain":{"type":"string","description":"Custom domain to  display help center.","example":"https://help.example.com/."},"header_text":{"type":"string","description":"Help center header","example":"Handbook"},"homepage_link":{"type":"string","description":"link to main dashboard","example":"https://www.example.com/"},"name":{"type":"string","description":"Name for the portal"},"slug":{"type":"string","description":"Slug for the portal to display in link"},"page_title":{"type":"string","description":"Page title for the portal"},"account_id":{"type":"integer"}}},"category_create_update_payload":{"type":"object","properties":{"description":{"type":"string","description":"Category description"},"locale":{"type":"string","description":"Category locale","example":"en/es"},"name":{"type":"string","description":"Category name"},"slug":{"type":"string","description":"Category slug"},"position":{"type":"integer","description":"Category position in the portal list to sort"},"portal_id":{"type":"integer"},"account_id":{"type":"integer"},"associated_category_id":{"type":"integer","description":"To associate similar categories to each other, e.g same category of product documentation in different languages"},"parent_category_id":{"type":"integer","description":"To define parent category, e.g product documentation has multiple level features in sales category or in engineering category."}}},"article_create_update_payload":{"type":"object","properties":{"content":{"type":"string","description":"The text content."},"meta":{"type":"object","description":"Use for search","example":{"tags":["article_name"],"title":"article title","description":"article description"}},"position":{"type":"integer","description":"article position in category"},"status":{"type":"integer","example":["draft","published","archived"]},"title":{"type":"string"},"slug":{"type":"string"},"views":{"type":"integer"},"portal_id":{"type":"integer"},"account_id":{"type":"integer"},"author_id":{"type":"integer"},"category_id":{"type":"integer"},"folder_id":{"type":"integer"},"associated_article_id":{"type":"integer","description":"To associate similar articles to each other, e.g to provide the link for the reference."}}},"public_contact_create_update_payload":{"type":"object","properties":{"identifier":{"type":"string","description":"External identifier of the contact"},"identifier_hash":{"type":"string","description":"Identifier hash prepared for HMAC authentication"},"email":{"type":"string","description":"Email of the contact"},"name":{"type":"string","description":"Name of the contact"},"phone_number":{"type":"string","description":"Phone number of the contact"},"avatar_url":{"type":"string","description":"The url to a jpeg, png file for the user avatar"},"custom_attributes":{"type":"object","description":"Custom attributes of the customer"}}},"public_message_create_payload":{"type":"object","properties":{"content":{"type":"string","description":"Content for the message"},"echo_id":{"type":"string","description":"Temporary identifier which will be passed back via websockets"}}},"public_message_update_payload":{"type":"object","properties":{"submitted_values":{"type":"object","description":"Replies to the Bot Message Types"}}},"public_conversation_create_payload":{"type":"object","properties":{"custom_attributes":{"type":"object","description":"Custom attributes of the conversation"}}},"extended_contact":{"allOf":[{"$ref":"#/definitions/contact"},{"type":"object","properties":{"id":{"type":"number","description":"Id of the user"},"availability_status":{"type":"string","enum":["online","offline"],"description":"Availability status of the user"}}}]},"contact_base":{"allOf":[{"$ref":"#/definitions/generic_id"},{"$ref":"#/definitions/contact"}]},"contact_list":{"type":"array","description":"array of contacts","items":{"allOf":[{"$ref":"#/definitions/generic_id"},{"$ref":"#/definitions/contact"}]}},"contact_conversations":{"type":"array","description":"array of conversations","items":{"allOf":[{"$ref":"#/definitions/conversation"},{"type":"object","properties":{"meta":{"type":"object","properties":{"channel":{"type":"string","description":"Channel type of the conversation inbox."},"sender":{"type":"object","properties":{"id":{"type":"number","description":"ID fo the sender"},"name":{"type":"string","description":"The name of the sender"},"thumbnail":{"type":"string","description":"Avatar URL of the contact"}}},"assignee":{"$ref":"#/definitions/user"}}}}},{"type":"object","properties":{"display_id":{"type":"number"}}}]}},"contact_labels":{"type":"object","properties":{"payload":{"type":"array","description":"Array of labels","items":{"type":"string"}}}},"conversation_list":{"type":"object","properties":{"data":{"type":"object","properties":{"meta":{"type":"object","properties":{"mine_count":{"type":"number"},"unassigned_count":{"type":"number"},"assigned_count":{"type":"number"},"all_count":{"type":"number"}}},"payload":{"type":"array","description":"array of conversations","items":{"allOf":[{"$ref":"#/definitions/generic_id"},{"$ref":"#/definitions/conversation"},{"type":"object","properties":{"meta":{"type":"object","properties":{"channel":{"type":"string","description":"Channel type of the conversation inbox."},"sender":{"type":"object","properties":{"id":{"type":"number","description":"ID fo the sender"},"name":{"type":"string","description":"The name of the sender"},"thumbnail":{"type":"string","description":"Avatar URL of the contact"}}},"assignee":{"$ref":"#/definitions/user"}}}}}]}}}}}},"conversation_show":{"type":"object","allOf":[{"$ref":"#/definitions/conversation"},{"type":"object","properties":{"meta":{"type":"object","properties":{"channel":{"type":"string","description":"Channel type of the conversation inbox."},"sender":{"type":"object","properties":{"id":{"type":"number","description":"ID fo the sender"},"name":{"type":"string","description":"The name of the sender"},"thumbnail":{"type":"string","description":"Avatar URL of the contact"}}},"assignee":{"$ref":"#/definitions/user"}}}}}]},"conversation_status_toggle":{"type":"object","properties":{"meta":{"type":"object"},"payload":{"type":"object","properties":{"success":{"type":"boolean"},"current_status":{"type":"string","enum":["open","resolved"]},"conversation_id":{"type":"number"}}}}},"conversation_labels":{"type":"object","properties":{"payload":{"type":"array","description":"Array of labels","items":{"type":"string"}}}},"account_summary":{"type":"object","properties":{"avg_first_response_time":{"type":"string"},"avg_resolution_time":{"type":"string"},"conversations_count":{"type":"number"},"incoming_messages_count":{"type":"number"},"outgoing_messages_count":{"type":"number"},"resolutions_count":{"type":"number"},"previous":{"type":"object","properties":{"avg_first_response_time":{"type":"string"},"avg_resolution_time":{"type":"string"},"conversations_count":{"type":"number"},"incoming_messages_count":{"type":"number"},"outgoing_messages_count":{"type":"number"},"resolutions_count":{"type":"number"}}}}},"agent_conversation_metrics":{"type":"object","properties":{"id":{"type":"number"},"name":{"type":"string"},"email":{"type":"string"},"thumbnail":{"type":"string"},"availability":{"type":"string"},"metric":{"type":"object","properties":{"open":{"type":"number"},"unattended":{"type":"number"}}}}},"note":{"type":"object","properties":{"id":{"type":"integer","description":"The ID of the note"},"content":{"type":"string","description":"The text content of the note"},"account_id":{"type":"integer","description":"The ID of the account the note belongs to"},"contact_id":{"type":"integer","description":"The ID of the contact the note is attached to"},"user":{"$ref":"#/definitions/agent"},"created_at":{"type":"integer","description":"Unix timestamp of when the note was created"},"updated_at":{"type":"integer","description":"Unix timestamp of when the note was last updated"}}},"label":{"type":"object","properties":{"id":{"type":"integer","description":"The ID of the label"},"title":{"type":"string","description":"The title of the label. Stored in lowercase; only letters, numbers, hyphens and underscores are allowed"},"description":{"type":"string","description":"A description of the label"},"color":{"type":"string","description":"The hex color code of the label"},"show_on_sidebar":{"type":"boolean","description":"Whether the label is shown in the conversation sidebar"}}},"macro":{"type":"object","properties":{"id":{"type":"integer","description":"The ID of the macro"},"name":{"type":"string","description":"The name of the macro"},"visibility":{"type":"string","enum":["personal","global"],"description":"Whether the macro is visible only to its author or to everyone in the account"},"created_by":{"$ref":"#/definitions/agent"},"updated_by":{"$ref":"#/definitions/agent"},"account_id":{"type":"integer","description":"The ID of the account the macro belongs to"},"actions":{"type":"array","description":"Ordered list of actions executed when the macro runs","items":{"type":"object","properties":{"action_name":{"type":"string","enum":["send_message","add_label","assign_team","assign_agent","mute_conversation","change_status","remove_label","remove_assigned_team","send_webhook_event","resolve_conversation","snooze_conversation","change_priority","send_email_transcript","send_attachment","add_private_note"],"description":"The action to perform"},"action_params":{"type":"array","description":"Parameters for the action (for example the label titles, the team ID, the message text)","items":{"type":"string"}}}}},"files":{"type":"array","description":"Attachments used by send_attachment actions. Only present when the macro has files","items":{"type":"object","properties":{"id":{"type":"integer"},"macro_id":{"type":"integer"},"file_type":{"type":"string"},"account_id":{"type":"integer"},"file_url":{"type":"string"},"blob_id":{"type":"integer"},"filename":{"type":"string"}}}}}},"csat_survey_response":{"type":"object","properties":{"id":{"type":"integer","description":"The ID of the survey response"},"rating":{"type":"integer","description":"The rating given by the contact (1 to 5)"},"feedback_message":{"type":"string","description":"The optional free-text feedback left by the contact"},"account_id":{"type":"integer","description":"The ID of the account"},"message_id":{"type":"integer","description":"The ID of the survey message the response belongs to"},"contact":{"$ref":"#/definitions/contact"},"conversation_id":{"type":"integer","description":"The display ID of the conversation the survey was sent in"},"assigned_agent":{"$ref":"#/definitions/agent"},"created_at":{"type":"integer","description":"Unix timestamp of when the response was recorded"}}},"applied_sla":{"type":"object","properties":{"id":{"type":"integer","description":"The ID of the applied SLA"},"sla_id":{"type":"integer","description":"The ID of the SLA policy applied to the conversation"},"sla_status":{"type":"string","enum":["active","hit","missed","active_with_misses"],"description":"The current status of the SLA on the conversation"},"created_at":{"type":"integer","description":"Unix timestamp of when the SLA was applied"},"updated_at":{"type":"integer","description":"Unix timestamp of when the applied SLA was last updated"},"sla_description":{"type":"string","description":"The description of the SLA policy"},"sla_name":{"type":"string","description":"The name of the SLA policy"},"sla_first_response_time_threshold":{"type":"number","description":"First response time threshold of the policy, in seconds"},"sla_next_response_time_threshold":{"type":"number","description":"Next response time threshold of the policy, in seconds"},"sla_only_during_business_hours":{"type":"boolean","description":"Whether the thresholds are measured only during business hours"},"sla_resolution_time_threshold":{"type":"number","description":"Resolution time threshold of the policy, in seconds"}}},"sla_event":{"type":"object","properties":{"id":{"type":"integer","description":"The ID of the SLA event"},"event_type":{"type":"string","enum":["frt","nrt","rt"],"description":"The threshold that was breached. frt = first response time, nrt = next response time, rt = resolution time"},"meta":{"type":"object","description":"Additional data about the breach"},"created_at":{"type":"integer","description":"Unix timestamp of when the event was recorded"},"updated_at":{"type":"integer","description":"Unix timestamp of when the event was last updated"}}},"bot_summary":{"type":"object","properties":{"bot_resolutions_count":{"type":"number","description":"Number of conversations resolved by a bot in the period"},"bot_handoffs_count":{"type":"number","description":"Number of conversations handed off from a bot to a human agent in the period"},"previous":{"type":"object","description":"The same metrics for the period immediately preceding the requested one, with the same duration","properties":{"bot_resolutions_count":{"type":"number"},"bot_handoffs_count":{"type":"number"}}}}},"pipeline":{"type":"object","properties":{"id":{"type":"number","description":"The ID of the pipeline"},"account_id":{"type":"number","description":"The ID of the account the pipeline belongs to"},"name":{"type":"string","description":"The name of the pipeline"},"description":{"type":"string","description":"The description of the pipeline"},"pipeline_type":{"type":"string","enum":["sales","support","onboarding","custom"],"description":"The type of the pipeline. Sales pipelines are created with a default set of stages"},"is_default":{"type":"boolean","description":"Whether this is the default pipeline of the account. Only one pipeline per account can be the default"},"is_active":{"type":"boolean","description":"Whether the pipeline is active. Inactive pipelines are not returned by the list endpoint"},"auto_add_contacts":{"type":"boolean","description":"Whether new contacts are automatically added to this pipeline"},"config":{"type":"object","description":"Free-form configuration object for the pipeline"},"created_by_id":{"type":"number","description":"The ID of the user who created the pipeline"},"updated_by_id":{"type":"number","description":"The ID of the user who last updated the pipeline"},"created_at":{"type":"string","format":"date-time","description":"The time at which the pipeline was created"},"updated_at":{"type":"string","format":"date-time","description":"The time at which the pipeline was last updated"}}},"pipeline_stage":{"type":"object","properties":{"id":{"type":"number","description":"The ID of the stage"},"pipeline_id":{"type":"number","description":"The ID of the pipeline the stage belongs to"},"name":{"type":"string","description":"The name of the stage"},"description":{"type":"string","description":"The description of the stage"},"color":{"type":"string","description":"Hex color of the stage, e.g. \"#3498db\""},"icon":{"type":"string","description":"Icon identifier of the stage"},"position":{"type":"integer","description":"The position of the stage within the pipeline (1-based, unique per pipeline)"},"probability":{"type":"string","description":"Win probability of the stage as a decimal between 0 and 100 (serialized as a string, e.g. \"50.0\")"},"stage_type":{"type":"string","enum":["lead","qualified","proposal","negotiation","won","lost","custom"],"description":"The type of the stage"},"is_win_stage":{"type":"boolean","description":"Whether contacts in this stage are considered won"},"is_lose_stage":{"type":"boolean","description":"Whether contacts in this stage are considered lost"},"is_active":{"type":"boolean","description":"Whether the stage is active"},"sla_hours":{"type":"integer","description":"Maximum number of hours a contact is expected to stay in the stage"},"entry_actions":{"type":"object","description":"Automation actions triggered when a contact enters the stage"},"exit_actions":{"type":"object","description":"Automation actions triggered when a contact leaves the stage"},"time_based_actions":{"type":"object","description":"Automation actions triggered after a contact has spent a given time in the stage"},"auto_move_conditions":{"type":"object","description":"Conditions under which contacts are moved automatically out of the stage"},"required_fields":{"type":"array","items":{"type":"string"},"description":"Contact fields that must be present to enter the stage"},"custom_fields_schema":{"type":"array","items":{"type":"object"},"description":"Schema of the custom fields captured for contacts in the stage"},"created_at":{"type":"string","format":"date-time","description":"The time at which the stage was created"},"updated_at":{"type":"string","format":"date-time","description":"The time at which the stage was last updated"}}},"contact_stage":{"type":"object","description":"A record of a contact being placed in a pipeline stage. Only one record per contact and pipeline is active at a time","properties":{"id":{"type":"number","description":"The ID of the contact stage record"},"contact_id":{"type":"number","description":"The ID of the contact"},"pipeline_stage_id":{"type":"number","description":"The ID of the pipeline stage"},"entered_at":{"type":"string","format":"date-time","description":"The time at which the contact entered the stage"},"exited_at":{"type":"string","format":"date-time","description":"The time at which the contact left the stage, null while active"},"is_active":{"type":"boolean","description":"Whether this is the current stage of the contact in its pipeline"},"is_stuck":{"type":"boolean","description":"Whether the contact has been flagged as stuck in this stage"},"stuck_reason":{"type":"string","description":"The reason given when the contact was flagged as stuck"},"move_reason":{"type":"string","description":"The reason for the move into this stage"},"notes":{"type":"string","description":"Notes attached when the contact was moved into the stage"},"custom_field_values":{"type":"object","description":"Values of the stage custom fields for this contact"},"entered_from_stage_id":{"type":"number","description":"The ID of the stage the contact came from, if any"},"exited_to_stage_id":{"type":"number","description":"The ID of the stage the contact moved to, if any"},"moved_by_id":{"type":"number","description":"The ID of the user who moved the contact into the stage"},"created_at":{"type":"string","format":"date-time","description":"The time at which the record was created"},"updated_at":{"type":"string","format":"date-time","description":"The time at which the record was last updated"}}},"stage_transition":{"type":"object","description":"An entry of the stage history of a contact within a pipeline","properties":{"id":{"type":"number","description":"The ID of the transition"},"contact_id":{"type":"number","description":"The ID of the contact"},"pipeline_id":{"type":"number","description":"The ID of the pipeline"},"from_stage_id":{"type":"number","description":"The ID of the previous stage, null when the contact entered the pipeline"},"to_stage_id":{"type":"number","description":"The ID of the stage the contact moved to"},"transitioned_by_id":{"type":"number","description":"The ID of the user who performed the move, null for automated moves"},"trigger_type":{"type":"string","enum":["manual","automation","api","import","bulk","webhook","scheduled"],"description":"What triggered the transition"},"trigger_details":{"type":"object","description":"Additional details about the trigger"},"transitioned_at":{"type":"string","format":"date-time","description":"The time at which the transition happened"},"time_in_previous_stage":{"type":"string","description":"Time spent in the previous stage, as a PostgreSQL interval"},"total_pipeline_time":{"type":"string","description":"Total time spent in the pipeline up to this transition, as a PostgreSQL interval"},"notes":{"type":"string","description":"Notes attached to the transition"},"metadata":{"type":"object","description":"Free-form metadata"},"opportunity_id":{"type":"number","description":"The ID of the related opportunity, if any"},"conversation_id":{"type":"number","description":"The ID of the related conversation, if any"},"message_id":{"type":"number","description":"The ID of the related message, if any"},"automation_rule_id":{"type":"number","description":"The ID of the automation rule that triggered the move, if any"},"from_stage":{"$ref":"#/definitions/pipeline_stage"},"to_stage":{"$ref":"#/definitions/pipeline_stage"},"transitioned_by":{"type":"object","description":"The user who performed the move, null for automated moves"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"pipeline_contact":{"type":"object","description":"A contact as rendered on a pipeline board, including its position in the stage and the assignment of its most relevant conversation","properties":{"id":{"type":"number","description":"The ID of the contact"},"name":{"type":"string","description":"The name of the contact"},"email":{"type":"string","description":"Email address of the contact"},"phone_number":{"type":"string","description":"Phone number of the contact"},"thumbnail":{"type":"string","description":"Avatar URL of the contact"},"additional_attributes":{"type":"object","description":"The object containing additional attributes related to the contact"},"custom_attributes":{"type":"object","description":"The custom attributes of the contact"},"labels":{"type":"array","description":"Labels applied to the contact","items":{"type":"object","properties":{"id":{"type":"number"},"title":{"type":"string"},"color":{"type":"string"}}}},"contact_type":{"type":"string","description":"Value of the contact_type additional attribute, if set"},"created_at":{"type":"string","format":"date-time","description":"The time at which the contact was created"},"entered_stage_at":{"type":"string","format":"date-time","description":"The time at which the contact entered its current stage"},"pipeline_entered_at":{"type":"string","format":"date-time","description":"The time at which the contact first entered the pipeline"},"current_pipeline_stage":{"type":"object","properties":{"id":{"type":"number"},"name":{"type":"string"}}},"opportunity_value":{"type":"number","description":"Value of the opportunity_value additional attribute, 0 when not set"},"assignee_id":{"type":"number","description":"Assignee of the most relevant conversation of the contact (open conversations first, then most recent activity)"},"team_id":{"type":"number","description":"Team of the most relevant conversation of the contact"},"unread_messages_count":{"type":"integer","description":"Number of unread incoming messages in that conversation"},"availability_status":{"type":"string","description":"Online status of the contact"}}},"custom_role":{"type":"object","properties":{"id":{"type":"number","description":"The ID of the custom role"},"name":{"type":"string","description":"The name of the custom role"},"description":{"type":"string","description":"The description of the custom role"},"permissions":{"type":"array","description":"The permissions granted by the role","items":{"type":"string","enum":["conversation_manage","conversation_unassigned_manage","conversation_participating_manage","contact_manage","report_manage","knowledge_base_manage"]}},"created_at":{"type":"string","format":"date-time","description":"The time at which the custom role was created"},"updated_at":{"type":"string","format":"date-time","description":"The time at which the custom role was last updated"}}},"note_create_update_payload":{"type":"object","required":["content"],"properties":{"content":{"type":"string","description":"The text content of the note"}}},"label_create_update_payload":{"type":"object","properties":{"title":{"type":"string","description":"The title of the label. Only letters, numbers, hyphens and underscores are allowed; it is stored in lowercase and must be unique within the account"},"description":{"type":"string","description":"A description of the label"},"color":{"type":"string","description":"The hex color code of the label"},"show_on_sidebar":{"type":"boolean","description":"Whether the label is shown in the conversation sidebar"}}},"macro_create_update_payload":{"type":"object","properties":{"name":{"type":"string","description":"The name of the macro"},"visibility":{"type":"string","enum":["personal","global"],"description":"Who can see and run the macro. Agents can only create personal macros; a global value sent by an agent is stored as personal"},"actions":{"type":"array","description":"Ordered list of actions executed when the macro runs","items":{"type":"object","properties":{"action_name":{"type":"string","enum":["send_message","add_label","assign_team","assign_agent","mute_conversation","change_status","remove_label","remove_assigned_team","send_webhook_event","resolve_conversation","snooze_conversation","change_priority","send_email_transcript","send_attachment","add_private_note"],"description":"The action to perform"},"action_params":{"type":"array","description":"Parameters for the action (for example the label titles, the team ID, the message text). For send_attachment, the ID of an uploaded blob","items":{"type":"string"}}}}}}},"pipeline_create_update_payload":{"type":"object","required":["pipeline"],"properties":{"pipeline":{"type":"object","properties":{"name":{"type":"string","description":"The name of the pipeline"},"description":{"type":"string","description":"The description of the pipeline"},"pipeline_type":{"type":"string","enum":["sales","support","onboarding","custom"],"description":"The type of the pipeline. Defaults to sales, which creates a default set of stages on creation"},"is_default":{"type":"boolean","description":"Whether this is the default pipeline of the account. Only one pipeline per account can be the default"},"is_active":{"type":"boolean","description":"Whether the pipeline is active"},"auto_add_contacts":{"type":"boolean","description":"Whether new contacts are automatically added to this pipeline"},"config":{"type":"object","description":"Free-form configuration object for the pipeline"}}}}},"pipeline_stage_create_update_payload":{"type":"object","required":["stage"],"properties":{"stage":{"type":"object","properties":{"name":{"type":"string","description":"The name of the stage"},"description":{"type":"string","description":"The description of the stage"},"color":{"type":"string","description":"Hex color of the stage, e.g. \"#3498db\""},"position":{"type":"integer","description":"The position of the stage within the pipeline. On creation the stage is appended at the end regardless of this value"},"probability":{"type":"number","description":"Win probability between 0 and 100"},"stage_type":{"type":"string","enum":["lead","qualified","proposal","negotiation","won","lost","custom"],"description":"The type of the stage"},"sla_hours":{"type":"integer","description":"Maximum number of hours a contact is expected to stay in the stage"},"is_win_stage":{"type":"boolean","description":"Whether contacts in this stage are considered won"},"is_lose_stage":{"type":"boolean","description":"Whether contacts in this stage are considered lost"},"is_active":{"type":"boolean","description":"Whether the stage is active"},"entry_actions":{"type":"object","description":"Automation actions triggered when a contact enters the stage"},"exit_actions":{"type":"object","description":"Automation actions triggered when a contact leaves the stage"},"time_based_actions":{"type":"object","description":"Automation actions triggered after a contact has spent a given time in the stage"},"auto_move_conditions":{"type":"object","description":"Conditions under which contacts are moved automatically out of the stage"},"required_fields":{"type":"array","items":{"type":"string"},"description":"Contact fields that must be present to enter the stage"},"custom_fields_schema":{"type":"array","items":{"type":"object"},"description":"Schema of the custom fields captured for contacts in the stage"}}}}},"custom_role_create_update_payload":{"type":"object","required":["custom_role"],"properties":{"custom_role":{"type":"object","properties":{"name":{"type":"string","description":"The name of the custom role"},"description":{"type":"string","description":"The description of the custom role"},"permissions":{"type":"array","description":"The permissions granted by the role","items":{"type":"string","enum":["conversation_manage","conversation_unassigned_manage","conversation_participating_manage","contact_manage","report_manage","knowledge_base_manage"]}}}}}}},"parameters":{"account_id":{"in":"path","name":"account_id","type":"integer","required":true,"description":"The numeric ID of the account"},"agent_bot_id":{"in":"path","name":"id","type":"integer","required":true,"description":"The ID of the agentbot to be updated"},"team_id":{"in":"path","name":"team_id","type":"integer","required":true,"description":"The ID of the team to be updated"},"inbox_id":{"in":"path","name":"inbox_id","type":"integer","required":true,"description":"The ID of the Inbox"},"hook_id":{"in":"path","name":"hook_id","type":"integer","required":true,"description":"The numeric ID of the integration hook"},"source_id":{"in":"path","name":"source_id","required":true,"type":"string","description":"Id of the session for which the conversation is created.\n\n\n\n Source Ids can be obtained through contactable inboxes API or via generated.\u003cbr/\u003e\u003cbr/\u003eWebsite: platform-generated string which can be obtained from webhook events. \u003cbr/\u003e Phone Channels(Twilio): Phone number in e164 format \u003cbr/\u003e Email Channels: Contact Email address \u003cbr/\u003e API Channel: Any Random String"},"contact_sort_param":{"in":"query","name":"sort","type":"string","enum":["name","email","phone_number","last_activity_at","-name","-email","-phone_number","-last_activity_at"],"required":false,"description":"The attribute by which list should be sorted"},"conversation_id":{"in":"path","name":"conversation_id","type":"integer","required":true,"description":"The numeric ID of the conversation"},"conversation_uuid":{"in":"path","name":"conversation_uuid","type":"integer","required":true,"description":"The uuid of the conversation"},"custom_filter_id":{"in":"path","name":"custom_filter_id","type":"integer","required":true,"description":"The numeric ID of the custom filter"},"webhook_id":{"in":"path","name":"webhook_id","type":"integer","required":true,"description":"The numeric ID of the webhook"},"message_id":{"in":"path","name":"message_id","type":"integer","required":true,"description":"The numeric ID of the message"},"page":{"in":"query","name":"page","type":"integer","default":1,"required":false,"description":"The page parameter"},"platform_user_id":{"in":"path","name":"id","type":"integer","required":true,"description":"The numeric ID of the user on the platform"},"report_type":{"in":"query","name":"type","type":"string","enum":["account","agent","inbox","label","team"],"required":true,"description":"Type of report"},"report_metric":{"in":"query","name":"metric","type":"string","enum":["conversations_count","incoming_messages_count","outgoing_messages_count","avg_first_response_time","avg_resolution_time","resolutions_count"],"required":true,"description":"The type of metric"},"public_inbox_identifier":{"in":"path","name":"inbox_identifier","type":"string","required":true,"description":"The identifier obtained from API inbox channel"},"public_contact_identifier":{"in":"path","name":"contact_identifier","type":"string","required":true,"description":"The source id of contact obtained on contact create"},"portal_id":{"in":"path","name":"portal_id","type":"integer","required":true,"description":"The numeric ID of the portal"}},"x-tagGroups":[{"name":"Application","tags":["Account AgentBots","Agents","Canned Responses","Contacts","Contact Labels","Conversation Assignment","Conversation Labels","Conversations","Custom Attributes","Custom Filters","Inboxes","Integrations","Messages","Profile","Reports","Teams","Webhooks","Automation Rule","Help Center","Labels","Contact Notes","Macros","Custom Roles","Pipelines","Pipeline Stages","Contact Stages","CSAT Survey Responses","Applied SLAs"]},{"name":"Client","tags":["Contacts API","Conversations API","Messages API","Inbox API"]},{"name":"Others","tags":["CSAT Survey Page"]}]}