Bearer auth. Cursor pagination. Idempotency keys. Webhooks assinados. A API que seu time teria construído se tivesse o fim de semana.
Escolha o runtime
const API_BASE = process.env.IR_API_URL ?? 'https://api.instantreply.co';
const headers = { 'Authorization': `Bearer ${process.env.IR_API_KEY}` };
const res = await fetch(`${API_BASE}/v1/conversations?status=active`, { headers });
const { data } = await res.json();
for (const c of data) {
if (c.last_message_preview?.includes('refund')) {
await fetch(`${API_BASE}/v1/conversations/${c.id}`, {
method: 'PATCH', headers: { ...headers, 'Content-Type': 'application/json' },
body: JSON.stringify({ tags: ['priority:refund'] }),
});
}
}Superfície v1
/v1/conversations/v1/conversations/:id/v1/conversations/:id/v1/conversations/:id/messages/v1/conversations/:id/messages/v1/contacts/v1/contacts/:id/v1/contacts/:id/v1/channels/v1/analytics/summary/v1/usage/v1/webhooks/v1/webhooks/v1/webhooks/:idDesign
Todo endpoint de lista retorna has_more e next_cursor. Sem registros perdidos sob carga, sem off-by-one.
Passe um UUID e tente de novo com segurança por 24 horas. Side effects disparam exatamente uma vez.
Cole o ID no suporte e a gente traça a chamada exata, a resposta exata, a chamada downstream exata.
Mesmo envelope JSON em toda falha. code, message, doc_url, request_id. Sem null surpresa.
Erros
Sem flags de sucesso aninhados. Sem mistura de casing. Sem 200 silencioso na falha. Se a chamada quebrou, o body te diz exatamente qual chamada, o que ela esperava, e onde tão os docs.
// 422 Unprocessable Entity
{
"error": {
"code": "INVALID_PLATFORM",
"message": "Channel 'tiktok' is not yet supported on v1.",
"doc_url": "https://www.instantreply.co/api-docs#errors",
"request_id": "req_8f2a0b1c"
}
}