Skip to main content

Reports API

Reports endpoints exposed by the Devotel CPaaS API Base path: /api/v1/reports Endpoint count: 4

title: “Errors worth branching on” description: “Per-endpoint failure templates matching the envelope — what actually fires, what to retry, what to surface to the operator.”

Errors worth branching on

These five failures cover the report run + list chain (POST /api/v1/reports//run, GET /api/v1/reports//download/), the path the weekly scheduler takes. Each block below is a full { error, meta } envelope as the API returns it, and the matrix at the bottom answers retry vs surface for the same five classes. For the platform-wide decision table these branches plug into, see the error handling guide.

401 — Unauthorized

A 401 on this page is the bearer key failing before the route ran — it never means the resource is wrong. Rotate the key or re-mint the scoped token; retrying the same request changes nothing.

403 — Forbidden

A 403 means the key authenticated but the operation is gated by scope — check the key’s scopes on the developer page; a 403 is never a data-not-found shape.

422 — Schema

A 422 means the payload did not match the request schema — branch on error.details.field and list the metric slugs first and resend with an allowed value instead of blind-retrying the same body.

429 — Rate

The Retry-After header and error.details.retry_after are both set on every 429 — resend the SAME request after the lower of the two.

402 — Feature gate

Surface the upsell page — the report route is data-safe; only provisioning gates it.

60-second retry matrix


Escalations grouped by reason code

GET /api/v1/reports/escalation-by-reason
Aggregate escalated conversations by escalation reason code for a time window (explicit from/to, or a 24h/7d/30d/90d range shortcut; defaults to the last 30 days). Returns one bucket per code with its count and median escalation→resolution time, plus an uncoded bucket for legacy free-text reasons. Use it to rank the top escalation drivers in the inbox.
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.

List queue-sla

GET /api/v1/reports/queue-sla
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.

List sla-attestation

GET /api/v1/reports/sla-attestation
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.

Generate an on-demand report

POST /api/v1/reports/generate
Generate a delivery report on demand for one channel (or all channels) over a time window chosen with an explicit from/to pair or a 24h/7d/30d/90d range shortcut. Returns aggregate metrics (totals, delivered/failed, delivery rate, cost) plus a daily breakdown and a per-channel breakdown. Requires owner, admin or developer role.
string
Stripe-style idempotency token. Pass a stable, client-generated value (1-255 chars) to dedupe retries on transient timeouts. The same key+credential+path replays the original response for 24h on 2xx (5min on 4xx, 30s on 5xx). Returns 409 if a concurrent request with the same key is already in flight; replayed responses include the Idempotency-Replay: true response header.
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.
string (enum: sms|mms|whatsapp|email|rcs|viber|…)
—
string
—
string
—
string (enum: 24h|7d|30d|90d)
—