Bearer auth. Cursor pagination. Idempotency keys. Webhooks firmados. La API que tu equipo habría construido si tuviera el fin de semana.
Elige el 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'] }),
});
}
}Superficie 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/:codeDiseño
Cada endpoint de lista devuelve has_more y next_cursor. Sin records perdidos bajo carga, sin off-by-one.
Pasa un UUID y reintenta seguro por 24 horas. Los side effects disparan exactamente una vez.
Pega el ID en soporte y trazamos exactamente la llamada, la respuesta y la llamada downstream.
Mismo envelope JSON en cada falla. code, message, doc_url, request_id. Sin nulls sorpresa.
Errores
Sin flags de éxito anidados. Sin mezclas de casing. Sin 200s silenciosos en falla. Si la llamada se rompió, el body te dice exactamente qué llamada, qué esperaba y dónde están los 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"
}
}Webhooks
POST /v1/webhooks con la URL de tu endpoint y los eventos. La respuesta devuelve un secreto de firma whsec_ una sola vez — nunca se guarda de forma legible ni se vuelve a mostrar. Cópialo en INSTANTREPLY_WEBHOOK_SECRET. ¿Lo perdiste? No hay endpoint para recuperarlo: elimina el webhook y registra uno nuevo para obtener un secreto nuevo.
// POST /v1/webhooks (scope: webhooks:write)
// Request
{
"url": "https://your-app.com/instantreply/webhook",
"events": ["*"],
"description": "Inbound events"
}
// 201 Created — the secret is returned ONCE, here only.
{
"id": "b1e7…",
"url": "https://your-app.com/instantreply/webhook",
"events": ["*"],
"secret": "whsec_9f2c…" // ← store this now; never shown again
}