# SiteUp API — Documentacao Completa > API completa da plataforma SiteUp. Server: https://app.siteup.com.br Documentacao interativa: https://www.siteup.com.br/docs --- # Plataforma ## Contas Account management APIs ### POST /platform/api/v1/accounts **Create an Account** **Request body:** Content-Type: `application/json` -> account_create_update_payload **Responses:** - `200`: Success - `401`: Unauthorized ### GET /platform/api/v1/accounts/{account_id} **Get an account details** Get the details of an account **Responses:** - `200`: Success - `401`: Unauthorized - `404`: The given account does not exist ### PATCH /platform/api/v1/accounts/{account_id} **Update an account** Update an account's attributes **Request body:** Content-Type: `application/json` -> account_create_update_payload **Responses:** - `200`: Success - `401`: Unauthorized ### DELETE /platform/api/v1/accounts/{account_id} **Delete an Account** **Responses:** - `200`: Success - `401`: Unauthorized - `404`: The account does not exist ## Usuários da Conta Account user management APIs ### GET /platform/api/v1/accounts/{account_id}/account_users **List all Account Users** List all account users **Responses:** - `200`: Success - `401`: Unauthorized ### POST /platform/api/v1/accounts/{account_id}/account_users **Create an Account User** **Request body:** Content-Type: `application/json` -> account_user_create_update_payload **Responses:** - `200`: Success - `401`: Unauthorized ### DELETE /platform/api/v1/accounts/{account_id}/account_users **Delete an Account User** **Responses:** - `200`: Success - `401`: Unauthorized - `404`: The account does not exist ## Bots Bot integrations ### GET /platform/api/v1/agent_bots **List all AgentBots** List all agent bots available **Responses:** - `200`: Success - `401`: Unauthorized ### POST /platform/api/v1/agent_bots **Create an Agent Bot** Create an agent bot **Request body:** Content-Type: `application/json` -> platform_agent_bot_create_update_payload **Responses:** - `200`: Success - `401`: Unauthorized ### GET /platform/api/v1/agent_bots/{id} **Get an agent bot details** Get the details of an agent bot **Responses:** - `200`: Success - `401`: Unauthorized - `404`: The given agent bot ID does not exist ### PATCH /platform/api/v1/agent_bots/{id} **Update an agent bot** Update an agent bot's attributes **Request body:** Content-Type: `application/json` -> platform_agent_bot_create_update_payload **Responses:** - `200`: Success - `401`: Unauthorized ### DELETE /platform/api/v1/agent_bots/{id} **Delete an AgentBot** **Responses:** - `200`: Success - `401`: Unauthorized - `404`: The agent bot does not exist ## Usuários User management APIs ### POST /platform/api/v1/users **Create a User** **Request body:** Content-Type: `application/json` -> user_create_update_payload **Responses:** - `200`: Success - `401`: Unauthorized ### GET /platform/api/v1/users/{id} **Get an user details** Get the details of an user **Responses:** - `200`: Success - `401`: Unauthorized - `404`: The given user does not exist ### PATCH /platform/api/v1/users/{id} **Update a user** Update a user's attributes **Request body:** Content-Type: `application/json` -> user_create_update_payload **Responses:** - `200`: Success - `401`: Unauthorized ### DELETE /platform/api/v1/users/{id} **Delete a User** **Responses:** - `200`: Success - `401`: Unauthorized - `404`: The user does not exist ### GET /platform/api/v1/users/{id}/login **Get User SSO Link** Get the sso link of a user **Responses:** - `200`: Success - `401`: Unauthorized - `404`: The given user does not exist # Aplicação ## Bots da Conta Account-specific Agent Bots ### GET /api/v1/accounts/{account_id}/agent_bots **List all AgentBots** List all agent bots available for the current account **Responses:** - `200`: Success - `401`: Unauthorized ### POST /api/v1/accounts/{account_id}/agent_bots **Create an Agent Bot** Create an agent bot in the account **Request body:** Content-Type: `application/json` -> agent_bot_create_update_payload **Responses:** - `200`: Success - `401`: Unauthorized ### GET /api/v1/accounts/{account_id}/agent_bots/{id} **Get an agent bot details** Get the details of an agent bot in the account **Responses:** - `200`: Success - `401`: Unauthorized - `404`: The given agent bot ID does not exist in the account ### PATCH /api/v1/accounts/{account_id}/agent_bots/{id} **Update an agent bot** Update an agent bot's attributes **Request body:** Content-Type: `application/json` -> agent_bot_create_update_payload **Responses:** - `200`: Success - `401`: Unauthorized ### DELETE /api/v1/accounts/{account_id}/agent_bots/{id} **Delete an AgentBot** Delete an AgentBot from the account **Responses:** - `200`: Success - `401`: Unauthorized - `404`: The agent bot does not exist in the account ## Agentes Agent management APIs ### GET /api/v1/accounts/{account_id}/agents **List Agents in Account** Get Details of Agents in an Account **Responses:** - `200`: Success - `403`: Access denied ### POST /api/v1/accounts/{account_id}/agents **Add a New Agent** Add a new Agent to Account **Request body:** Content-Type: `application/json` -> agent_create_payload **Responses:** - `200`: Success - `403`: Access denied ### PATCH /api/v1/accounts/{account_id}/agents/{id} **Update Agent in Account** Update an Agent in Account **Parameters:** - `id` (path) (required): The ID of the agent to be updated. **Request body:** Content-Type: `application/json` -> agent_update_payload **Responses:** - `200`: Success - `404`: Agent not found - `403`: Access denied ### DELETE /api/v1/accounts/{account_id}/agents/{id} **Remove an Agent from Account** **Parameters:** - `id` (path) (required): The ID of the agent to be deleted. **Responses:** - `200`: Success - `404`: Agent not found - `403`: Access denied ## Respostas Prontas Pre-defined responses for common queries ### GET /api/v1/accounts/{account_id}/canned_responses **List all Canned Responses in an Account** Get Details of Canned Responses in an Account **Responses:** - `200`: Success - `403`: Access denied ### POST /api/v1/accounts/{account_id}/canned_responses **Add a New Canned Response** Add a new Canned Response to Account **Request body:** Content-Type: `application/json` -> canned_response_create_update_payload **Responses:** - `200`: Success - `403`: Access denied ### PATCH /api/v1/accounts/{account_id}/canned_responses/{id} **Update Canned Response in Account** Update a Canned Response in Account **Parameters:** - `id` (path) (required): The ID of the canned response to be updated. **Request body:** Content-Type: `application/json` -> canned_response_create_update_payload **Responses:** - `200`: Success - `404`: Agent not found - `403`: Access denied ### DELETE /api/v1/accounts/{account_id}/canned_responses/{id} **Remove a Canned Response from Account** **Parameters:** - `id` (path) (required): The ID of the canned response to be deleted **Responses:** - `200`: Success - `404`: Canned Response not found - `403`: Access denied ## Contatos Contact management APIs ### GET /api/v1/accounts/{account_id}/contacts **List Contacts** Listing all the resolved contacts with pagination (Page size = 15). Resolved contacts are the ones with a value for identifier, email or phone number **Parameters:** - account_id (ref) - contact_sort_param (ref) - page (ref) **Responses:** - `200`: Success - `400`: Bad Request Error ### POST /api/v1/accounts/{account_id}/contacts **Create Contact** Create a new Contact **Parameters:** - account_id (ref) **Request body:** Content-Type: `application/json` -> contact_create_payload **Responses:** - `200`: Success - `400`: Bad Request Error ### GET /api/v1/accounts/{account_id}/contacts/{id} **Show Contact** Get a contact belonging to the account using ID **Responses:** - `200`: Success - `404`: Contact not found - `403`: Access denied ### PUT /api/v1/accounts/{account_id}/contacts/{id} **Update Contact** Update a contact belonging to the account using ID **Request body:** Content-Type: `application/json` -> contact_update_payload **Responses:** - `204`: Success - `404`: Contact not found - `403`: Access denied ### DELETE /api/v1/accounts/{account_id}/contacts/{id} **Delete Contact** Delete a contact belonging to the account using ID **Responses:** - `200`: Success - `401`: Unauthorized - `404`: Contact not found ### GET /api/v1/accounts/{account_id}/contacts/{id}/conversations **Contact Conversations** Get conversations associated with that contact **Parameters:** - `id` (path) (required): ID of the contact **Responses:** - `200`: Success - `404`: Contact not found - `403`: Access denied ### GET /api/v1/accounts/{account_id}/contacts/search **Search Contacts** 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 **Parameters:** - account_id (ref) - `q` (query): Search using contact `name`, `identifier`, `email` or `phone number` - contact_sort_param (ref) - page (ref) **Responses:** - `200`: Success - `401`: Authentication error ### POST /api/v1/accounts/{account_id}/contacts/filter **Contact Filter** Filter contacts with custom filter options and pagination **Parameters:** - account_id (ref) - `page` (query): **Request body:** Content-Type: `application/json` - payload: array (ex: [{'attribute_key': 'name', 'filter_operator': 'equal_to', 'values': ['en'], 'query_operator': 'AND'}, {'attribute_key': 'country_code', 'filter_operator': 'equal_to', 'values': ['us'], 'query_operator': None}]) **Responses:** - `200`: Success - `400`: Bad Request Error ### POST /api/v1/accounts/{account_id}/contacts/{id}/contact_inboxes **Create contact inbox** Create a contact inbox record for an inbox **Parameters:** - account_id (ref) - `id` (path) (required): ID of the contact **Request body:** Content-Type: `application/json` - inbox_id: number (required) — The ID of the inbox (ex: 1) - source_id: string — Contact Inbox Source Id **Responses:** - `200`: Success - `401`: Authentication error - `422`: Incorrect payload ### GET /api/v1/accounts/{account_id}/contacts/{id}/contactable_inboxes **Get Contactable Inboxes** Get List of contactable Inboxes **Parameters:** - account_id (ref) - `id` (path) (required): ID of the contact **Responses:** - `200`: Success - `401`: Authentication error - `422`: Incorrect payload ### POST /api/v1/accounts/{account_id}/actions/contact_merge **Merge Contacts** Merge two contacts into a single contact. The base contact remains and receives all data from the mergee contact. After the merge, the mergee contact is permanently deleted. This action is irreversible. All conversations, labels, and custom attributes from the mergee contact will be moved to the base contact. **Request body:** Content-Type: `application/json` - base_contact_id: integer (required) — ID of the contact that will remain after the merge and receive all data (ex: 1) - mergee_contact_id: integer (required) — ID of the contact that will be merged into the base contact and deleted (ex: 2) **Responses:** - `200`: Contacts merged successfully - `400`: Bad request - invalid contact IDs or contacts cannot be merged - `401`: Unauthorized - `404`: One or both contacts not found ## Etiquetas de Contato Manage contact labels ### GET /api/v1/accounts/{account_id}/contacts/{id}/labels **List Labels** Lists all the labels of a contact **Responses:** - `200`: Success - `401`: Unauthorized - `404`: Contact not found ### POST /api/v1/accounts/{account_id}/contacts/{id}/labels **Add Labels** Add labels to a contact. Note that this API would overwrite the existing list of labels associated to the conversation. **Request body:** Content-Type: `application/json` - labels: array (required) — Array of labels (comma-separated strings) (ex: ['support', 'billing']) **Responses:** - `200`: Success - `401`: Unauthorized - `404`: Contact not found ## Atribuição de Conversas Manage conversation assignments ### POST /api/v1/accounts/{account_id}/conversations/{conversation_id}/assignments **Assign Conversation** Assign a conversation to an agent or a team **Request body:** Content-Type: `application/json` - assignee_id: number — Id of the assignee user (ex: 1) - team_id: number — Id of the team. If the assignee_id is present, this param would be ignored (ex: 1) **Responses:** - `200`: Success - `401`: Unauthorized - `404`: Conversation not found ## Conversas Conversation management APIs ### GET /api/v1/accounts/{account_id}/conversations/meta **Get Conversation Counts** Get open, unassigned and all Conversation counts **Parameters:** - `status` (query): Filter by conversation status. - `q` (query): Filters conversations with messages containing the search term - `inbox_id` (query): - `team_id` (query): - `labels` (query): **Responses:** - `200`: Success - `400`: Bad Request Error ### GET /api/v1/accounts/{account_id}/conversations **Conversations List** List all the conversations with pagination **Parameters:** - `assignee_type` (query): Filter conversations by assignee type. - `status` (query): Filter by conversation status. - `q` (query): Filters conversations with messages containing the search term - `inbox_id` (query): - `team_id` (query): - `labels` (query): - `page` (query): paginate through conversations **Responses:** - `200`: Success - `400`: Bad Request Error ### POST /api/v1/accounts/{account_id}/conversations **Create New Conversation** Creating a conversation in SiteUp requires a source id. Learn more about source_id: https://siteup.com.br **Request body:** Content-Type: `application/json` -> conversation_create_payload **Responses:** - `200`: Success - `403`: Access denied ### POST /api/v1/accounts/{account_id}/conversations/filter **Conversations Filter** Filter conversations with custom filter options and pagination **Parameters:** - `page` (query): **Request body:** Content-Type: `application/json` - payload: array (ex: [{'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': None}]) **Responses:** - `200`: Success - `400`: Bad Request Error ### GET /api/v1/accounts/{account_id}/conversations/{conversation_id} **Conversation Details** Get all details regarding a conversation with all messages in the conversation **Responses:** - `200`: Success - `403`: Access denied - `404`: Conversation not found ### PATCH /api/v1/accounts/{account_id}/conversations/{conversation_id} **Update Conversation** Update Conversation Attributes **Request body:** Content-Type: `application/json` - priority: string — The priority of the conversation (ex: high) - sla_policy_id: number — The ID of the SLA policy (Available only in Enterprise edition) (ex: 1) **Responses:** - `200`: Success - `401`: Unauthorized - `404`: Conversation not found ### POST /api/v1/accounts/{account_id}/conversations/{conversation_id}/toggle_status **Toggle Status** Toggle the status of a conversation. Pass `status` to explicitly set the conversation state. Use `snoozed` along with `snoozed_until` to snooze a conversation until a specific time. If `snoozed_until` is omitted, the conversation is snoozed until the next reply from the contact. Regardless of the value provided, snoozed conversations always reopen on the next reply from the contact. **Request body:** Content-Type: `application/json` - status: string (required) — The status of the conversation (ex: open) - snoozed_until: number — When status is `snoozed`, schedule the reopen time as a Unix timestamp in seconds. If not provided, the conversation is snoozed until the next customer reply. The conversation always reopens when the customer replies. (ex: 1757506877) **Responses:** - `200`: Success - `404`: Conversation not found - `401`: Unauthorized ### POST /api/v1/accounts/{account_id}/conversations/{conversation_id}/toggle_priority **Toggle Priority** Toggles the priority of conversation **Request body:** Content-Type: `application/json` - priority: string (required) — The priority of the conversation (ex: high) **Responses:** - `200`: Success - `401`: Unauthorized - `404`: Conversation not found ### POST /api/v1/accounts/{account_id}/conversations/{conversation_id}/toggle_typing_status **Toggle Typing Status** Toggles the typing status for a conversation. **Request body:** Content-Type: `application/json` - typing_status: string (required) — Typing status to set. (ex: on) - is_private: boolean — Whether the typing event is for private notes. **Responses:** - `200`: Success - `401`: Unauthorized - `404`: Conversation not found ### POST /api/v1/accounts/{account_id}/conversations/{conversation_id}/custom_attributes **Update Custom Attributes** Updates the custom attributes of a conversation **Request body:** Content-Type: `application/json` - custom_attributes: object (required) — The custom attributes to be set for the conversation (ex: {'order_id': '12345', 'previous_conversation': '67890'}) **Responses:** - `200`: Success - `401`: Unauthorized - `404`: Conversation not found ### GET /api/v1/accounts/{account_id}/conversations/{conversation_id}/labels **List Labels** Lists all the labels of a conversation **Responses:** - `200`: Success - `404`: Conversation not found - `401`: Unauthorized ### POST /api/v1/accounts/{account_id}/conversations/{conversation_id}/labels **Add Labels** Add labels to a conversation. Note that this API would overwrite the existing list of labels associated to the conversation. **Request body:** Content-Type: `application/json` - labels: array (required) — Array of labels (comma-separated strings) (ex: ['support', 'billing']) **Responses:** - `200`: Success - `404`: Conversation not found - `401`: Unauthorized ### GET /api/v1/accounts/{account_id}/conversations/{conversation_id}/reporting_events **Conversation Reporting Events** Get reporting events for a specific conversation. This endpoint returns events such as first response time, resolution time, and other metrics for the conversation, sorted by creation time in ascending order. **Responses:** - `200`: Success - `403`: Access denied - `404`: Conversation not found ## Atributos Personalizados Custom fields for contacts and conversations ### GET /api/v1/accounts/{account_id}/custom_attribute_definitions **List all custom attributes in an account** Get details of custom attributes in an Account **Parameters:** - `attribute_model` (query) (required): conversation_attribute(0)/contact_attribute(1) **Responses:** - `200`: Success - `403`: Access denied ### POST /api/v1/accounts/{account_id}/custom_attribute_definitions **Add a new custom attribute** Add a new custom attribute to account **Request body:** Content-Type: `application/json` -> custom_attribute_create_update_payload **Responses:** - `200`: Success - `403`: Access denied ### GET /api/v1/accounts/{account_id}/custom_attribute_definitions/{id} **Get a custom attribute details** Get the details of a custom attribute in the account **Parameters:** - account_id (ref) - `id` (path) (required): The ID of the custom attribute to be updated. **Responses:** - `200`: Success - `401`: Unauthorized - `404`: The given attribute ID does not exist in the account ### PATCH /api/v1/accounts/{account_id}/custom_attribute_definitions/{id} **Update custom attribute in Account** Update a custom attribute in account **Parameters:** - `id` (path) (required): The ID of the custom attribute to be updated. **Request body:** Content-Type: `application/json` -> custom_attribute_create_update_payload **Responses:** - `200`: Success - `404`: Agent not found - `403`: Access denied ### DELETE /api/v1/accounts/{account_id}/custom_attribute_definitions/{id} **Remove a custom attribute from account** **Parameters:** - account_id (ref) - `id` (path) (required): The ID of the custom attribute to be deleted **Responses:** - `200`: Success - `404`: Custom attribute not found - `403`: Access denied ## Filtros Personalizados Saved filters for conversations ### GET /api/v1/accounts/{account_id}/custom_filters **List all custom filters** List all custom filters in a category of a user **Responses:** - `200`: Success - `401`: Unauthorized ### POST /api/v1/accounts/{account_id}/custom_filters **Create a custom filter** Create a custom filter in the account **Parameters:** - account_id (ref) **Request body:** Content-Type: `application/json` -> custom_filter_create_update_payload **Responses:** - `200`: Success - `401`: Unauthorized ### GET /api/v1/accounts/{account_id}/custom_filters/{custom_filter_id} **Get a custom filter details** Get the details of a custom filter in the account **Responses:** - `200`: Success - `401`: Unauthorized - `404`: The given team ID does not exist in the account ### PATCH /api/v1/accounts/{account_id}/custom_filters/{custom_filter_id} **Update a custom filter** Update a custom filter's attributes **Request body:** Content-Type: `application/json` -> custom_filter_create_update_payload **Responses:** - `200`: Success - `401`: Unauthorized ### DELETE /api/v1/accounts/{account_id}/custom_filters/{custom_filter_id} **Delete a custom filter** Delete a custom filter from the account **Responses:** - `200`: Success - `401`: Unauthorized - `404`: The custom filter does not exist in the account ## Caixas de Entrada Communication channels setup ### GET /api/v1/accounts/{account_id}/inboxes **List all inboxes** List all inboxes available in the current account **Parameters:** - account_id (ref) **Responses:** - `200`: Success - `404`: Inbox not found - `403`: Access denied ### POST /api/v1/accounts/{account_id}/inboxes **Create an inbox** You can create more than one website inbox in each account **Parameters:** - account_id (ref) **Request body:** Content-Type: `application/json` -> inbox_create_payload **Responses:** - `200`: Success - `404`: Inbox not found - `403`: Access denied ### GET /api/v1/accounts/{account_id}/inboxes/{id} **Get an inbox** Get an inbox available in the current account **Parameters:** - account_id (ref) - `id` (path) (required): ID of the inbox **Responses:** - `200`: Success - `404`: Inbox not found - `403`: Access denied ### PATCH /api/v1/accounts/{account_id}/inboxes/{id} **Update Inbox** Update an existing inbox **Parameters:** - account_id (ref) - `id` (path) (required): ID of the inbox **Request body:** Content-Type: `application/json` -> inbox_update_payload **Responses:** - `200`: Success - `404`: Inbox not found - `403`: Access denied ### GET /api/v1/accounts/{account_id}/inboxes/{id}/agent_bot **Show Inbox Agent Bot** See if an agent bot is associated to the Inbox **Parameters:** - account_id (ref) - `id` (path) (required): ID of the inbox **Responses:** - `204`: Success - `404`: Inbox not found, Agent bot not found - `403`: Access denied ### POST /api/v1/accounts/{account_id}/inboxes/{id}/set_agent_bot **Add or remove agent bot** To add an agent bot pass agent_bot id, to remove agent bot from an inbox pass null **Parameters:** - account_id (ref) - `id` (path) (required): ID of the inbox **Request body:** Content-Type: `application/json` - agent_bot: number (required) — Agent bot ID (ex: 1) **Responses:** - `204`: Success - `404`: Inbox not found, Agent bot not found - `403`: Access denied ### GET /api/v1/accounts/{account_id}/inbox_members/{inbox_id} **List Agents in Inbox** Get Details of Agents in an Inbox **Parameters:** - inbox_id (ref) **Responses:** - `200`: Success - `404`: Inbox not found - `403`: Access denied ### POST /api/v1/accounts/{account_id}/inbox_members **Add a New Agent** Add a new Agent to Inbox **Request body:** Content-Type: `application/json` - inbox_id: integer (required) — The ID of the inbox (ex: 1) - user_ids: array (required) — IDs of users to be added to the inbox (ex: [1]) **Responses:** - `200`: Success - `404`: Inbox not found - `403`: Access denied - `422`: User must exist ### PATCH /api/v1/accounts/{account_id}/inbox_members **Update Agents in Inbox** All agents except the one passed in params will be removed **Request body:** Content-Type: `application/json` - inbox_id: string (required) — The ID of the inbox (ex: 1) - user_ids: array (required) — IDs of users to be added to the inbox (ex: [1]) **Responses:** - `200`: Success - `404`: Inbox not found - `403`: Access denied - `422`: User must exist ### DELETE /api/v1/accounts/{account_id}/inbox_members **Remove an Agent from Inbox** **Request body:** Content-Type: `application/json` - inbox_id: string (required) — The ID of the inbox - user_ids: array (required) — IDs of users to be deleted from the inbox **Responses:** - `200`: Success - `404`: Inbox not found - `403`: Access denied - `422`: User must exist ## Integrações Third-party integrations ### GET /api/v1/accounts/{account_id}/integrations/apps **List all the Integrations** Get the details of all Integrations available for the account **Responses:** - `200`: Success - `401`: Unauthorized - `404`: Url not found ### POST /api/v1/accounts/{account_id}/integrations/hooks **Create an integration hook** **Parameters:** - account_id (ref) **Request body:** Content-Type: `application/json` -> integrations_hook_create_payload **Responses:** - `200`: Success - `401`: Unauthorized ### PATCH /api/v1/accounts/{account_id}/integrations/hooks/{hook_id} **Update an Integration Hook** **Parameters:** - account_id (ref) - hook_id (ref) **Request body:** Content-Type: `application/json` -> integrations_hook_update_payload **Responses:** - `200`: Success - `401`: Unauthorized ### DELETE /api/v1/accounts/{account_id}/integrations/hooks/{hook_id} **Delete an Integration Hook** **Parameters:** - account_id (ref) - hook_id (ref) **Responses:** - `200`: Success - `401`: Unauthorized - `404`: The hook does not exist in the account ## Etiquetas Account label management APIs ### GET /api/v1/accounts/{account_id}/labels **List all labels** List all labels available in the current account **Responses:** - `200`: Success - `401`: Unauthorized ### POST /api/v1/accounts/{account_id}/labels **Create a label** Create a label in the account **Request body:** Content-Type: `application/json` -> label_create_update_payload **Responses:** - `200`: Success - `401`: Unauthorized ### GET /api/v1/accounts/{account_id}/labels/{id} **Get a label** Get the details of a label in the account **Responses:** - `200`: Success - `401`: Unauthorized - `404`: The given label ID does not exist in the account ### PATCH /api/v1/accounts/{account_id}/labels/{id} **Update a label** Update a label's attributes **Request body:** Content-Type: `application/json` -> label_create_update_payload **Responses:** - `200`: Success - `401`: Unauthorized ### DELETE /api/v1/accounts/{account_id}/labels/{id} **Delete a label** Delete a label from the account **Responses:** - `200`: Success - `401`: Unauthorized - `404`: The label does not exist in the account ## Mensagens Message management APIs ### GET /api/v1/accounts/{account_id}/conversations/{conversation_id}/messages **Get messages** List all messages of a conversation **Parameters:** - `after` (query): Fetch messages after the message with this ID. Returns up to 100 messages in ascending order. - `before` (query): Fetch messages before the message with this ID. Returns up to 20 messages in ascending order. **Responses:** - `200`: Success - `404`: Conversation not found - `401`: Unauthorized ### POST /api/v1/accounts/{account_id}/conversations/{conversation_id}/messages **Create New Message** Create a new message in the conversation. ## WhatsApp Template Messages For WhatsApp channels, you can send structured template messages using the `template_params` field. Templates must be pre-approved in WhatsApp Business Manager. ### Example Templates **Text with Image Header:** ```json { "content": "Hi your order 121212 is confirmed. Please wait for further updates", "template_params": { "name": "order_confirmation", "category": "MARKETING", "language": "en", "processed_params": { "body": { "1": "121212" }, "header": { "media_url": "https://picsum.photos/200/300", "media_type": "image" } } } } ``` **Text with Copy Code Button:** ```json { "content": "Special offer! Get 30% off your next purchase. Use the code below", "template_params": { "name": "discount_coupon", "category": "MARKETING", "language": "en", "processed_params": { "body": { "discount_percentage": "30" }, "buttons": [{ "type": "copy_code", "parameter": "SAVE20" }] } } } ``` **Request body:** Content-Type: `application/json` -> conversation_message_create_payload **Responses:** - `200`: Success - `404`: Conversation not found - `403`: Access denied ### DELETE /api/v1/accounts/{account_id}/conversations/{conversation_id}/messages/{message_id} **Delete a message** Delete a message and it's attachments from the conversation. **Responses:** - `200`: Success - `401`: Unauthorized - `404`: The message or conversation does not exist in the account ## Perfil User profile APIs ### GET /api/v1/profile **Fetch user profile** Get the user profile details **Responses:** - `200`: Success - `401`: Unauthorized ### PUT /api/v1/profile **Update user profile** Update the user profile details **Request body:** Content-Type: `application/json` - profile: object (required) - name: string - email: string - display_name: string - message_signature: string - phone_number: string - current_password: string - password: string - password_confirmation: string - ui_settings: object Content-Type: `multipart/form-data` - profile: object (required) - name: string - email: string - display_name: string - message_signature: string - phone_number: string - current_password: string - password: string - password_confirmation: string - avatar: string - ui_settings: object **Responses:** - `200`: Success - `401`: Unauthorized ## Relatórios Analytics and reporting APIs ### GET /api/v1/accounts/{account_id}/reporting_events **Account Reporting Events** Get paginated reporting events for the account. This endpoint returns reporting events such as first response time, resolution time, and other metrics. Only administrators can access this endpoint. Results are paginated with 25 items per page. **Parameters:** - page (ref) - `since` (query): The timestamp from where events should start (Unix timestamp in seconds) - `until` (query): The timestamp from where events should stop (Unix timestamp in seconds) - `inbox_id` (query): Filter events by inbox ID - `user_id` (query): Filter events by user/agent ID - `name` (query): Filter events by event name (e.g., first_response, resolution, reply_time) **Responses:** - `200`: Success - `403`: Access denied - Only administrators can access this endpoint ### GET /api/v2/accounts/{account_id}/reports **Get Account reports** Get Account reports for a specific type, metric and date range **Responses:** - `200`: Success - `404`: reports not found - `403`: Access denied ### GET /api/v2/accounts/{account_id}/reports/summary **Get Account reports summary** Get Account reports summary for a specific type and date range **Responses:** - `200`: Success - `404`: reports not found - `403`: Access denied ### GET /api/v2/accounts/{account_id}/reports/conversations **Account Conversation Metrics** Get conversation metrics for Account **Responses:** - `200`: Success - `404`: reports not found - `403`: Access denied ### GET /api/v2/accounts/{account_id}/reports/conversations/ **Agent Conversation Metrics** Get conversation metrics for Agent **Responses:** - `200`: Success - `404`: reports not found - `403`: Access denied ### GET /api/v2/accounts/{account_id}/summary_reports/channel **Get conversation statistics grouped by channel type** Get conversation counts grouped by channel type and status for a given date range. Returns statistics for each channel type including open, resolved, pending, snoozed, and total conversation counts. **Note:** This API endpoint is available only in SiteUp version 4.10.0 and above. The date range is limited to a maximum of 6 months. **Responses:** - `200`: Success - `400`: Date range exceeds 6 months limit - `403`: Access denied ### GET /api/v2/accounts/{account_id}/summary_reports/inbox **Get conversation statistics grouped by inbox** Get conversation statistics grouped by inbox for a given date range. Returns metrics for each inbox including conversation counts, resolution counts, average first response time, average resolution time, and average reply time. **Responses:** - `200`: Success - `403`: Access denied ### GET /api/v2/accounts/{account_id}/summary_reports/agent **Get conversation statistics grouped by agent** Get conversation statistics grouped by agent for a given date range. Returns metrics for each agent including conversation counts, resolution counts, average first response time, average resolution time, and average reply time. **Responses:** - `200`: Success - `403`: Access denied ### GET /api/v2/accounts/{account_id}/summary_reports/team **Get conversation statistics grouped by team** Get conversation statistics grouped by team for a given date range. Returns metrics for each team including conversation counts, resolution counts, average first response time, average resolution time, and average reply time. **Responses:** - `200`: Success - `403`: Access denied ### GET /api/v2/accounts/{account_id}/reports/first_response_time_distribution **Get first response time distribution by channel** Get the distribution of first response times grouped by channel type. Returns conversation counts in different time buckets (0-1h, 1-4h, 4-8h, 8-24h, 24h+) for each channel type. **Note:** This API endpoint is available only in SiteUp version 4.11.0 and above. **Responses:** - `200`: Success - `403`: Access denied ### GET /api/v2/accounts/{account_id}/reports/inbox_label_matrix **Get inbox-label matrix report** Get a matrix showing the count of conversations for each inbox-label combination. Returns a list of inboxes, labels, and a 2D matrix where each cell contains the count of conversations in a specific inbox that have a specific label applied. **Note:** This API endpoint is available only in SiteUp version 4.11.0 and above. **Responses:** - `200`: Success - `403`: Access denied ### GET /api/v2/accounts/{account_id}/reports/outgoing_messages_count **Get outgoing messages count grouped by entity** Get the count of outgoing messages grouped by a specified entity (agent, team, inbox, or label). When grouped by agent, messages sent by bots (AgentBot, Captain::Assistant) are excluded. **Note:** This API endpoint is available only in SiteUp version 4.11.0 and above. **Parameters:** - `group_by` (query) (required): The entity to group outgoing message counts by. **Responses:** - `200`: Success - `403`: Access denied ## Times Team management APIs ### GET /api/v1/accounts/{account_id}/teams **List all teams** List all teams available in the current account **Responses:** - `200`: Success - `401`: Unauthorized ### POST /api/v1/accounts/{account_id}/teams **Create a team** Create a team in the account **Parameters:** - account_id (ref) **Request body:** Content-Type: `application/json` -> team_create_update_payload **Responses:** - `200`: Success - `401`: Unauthorized ### GET /api/v1/accounts/{account_id}/teams/{team_id} **Get a team details** Get the details of a team in the account **Responses:** - `200`: Success - `401`: Unauthorized - `404`: The given team ID does not exist in the account ### PATCH /api/v1/accounts/{account_id}/teams/{team_id} **Update a team** Update a team's attributes **Request body:** Content-Type: `application/json` -> team_create_update_payload **Responses:** - `200`: Success - `401`: Unauthorized ### DELETE /api/v1/accounts/{account_id}/teams/{team_id} **Delete a team** Delete a team from the account **Responses:** - `200`: Success - `401`: Unauthorized - `404`: The team does not exist in the account ### GET /api/v1/accounts/{account_id}/teams/{team_id}/team_members **List Agents in Team** Get Details of Agents in an Team **Parameters:** - account_id (ref) - team_id (ref) **Responses:** - `200`: Success - `403`: Access denied - `404`: Team not found ### POST /api/v1/accounts/{account_id}/teams/{team_id}/team_members **Add a New Agent** Add a new Agent to Team **Request body:** Content-Type: `application/json` - user_ids: array (required) — IDs of users to be added to the team (ex: [1]) **Responses:** - `200`: Success - `403`: Access denied - `404`: Team not found - `422`: User must exist ### PATCH /api/v1/accounts/{account_id}/teams/{team_id}/team_members **Update Agents in Team** All agents except the one passed in params will be removed **Request body:** Content-Type: `application/json` - user_ids: array (required) — IDs of users to be added to the team (ex: [1]) **Responses:** - `200`: Success - `403`: Access denied - `404`: Team not found - `422`: User must exist ### DELETE /api/v1/accounts/{account_id}/teams/{team_id}/team_members **Remove an Agent from Team** **Request body:** Content-Type: `application/json` - user_ids: array (required) — IDs of users to be deleted from the team **Responses:** - `200`: Success - `403`: Access denied - `404`: Team not found - `422`: User must exist ## Webhooks Event notification webhooks ### GET /api/v1/accounts/{account_id}/webhooks **List all webhooks** List all webhooks in the account **Responses:** - `200`: Success - `401`: Unauthorized ### POST /api/v1/accounts/{account_id}/webhooks **Add a webhook** Add a webhook subscription to the account **Parameters:** - account_id (ref) **Request body:** Content-Type: `application/json` -> webhook_create_update_payload **Responses:** - `200`: Success - `401`: Unauthorized ### PATCH /api/v1/accounts/{account_id}/webhooks/{webhook_id} **Update a webhook object** Update a webhook object in the account **Parameters:** - account_id (ref) **Request body:** Content-Type: `application/json` -> webhook_create_update_payload **Responses:** - `200`: Success - `401`: Unauthorized ### DELETE /api/v1/accounts/{account_id}/webhooks/{webhook_id} **Delete a webhook** Delete a webhook from the account **Responses:** - `200`: Success - `401`: Unauthorized - `404`: The webhook does not exist in the account ## Regras de Automação Workflow automation rules ### GET /api/v1/accounts/{account_id}/automation_rules **List all automation rules in an account** Get details of automation rules in an Account **Parameters:** - account_id (ref) - page (ref) **Responses:** - `200`: Success - `403`: Access denied ### POST /api/v1/accounts/{account_id}/automation_rules **Add a new automation rule** Add a new automation rule to account **Request body:** Content-Type: `application/json` -> automation_rule_create_update_payload **Responses:** - `200`: Success - `403`: Access denied ### GET /api/v1/accounts/{account_id}/automation_rules/{id} **Get a automation rule details** Get the details of a automation rule in the account **Parameters:** - `id` (path) (required): The ID of the automation rule to be updated. **Responses:** - `200`: Success Example: ```json { "payload": { "id": 90, "account_id": 1, "name": "add-label-bug-if-message-contains-bug", "description": "add-label-bug-if-message-contains-bug", "event_name": "message_created", "conditions": [ { "values": [ "incoming" ], "attribute_key": "message_type", "query_operator": "and", "filter_operator": "equal_to" }, { "values": [ "bug" ], "attribute_key": "content", "filter_operator": "contains" } ], "actions": [ { "action_name": "add_label", "action_params": [ "bugs", "support-query" ] } ], "created_on": 1650555440, "active": true } } ``` - `401`: Unauthorized - `404`: The given rule ID does not exist in the account ### PATCH /api/v1/accounts/{account_id}/automation_rules/{id} **Update automation rule in Account** Update a automation rule in account **Parameters:** - `id` (path) (required): The ID of the automation rule to be updated. **Request body:** Content-Type: `application/json` -> automation_rule_create_update_payload **Responses:** - `200`: Success - `403`: Access denied - `404`: Rule not found ### DELETE /api/v1/accounts/{account_id}/automation_rules/{id} **Remove a automation rule from account** **Parameters:** - `id` (path) (required): The ID of the automation rule to be deleted **Responses:** - `200`: Success - `403`: Access denied - `404`: automation rule not found ## Central de Ajuda Knowledge base management ### POST /api/v1/accounts/{account_id}/portals **Add a new portal** Add a new portal to account **Request body:** Content-Type: `application/json` -> portal_create_update_payload **Responses:** - `200`: Success - `403`: Access denied ### GET /api/v1/accounts/{account_id}/portals **List all portals in an account** Get details of portals in an Account **Parameters:** - account_id (ref) **Responses:** - `200`: Success Example: ```json { "payload": [ { "id": 4, "color": "#1F93FF", "custom_domain": "siteup.help", "header_text": "Handbook", "homepage_link": "https://siteup.com.br", "name": "Handbook", "page_title": "Handbook", "slug": "handbook", "archived": false, "account_id": 1, "config": { "allowed_locales": [ { "code": "en", "articles_count": 32, "categories_count": 9 } ] }, "inbox": { "id": 37, "avatar_url": "https://example.com/avatar.png", "channel_id": 1, "name": "SiteUp", "channel_type": "Channel::WebWidget", "greeting_enabled": true, "widget_color": "#1F93FF", "website_url": "SiteUp.com" }, "logo": { "id": 19399916, "portal_id": 4, "file_type": "image/png", "account_id": 1, "file_url": "https://example.com/logo.png", "blob_id": 21239614, "filename": "square.png" }, "meta": { "all_articles_count": 0, "categories_count": 9, "default_locale": "en" } } ] } ``` - `403`: Access denied ### PATCH /api/v1/accounts/{account_id}/portals/{id} **Update a portal** Update a portal to account **Parameters:** - account_id (ref) - portal_id (ref) **Request body:** Content-Type: `application/json` -> portal_create_update_payload **Responses:** - `200`: Success Example: ```json { "payload": { "id": 123, "archived": false, "color": "#1F93FF", "config": { "allowed_locales": [ { "code": "en", "articles_count": 32, "categories_count": 9 } ] }, "custom_domain": "siteup.help", "header_text": "Handbook", "homepage_link": "https://siteup.com.br", "name": "Handbook", "slug": "handbook", "page_title": "Handbook", "account_id": 123, "inbox": { "id": 123, "name": "SiteUp", "website_url": "SiteUp.com", "channel_type": "Channel::WebWidget", "avatar_url": "https://example.com/avatar.png", "widget_color": "#1F93FF", "website_token": "4cWzuf9i9jxN9tbnv8K9STKU", "enable_auto_assignment": true, "web_widget_script": "", "welcome_title": "Hi there ! 🙌🏼", "welcome_tagline": "We make it simple to connect with us.", "greeting_enabled": true, "greeting_message": "Hey there 👋, Thank you for reaching out to us.", "channel_id": 123, "working_hours_enabled": true, "enable_email_collect": true, "csat_survey_enabled": true, "timezone": "America/Los_Angeles", "business_name": "SiteUp", "hmac_mandatory": true }, "logo": { "id": 123, "portal_id": 123, "file_type": "image/png", "account_id": 123, "file_url": "https://example.com/logo.png", "blob_id": 123, "filename": "square.png" }, "meta": { "all_articles_count": 32, "categories_count": 9, "default_locale": "en" } } } ``` - `403`: Access denied - `404`: Portal not found ### POST /api/v1/accounts/{account_id}/portals/{id}/categories **Add a new category** Add a new category to portal **Request body:** Content-Type: `application/json` -> category_create_update_payload **Responses:** - `200`: Success - `403`: Access denied ### POST /api/v1/accounts/{account_id}/portals/{id}/articles **Add a new article** Add a new article to portal **Request body:** Content-Type: `application/json` -> article_create_update_payload **Responses:** - `200`: Success - `403`: Access denied # APIs Públicas ## API Pública - Contatos Public contact APIs ### POST /public/api/v1/inboxes/{inbox_identifier}/contacts **Create a contact** _Endpoint publico — sem autenticacao._ **Request body:** Content-Type: `application/json` -> public_contact_create_update_payload **Responses:** - `200`: Success - `401`: Unauthorized ### GET /public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier} **Get a contact** Get the details of a contact _Endpoint publico — sem autenticacao._ **Responses:** - `200`: Success - `401`: Unauthorized - `404`: The given contact does not exist ### PATCH /public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier} **Update a contact** Update a contact's attributes _Endpoint publico — sem autenticacao._ **Request body:** Content-Type: `application/json` -> public_contact_create_update_payload **Responses:** - `200`: Success - `401`: Unauthorized ## API Pública - Conversas Public conversation APIs ### POST /public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations **Create a conversation** _Endpoint publico — sem autenticacao._ **Request body:** Content-Type: `application/json` -> public_conversation_create_payload **Responses:** - `200`: Success - `401`: Unauthorized ### GET /public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations **List all conversations** List all conversations for the contact _Endpoint publico — sem autenticacao._ **Responses:** - `200`: Success - `401`: Unauthorized ### GET /public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations/{conversation_id} **Get a single conversation** Retrieves the details of a specific conversation _Endpoint publico — sem autenticacao._ **Responses:** - `200`: Success - `401`: Unauthorized - `404`: Conversation not found ### POST /public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations/{conversation_id}/toggle_status **Resolve a conversation** Marks a conversation as resolved _Endpoint publico — sem autenticacao._ **Responses:** - `200`: Conversation resolved successfully - `401`: Unauthorized - `404`: Conversation not found ### POST /public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations/{conversation_id}/toggle_typing **Toggle typing status** Toggles the typing status in a conversation _Endpoint publico — sem autenticacao._ **Parameters:** - `typing_status` (query) (required): Typing status, either 'on' or 'off' **Request body:** Content-Type: `application/json` - typing_status: string — The typing status to set (ex: on) **Responses:** - `200`: Typing status toggled successfully - `401`: Unauthorized - `404`: Conversation not found ### POST /public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations/{conversation_id}/update_last_seen **Update last seen** Updates the last seen time of the contact in a conversation _Endpoint publico — sem autenticacao._ **Responses:** - `200`: Last seen updated successfully - `401`: Unauthorized - `404`: Conversation not found ## API Pública - Mensagens Public message APIs ### POST /public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations/{conversation_id}/messages **Create a message** _Endpoint publico — sem autenticacao._ **Request body:** Content-Type: `application/json` -> public_message_create_payload **Responses:** - `200`: Success - `401`: Unauthorized ### GET /public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations/{conversation_id}/messages **List all messages** List all messages in the conversation _Endpoint publico — sem autenticacao._ **Responses:** - `200`: Success - `401`: Unauthorized ### PATCH /public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations/{conversation_id}/messages/{message_id} **Update a message** _Endpoint publico — sem autenticacao._ **Request body:** Content-Type: `application/json` -> public_message_update_payload **Responses:** - `200`: Success - `401`: Unauthorized # Outros ## Pesquisa CSAT Customer satisfaction survey ### GET /survey/responses/{conversation_uuid} **Get CSAT survey page** You can redirect the client to this URL, instead of implementing the CSAT survey component yourself. _Endpoint publico — sem autenticacao._ **Responses:** - `200`: Success # SiteUp Custom ## Lead Capture Captura de leads via formularios. Publicos + admin. ### POST /api/leads/capture/{slug} **Captura de lead publico** Recebe form. CORS. Sem auth. _Endpoint publico — sem autenticacao._ **Parameters:** - `slug` (path) (required): **Request body:** Content-Type: `application/json` - name: string (required) - email: string (required) - phone: string - message: string - custom_attributes: object - tracking: object — gclid/fbclid/ctwa_clid/leadgen_id/utm_* **Responses:** - `200`: Sucesso Example: ```json { "success": true, "contact_id": 12345, "conversation_id": 67890 } ``` - `401`: Nao autorizado - `404`: Nao encontrado ### OPTIONS /api/leads/capture/{slug} **CORS preflight** Preflight. _Endpoint publico — sem autenticacao._ **Parameters:** - `slug` (path) (required): **Responses:** - `200`: OK ### GET /lead-capture.js **Script JS embed** JS auto-tracking. _Endpoint publico — sem autenticacao._ **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ### GET /api/v1/accounts/{account_id}/lead_capture_endpoints **Listar endpoints** Lista todos. **Parameters:** - `account_id` (path) (required): **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ### POST /api/v1/accounts/{account_id}/lead_capture_endpoints **Criar endpoint** capture_config define mapeamento. **Parameters:** - `account_id` (path) (required): **Request body:** Content-Type: `application/json` - name: string (required) - slug: string (required) - inbox_id: integer - enabled: boolean - capture_config: object - allowed_origins: array **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ### GET /api/v1/accounts/{account_id}/lead_capture_endpoints/{id} **Detalhe** Config completa. **Parameters:** - `account_id` (path) (required): - `id` (path) (required): **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ### PATCH /api/v1/accounts/{account_id}/lead_capture_endpoints/{id} **Atualizar** Atualiza config. **Parameters:** - `account_id` (path) (required): - `id` (path) (required): **Request body:** Content-Type: `application/json` **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ### DELETE /api/v1/accounts/{account_id}/lead_capture_endpoints/{id} **Excluir** Remove. **Parameters:** - `account_id` (path) (required): - `id` (path) (required): **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ## Captain (Agente IA) Agente IA: preferencias, knowledge base, tarefas. ### GET /api/v1/accounts/{account_id}/ai_agent_documents **Listar knowledge base** PDFs/URLs/textos. **Parameters:** - `account_id` (path) (required): **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ### POST /api/v1/accounts/{account_id}/ai_agent_documents **Adicionar ao knowledge base** PDF/URL/texto pra Capitao usar. **Parameters:** - `account_id` (path) (required): **Request body:** Content-Type: `application/json` - document_type: string - name: string - content: string - url: string **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ### GET /api/v1/accounts/{account_id}/ai_agent_documents/{id} **Detalhe do documento** Conteudo + metadados. **Parameters:** - `account_id` (path) (required): - `id` (path) (required): **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ### DELETE /api/v1/accounts/{account_id}/ai_agent_documents/{id} **Remover documento** Remove do knowledge base. **Parameters:** - `account_id` (path) (required): - `id` (path) (required): **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ## Disparo de Mensagens Broadcasts em massa. ### GET /api/v1/accounts/{account_id}/broadcasts **Listar broadcasts** Historico de disparos. **Parameters:** - `account_id` (path) (required): **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ### POST /api/v1/accounts/{account_id}/broadcasts **Criar broadcast** Dispara em massa. Suporta template + agendamento. **Parameters:** - `account_id` (path) (required): **Request body:** Content-Type: `application/json` - inbox_id: integer (required) - message: string (required) - template_id: string - contact_ids: array (required) - filters: object - scheduled_at: string **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ### GET /api/v1/accounts/{account_id}/broadcasts/{id} **Detalhe do broadcast** Status + estatisticas. **Parameters:** - `account_id` (path) (required): - `id` (path) (required): **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ### DELETE /api/v1/accounts/{account_id}/broadcasts/{id} **Cancelar broadcast** Cancela agendado. **Parameters:** - `account_id` (path) (required): - `id` (path) (required): **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ### GET /api/v1/accounts/{account_id}/whatsapp_group_broadcasts **Listar broadcasts em grupo** Historico em grupos WhatsApp. **Parameters:** - `account_id` (path) (required): **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ### POST /api/v1/accounts/{account_id}/whatsapp_group_broadcasts **Disparar pra grupos WhatsApp** Multiplos grupos simultaneamente. **Parameters:** - `account_id` (path) (required): **Request body:** Content-Type: `application/json` - inbox_id: integer (required) - message: string (required) - group_ids: array (required) **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ## VOIP Chamadas via WhatsApp Business. ### GET /api/v1/accounts/{account_id}/voip_settings **Buscar config VOIP** Settings globais. **Parameters:** - `account_id` (path) (required): **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ### PATCH /api/v1/accounts/{account_id}/voip_settings **Atualizar config VOIP** Atualiza settings. **Parameters:** - `account_id` (path) (required): **Request body:** Content-Type: `application/json` **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ### GET /api/v1/accounts/{account_id}/voip_devices **Listar dispositivos VOIP** Numeros configurados. **Parameters:** - `account_id` (path) (required): **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ### POST /api/v1/accounts/{account_id}/voip_devices **Adicionar dispositivo VOIP** Conecta numero. device_token do WAVOIP. **Parameters:** - `account_id` (path) (required): **Request body:** Content-Type: `application/json` - device_token: string (required) - phone_number: string (required) - simultaneous_calls: integer **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ### GET /api/v1/accounts/{account_id}/voip_devices/{id} **Detalhe do dispositivo** Config + status. **Parameters:** - `account_id` (path) (required): - `id` (path) (required): **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ### PATCH /api/v1/accounts/{account_id}/voip_devices/{id} **Atualizar dispositivo** Atualiza config. **Parameters:** - `account_id` (path) (required): - `id` (path) (required): **Request body:** Content-Type: `application/json` **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ### DELETE /api/v1/accounts/{account_id}/voip_devices/{id} **Remover dispositivo** Desconecta. **Parameters:** - `account_id` (path) (required): - `id` (path) (required): **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ### POST /api/v1/accounts/{account_id}/conversations/{conversation_id}/voip_calls **Iniciar chamada VOIP** Outbound call. **Parameters:** - `account_id` (path) (required): - `conversation_id` (path) (required): **Request body:** Content-Type: `application/json` - device_id: integer **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ### POST /webhooks/wavoip/{device_token} **Webhook WAVOIP** Eventos do WAVOIP. Sem auth. _Endpoint publico — sem autenticacao._ **Parameters:** - `device_token` (path) (required): **Request body:** Content-Type: `application/json` **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ### GET /api/v1/accounts/{account_id}/voip_sla_policies **Listar SLAs** Politicas configuradas. **Parameters:** - `account_id` (path) (required): **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ### PATCH /api/v1/accounts/{account_id}/voip_sla_policies **Atualizar SLA** Atualiza thresholds. **Parameters:** - `account_id` (path) (required): **Request body:** Content-Type: `application/json` **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ## VOIP - Analytics Metricas de chamadas. ### GET /api/v1/accounts/{account_id}/voip_analytics/funnel **Funil de chamadas** Distribuicao pelos estagios do funil. **Parameters:** - `account_id` (path) (required): **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ### GET /api/v1/accounts/{account_id}/voip_analytics/financial **Financeiro** Valor de leads via VOIP. **Parameters:** - `account_id` (path) (required): **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ### GET /api/v1/accounts/{account_id}/voip_analytics/by_agent **Por agente** Metricas por atendente. **Parameters:** - `account_id` (path) (required): **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ### GET /api/v1/accounts/{account_id}/voip_analytics/by_origin **Por origem** Metricas por origem do lead. **Parameters:** - `account_id` (path) (required): **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ### GET /api/v1/accounts/{account_id}/voip_analytics/daily **Diario** Serie temporal diaria. **Parameters:** - `account_id` (path) (required): **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ### GET /api/v1/accounts/{account_id}/voip_analytics/distance **Distancia geografica** Distribuicao geografica. **Parameters:** - `account_id` (path) (required): **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ### GET /api/v1/accounts/{account_id}/voip_analytics/calls_per_lead **Chamadas por lead** Tentativas medias. **Parameters:** - `account_id` (path) (required): **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ### GET /api/v1/accounts/{account_id}/voip_analytics/attendance_rate **Taxa de atendimento** % atendidas. **Parameters:** - `account_id` (path) (required): **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ### GET /api/v1/accounts/{account_id}/voip_analytics/lead_speed **Velocidade de resposta** Tempo entre lead e 1a chamada. **Parameters:** - `account_id` (path) (required): **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ### GET /api/v1/accounts/{account_id}/voip_analytics/fcr_rate **First Call Resolution** % convertidos na 1a ligacao. **Parameters:** - `account_id` (path) (required): **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ### GET /api/v1/accounts/{account_id}/voip_analytics/setup_checklist **Checklist de setup** Status de configuracao. **Parameters:** - `account_id` (path) (required): **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ### GET /api/v1/accounts/{account_id}/voip_analytics/compare **Comparativo** Compara periodos. **Parameters:** - `account_id` (path) (required): **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ### GET /api/v1/accounts/{account_id}/voip_analytics/recent_summaries **Resumos recentes** Ultimas chamadas com resumo IA. **Parameters:** - `account_id` (path) (required): **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ### GET /api/v1/accounts/{account_id}/voip_analytics/targets **Buscar metas** Metas configuradas. **Parameters:** - `account_id` (path) (required): **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ### PATCH /api/v1/accounts/{account_id}/voip_analytics/targets **Atualizar metas** Atualiza alvo. **Parameters:** - `account_id` (path) (required): **Request body:** Content-Type: `application/json` **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ## Call Records Historico de chamadas. ### GET /api/v1/accounts/{account_id}/call_records **Listar chamadas** Historico: status, duracao, scoring, transcricao. **Parameters:** - `account_id` (path) (required): **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ### GET /api/v1/accounts/{account_id}/call_records/{id} **Detalhe da chamada** Inclui transcricao + analise IA. **Parameters:** - `account_id` (path) (required): - `id` (path) (required): **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ### PATCH /api/v1/accounts/{account_id}/call_records/{id} **Atualizar chamada** Disposition + notas. **Parameters:** - `account_id` (path) (required): - `id` (path) (required): **Request body:** Content-Type: `application/json` - disposition: string - notes: string **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ## Lead Scoring Pontuacao de leads. ### GET /api/v1/accounts/{account_id}/contacts/{contact_id}/lead_scores **Historico de scoring** Pontuacoes ao longo do tempo + razoes. **Parameters:** - `account_id` (path) (required): - `contact_id` (path) (required): **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ## Chatbot Flows Flow Builder. ### GET /api/v1/accounts/{account_id}/chatbot_flows **Listar fluxos** Lista flows. **Parameters:** - `account_id` (path) (required): **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ### POST /api/v1/accounts/{account_id}/chatbot_flows **Criar fluxo** Drag-and-drop. **Parameters:** - `account_id` (path) (required): **Request body:** Content-Type: `application/json` - name: string - inbox_ids: array - flow_data: object - enabled: boolean **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ### GET /api/v1/accounts/{account_id}/chatbot_flows/{id} **Detalhe do flow** JSON completo. **Parameters:** - `account_id` (path) (required): - `id` (path) (required): **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ### PATCH /api/v1/accounts/{account_id}/chatbot_flows/{id} **Atualizar flow** Nodes/edges. **Parameters:** - `account_id` (path) (required): - `id` (path) (required): **Request body:** Content-Type: `application/json` **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado ### DELETE /api/v1/accounts/{account_id}/chatbot_flows/{id} **Excluir flow** Remove. **Parameters:** - `account_id` (path) (required): - `id` (path) (required): **Responses:** - `200`: Sucesso - `401`: Nao autorizado - `404`: Nao encontrado # Kanban ## Funis Operações relacionadas aos funis de vendas ### GET /accounts/{account_id}/funnels **Listar funnels** Retorna todos os funis de vendas da conta ordenados por nome **Parameters:** - `account_id` (path) (required): ID da conta **Responses:** - `200`: Lista de funnels retornada com sucesso Example: ```json [ { "id": 1, "name": "Funnel de Vendas", "description": "Funnel principal de vendas", "active": true, "account_id": 1, "created_at": "2024-01-15T10:00:00Z", "updated_at": "2024-01-15T10:00:00Z" } ] ``` - `401`: - `403`: ### POST /accounts/{account_id}/funnels **Criar funnel** Cria um novo funil de vendas com validação de IDs únicos de etapas **Parameters:** - `account_id` (path) (required): ID da conta **Request body:** Content-Type: `application/json` -> FunnelCreate **Responses:** - `201`: Funnel criado com sucesso - `400`: - `422`: - `403`: Limite de funnels atingido ### GET /accounts/{account_id}/funnels/{id} **Obter funnel** Retorna detalhes de um funil específico **Parameters:** - `account_id` (path) (required): ID da conta - `id` (path) (required): ID do funil **Responses:** - `200`: Funnel encontrado - `404`: ### PUT /accounts/{account_id}/funnels/{id} **Atualizar funnel** Atualiza um funil de vendas existente **Parameters:** - `account_id` (path) (required): ID da conta - `id` (path) (required): ID do funil **Request body:** Content-Type: `application/json` -> FunnelUpdate **Responses:** - `200`: Funnel atualizado com sucesso - `400`: - `404`: - `422`: ### DELETE /accounts/{account_id}/funnels/{id} **Excluir funnel** Exclui um funil de vendas **Parameters:** - `account_id` (path) (required): ID da conta - `id` (path) (required): ID do funil **Responses:** - `200`: Funnel excluído com sucesso - `404`: ### GET /accounts/{account_id}/funnels/{id}/stage_stats **Estatísticas por etapa** Retorna estatísticas dos itens por etapa do funil (name, color, description, count, total_value). Aceita filtros opcionais: prioridades, agente, valor, datas e exibição de won/lost. **Parameters:** - `account_id` (path) (required): ID da conta - `id` (path) (required): ID do funil - `priorities` (query): Filtrar por prioridades (array) - `agent_id` (query): ID do agente; use -1 para itens não atribuídos - `value_min` (query): Valor mínimo do item - `value_max` (query): Valor máximo do item - `date_start` (query): Filtrar itens criados a partir desta data - `date_end` (query): Filtrar itens criados até esta data - `show_won` (query): Incluir itens com status won (default true) - `show_lost` (query): Incluir itens com status lost (default true) **Responses:** - `200`: Estatísticas das etapas (stages com name, color, description, count, total_value; total_items) Example: ```json { "stages": { "lead": { "name": "Lead", "color": "#3b82f6", "description": null, "count": 5, "total_value": 5000.0 }, "prospect": { "name": "Prospecto", "color": "#f59e0b", "description": null, "count": 3, "total_value": 3000.0 }, "customer": { "name": "Cliente", "color": "#10b981", "description": null, "count": 2, "total_value": 2000.0 } }, "total_items": 10 } ``` - `404`: ## Ofertas Operações relacionadas às ofertas ### GET /accounts/{account_id}/offers **Listar ofertas** Retorna todas as ofertas da conta **Parameters:** - `account_id` (path) (required): ID da conta **Responses:** - `200`: Lista de ofertas retornada com sucesso Example: ```json [ { "id": 123, "title": "Oferta Black Friday", "value": "99.9", "currency": "BRL", "type": "main", "product_link": "https://exemplo.com/produto", "offer_group_id": 10, "offer_group_name": "Grupo Principal", "additional_data": { "orderbump_offer_ids": [ 2, 3 ] }, "created_at": "2026-04-07T10:11:12.000Z", "updated_at": "2026-04-07T10:11:12.000Z", "image_url": null, "usage_items_count": 4 } ] ``` - `401`: - `403`: ### POST /accounts/{account_id}/offers **Criar oferta** Cria uma nova oferta para a conta **Parameters:** - `account_id` (path) (required): ID da conta **Request body:** Content-Type: `application/json` - offer: object (required) - title: string - value: number - currency: string - type: string - product_link: string - offer_group_id: ['integer', 'null'] - additional_data: object **Responses:** - `201`: Oferta criada com sucesso Example: ```json { "id": 124, "title": "Nova Oferta", "value": "129.9", "currency": "BRL", "type": "main", "product_link": "https://exemplo.com/nova-oferta", "offer_group_id": 10, "offer_group_name": "Grupo Principal", "additional_data": { "orderbump_offer_ids": [ 2 ] }, "created_at": "2026-04-07T10:20:00.000Z", "updated_at": "2026-04-07T10:20:00.000Z", "image_url": null } ``` - `400`: - `401`: - `403`: - `422`: ### GET /accounts/{account_id}/offers/search **Buscar ofertas por texto** Retorna ofertas que correspondem ao texto pesquisado **Parameters:** - `account_id` (path) (required): ID da conta - `query` (query) (required): Texto para busca **Responses:** - `200`: Lista de ofertas filtradas retornada com sucesso Example: ```json [ { "id": 123, "title": "Oferta Black Friday", "value": "99.9", "currency": "BRL", "type": "main", "product_link": "https://exemplo.com/produto", "offer_group_id": 10, "offer_group_name": "Grupo Principal", "additional_data": { "orderbump_offer_ids": [ 2, 3 ] }, "created_at": "2026-04-07T10:11:12.000Z", "updated_at": "2026-04-07T10:11:12.000Z", "image_url": null } ] ``` - `400`: - `401`: - `403`: ### GET /accounts/{account_id}/offers/{id} **Buscar oferta por ID** Retorna os dados de uma oferta específica **Parameters:** - `account_id` (path) (required): ID da conta - `id` (path) (required): ID da oferta **Responses:** - `200`: Oferta encontrada Example: ```json { "id": 123, "title": "Oferta Black Friday", "value": "99.9", "currency": "BRL", "type": "main", "product_link": "https://exemplo.com/produto", "offer_group_id": 10, "offer_group_name": "Grupo Principal", "additional_data": { "orderbump_offer_ids": [ 2, 3 ] }, "created_at": "2026-04-07T10:11:12.000Z", "updated_at": "2026-04-07T10:11:12.000Z", "image_url": null } ``` - `401`: - `403`: - `404`: ### PATCH /accounts/{account_id}/offers/{id} **Atualizar oferta** Atualiza os dados de uma oferta existente **Parameters:** - `account_id` (path) (required): ID da conta - `id` (path) (required): ID da oferta **Request body:** Content-Type: `application/json` - offer: object (required) - title: string - value: number - currency: string - type: string - product_link: string - offer_group_id: ['integer', 'null'] - additional_data: object **Responses:** - `200`: Oferta atualizada com sucesso Example: ```json { "id": 123, "title": "Oferta atualizada", "value": "149.9", "currency": "BRL", "type": "main", "product_link": "https://exemplo.com/oferta-atualizada", "offer_group_id": null, "offer_group_name": null, "additional_data": { "orderbump_offer_ids": [ 3, 4 ] }, "created_at": "2026-04-07T10:11:12.000Z", "updated_at": "2026-04-07T10:25:00.000Z", "image_url": null } ``` - `400`: - `401`: - `403`: - `404`: - `422`: ### DELETE /accounts/{account_id}/offers/{id} **Deletar oferta** Exclui uma oferta existente **Parameters:** - `account_id` (path) (required): ID da conta - `id` (path) (required): ID da oferta **Responses:** - `200`: Oferta deletada com sucesso - `401`: - `403`: - `404`: ## Itens Kanban Operações relacionadas aos itens do Kanban ### GET /accounts/{account_id}/kanban_items **Listar kanban items** Retorna todos os itens do Kanban com paginação e filtros **Parameters:** - `account_id` (path) (required): ID da conta - `funnel_id` (query) (required): ID do funil - `stage_id` (query): ID da etapa para filtrar - `agent_id` (query): ID do agente para filtrar - `conversation` (query): ID da conversa (display_id) para filtrar itens vinculados a essa conversa - `page` (query): Número da página (padrão: 1) **Responses:** - `200`: Lista de kanban items com paginação Example: ```json { "items": [ { "id": 1, "funnel_id": 1, "funnel_stage": "lead", "position": 1, "item_details": { "title": "Novo Lead", "description": "Descrição do lead", "priority": "high", "value": 1000.0 } } ], "pagination": { "current_page": 1, "total_count": 50, "has_more": true, "items_per_page": 50 } } ``` - `400`: ### POST /accounts/{account_id}/kanban_items **Criar kanban item** Cria um novo item no Kanban **Parameters:** - `account_id` (path) (required): ID da conta **Request body:** Content-Type: `application/json` -> KanbanItemCreate **Responses:** - `201`: Kanban item criado - `400`: - `422`: ### POST /accounts/{account_id}/kanban_items/reorder **Reordenar kanban items** Reordena os itens do Kanban em suas respectivas etapas **Parameters:** - `account_id` (path) (required): ID da conta **Request body:** Content-Type: `application/json` -> ReorderRequest **Responses:** - `200`: Items reordenados com sucesso - `400`: - `422`: ### GET /accounts/{account_id}/kanban_items/{id} **Obter kanban item** Retorna detalhes de um item específico com cache **Parameters:** - `account_id` (path) (required): ID da conta - `id` (path) (required): ID do item **Responses:** - `200`: Kanban item encontrado - `404`: ### PUT /accounts/{account_id}/kanban_items/{id} **Atualizar kanban item** Atualiza um item do Kanban **Parameters:** - `account_id` (path) (required): ID da conta - `id` (path) (required): ID do item **Request body:** Content-Type: `application/json` -> KanbanItemUpdate **Responses:** - `200`: Kanban item atualizado - `400`: - `404`: - `422`: ### DELETE /accounts/{account_id}/kanban_items/{id} **Excluir kanban item** Exclui um item do Kanban **Parameters:** - `account_id` (path) (required): ID da conta - `id` (path) (required): ID do item **Responses:** - `200`: Kanban item excluído com sucesso - `404`: ### POST /accounts/{account_id}/kanban_items/{id}/move_to_stage **Mover item para etapa** Move um item do Kanban para uma etapa específica **Parameters:** - `account_id` (path) (required): ID da conta - `id` (path) (required): ID do item - `funnel_stage` (query) (required): Nova etapa do item - `funnel_id` (query): ID do funil **Responses:** - `200`: Item movido para etapa com sucesso - `400`: - `404`: ### POST /accounts/{account_id}/kanban_items/{id}/move **Mover item** Move um item do Kanban para outro funil/etapa **Parameters:** - `account_id` (path) (required): ID da conta - `id` (path) (required): ID do item - `funnel_id` (query) (required): ID do funil de destino - `funnel_stage` (query) (required): Etapa de destino **Responses:** - `200`: Item movido com sucesso - `400`: - `404`: ### POST /accounts/{account_id}/kanban_items/{id}/change_status **Mudar status** Muda o status do kanban item (won, lost, open) **Parameters:** - `account_id` (path) (required): ID da conta - `id` (path) (required): ID do item **Request body:** Content-Type: `application/json` - status: string (required) — Novo status do item (ex: won) **Responses:** - `200`: Status alterado - `400`: - `404`: - `422`: ### GET /accounts/{account_id}/kanban_items/reports **Relatórios de kanban items** Retorna métricas e relatórios dos itens (from, to, funnel_id, channel, user_ids[]) **Parameters:** - `account_id` (path) (required): - `funnel_id` (query): - `from` (query): Timestamp início (segundos ou milissegundos) - `to` (query): Timestamp fim (segundos ou milissegundos) - `channel` (query): Canal para filtrar relatórios (ex: Whatsapp) - `user_ids` (query): IDs dos agentes para filtrar (ex: user_ids[]=5&user_ids[]=9) **Responses:** - `200`: Métricas de relatório Example: ```json { "date_range": { "from": 1711929600, "to": 1714521600 }, "filters": { "funnel_id": 2, "channel": "Whatsapp", "user_ids": [ 5, 9 ] }, "totals": { "total_items": 42, "won_items": 10, "lost_items": 6, "open_items": 26, "total_value": 12500.75 } } ``` - `401`: - `403`: ### GET /accounts/{account_id}/kanban_items/search **Buscar kanban items** Busca itens por texto (title, description, customer_name, customer_email) **Parameters:** - `account_id` (path) (required): - `query` (query) (required): - `funnel_id` (query): **Responses:** - `200`: Lista de itens encontrados - `401`: ### GET /accounts/{account_id}/kanban_items/filter **Filtrar kanban items** Filtra itens por prioridades, valor, agente, conversa, datas (priorities, value_min, value_max, agent_id, conversation, date_start, date_end, scheduled_date_start, scheduled_date_end) **Parameters:** - `account_id` (path) (required): - `funnel_id` (query): - `priorities` (query): - `value_min` (query): - `value_max` (query): - `agent_id` (query): - `conversation` (query): ID da conversa (display_id) para filtrar itens vinculados a essa conversa - `date_start` (query): - `date_end` (query): - `scheduled_date_start` (query): - `scheduled_date_end` (query): **Responses:** - `200`: Lista de itens filtrados - `401`: - `403`: ### GET /accounts/{account_id}/kanban_items/export **Exportar kanban items (CSV)** Exporta itens do funil em CSV (funnel_id obrigatório; filtros opcionais) **Parameters:** - `account_id` (path) (required): - `funnel_id` (query) (required): - `priorities` (query): - `value_min` (query): - `value_max` (query): - `agent_id` (query): - `date_start` (query): - `date_end` (query): - `scheduled_date_start` (query): - `scheduled_date_end` (query): **Responses:** - `200`: Arquivo CSV - `400`: - `403`: ### POST /accounts/{account_id}/kanban_items/import **Importar kanban items (CSV)** Importa itens a partir de CSV (funnel_id, file, mappings, default_stage_id) **Parameters:** - `account_id` (path) (required): **Request body:** Content-Type: `multipart/form-data` - funnel_id: integer - default_stage_id: string - mappings: object - file: string **Responses:** - `200`: Resultado da importação (created_count, error_count, errors) - `400`: - `404`: - `422`: ### POST /accounts/{account_id}/kanban_items/bulk_move_items **Mover múltiplos itens de etapa** Move vários itens para uma nova etapa (item_ids, new_stage, funnel_id opcional) **Parameters:** - `account_id` (path) (required): **Request body:** Content-Type: `application/json` - item_ids: array (required) (ex: [1, 2, 3]) - new_stage: string (required) (ex: prospect) - funnel_id: integer **Responses:** - `200`: moved_count, total_requested, errors, new_stage - `400`: - `404`: ### POST /accounts/{account_id}/kanban_items/bulk_assign_agent **Atribuir agente em massa** Atribui um agente a múltiplos itens (item_ids, agent_id, mode: replace ou add) **Parameters:** - `account_id` (path) (required): **Request body:** Content-Type: `application/json` - item_ids: array (required) - agent_id: integer (required) - mode: string **Responses:** - `200`: assigned_count, total_requested, errors, agent_id, agent_name, mode - `400`: - `404`: ### POST /accounts/{account_id}/kanban_items/bulk_set_priority **Definir prioridade em massa** Aplica prioridade a múltiplos itens (item_ids, priority: high, medium, low, urgent, none) **Parameters:** - `account_id` (path) (required): **Request body:** Content-Type: `application/json` - item_ids: array (required) - priority: string (required) **Responses:** - `200`: updated_count, total_requested, errors, priority - `400`: - `404`: ### GET /accounts/{account_id}/kanban_items/{id}/time_report **Relatório de tempo do item** Retorna tempo total gasto no item (timer_duration + sessão atual se timer rodando) **Parameters:** - `account_id` (path) (required): - `id` (path) (required): ID do item **Responses:** - `200`: item_id, total_duration_seconds, total_duration_formatted, timer_started_at, is_timer_running - `404`: ### GET /accounts/{account_id}/kanban_items/{id}/stage_time_breakdown **Tempo por etapa** Retorna o tempo gasto em cada etapa do funil para o item **Parameters:** - `account_id` (path) (required): - `id` (path) (required): ID do item **Responses:** - `200`: item_id, stage_breakdown, total_stages - `404`: ### GET /accounts/{account_id}/kanban_items/{id}/counts **Contagens do item** Retorna contagem de notas, checklist e anexos **Parameters:** - `account_id` (path) (required): - `id` (path) (required): ID do item **Responses:** - `200`: item_id, notes_count, checklist_count, attachments_count Example: ```json { "item_id": 123, "notes_count": 8, "checklist_count": 14, "attachments_count": 3 } ``` - `404`: ### GET /accounts/{account_id}/kanban_items/{id}/checklist_progress_by_agent **Progresso do checklist por agente** Retorna progresso do checklist agrupado por agente atribuído **Parameters:** - `account_id` (path) (required): - `id` (path) (required): ID do item **Responses:** - `200`: item_id, checklist_total_items, progress_by_agent, summary Example: ```json { "item_id": 123, "checklist_total_items": 10, "progress_by_agent": [ { "agent_id": 5, "completed": 4, "pending": 1 }, { "agent_id": 9, "completed": 2, "pending": 3 } ], "summary": { "completed": 6, "pending": 4 } } ``` - `404`: ## Agentes (Kanban) ### POST /accounts/{account_id}/kanban_items/{id}/assign_agent **Atribuir agente** Atribui um agente ao kanban item **Parameters:** - `account_id` (path) (required): ID da conta - `id` (path) (required): ID do item **Request body:** Content-Type: `application/json` - agent_id: integer (required) — ID do agente (ex: 1) **Responses:** - `200`: Agente atribuído - `400`: - `404`: - `422`: ### POST /accounts/{account_id}/kanban_items/{id}/remove_agent **Remover agente** Remove um agente do kanban item **Parameters:** - `account_id` (path) (required): ID da conta - `id` (path) (required): ID do item **Request body:** Content-Type: `application/json` - agent_id: integer (required) — ID do agente (ex: 1) **Responses:** - `200`: Agente removido - `400`: - `404`: - `422`: ### GET /accounts/{account_id}/kanban_items/{id}/assigned_agents **Listar agentes atribuídos** Retorna os agentes atribuídos ao kanban item **Parameters:** - `account_id` (path) (required): ID da conta - `id` (path) (required): ID do item **Responses:** - `200`: Agentes atribuídos Example: ```json { "assigned_agents": [ { "id": 1, "name": "João Silva", "email": "joao@example.com", "avatar_url": "https://example.com/avatar.jpg", "availability_status": "online" } ], "primary_agent": { "id": 1, "name": "João Silva", "email": "joao@example.com", "avatar_url": "https://example.com/avatar.jpg", "availability_status": "online" } } ``` - `404`: ## Checklist Operações relacionadas ao checklist ### POST /accounts/{account_id}/kanban_items/{id}/create_checklist_item **Criar item do checklist** Adiciona um novo item ao checklist do kanban item **Parameters:** - `account_id` (path) (required): ID da conta - `id` (path) (required): ID do item **Request body:** Content-Type: `application/json` - text: string (required) — Texto do item do checklist (ex: Fazer follow-up com o cliente) **Responses:** - `200`: Item do checklist criado - `400`: - `404`: ### POST /accounts/{account_id}/kanban_items/{id}/assign_agent_to_checklist_item **Atribuir agente ao item do checklist** Atribui um agente a um item específico do checklist **Parameters:** - `account_id` (path) (required): ID da conta - `id` (path) (required): ID do item **Request body:** Content-Type: `application/json` - checklist_item_id: string (required) — ID do item do checklist (ex: uuid-123) - agent_id: integer (required) — ID do agente (ex: 1) **Responses:** - `200`: Agente atribuído ao item do checklist - `400`: - `404`: ### POST /accounts/{account_id}/kanban_items/{id}/remove_agent_from_checklist_item **Remover agente do item do checklist** Remove um agente de um item específico do checklist **Parameters:** - `account_id` (path) (required): ID da conta - `id` (path) (required): ID do item **Request body:** Content-Type: `application/json` - checklist_item_id: string (required) — ID do item do checklist (ex: uuid-123) **Responses:** - `200`: Agente removido do item do checklist - `400`: - `404`: ### GET /accounts/{account_id}/kanban_items/{id}/get_checklist **Listar checklist do item** Retorna o checklist do kanban item **Parameters:** - `account_id` (path) (required): - `id` (path) (required): ID do item **Responses:** - `200`: item_id, checklist, checklist_count - `404`: ### DELETE /accounts/{account_id}/kanban_items/{id}/delete_checklist_item **Excluir item do checklist** Remove um item do checklist (checklist_item_id) **Parameters:** - `account_id` (path) (required): - `id` (path) (required): ID do item - `checklist_item_id` (query) (required): **Responses:** - `200`: Kanban item atualizado - `404`: ### PATCH /accounts/{account_id}/kanban_items/{id}/update_checklist_item **Atualizar item do checklist** Atualiza um item do checklist (checklist_item_id; text, due_date, priority, agent_id, linked_*) **Parameters:** - `account_id` (path) (required): - `id` (path) (required): ID do item **Request body:** Content-Type: `application/json` - checklist_item_id: string (required) - text: string - due_date: string - priority: string - agent_id: integer - linked_item_id: integer - linked_conversation_id: integer - linked_contact_id: integer **Responses:** - `200`: Kanban item atualizado - `400`: - `404`: ### POST /accounts/{account_id}/kanban_items/{id}/toggle_checklist_item **Marcar/desmarcar item do checklist** Alterna o status completed de um item do checklist (checklist_item_id) **Parameters:** - `account_id` (path) (required): - `id` (path) (required): ID do item **Request body:** Content-Type: `application/json` - checklist_item_id: string (required) — ID do item do checklist **Responses:** - `200`: Kanban item atualizado - `400`: - `404`: ### POST /accounts/{account_id}/kanban_items/{id}/duplicate_checklist **Duplicar checklist para outro item** Copia o checklist deste item para outro (target_item_id; merge=true para mesclar) **Parameters:** - `account_id` (path) (required): - `id` (path) (required): ID do item origem **Request body:** Content-Type: `application/json` - target_item_id: integer (required) - merge: string — Se true, mescla com checklist existente do destino **Responses:** - `200`: source_item_id, target_item_id, duplicated_items_count, total_items_count - `404`: - `422`: ### GET /accounts/{account_id}/kanban_items/{id}/search_checklist **Buscar no checklist** Busca itens do checklist por texto (query) **Parameters:** - `account_id` (path) (required): - `id` (path) (required): ID do item - `query` (query): **Responses:** - `200`: item_id, query, total_items, filtered_items, checklist - `404`: ## Notas Operações relacionadas às notas ### POST /accounts/{account_id}/kanban_items/{id}/create_note **Criar nota** Adiciona uma nova nota ao kanban item **Parameters:** - `account_id` (path) (required): ID da conta - `id` (path) (required): ID do item **Request body:** Content-Type: `application/json` - text: string (required) — Texto da nota (ex: Cliente interessado no produto premium) **Responses:** - `200`: Nota criada - `400`: - `404`: ### GET /accounts/{account_id}/kanban_items/{id}/get_notes **Listar notas do item** Retorna as notas do kanban item **Parameters:** - `account_id` (path) (required): - `id` (path) (required): ID do item **Responses:** - `200`: item_id, notes, notes_count - `404`: ### PATCH /accounts/{account_id}/kanban_items/{id}/update_note **Atualizar nota** Atualiza uma nota do item (note_id no body; text, attachments, linked_item_id, linked_conversation_id, linked_contact_id) **Parameters:** - `account_id` (path) (required): - `id` (path) (required): ID do item **Request body:** Content-Type: `application/json` - note_id: string (required) — ID da nota - text: string - attachments: array - linked_item_id: integer - linked_conversation_id: integer - linked_contact_id: integer **Responses:** - `200`: Kanban item atualizado - `400`: - `404`: ### DELETE /accounts/{account_id}/kanban_items/{id}/delete_note **Excluir nota** Remove uma nota do item (note_id no body ou query) **Parameters:** - `account_id` (path) (required): - `id` (path) (required): ID do item - `note_id` (query): **Request body:** Content-Type: `application/json` - note_id: string **Responses:** - `200`: Kanban item atualizado - `404`: ## Mensagens Agendadas Operações relacionadas às mensagens agendadas ### GET /accounts/{account_id}/conversations/{conversation_id}/scheduled_messages **Listar mensagens agendadas** Retorna todas as mensagens agendadas de uma conversa específica **Parameters:** - `account_id` (path) (required): ID da conta - `conversation_id` (path) (required): ID da conversa **Responses:** - `200`: Lista de mensagens agendadas retornada com sucesso Example: ```json { "payload": [ { "id": 3, "message": "TEste", "scheduled_at": 1756302600, "title": "Teste", "inbox_id": 7, "conversation_id": 1918, "created_at": 1756302539, "status": "pending", "is_recurrent": false, "period": "" } ] } ``` - `400`: - `401`: - `403`: - `404`: ### POST /accounts/{account_id}/conversations/{conversation_id}/scheduled_messages **Criar mensagem agendada** Cria uma nova mensagem agendada para uma conversa específica **Parameters:** - `account_id` (path) (required): ID da conta - `conversation_id` (path) (required): ID da conversa **Request body:** Content-Type: `application/json` -> ScheduledMessageCreate **Responses:** - `200`: Mensagem agendada criada com sucesso Example: ```json { "id": 3, "message": "Lembrete: reunião às 14h", "scheduled_at": 1756302600, "title": "Reunião", "inbox_id": 7, "conversation_id": 1897, "created_at": 1756302539, "status": "pending", "is_recurrent": false, "period": "" } ``` - `400`: - `401`: - `403`: - `404`: - `422`: ### PATCH /accounts/{account_id}/conversations/{conversation_id}/scheduled_messages/{id} **Atualizar mensagem agendada** Atualiza uma mensagem agendada específica **Parameters:** - `account_id` (path) (required): ID da conta - `conversation_id` (path) (required): ID da conversa - `id` (path) (required): ID da mensagem agendada **Request body:** Content-Type: `application/json` -> ScheduledMessageUpdate **Responses:** - `200`: Mensagem agendada atualizada com sucesso Example: ```json { "id": 3, "message": "Novo conteúdo da mensagem", "scheduled_at": 1756388400, "title": "Título Atualizado", "inbox_id": 7, "conversation_id": 1897, "created_at": 1756302539, "status": "pending", "is_recurrent": false, "period": "" } ``` - `400`: - `401`: - `403`: - `404`: - `422`: ### DELETE /accounts/{account_id}/conversations/{conversation_id}/scheduled_messages/{id} **Excluir mensagem agendada** Exclui uma mensagem agendada específica **Parameters:** - `account_id` (path) (required): ID da conta - `conversation_id` (path) (required): ID da conversa - `id` (path) (required): ID da mensagem agendada **Responses:** - `200`: Mensagem agendada excluída com sucesso - `400`: - `401`: - `403`: - `404`: