Endpoints
Referência completa dos endpoints da API.
Base URL
https://api.supersquad.com/v1
Agents
Listar agentes
httpGET /agents
Response:
json{ "data": [ { "id": "agent_123", "name": "Assistente de Vendas", "status": "active" } ], "pagination": { "total": 10, "page": 1, "limit": 20 } }
Obter agente
httpGET /agents/:id
Criar agente
httpPOST /agents
Body:
json{ "name": "Novo Agente", "instructions": "Você é um assistente...", "model": "gpt-4o-mini" }
Atualizar agente
httpPATCH /agents/:id
Deletar agente
httpDELETE /agents/:id
Contacts
Listar contatos
httpGET /contacts
Obter contato
httpGET /contacts/:id
Criar contato
httpPOST /contacts
Body:
json{ "name": "João Silva", "phone": "+5511999999999", "email": "joao@example.com" }
Messages
Enviar mensagem
httpPOST /messages
Body:
json{ "contactId": "contact_123", "channelId": "channel_456", "content": "Olá! Como posso ajudar?" }
Listar mensagens
httpGET /threads/:threadId/messages
Threads
Listar threads
httpGET /threads
Obter thread
httpGET /threads/:id
Criar thread
httpPOST /threads
Estatísticas NPS
Agrega respostas NPS registradas em threads (nps_created_at no intervalo).
httpGET /threads/stats/nps?workspaceId={uuid}&dateFrom={iso}&dateTo={iso}
Response:
json{ "promotores": 4, "neutros": 1, "detratores": 2, "total": 7, "npsScore": 29 }
Promotores: 9–10. Neutros: 7–8. Detratores: 0–6. npsScore é null sem respostas no período.