{"openapi":"3.1.0","info":{"title":"API do Atendux","version":"1.0.0","description":"API pública do Atendux. Autentique com `Authorization: Bearer atx_...` (Configurações → Integrações → API e webhooks). Limite por empresa, por minuto: light 60, essencial 120, equipe 300, empresa 600. Erros no formato { \"error\": { \"code\", \"message\", \"details\" } }."},"jsonSchemaDialect":"https://json-schema.org/draft/2020-12/schema","servers":[{"url":"https://api.atendux.tech/public/v1"}],"tags":[{"name":"Contatos"},{"name":"Conversas"},{"name":"Consultas"},{"name":"Webhooks"}],"paths":{"/contacts":{"get":{"operationId":"contactsList","tags":["Contatos"],"summary":"Listar e buscar contatos","description":"Contatos da empresa, dos mais recentes para os mais antigos, com busca por nome, e-mail ou telefone.\n\nEscopo: `contacts:read` (Ver contatos).","security":[{"bearerAuth":[]}],"x-atendux-scope":"contacts:read","parameters":[{"name":"q","in":"query","required":false,"description":"Busca por nome, e-mail ou telefone (2 caracteres ou mais).","schema":{"type":"string","maxLength":80}},{"name":"cursor","in":"query","required":false,"description":"Cursor da próxima página.","schema":{"type":"string","minLength":1,"maxLength":512}},{"name":"limit","in":"query","required":false,"description":"Itens por página (1 a 100, padrão 50).","schema":{"default":50,"type":"integer","minimum":1,"maximum":100}}],"responses":{"200":{"description":"Sucesso.","content":{"application/json":{"schema":{"type":"object","properties":{"contacts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":["string","null"]},"phone":{"description":"Só dígitos, com o código do país (5548999990000).","type":["string","null"]},"email":{"type":["string","null"]},"company":{"type":["string","null"]},"notes":{"type":["string","null"]},"customFields":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"origin":{"type":"string","enum":["channel","import","manual","crm"]},"tags":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"},"color":{"type":"string","enum":["teal","blue","amber","violet","red","gray"]}},"required":["id","name","color"],"additionalProperties":false}},"createdAt":{"type":"string","description":"Data e hora em ISO 8601 (UTC)."}},"required":["id","name","phone","email","company","notes","customFields","origin","tags","createdAt"],"additionalProperties":false}},"nextCursor":{"type":["string","null"]}},"required":["contacts","nextCursor"],"additionalProperties":false}}}},"400":{"description":"Dados inválidos (INVALID_PAYLOAD, com details.field).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Chave ausente, inválida, revogada ou vencida (UNAUTHENTICATED).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Fora dos escopos da chave (FORBIDDEN_SCOPE), sem a permissão no painel (FORBIDDEN_PERMISSION), assinatura inativa ou termos pendentes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não encontrado nesta empresa (NOT_FOUND).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflito com o estado atual (veja o code).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Limite de pedidos por minuto do plano (RATE_LIMITED). Espere o Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"contactsCreate","tags":["Contatos"],"summary":"Criar contato","description":"Cria um contato com nome, telefone ou e-mail. Telefone ou e-mail já cadastrado responde 409 CONTACT_EXISTS (details.contactId traz o existente).\n\nEscopo: `contacts:write` (Criar e editar contatos).","security":[{"bearerAuth":[]}],"x-atendux-scope":"contacts:write","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"anyOf":[{"type":"string","maxLength":1000},{"type":"null"}]},"phone":{"anyOf":[{"type":"string","maxLength":40},{"type":"null"}]},"email":{"anyOf":[{"type":"string","maxLength":1000},{"type":"null"}]},"notes":{"anyOf":[{"type":"string","maxLength":20000},{"type":"null"}]},"tagIds":{"default":[],"maxItems":50,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}}}}}},"responses":{"201":{"description":"Sucesso.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":["string","null"]},"phone":{"description":"Só dígitos, com o código do país (5548999990000).","type":["string","null"]},"email":{"type":["string","null"]},"company":{"type":["string","null"]},"notes":{"type":["string","null"]},"customFields":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"origin":{"type":"string","enum":["channel","import","manual","crm"]},"tags":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"},"color":{"type":"string","enum":["teal","blue","amber","violet","red","gray"]}},"required":["id","name","color"],"additionalProperties":false}},"createdAt":{"type":"string","description":"Data e hora em ISO 8601 (UTC)."}},"required":["id","name","phone","email","company","notes","customFields","origin","tags","createdAt"],"additionalProperties":false}}}},"400":{"description":"Dados inválidos (INVALID_PAYLOAD, com details.field).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Chave ausente, inválida, revogada ou vencida (UNAUTHENTICATED).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Fora dos escopos da chave (FORBIDDEN_SCOPE), sem a permissão no painel (FORBIDDEN_PERMISSION), assinatura inativa ou termos pendentes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não encontrado nesta empresa (NOT_FOUND).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflito com o estado atual (veja o code).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Limite de pedidos por minuto do plano (RATE_LIMITED). Espere o Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/contacts/{id}":{"get":{"operationId":"contactsGet","tags":["Contatos"],"summary":"Ver contato","description":"Um contato, com telefone, e-mail, campos personalizados e etiquetas.\n\nEscopo: `contacts:read` (Ver contatos).","security":[{"bearerAuth":[]}],"x-atendux-scope":"contacts:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Sucesso.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":["string","null"]},"phone":{"description":"Só dígitos, com o código do país (5548999990000).","type":["string","null"]},"email":{"type":["string","null"]},"company":{"type":["string","null"]},"notes":{"type":["string","null"]},"customFields":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"origin":{"type":"string","enum":["channel","import","manual","crm"]},"tags":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"},"color":{"type":"string","enum":["teal","blue","amber","violet","red","gray"]}},"required":["id","name","color"],"additionalProperties":false}},"createdAt":{"type":"string","description":"Data e hora em ISO 8601 (UTC)."}},"required":["id","name","phone","email","company","notes","customFields","origin","tags","createdAt"],"additionalProperties":false}}}},"400":{"description":"Dados inválidos (INVALID_PAYLOAD, com details.field).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Chave ausente, inválida, revogada ou vencida (UNAUTHENTICATED).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Fora dos escopos da chave (FORBIDDEN_SCOPE), sem a permissão no painel (FORBIDDEN_PERMISSION), assinatura inativa ou termos pendentes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não encontrado nesta empresa (NOT_FOUND).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflito com o estado atual (veja o code).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Limite de pedidos por minuto do plano (RATE_LIMITED). Espere o Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"contactsUpdate","tags":["Contatos"],"summary":"Editar contato","description":"Muda só os campos enviados. O telefone que veio do WhatsApp não muda (409 CONFLICT).\n\nEscopo: `contacts:write` (Criar e editar contatos).","security":[{"bearerAuth":[]}],"x-atendux-scope":"contacts:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"email":{"anyOf":[{"type":"string","const":""},{"type":"null"},{"type":"string","maxLength":254,"format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"}]},"phone":{"anyOf":[{"type":"string","maxLength":40},{"type":"null"}]},"company":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}]},"notes":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}]},"customFields":{"type":"object","propertyNames":{"type":"string","minLength":1,"maxLength":40},"additionalProperties":{"type":"string","maxLength":200}}}}}}},"responses":{"200":{"description":"Sucesso.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":["string","null"]},"phone":{"description":"Só dígitos, com o código do país (5548999990000).","type":["string","null"]},"email":{"type":["string","null"]},"company":{"type":["string","null"]},"notes":{"type":["string","null"]},"customFields":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"origin":{"type":"string","enum":["channel","import","manual","crm"]},"tags":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"},"color":{"type":"string","enum":["teal","blue","amber","violet","red","gray"]}},"required":["id","name","color"],"additionalProperties":false}},"createdAt":{"type":"string","description":"Data e hora em ISO 8601 (UTC)."}},"required":["id","name","phone","email","company","notes","customFields","origin","tags","createdAt"],"additionalProperties":false}}}},"400":{"description":"Dados inválidos (INVALID_PAYLOAD, com details.field).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Chave ausente, inválida, revogada ou vencida (UNAUTHENTICATED).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Fora dos escopos da chave (FORBIDDEN_SCOPE), sem a permissão no painel (FORBIDDEN_PERMISSION), assinatura inativa ou termos pendentes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não encontrado nesta empresa (NOT_FOUND).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflito com o estado atual (veja o code).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Limite de pedidos por minuto do plano (RATE_LIMITED). Espere o Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/contacts/{id}/tags":{"put":{"operationId":"contactsTags","tags":["Contatos"],"summary":"Trocar as etiquetas do contato","description":"O contato fica exatamente com as etiquetas enviadas.\n\nEscopo: `contacts:write` (Criar e editar contatos).","security":[{"bearerAuth":[]}],"x-atendux-scope":"contacts:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"tagIds":{"description":"Ids das etiquetas (GET /tags). Lista vazia tira todas.","maxItems":100,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}},"required":["tagIds"]}}}},"responses":{"200":{"description":"Sucesso.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":["string","null"]},"phone":{"description":"Só dígitos, com o código do país (5548999990000).","type":["string","null"]},"email":{"type":["string","null"]},"company":{"type":["string","null"]},"notes":{"type":["string","null"]},"customFields":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"origin":{"type":"string","enum":["channel","import","manual","crm"]},"tags":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"},"color":{"type":"string","enum":["teal","blue","amber","violet","red","gray"]}},"required":["id","name","color"],"additionalProperties":false}},"createdAt":{"type":"string","description":"Data e hora em ISO 8601 (UTC)."}},"required":["id","name","phone","email","company","notes","customFields","origin","tags","createdAt"],"additionalProperties":false}}}},"400":{"description":"Dados inválidos (INVALID_PAYLOAD, com details.field).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Chave ausente, inválida, revogada ou vencida (UNAUTHENTICATED).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Fora dos escopos da chave (FORBIDDEN_SCOPE), sem a permissão no painel (FORBIDDEN_PERMISSION), assinatura inativa ou termos pendentes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não encontrado nesta empresa (NOT_FOUND).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflito com o estado atual (veja o code).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Limite de pedidos por minuto do plano (RATE_LIMITED). Espere o Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/conversations":{"get":{"operationId":"conversationsList","tags":["Conversas"],"summary":"Listar conversas","description":"Conversas da empresa, das mais novas para as mais antigas, com filtro de situação, setor e atividade desde uma data.\n\nEscopo: `conversations:read` (Ver conversas).","security":[{"bearerAuth":[]}],"x-atendux-scope":"conversations:read","parameters":[{"name":"status","in":"query","required":false,"description":"open ou closed. Sem ele, as duas.","schema":{"type":"string","enum":["open","closed"]}},{"name":"queueId","in":"query","required":false,"description":"Só as conversas deste setor.","schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"updatedSince","in":"query","required":false,"description":"Só as conversas com atividade a partir desta data (ISO 8601).","schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"cursor","in":"query","required":false,"description":"Cursor da próxima página.","schema":{"type":"string","minLength":1,"maxLength":512}},{"name":"limit","in":"query","required":false,"description":"Itens por página (1 a 100, padrão 50).","schema":{"default":50,"type":"integer","minimum":1,"maximum":100}}],"responses":{"200":{"description":"Sucesso.","content":{"application/json":{"schema":{"type":"object","properties":{"conversations":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"status":{"type":"string","enum":["open","closed"]},"contact":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":["string","null"]},"phone":{"type":["string","null"]},"email":{"type":["string","null"]}},"required":["id","name","phone","email"],"additionalProperties":false},"channel":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"type":{"type":"string","enum":["whatsapp_cloud","whatsapp_waha","telegram","webchat","instagram","email"]},"name":{"type":"string"}},"required":["id","type","name"],"additionalProperties":false},"queue":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"assignee":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"tags":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"},"color":{"type":"string","enum":["teal","blue","amber","violet","red","gray"]}},"required":["id","name","color"],"additionalProperties":false}},"unreadCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"lastMessageAt":{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},"lastInboundAt":{"anyOf":[{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},{"type":"null"}]},"createdAt":{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},"closedAt":{"anyOf":[{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},{"type":"null"}]}},"required":["id","status","contact","channel","queue","assignee","tags","unreadCount","lastMessageAt","lastInboundAt","createdAt","closedAt"],"additionalProperties":false}},"nextCursor":{"type":["string","null"]}},"required":["conversations","nextCursor"],"additionalProperties":false}}}},"400":{"description":"Dados inválidos (INVALID_PAYLOAD, com details.field).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Chave ausente, inválida, revogada ou vencida (UNAUTHENTICATED).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Fora dos escopos da chave (FORBIDDEN_SCOPE), sem a permissão no painel (FORBIDDEN_PERMISSION), assinatura inativa ou termos pendentes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não encontrado nesta empresa (NOT_FOUND).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflito com o estado atual (veja o code).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Limite de pedidos por minuto do plano (RATE_LIMITED). Espere o Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/conversations/{id}":{"get":{"operationId":"conversationsGet","tags":["Conversas"],"summary":"Ver conversa","description":"A conversa, com contato, canal, setor, responsável e etiquetas.\n\nEscopo: `conversations:read` (Ver conversas).","security":[{"bearerAuth":[]}],"x-atendux-scope":"conversations:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Sucesso.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"status":{"type":"string","enum":["open","closed"]},"contact":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":["string","null"]},"phone":{"type":["string","null"]},"email":{"type":["string","null"]}},"required":["id","name","phone","email"],"additionalProperties":false},"channel":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"type":{"type":"string","enum":["whatsapp_cloud","whatsapp_waha","telegram","webchat","instagram","email"]},"name":{"type":"string"}},"required":["id","type","name"],"additionalProperties":false},"queue":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"assignee":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"tags":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"},"color":{"type":"string","enum":["teal","blue","amber","violet","red","gray"]}},"required":["id","name","color"],"additionalProperties":false}},"unreadCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"lastMessageAt":{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},"lastInboundAt":{"anyOf":[{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},{"type":"null"}]},"createdAt":{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},"closedAt":{"anyOf":[{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},{"type":"null"}]}},"required":["id","status","contact","channel","queue","assignee","tags","unreadCount","lastMessageAt","lastInboundAt","createdAt","closedAt"],"additionalProperties":false}}}},"400":{"description":"Dados inválidos (INVALID_PAYLOAD, com details.field).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Chave ausente, inválida, revogada ou vencida (UNAUTHENTICATED).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Fora dos escopos da chave (FORBIDDEN_SCOPE), sem a permissão no painel (FORBIDDEN_PERMISSION), assinatura inativa ou termos pendentes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não encontrado nesta empresa (NOT_FOUND).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflito com o estado atual (veja o code).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Limite de pedidos por minuto do plano (RATE_LIMITED). Espere o Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/conversations/{id}/messages":{"get":{"operationId":"conversationsMessages","tags":["Conversas"],"summary":"Ler mensagens","description":"As mensagens mais recentes, em ordem cronológica. Para as mais antigas, passe o nextCursor em before.\n\nEscopo: `conversations:read` (Ver conversas).","security":[{"bearerAuth":[]}],"x-atendux-scope":"conversations:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"before","in":"query","required":false,"description":"Cursor (nextCursor) para buscar mensagens mais antigas.","schema":{"type":"string","minLength":1,"maxLength":512}},{"name":"limit","in":"query","required":false,"description":"Itens por página (1 a 100, padrão 50).","schema":{"default":50,"type":"integer","minimum":1,"maximum":100}}],"responses":{"200":{"description":"Sucesso.","content":{"application/json":{"schema":{"type":"object","properties":{"messages":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"conversationId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"direction":{"type":"string","enum":["in","out"]},"sender":{"type":"string","enum":["contact","agent","system"],"description":"contact (cliente), agent (equipe) ou system (automático)."},"authorName":{"type":["string","null"]},"type":{"type":"string","enum":["text","image","audio","video","document","sticker","location","unsupported"]},"text":{"type":["string","null"]},"media":{"anyOf":[{"type":"object","properties":{"mime":{"type":"string"},"filename":{"type":["string","null"]}},"required":["mime","filename"],"additionalProperties":false},{"type":"null"}]},"status":{"type":"string","enum":["pending","sent","delivered","read","failed"]},"error":{"type":["string","null"]},"templateName":{"type":["string","null"]},"createdAt":{"type":"string","description":"Data e hora em ISO 8601 (UTC)."}},"required":["id","conversationId","direction","sender","authorName","type","text","media","status","error","templateName","createdAt"],"additionalProperties":false}},"nextCursor":{"type":["string","null"]}},"required":["messages","nextCursor"],"additionalProperties":false}}}},"400":{"description":"Dados inválidos (INVALID_PAYLOAD, com details.field).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Chave ausente, inválida, revogada ou vencida (UNAUTHENTICATED).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Fora dos escopos da chave (FORBIDDEN_SCOPE), sem a permissão no painel (FORBIDDEN_PERMISSION), assinatura inativa ou termos pendentes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não encontrado nesta empresa (NOT_FOUND).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflito com o estado atual (veja o code).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Limite de pedidos por minuto do plano (RATE_LIMITED). Espere o Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"conversationsSend","tags":["Conversas"],"summary":"Enviar texto","description":"Responde a conversa como a pessoa que criou a chave. Conversa encerrada (409 CONVERSATION_CLOSED), com outra pessoa (409 CONVERSATION_NOT_YOURS) ou com a janela de 24 horas da Cloud API fechada (409 WINDOW_CLOSED) não recebe.\n\nEscopo: `messages:send` (Enviar mensagens).","security":[{"bearerAuth":[]}],"x-atendux-scope":"messages:send","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string","minLength":1,"maxLength":4096},"subject":{"type":"string","maxLength":200}},"required":["text"]}}}},"responses":{"201":{"description":"Sucesso.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"conversationId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"direction":{"type":"string","enum":["in","out"]},"sender":{"type":"string","enum":["contact","agent","system"],"description":"contact (cliente), agent (equipe) ou system (automático)."},"authorName":{"type":["string","null"]},"type":{"type":"string","enum":["text","image","audio","video","document","sticker","location","unsupported"]},"text":{"type":["string","null"]},"media":{"anyOf":[{"type":"object","properties":{"mime":{"type":"string"},"filename":{"type":["string","null"]}},"required":["mime","filename"],"additionalProperties":false},{"type":"null"}]},"status":{"type":"string","enum":["pending","sent","delivered","read","failed"]},"error":{"type":["string","null"]},"templateName":{"type":["string","null"]},"createdAt":{"type":"string","description":"Data e hora em ISO 8601 (UTC)."}},"required":["id","conversationId","direction","sender","authorName","type","text","media","status","error","templateName","createdAt"],"additionalProperties":false}}}},"400":{"description":"Dados inválidos (INVALID_PAYLOAD, com details.field).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Chave ausente, inválida, revogada ou vencida (UNAUTHENTICATED).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Fora dos escopos da chave (FORBIDDEN_SCOPE), sem a permissão no painel (FORBIDDEN_PERMISSION), assinatura inativa ou termos pendentes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não encontrado nesta empresa (NOT_FOUND).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflito com o estado atual (veja o code).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Limite de pedidos por minuto do plano (RATE_LIMITED). Espere o Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/conversations/{id}/template":{"post":{"operationId":"conversationsTemplate","tags":["Conversas"],"summary":"Enviar modelo do WhatsApp","description":"Envia um modelo aprovado pela Meta numa conversa do WhatsApp oficial (Cloud API), dentro ou fora da janela de 24 horas.\n\nEscopo: `templates:send` (Enviar modelos do WhatsApp).","security":[{"bearerAuth":[]}],"x-atendux-scope":"templates:send","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":512},"language":{"type":"string","minLength":2,"maxLength":15},"bodyParams":{"maxItems":30,"type":"array","items":{"type":"string","minLength":1,"maxLength":1024}}},"required":["name","language"]}}}},"responses":{"201":{"description":"Sucesso.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"conversationId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"direction":{"type":"string","enum":["in","out"]},"sender":{"type":"string","enum":["contact","agent","system"],"description":"contact (cliente), agent (equipe) ou system (automático)."},"authorName":{"type":["string","null"]},"type":{"type":"string","enum":["text","image","audio","video","document","sticker","location","unsupported"]},"text":{"type":["string","null"]},"media":{"anyOf":[{"type":"object","properties":{"mime":{"type":"string"},"filename":{"type":["string","null"]}},"required":["mime","filename"],"additionalProperties":false},{"type":"null"}]},"status":{"type":"string","enum":["pending","sent","delivered","read","failed"]},"error":{"type":["string","null"]},"templateName":{"type":["string","null"]},"createdAt":{"type":"string","description":"Data e hora em ISO 8601 (UTC)."}},"required":["id","conversationId","direction","sender","authorName","type","text","media","status","error","templateName","createdAt"],"additionalProperties":false}}}},"400":{"description":"Dados inválidos (INVALID_PAYLOAD, com details.field).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Chave ausente, inválida, revogada ou vencida (UNAUTHENTICATED).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Fora dos escopos da chave (FORBIDDEN_SCOPE), sem a permissão no painel (FORBIDDEN_PERMISSION), assinatura inativa ou termos pendentes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não encontrado nesta empresa (NOT_FOUND).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflito com o estado atual (veja o code).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Limite de pedidos por minuto do plano (RATE_LIMITED). Espere o Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/conversations/{id}/close":{"post":{"operationId":"conversationsClose","tags":["Conversas"],"summary":"Encerrar conversa","description":"Encerra e manda a pesquisa do encerramento, como no painel. Com `skipSurvey: true`, encerra sem a pesquisa.\n\nEscopo: `conversations:write` (Encerrar e transferir conversas).","security":[{"bearerAuth":[]}],"x-atendux-scope":"conversations:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"skipSurvey":{"description":"true encerra sem mandar a pesquisa de satisfação (padrão: false).","type":"boolean"}}}}}},"responses":{"200":{"description":"Sucesso.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"status":{"type":"string","enum":["open","closed"]},"contact":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":["string","null"]},"phone":{"type":["string","null"]},"email":{"type":["string","null"]}},"required":["id","name","phone","email"],"additionalProperties":false},"channel":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"type":{"type":"string","enum":["whatsapp_cloud","whatsapp_waha","telegram","webchat","instagram","email"]},"name":{"type":"string"}},"required":["id","type","name"],"additionalProperties":false},"queue":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"assignee":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"tags":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"},"color":{"type":"string","enum":["teal","blue","amber","violet","red","gray"]}},"required":["id","name","color"],"additionalProperties":false}},"unreadCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"lastMessageAt":{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},"lastInboundAt":{"anyOf":[{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},{"type":"null"}]},"createdAt":{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},"closedAt":{"anyOf":[{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},{"type":"null"}]}},"required":["id","status","contact","channel","queue","assignee","tags","unreadCount","lastMessageAt","lastInboundAt","createdAt","closedAt"],"additionalProperties":false}}}},"400":{"description":"Dados inválidos (INVALID_PAYLOAD, com details.field).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Chave ausente, inválida, revogada ou vencida (UNAUTHENTICATED).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Fora dos escopos da chave (FORBIDDEN_SCOPE), sem a permissão no painel (FORBIDDEN_PERMISSION), assinatura inativa ou termos pendentes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não encontrado nesta empresa (NOT_FOUND).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflito com o estado atual (veja o code).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Limite de pedidos por minuto do plano (RATE_LIMITED). Espere o Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/conversations/{id}/assign":{"post":{"operationId":"conversationsAssign","tags":["Conversas"],"summary":"Atribuir conversa","description":"Passa a conversa para uma pessoa da equipe que atende no setor dela.\n\nEscopo: `conversations:write` (Encerrar e transferir conversas).","security":[{"bearerAuth":[]}],"x-atendux-scope":"conversations:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$","description":"Id da pessoa da equipe que vai atender."}},"required":["userId"]}}}},"responses":{"200":{"description":"Sucesso.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"status":{"type":"string","enum":["open","closed"]},"contact":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":["string","null"]},"phone":{"type":["string","null"]},"email":{"type":["string","null"]}},"required":["id","name","phone","email"],"additionalProperties":false},"channel":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"type":{"type":"string","enum":["whatsapp_cloud","whatsapp_waha","telegram","webchat","instagram","email"]},"name":{"type":"string"}},"required":["id","type","name"],"additionalProperties":false},"queue":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"assignee":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"tags":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"},"color":{"type":"string","enum":["teal","blue","amber","violet","red","gray"]}},"required":["id","name","color"],"additionalProperties":false}},"unreadCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"lastMessageAt":{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},"lastInboundAt":{"anyOf":[{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},{"type":"null"}]},"createdAt":{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},"closedAt":{"anyOf":[{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},{"type":"null"}]}},"required":["id","status","contact","channel","queue","assignee","tags","unreadCount","lastMessageAt","lastInboundAt","createdAt","closedAt"],"additionalProperties":false}}}},"400":{"description":"Dados inválidos (INVALID_PAYLOAD, com details.field).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Chave ausente, inválida, revogada ou vencida (UNAUTHENTICATED).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Fora dos escopos da chave (FORBIDDEN_SCOPE), sem a permissão no painel (FORBIDDEN_PERMISSION), assinatura inativa ou termos pendentes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não encontrado nesta empresa (NOT_FOUND).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflito com o estado atual (veja o code).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Limite de pedidos por minuto do plano (RATE_LIMITED). Espere o Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/conversations/{id}/transfer":{"post":{"operationId":"conversationsTransfer","tags":["Conversas"],"summary":"Transferir conversa","description":"Transfere para um setor ou para uma pessoa, com nota interna opcional.\n\nEscopo: `conversations:write` (Encerrar e transferir conversas).","security":[{"bearerAuth":[]}],"x-atendux-scope":"conversations:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"queueId":{"description":"Setor de destino.","type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"userId":{"description":"Pessoa de destino.","type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"note":{"description":"Nota interna da transferência.","type":"string","maxLength":500}}}}}},"responses":{"200":{"description":"Sucesso.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"status":{"type":"string","enum":["open","closed"]},"contact":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":["string","null"]},"phone":{"type":["string","null"]},"email":{"type":["string","null"]}},"required":["id","name","phone","email"],"additionalProperties":false},"channel":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"type":{"type":"string","enum":["whatsapp_cloud","whatsapp_waha","telegram","webchat","instagram","email"]},"name":{"type":"string"}},"required":["id","type","name"],"additionalProperties":false},"queue":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"assignee":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"tags":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"},"color":{"type":"string","enum":["teal","blue","amber","violet","red","gray"]}},"required":["id","name","color"],"additionalProperties":false}},"unreadCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"lastMessageAt":{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},"lastInboundAt":{"anyOf":[{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},{"type":"null"}]},"createdAt":{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},"closedAt":{"anyOf":[{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},{"type":"null"}]}},"required":["id","status","contact","channel","queue","assignee","tags","unreadCount","lastMessageAt","lastInboundAt","createdAt","closedAt"],"additionalProperties":false}}}},"400":{"description":"Dados inválidos (INVALID_PAYLOAD, com details.field).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Chave ausente, inválida, revogada ou vencida (UNAUTHENTICATED).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Fora dos escopos da chave (FORBIDDEN_SCOPE), sem a permissão no painel (FORBIDDEN_PERMISSION), assinatura inativa ou termos pendentes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não encontrado nesta empresa (NOT_FOUND).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflito com o estado atual (veja o code).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Limite de pedidos por minuto do plano (RATE_LIMITED). Espere o Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/tags":{"get":{"operationId":"tagsList","tags":["Consultas"],"summary":"Listar etiquetas","description":"As etiquetas da empresa.\n\nEscopo: `tags:read` (Ver etiquetas).","security":[{"bearerAuth":[]}],"x-atendux-scope":"tags:read","parameters":[],"responses":{"200":{"description":"Sucesso.","content":{"application/json":{"schema":{"type":"object","properties":{"tags":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"},"color":{"type":"string","enum":["teal","blue","amber","violet","red","gray"]}},"required":["id","name","color"],"additionalProperties":false}}},"required":["tags"],"additionalProperties":false}}}},"400":{"description":"Dados inválidos (INVALID_PAYLOAD, com details.field).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Chave ausente, inválida, revogada ou vencida (UNAUTHENTICATED).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Fora dos escopos da chave (FORBIDDEN_SCOPE), sem a permissão no painel (FORBIDDEN_PERMISSION), assinatura inativa ou termos pendentes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não encontrado nesta empresa (NOT_FOUND).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflito com o estado atual (veja o code).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Limite de pedidos por minuto do plano (RATE_LIMITED). Espere o Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/queues":{"get":{"operationId":"queuesList","tags":["Consultas"],"summary":"Listar setores","description":"Os setores e quem atende em cada um.\n\nEscopo: `queues:read` (Ver setores).","security":[{"bearerAuth":[]}],"x-atendux-scope":"queues:read","parameters":[],"responses":{"200":{"description":"Sucesso.","content":{"application/json":{"schema":{"type":"object","properties":{"queues":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"},"members":{"type":"array","items":{"type":"object","properties":{"userId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["userId","name"],"additionalProperties":false}}},"required":["id","name","members"],"additionalProperties":false}}},"required":["queues"],"additionalProperties":false}}}},"400":{"description":"Dados inválidos (INVALID_PAYLOAD, com details.field).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Chave ausente, inválida, revogada ou vencida (UNAUTHENTICATED).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Fora dos escopos da chave (FORBIDDEN_SCOPE), sem a permissão no painel (FORBIDDEN_PERMISSION), assinatura inativa ou termos pendentes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não encontrado nesta empresa (NOT_FOUND).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflito com o estado atual (veja o code).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Limite de pedidos por minuto do plano (RATE_LIMITED). Espere o Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/channels":{"get":{"operationId":"channelsList","tags":["Consultas"],"summary":"Listar canais","description":"Os canais da empresa, sem credenciais.\n\nEscopo: `channels:read` (Ver canais).","security":[{"bearerAuth":[]}],"x-atendux-scope":"channels:read","parameters":[],"responses":{"200":{"description":"Sucesso.","content":{"application/json":{"schema":{"type":"object","properties":{"channels":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"type":{"type":"string","enum":["whatsapp_cloud","whatsapp_waha","telegram","webchat","instagram","email"]},"name":{"type":"string"},"status":{"type":"string"},"phoneNumber":{"type":["string","null"]},"official":{"type":"boolean"}},"required":["id","type","name","status","phoneNumber","official"],"additionalProperties":false}}},"required":["channels"],"additionalProperties":false}}}},"400":{"description":"Dados inválidos (INVALID_PAYLOAD, com details.field).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Chave ausente, inválida, revogada ou vencida (UNAUTHENTICATED).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Fora dos escopos da chave (FORBIDDEN_SCOPE), sem a permissão no painel (FORBIDDEN_PERMISSION), assinatura inativa ou termos pendentes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não encontrado nesta empresa (NOT_FOUND).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflito com o estado atual (veja o code).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Limite de pedidos por minuto do plano (RATE_LIMITED). Espere o Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhooks":{"get":{"operationId":"webhooksList","tags":["Webhooks"],"summary":"Listar webhooks","description":"Os webhooks da empresa (até 10), sem os segredos.\n\nEscopo: `webhooks:manage` (Gerenciar webhooks).","security":[{"bearerAuth":[]}],"x-atendux-scope":"webhooks:manage","parameters":[],"responses":{"200":{"description":"Sucesso.","content":{"application/json":{"schema":{"type":"object","properties":{"webhooks":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"url":{"type":"string"},"description":{"type":["string","null"]},"events":{"type":"array","items":{"type":"string","enum":["message.received","message.sent","message.status_updated","conversation.created","conversation.assigned","conversation.transferred","conversation.closed","conversation.reopened","contact.created","contact.updated","survey.answered"]}},"includeContent":{"type":"boolean"},"includeContact":{"type":"boolean"},"enabled":{"type":"boolean"},"disabledReason":{"anyOf":[{"type":"string","enum":["manual","failing"]},{"type":"null"}]},"failingSince":{"anyOf":[{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},{"type":"null"}]},"lastSuccessAt":{"anyOf":[{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},{"type":"null"}]},"createdAt":{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},"updatedAt":{"type":"string","description":"Data e hora em ISO 8601 (UTC)."}},"required":["id","url","description","events","includeContent","includeContact","enabled","disabledReason","failingSince","lastSuccessAt","createdAt","updatedAt"],"additionalProperties":false}}},"required":["webhooks"],"additionalProperties":false}}}},"400":{"description":"Dados inválidos (INVALID_PAYLOAD, com details.field).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Chave ausente, inválida, revogada ou vencida (UNAUTHENTICATED).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Fora dos escopos da chave (FORBIDDEN_SCOPE), sem a permissão no painel (FORBIDDEN_PERMISSION), assinatura inativa ou termos pendentes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não encontrado nesta empresa (NOT_FOUND).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflito com o estado atual (veja o code).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Limite de pedidos por minuto do plano (RATE_LIMITED). Espere o Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"webhooksCreate","tags":["Webhooks"],"summary":"Criar webhook","description":"Cria um webhook. O segredo (whsec_...) volta uma vez só, nesta resposta. acceptResponsibility: true confirma: \"Este endereço é de um sistema da empresa ou de um fornecedor contratado por ela, e a empresa responde pelo que ele faz com os dados.\"\n\nEscopo: `webhooks:manage` (Gerenciar webhooks).","security":[{"bearerAuth":[]}],"x-atendux-scope":"webhooks:manage","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","minLength":1,"maxLength":2000},"description":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}]},"events":{"minItems":1,"type":"array","items":{"type":"string","enum":["message.received","message.sent","message.status_updated","conversation.created","conversation.assigned","conversation.transferred","conversation.closed","conversation.reopened","contact.created","contact.updated","survey.answered"]}},"includeContent":{"default":false,"type":"boolean"},"includeContact":{"default":false,"type":"boolean"},"acceptResponsibility":{"type":"boolean","const":true}},"required":["url","events","acceptResponsibility"]}}}},"responses":{"201":{"description":"Sucesso.","content":{"application/json":{"schema":{"type":"object","properties":{"webhook":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"url":{"type":"string"},"description":{"type":["string","null"]},"events":{"type":"array","items":{"type":"string","enum":["message.received","message.sent","message.status_updated","conversation.created","conversation.assigned","conversation.transferred","conversation.closed","conversation.reopened","contact.created","contact.updated","survey.answered"]}},"includeContent":{"type":"boolean"},"includeContact":{"type":"boolean"},"enabled":{"type":"boolean"},"disabledReason":{"anyOf":[{"type":"string","enum":["manual","failing"]},{"type":"null"}]},"failingSince":{"anyOf":[{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},{"type":"null"}]},"lastSuccessAt":{"anyOf":[{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},{"type":"null"}]},"createdAt":{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},"updatedAt":{"type":"string","description":"Data e hora em ISO 8601 (UTC)."}},"required":["id","url","description","events","includeContent","includeContact","enabled","disabledReason","failingSince","lastSuccessAt","createdAt","updatedAt"],"additionalProperties":false},"secret":{"type":"string"}},"required":["webhook","secret"],"additionalProperties":false}}}},"400":{"description":"Dados inválidos (INVALID_PAYLOAD, com details.field).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Chave ausente, inválida, revogada ou vencida (UNAUTHENTICATED).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Fora dos escopos da chave (FORBIDDEN_SCOPE), sem a permissão no painel (FORBIDDEN_PERMISSION), assinatura inativa ou termos pendentes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não encontrado nesta empresa (NOT_FOUND).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflito com o estado atual (veja o code).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Limite de pedidos por minuto do plano (RATE_LIMITED). Espere o Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhooks/{id}":{"get":{"operationId":"webhooksGet","tags":["Webhooks"],"summary":"Ver webhook","description":"Um webhook, sem o segredo.\n\nEscopo: `webhooks:manage` (Gerenciar webhooks).","security":[{"bearerAuth":[]}],"x-atendux-scope":"webhooks:manage","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Sucesso.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"url":{"type":"string"},"description":{"type":["string","null"]},"events":{"type":"array","items":{"type":"string","enum":["message.received","message.sent","message.status_updated","conversation.created","conversation.assigned","conversation.transferred","conversation.closed","conversation.reopened","contact.created","contact.updated","survey.answered"]}},"includeContent":{"type":"boolean"},"includeContact":{"type":"boolean"},"enabled":{"type":"boolean"},"disabledReason":{"anyOf":[{"type":"string","enum":["manual","failing"]},{"type":"null"}]},"failingSince":{"anyOf":[{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},{"type":"null"}]},"lastSuccessAt":{"anyOf":[{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},{"type":"null"}]},"createdAt":{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},"updatedAt":{"type":"string","description":"Data e hora em ISO 8601 (UTC)."}},"required":["id","url","description","events","includeContent","includeContact","enabled","disabledReason","failingSince","lastSuccessAt","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"description":"Dados inválidos (INVALID_PAYLOAD, com details.field).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Chave ausente, inválida, revogada ou vencida (UNAUTHENTICATED).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Fora dos escopos da chave (FORBIDDEN_SCOPE), sem a permissão no painel (FORBIDDEN_PERMISSION), assinatura inativa ou termos pendentes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não encontrado nesta empresa (NOT_FOUND).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflito com o estado atual (veja o code).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Limite de pedidos por minuto do plano (RATE_LIMITED). Espere o Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"webhooksUpdate","tags":["Webhooks"],"summary":"Editar, ligar ou desligar webhook","description":"Muda só os campos enviados. Trocar a URL pede acceptResponsibility: true de novo. enabled: true liga de novo e zera a contagem de falhas.\n\nEscopo: `webhooks:manage` (Gerenciar webhooks).","security":[{"bearerAuth":[]}],"x-atendux-scope":"webhooks:manage","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","minLength":1,"maxLength":2000},"description":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}]},"events":{"minItems":1,"type":"array","items":{"type":"string","enum":["message.received","message.sent","message.status_updated","conversation.created","conversation.assigned","conversation.transferred","conversation.closed","conversation.reopened","contact.created","contact.updated","survey.answered"]}},"includeContent":{"type":"boolean"},"includeContact":{"type":"boolean"},"enabled":{"type":"boolean"},"acceptResponsibility":{"type":"boolean","const":true}}}}}},"responses":{"200":{"description":"Sucesso.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"url":{"type":"string"},"description":{"type":["string","null"]},"events":{"type":"array","items":{"type":"string","enum":["message.received","message.sent","message.status_updated","conversation.created","conversation.assigned","conversation.transferred","conversation.closed","conversation.reopened","contact.created","contact.updated","survey.answered"]}},"includeContent":{"type":"boolean"},"includeContact":{"type":"boolean"},"enabled":{"type":"boolean"},"disabledReason":{"anyOf":[{"type":"string","enum":["manual","failing"]},{"type":"null"}]},"failingSince":{"anyOf":[{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},{"type":"null"}]},"lastSuccessAt":{"anyOf":[{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},{"type":"null"}]},"createdAt":{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},"updatedAt":{"type":"string","description":"Data e hora em ISO 8601 (UTC)."}},"required":["id","url","description","events","includeContent","includeContact","enabled","disabledReason","failingSince","lastSuccessAt","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"description":"Dados inválidos (INVALID_PAYLOAD, com details.field).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Chave ausente, inválida, revogada ou vencida (UNAUTHENTICATED).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Fora dos escopos da chave (FORBIDDEN_SCOPE), sem a permissão no painel (FORBIDDEN_PERMISSION), assinatura inativa ou termos pendentes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não encontrado nesta empresa (NOT_FOUND).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflito com o estado atual (veja o code).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Limite de pedidos por minuto do plano (RATE_LIMITED). Espere o Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"webhooksDelete","tags":["Webhooks"],"summary":"Excluir webhook","description":"Exclui o webhook e o registro das entregas dele.\n\nEscopo: `webhooks:manage` (Gerenciar webhooks).","security":[{"bearerAuth":[]}],"x-atendux-scope":"webhooks:manage","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Feito, sem corpo."},"400":{"description":"Dados inválidos (INVALID_PAYLOAD, com details.field).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Chave ausente, inválida, revogada ou vencida (UNAUTHENTICATED).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Fora dos escopos da chave (FORBIDDEN_SCOPE), sem a permissão no painel (FORBIDDEN_PERMISSION), assinatura inativa ou termos pendentes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não encontrado nesta empresa (NOT_FOUND).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflito com o estado atual (veja o code).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Limite de pedidos por minuto do plano (RATE_LIMITED). Espere o Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhooks/{id}/deliveries":{"get":{"operationId":"webhooksDeliveries","tags":["Webhooks"],"summary":"Ver entregas","description":"As entregas dos últimos 30 dias, das mais novas para as mais antigas.\n\nEscopo: `webhooks:manage` (Gerenciar webhooks).","security":[{"bearerAuth":[]}],"x-atendux-scope":"webhooks:manage","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["pending","retrying","succeeded","failed"]}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","maxLength":200}},{"name":"limit","in":"query","required":false,"schema":{"default":30,"type":"integer","minimum":1,"maximum":100}}],"responses":{"200":{"description":"Sucesso.","content":{"application/json":{"schema":{"type":"object","properties":{"deliveries":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"webhookId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"event":{"type":"string"},"eventId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"status":{"type":"string","enum":["pending","retrying","succeeded","failed"]},"attempt":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"responseStatus":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"latencyMs":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"error":{"type":["string","null"]},"test":{"type":"boolean"},"nextAttemptAt":{"anyOf":[{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},{"type":"null"}]},"createdAt":{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},"updatedAt":{"type":"string","description":"Data e hora em ISO 8601 (UTC)."}},"required":["id","webhookId","event","eventId","status","attempt","responseStatus","latencyMs","error","test","nextAttemptAt","createdAt","updatedAt"],"additionalProperties":false}},"nextCursor":{"type":["string","null"]}},"required":["deliveries","nextCursor"],"additionalProperties":false}}}},"400":{"description":"Dados inválidos (INVALID_PAYLOAD, com details.field).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Chave ausente, inválida, revogada ou vencida (UNAUTHENTICATED).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Fora dos escopos da chave (FORBIDDEN_SCOPE), sem a permissão no painel (FORBIDDEN_PERMISSION), assinatura inativa ou termos pendentes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não encontrado nesta empresa (NOT_FOUND).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflito com o estado atual (veja o code).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Limite de pedidos por minuto do plano (RATE_LIMITED). Espere o Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"webhooks":{"message.received":{"post":{"summary":"Mensagem recebida","description":"O cliente mandou uma mensagem.\n\nCabeçalhos: X-Atendux-Event, X-Atendux-Delivery e X-Atendux-Signature (t=<unix>,v1=<HMAC-SHA256 em hex de \"<t>.<corpo>\">). Responda 2xx em até 10 segundos.","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["id","type","createdAt","organizationId","data"],"properties":{"id":{"type":"string","format":"uuid","description":"Id do evento (igual no reenvio)."},"type":{"type":"string","const":"message.received"},"createdAt":{"type":"string","description":"Quando o evento aconteceu (ISO 8601)."},"organizationId":{"type":"string","format":"uuid"},"data":{"type":"object","properties":{"message":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"conversationId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"direction":{"type":"string","enum":["in","out"]},"sender":{"type":"string","enum":["contact","agent","system"],"description":"contact (cliente), agent (equipe) ou system (automático)."},"authorName":{"type":["string","null"]},"type":{"type":"string","enum":["text","image","audio","video","document","sticker","location","unsupported"]},"text":{"type":["string","null"]},"media":{"anyOf":[{"type":"object","properties":{"mime":{"type":"string"},"filename":{"type":["string","null"]}},"required":["mime","filename"],"additionalProperties":false},{"type":"null"}]},"status":{"type":"string","enum":["pending","sent","delivered","read","failed"]},"error":{"type":["string","null"]},"templateName":{"type":["string","null"]},"createdAt":{"type":"string","description":"Data e hora em ISO 8601 (UTC)."}},"required":["id","conversationId","direction","sender","authorName","type","text","media","status","error","templateName","createdAt"],"additionalProperties":false},"conversation":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"contactId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"channelId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["id","contactId","channelId"],"additionalProperties":false}},"required":["message","conversation"],"additionalProperties":false}}}}}},"responses":{"200":{"description":"Recebido. Qualquer 2xx conta como entregue."}}}},"message.sent":{"post":{"summary":"Mensagem enviada","description":"Uma mensagem da empresa saiu pelo canal (equipe, fluxo, automação ou o celular conectado).\n\nCabeçalhos: X-Atendux-Event, X-Atendux-Delivery e X-Atendux-Signature (t=<unix>,v1=<HMAC-SHA256 em hex de \"<t>.<corpo>\">). Responda 2xx em até 10 segundos.","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["id","type","createdAt","organizationId","data"],"properties":{"id":{"type":"string","format":"uuid","description":"Id do evento (igual no reenvio)."},"type":{"type":"string","const":"message.sent"},"createdAt":{"type":"string","description":"Quando o evento aconteceu (ISO 8601)."},"organizationId":{"type":"string","format":"uuid"},"data":{"type":"object","properties":{"message":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"conversationId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"direction":{"type":"string","enum":["in","out"]},"sender":{"type":"string","enum":["contact","agent","system"],"description":"contact (cliente), agent (equipe) ou system (automático)."},"authorName":{"type":["string","null"]},"type":{"type":"string","enum":["text","image","audio","video","document","sticker","location","unsupported"]},"text":{"type":["string","null"]},"media":{"anyOf":[{"type":"object","properties":{"mime":{"type":"string"},"filename":{"type":["string","null"]}},"required":["mime","filename"],"additionalProperties":false},{"type":"null"}]},"status":{"type":"string","enum":["pending","sent","delivered","read","failed"]},"error":{"type":["string","null"]},"templateName":{"type":["string","null"]},"createdAt":{"type":"string","description":"Data e hora em ISO 8601 (UTC)."}},"required":["id","conversationId","direction","sender","authorName","type","text","media","status","error","templateName","createdAt"],"additionalProperties":false},"conversation":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"contactId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"channelId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["id","contactId","channelId"],"additionalProperties":false}},"required":["message","conversation"],"additionalProperties":false}}}}}},"responses":{"200":{"description":"Recebido. Qualquer 2xx conta como entregue."}}}},"message.status_updated":{"post":{"summary":"Situação da mensagem","description":"Uma mensagem enviada foi entregue, lida ou falhou.\n\nCabeçalhos: X-Atendux-Event, X-Atendux-Delivery e X-Atendux-Signature (t=<unix>,v1=<HMAC-SHA256 em hex de \"<t>.<corpo>\">). Responda 2xx em até 10 segundos.","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["id","type","createdAt","organizationId","data"],"properties":{"id":{"type":"string","format":"uuid","description":"Id do evento (igual no reenvio)."},"type":{"type":"string","const":"message.status_updated"},"createdAt":{"type":"string","description":"Quando o evento aconteceu (ISO 8601)."},"organizationId":{"type":"string","format":"uuid"},"data":{"type":"object","properties":{"message":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"conversationId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"direction":{"type":"string","enum":["in","out"]},"sender":{"type":"string","enum":["contact","agent","system"],"description":"contact (cliente), agent (equipe) ou system (automático)."},"authorName":{"type":["string","null"]},"type":{"type":"string","enum":["text","image","audio","video","document","sticker","location","unsupported"]},"text":{"type":["string","null"]},"media":{"anyOf":[{"type":"object","properties":{"mime":{"type":"string"},"filename":{"type":["string","null"]}},"required":["mime","filename"],"additionalProperties":false},{"type":"null"}]},"status":{"type":"string","enum":["pending","sent","delivered","read","failed"]},"error":{"type":["string","null"]},"templateName":{"type":["string","null"]},"createdAt":{"type":"string","description":"Data e hora em ISO 8601 (UTC)."}},"required":["id","conversationId","direction","sender","authorName","type","text","media","status","error","templateName","createdAt"],"additionalProperties":false},"conversation":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"contactId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"channelId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["id","contactId","channelId"],"additionalProperties":false}},"required":["message","conversation"],"additionalProperties":false}}}}}},"responses":{"200":{"description":"Recebido. Qualquer 2xx conta como entregue."}}}},"conversation.created":{"post":{"summary":"Conversa nova","description":"Uma conversa começou (o cliente escreveu ou a empresa iniciou).\n\nCabeçalhos: X-Atendux-Event, X-Atendux-Delivery e X-Atendux-Signature (t=<unix>,v1=<HMAC-SHA256 em hex de \"<t>.<corpo>\">). Responda 2xx em até 10 segundos.","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["id","type","createdAt","organizationId","data"],"properties":{"id":{"type":"string","format":"uuid","description":"Id do evento (igual no reenvio)."},"type":{"type":"string","const":"conversation.created"},"createdAt":{"type":"string","description":"Quando o evento aconteceu (ISO 8601)."},"organizationId":{"type":"string","format":"uuid"},"data":{"type":"object","properties":{"conversation":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"status":{"type":"string","enum":["open","closed"]},"contact":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":["string","null"]},"phone":{"type":["string","null"]},"email":{"type":["string","null"]}},"required":["id","name","phone","email"],"additionalProperties":false},"channel":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"type":{"type":"string","enum":["whatsapp_cloud","whatsapp_waha","telegram","webchat","instagram","email"]},"name":{"type":"string"}},"required":["id","type","name"],"additionalProperties":false},"queue":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"assignee":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"tags":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"},"color":{"type":"string","enum":["teal","blue","amber","violet","red","gray"]}},"required":["id","name","color"],"additionalProperties":false}},"unreadCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"lastMessageAt":{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},"lastInboundAt":{"anyOf":[{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},{"type":"null"}]},"createdAt":{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},"closedAt":{"anyOf":[{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},{"type":"null"}]}},"required":["id","status","contact","channel","queue","assignee","tags","unreadCount","lastMessageAt","lastInboundAt","createdAt","closedAt"],"additionalProperties":false},"previous":{"description":"Em conversation.assigned e conversation.transferred: quem e qual setor antes.","type":"object","properties":{"assigneeId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"queueId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]}},"required":["assigneeId","queueId"],"additionalProperties":false}},"required":["conversation"],"additionalProperties":false}}}}}},"responses":{"200":{"description":"Recebido. Qualquer 2xx conta como entregue."}}}},"conversation.assigned":{"post":{"summary":"Conversa atribuída","description":"Uma conversa sem responsável ganhou um.\n\nCabeçalhos: X-Atendux-Event, X-Atendux-Delivery e X-Atendux-Signature (t=<unix>,v1=<HMAC-SHA256 em hex de \"<t>.<corpo>\">). Responda 2xx em até 10 segundos.","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["id","type","createdAt","organizationId","data"],"properties":{"id":{"type":"string","format":"uuid","description":"Id do evento (igual no reenvio)."},"type":{"type":"string","const":"conversation.assigned"},"createdAt":{"type":"string","description":"Quando o evento aconteceu (ISO 8601)."},"organizationId":{"type":"string","format":"uuid"},"data":{"type":"object","properties":{"conversation":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"status":{"type":"string","enum":["open","closed"]},"contact":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":["string","null"]},"phone":{"type":["string","null"]},"email":{"type":["string","null"]}},"required":["id","name","phone","email"],"additionalProperties":false},"channel":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"type":{"type":"string","enum":["whatsapp_cloud","whatsapp_waha","telegram","webchat","instagram","email"]},"name":{"type":"string"}},"required":["id","type","name"],"additionalProperties":false},"queue":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"assignee":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"tags":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"},"color":{"type":"string","enum":["teal","blue","amber","violet","red","gray"]}},"required":["id","name","color"],"additionalProperties":false}},"unreadCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"lastMessageAt":{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},"lastInboundAt":{"anyOf":[{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},{"type":"null"}]},"createdAt":{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},"closedAt":{"anyOf":[{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},{"type":"null"}]}},"required":["id","status","contact","channel","queue","assignee","tags","unreadCount","lastMessageAt","lastInboundAt","createdAt","closedAt"],"additionalProperties":false},"previous":{"description":"Em conversation.assigned e conversation.transferred: quem e qual setor antes.","type":"object","properties":{"assigneeId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"queueId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]}},"required":["assigneeId","queueId"],"additionalProperties":false}},"required":["conversation"],"additionalProperties":false}}}}}},"responses":{"200":{"description":"Recebido. Qualquer 2xx conta como entregue."}}}},"conversation.transferred":{"post":{"summary":"Conversa transferida","description":"A conversa mudou de pessoa ou de setor.\n\nCabeçalhos: X-Atendux-Event, X-Atendux-Delivery e X-Atendux-Signature (t=<unix>,v1=<HMAC-SHA256 em hex de \"<t>.<corpo>\">). Responda 2xx em até 10 segundos.","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["id","type","createdAt","organizationId","data"],"properties":{"id":{"type":"string","format":"uuid","description":"Id do evento (igual no reenvio)."},"type":{"type":"string","const":"conversation.transferred"},"createdAt":{"type":"string","description":"Quando o evento aconteceu (ISO 8601)."},"organizationId":{"type":"string","format":"uuid"},"data":{"type":"object","properties":{"conversation":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"status":{"type":"string","enum":["open","closed"]},"contact":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":["string","null"]},"phone":{"type":["string","null"]},"email":{"type":["string","null"]}},"required":["id","name","phone","email"],"additionalProperties":false},"channel":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"type":{"type":"string","enum":["whatsapp_cloud","whatsapp_waha","telegram","webchat","instagram","email"]},"name":{"type":"string"}},"required":["id","type","name"],"additionalProperties":false},"queue":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"assignee":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"tags":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"},"color":{"type":"string","enum":["teal","blue","amber","violet","red","gray"]}},"required":["id","name","color"],"additionalProperties":false}},"unreadCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"lastMessageAt":{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},"lastInboundAt":{"anyOf":[{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},{"type":"null"}]},"createdAt":{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},"closedAt":{"anyOf":[{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},{"type":"null"}]}},"required":["id","status","contact","channel","queue","assignee","tags","unreadCount","lastMessageAt","lastInboundAt","createdAt","closedAt"],"additionalProperties":false},"previous":{"description":"Em conversation.assigned e conversation.transferred: quem e qual setor antes.","type":"object","properties":{"assigneeId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"queueId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]}},"required":["assigneeId","queueId"],"additionalProperties":false}},"required":["conversation"],"additionalProperties":false}}}}}},"responses":{"200":{"description":"Recebido. Qualquer 2xx conta como entregue."}}}},"conversation.closed":{"post":{"summary":"Conversa encerrada","description":"A conversa foi encerrada pela equipe, por um fluxo ou por inatividade.\n\nCabeçalhos: X-Atendux-Event, X-Atendux-Delivery e X-Atendux-Signature (t=<unix>,v1=<HMAC-SHA256 em hex de \"<t>.<corpo>\">). Responda 2xx em até 10 segundos.","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["id","type","createdAt","organizationId","data"],"properties":{"id":{"type":"string","format":"uuid","description":"Id do evento (igual no reenvio)."},"type":{"type":"string","const":"conversation.closed"},"createdAt":{"type":"string","description":"Quando o evento aconteceu (ISO 8601)."},"organizationId":{"type":"string","format":"uuid"},"data":{"type":"object","properties":{"conversation":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"status":{"type":"string","enum":["open","closed"]},"contact":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":["string","null"]},"phone":{"type":["string","null"]},"email":{"type":["string","null"]}},"required":["id","name","phone","email"],"additionalProperties":false},"channel":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"type":{"type":"string","enum":["whatsapp_cloud","whatsapp_waha","telegram","webchat","instagram","email"]},"name":{"type":"string"}},"required":["id","type","name"],"additionalProperties":false},"queue":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"assignee":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"tags":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"},"color":{"type":"string","enum":["teal","blue","amber","violet","red","gray"]}},"required":["id","name","color"],"additionalProperties":false}},"unreadCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"lastMessageAt":{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},"lastInboundAt":{"anyOf":[{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},{"type":"null"}]},"createdAt":{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},"closedAt":{"anyOf":[{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},{"type":"null"}]}},"required":["id","status","contact","channel","queue","assignee","tags","unreadCount","lastMessageAt","lastInboundAt","createdAt","closedAt"],"additionalProperties":false},"previous":{"description":"Em conversation.assigned e conversation.transferred: quem e qual setor antes.","type":"object","properties":{"assigneeId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"queueId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]}},"required":["assigneeId","queueId"],"additionalProperties":false}},"required":["conversation"],"additionalProperties":false}}}}}},"responses":{"200":{"description":"Recebido. Qualquer 2xx conta como entregue."}}}},"conversation.reopened":{"post":{"summary":"Conversa reaberta","description":"Uma conversa encerrada foi reaberta.\n\nCabeçalhos: X-Atendux-Event, X-Atendux-Delivery e X-Atendux-Signature (t=<unix>,v1=<HMAC-SHA256 em hex de \"<t>.<corpo>\">). Responda 2xx em até 10 segundos.","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["id","type","createdAt","organizationId","data"],"properties":{"id":{"type":"string","format":"uuid","description":"Id do evento (igual no reenvio)."},"type":{"type":"string","const":"conversation.reopened"},"createdAt":{"type":"string","description":"Quando o evento aconteceu (ISO 8601)."},"organizationId":{"type":"string","format":"uuid"},"data":{"type":"object","properties":{"conversation":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"status":{"type":"string","enum":["open","closed"]},"contact":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":["string","null"]},"phone":{"type":["string","null"]},"email":{"type":["string","null"]}},"required":["id","name","phone","email"],"additionalProperties":false},"channel":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"type":{"type":"string","enum":["whatsapp_cloud","whatsapp_waha","telegram","webchat","instagram","email"]},"name":{"type":"string"}},"required":["id","type","name"],"additionalProperties":false},"queue":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"assignee":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"tags":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"},"color":{"type":"string","enum":["teal","blue","amber","violet","red","gray"]}},"required":["id","name","color"],"additionalProperties":false}},"unreadCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"lastMessageAt":{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},"lastInboundAt":{"anyOf":[{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},{"type":"null"}]},"createdAt":{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},"closedAt":{"anyOf":[{"type":"string","description":"Data e hora em ISO 8601 (UTC)."},{"type":"null"}]}},"required":["id","status","contact","channel","queue","assignee","tags","unreadCount","lastMessageAt","lastInboundAt","createdAt","closedAt"],"additionalProperties":false},"previous":{"description":"Em conversation.assigned e conversation.transferred: quem e qual setor antes.","type":"object","properties":{"assigneeId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"queueId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]}},"required":["assigneeId","queueId"],"additionalProperties":false}},"required":["conversation"],"additionalProperties":false}}}}}},"responses":{"200":{"description":"Recebido. Qualquer 2xx conta como entregue."}}}},"contact.created":{"post":{"summary":"Contato novo","description":"Um contato foi criado (pela equipe, pela API ou na primeira mensagem). Não sai para importação em lote.\n\nCabeçalhos: X-Atendux-Event, X-Atendux-Delivery e X-Atendux-Signature (t=<unix>,v1=<HMAC-SHA256 em hex de \"<t>.<corpo>\">). Responda 2xx em até 10 segundos.","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["id","type","createdAt","organizationId","data"],"properties":{"id":{"type":"string","format":"uuid","description":"Id do evento (igual no reenvio)."},"type":{"type":"string","const":"contact.created"},"createdAt":{"type":"string","description":"Quando o evento aconteceu (ISO 8601)."},"organizationId":{"type":"string","format":"uuid"},"data":{"type":"object","properties":{"contact":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":["string","null"]},"phone":{"description":"Só dígitos, com o código do país (5548999990000).","type":["string","null"]},"email":{"type":["string","null"]},"company":{"type":["string","null"]},"notes":{"type":["string","null"]},"customFields":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"origin":{"type":"string","enum":["channel","import","manual","crm"]},"tags":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"},"color":{"type":"string","enum":["teal","blue","amber","violet","red","gray"]}},"required":["id","name","color"],"additionalProperties":false}},"createdAt":{"type":"string","description":"Data e hora em ISO 8601 (UTC)."}},"required":["id","name","phone","email","company","notes","customFields","origin","tags","createdAt"],"additionalProperties":false}},"required":["contact"],"additionalProperties":false}}}}}},"responses":{"200":{"description":"Recebido. Qualquer 2xx conta como entregue."}}}},"contact.updated":{"post":{"summary":"Contato alterado","description":"Os dados ou as etiquetas de um contato mudaram.\n\nCabeçalhos: X-Atendux-Event, X-Atendux-Delivery e X-Atendux-Signature (t=<unix>,v1=<HMAC-SHA256 em hex de \"<t>.<corpo>\">). Responda 2xx em até 10 segundos.","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["id","type","createdAt","organizationId","data"],"properties":{"id":{"type":"string","format":"uuid","description":"Id do evento (igual no reenvio)."},"type":{"type":"string","const":"contact.updated"},"createdAt":{"type":"string","description":"Quando o evento aconteceu (ISO 8601)."},"organizationId":{"type":"string","format":"uuid"},"data":{"type":"object","properties":{"contact":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":["string","null"]},"phone":{"description":"Só dígitos, com o código do país (5548999990000).","type":["string","null"]},"email":{"type":["string","null"]},"company":{"type":["string","null"]},"notes":{"type":["string","null"]},"customFields":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"origin":{"type":"string","enum":["channel","import","manual","crm"]},"tags":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"},"color":{"type":"string","enum":["teal","blue","amber","violet","red","gray"]}},"required":["id","name","color"],"additionalProperties":false}},"createdAt":{"type":"string","description":"Data e hora em ISO 8601 (UTC)."}},"required":["id","name","phone","email","company","notes","customFields","origin","tags","createdAt"],"additionalProperties":false}},"required":["contact"],"additionalProperties":false}}}}}},"responses":{"200":{"description":"Recebido. Qualquer 2xx conta como entregue."}}}},"survey.answered":{"post":{"summary":"Pesquisa respondida","description":"O cliente deu a nota de uma pesquisa. Sai de novo, com o mesmo id da resposta, quando ele manda o comentário.\n\nCabeçalhos: X-Atendux-Event, X-Atendux-Delivery e X-Atendux-Signature (t=<unix>,v1=<HMAC-SHA256 em hex de \"<t>.<corpo>\">). Responda 2xx em até 10 segundos.","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["id","type","createdAt","organizationId","data"],"properties":{"id":{"type":"string","format":"uuid","description":"Id do evento (igual no reenvio)."},"type":{"type":"string","const":"survey.answered"},"createdAt":{"type":"string","description":"Quando o evento aconteceu (ISO 8601)."},"organizationId":{"type":"string","format":"uuid"},"data":{"type":"object","properties":{"answer":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"surveyId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"surveyName":{"type":"string"},"kind":{"type":"string","enum":["csat","nps","yes_no"]},"score":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"label":{"type":"string"},"comment":{"type":["string","null"]},"answeredAt":{"type":"string","description":"Data e hora em ISO 8601 (UTC)."}},"required":["id","surveyId","surveyName","kind","score","label","comment","answeredAt"],"additionalProperties":false},"conversationId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"contactId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["answer","conversationId","contactId"],"additionalProperties":false}}}}}},"responses":{"200":{"description":"Recebido. Qualquer 2xx conta como entregue."}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Chave da empresa: atx_ seguido de 43 caracteres."}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Código estável do erro (ex.: FORBIDDEN_SCOPE)."},"message":{"type":"string","description":"Mensagem em português."},"details":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}