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/messages/v1/messages/v1/messages/:id/v1/contacts/v1/contacts/:id/v1/contacts/:id/v1/channels/v1/analytics/summary/v1/usage/v1/keys/v1/keys/v1/keys/:id/rotate/v1/keys/:id/v1/webhooks/v1/webhooks/v1/webhooks/:id/v1/webhooks/:id/deliveries/v1/webhooks/send/v1/webhooks/trigger-campaign/v1/webhooks/sign-payload/v1/journeys/v1/trigger/v1/trigger/status/:id/v1/trigger/history/v1/trigger/validate/v1/trigger/batch/v1/trigger/enrollments/v1/events/v1/templates/v1/templates/v1/templates/:id/v1/templates/generate/validate/v1/templates/:id/validate/v1/templates/:id/submit/v1/campaigns/v1/campaigns/v1/campaigns/:id/v1/campaigns/:id/v1/campaigns/:id/send/v1/pipeline/leads/v1/pipeline/leads/:id/v1/pipeline/leads/:id/v1/pipeline/leads/:id/stage/v1/pipeline/stages/v1/automations/v1/automations/:id/v1/automations/:id/trigger/v1/comments/v1/comments/:id/v1/comments/:id/reply/v1/developer/capabilities/v1/developer/onboarding/v1/developer/limits/v1/developer/troubleshooting/errors/:codeDesign
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://instantreply.co/api-docs#errors",
"request_id": "req_8f2a0b1c"
}
}