Errors, limits and pagination

Callpme API error codes, rate limits, cursor-based pagination and idempotent requests.

On this page

Error formatLink to this section

An error returns an HTTP status code and a JSON body { "error": "…" }, with details when useful (for example, the field-by-field breakdown of a validation error).

Error 400
{
  "error": "Données invalides",
  "details": {
    "formErrors": [],
    "fieldErrors": {
      "name": [
        "Too small: expected string to have >=1 characters"
      ]
    }
  }
}
CodeMeaning
400Invalid request (parameter, body, cursor)
401API key invalid, missing, revoked or expired
403Action not allowed: plan limit, IP address not allowed, action restricted to admin keys, unverified account, number on the opt-out list
404Resource not found (or belonging to another organization)
409Conflict: time slot unavailable, reference already in use, idempotency key reused
422Request cannot be processed
429Rate limit or quota reached
500Internal error; retry, and share the X-Request-Id with support if it persists

Rate limitsLink to this section

  • 120 requests per minute per key (fixed one-minute window).
  • Optional monthly quota per key, set in the Developers area.
  • After 20 attempts with an invalid key within 5 minutes from the same IP address, requests from that address are rejected for 5 minutes.
  • POST /calls: 300 calls per day per organization.
  • Contact imports and knowledge additions: 30 requests per 10 minutes per organization.

Responses carry the X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset headers (Unix timestamp of the end of the window). A 429 rate-limit response also carries Retry-After (in seconds).

PaginationLink to this section

Lists are sorted from newest to oldest and paginated by cursor. To get the next page, pass the next_cursor value in the cursor parameter; next_cursor is null on the last page.

ParameterRule
limitInteger from 1 to 100, default 50 (/calls: up to 500, default 100)
cursornext_cursor value from the previous page
created_afterISO 8601 date (strictly after)
created_beforeISO 8601 date (strictly before)
JavaScript
async function listAll(path) {
  const items = [];
  let cursor = null;
  do {
    const url = new URL(`https://callpme.com/api/v1${path}`);
    url.searchParams.set("limit", "100");
    if (cursor) url.searchParams.set("cursor", cursor);
    const res = await fetch(url, {
      headers: { Authorization: `Bearer ${process.env.CALLPME_API_KEY}` },
    });
    if (!res.ok) throw new Error((await res.json()).error);
    const page = await res.json();
    items.push(...page.data);
    cursor = page.next_cursor;
  } while (cursor);
  return items;
}

const leads = await listAll("/leads");

IdempotencyLink to this section

Create requests (POST /agents, /calls, /appointments, /campaigns/{id}/contacts, /knowledge, /payment-plans) accept an optional Idempotency-Key header (8 to 128 characters: letters, digits, -, _, :, .).

  • Same key and same body within 24 hours: the original response is returned, with the Idempotent-Replayed: true header, and nothing new is created.
  • Same key with a different body: 409 error.
  • Same key while the first request is still in progress: 409 error with Retry-After: 5.
  • Only successful responses are stored: after an error, the key can be reused.