Getting StartedErrors & Rate Limits

Errors & Rate Limits

Understand error responses and rate limits in the Twenty2 API.

Twenty2 uses standard HTTP status codes and returns consistent error objects so you can handle failures predictably in your integration.

Error Response Format

All errors follow this structure:

{
  "success": false,
  "error": {
    "code": "INVALID_ASSISTANT",
    "message": "The assistant_id provided does not exist or is not published.",
    "status": 400
  }
}
FieldTypeDescription
successbooleanAlways false for errors
error.codestringMachine-readable error code
error.messagestringHuman-readable description of what went wrong
error.statusnumberHTTP status code

HTTP Status Codes

StatusMeaning
200Success
400Bad Request — missing or invalid parameters
401Unauthorized — API key is missing or invalid
403Forbidden — API key lacks access to this resource
404Not Found — the requested resource doesn't exist
422Unprocessable Entity — request is well-formed but contains invalid values
429Too Many Requests — rate limit exceeded
500Internal Server Error — something went wrong on Twenty2's end

Common Error Codes

CodeStatusDescription
UNAUTHORIZED401API key is missing or invalid
FORBIDDEN403API key does not have access to this resource
INVALID_ASSISTANT400The assistant_id does not exist or is not published
INVALID_NUMBER400from_number or to_number is not a valid E.164 phone number
CALL_NOT_FOUND404No call found for the given call_id
RATE_LIMIT_EXCEEDED429Too many requests — slow down and retry
INTERNAL_ERROR500Unexpected server error — contact support if this persists

Rate Limits

LimitValue
Requests per minute60
Concurrent calls3

If you exceed the rate limit you will receive a 429 response. Wait a moment and retry. For higher limits, contact the Twenty2 team.


Handling Errors — Best Practices

  1. Always check success in the response before processing data
  2. Use error.code for programmatic handling — not error.message which may change
  3. Retry on 500 with exponential backoff — these are usually transient
  4. Do not retry on 400 or 422 — fix the request first
  5. On 429, wait at least 1 second before retrying
    const response = await fetch("https://api.twentytwo.in/v1/calls", {
      method: "POST",
      headers: {
        "Authorization": "Bearer YOUR_API_KEY",
        "Content-Type": "application/json"
      },
      body: JSON.stringify({ ... })
    });

    const data = await response.json();

    if (!data.success) {
      console.error(`Error [${data.error.code}]: ${data.error.message}`);
    } else {
      console.log("Call queued:", data.call_id);
    }