ErzyCall API
    ErzyCall API

    Getting Started

    Quick StartAuthentication

    Guides

    Rate LimitingError HandlingWebhooks

    API Reference

    CallsContactsCasesAssistantsPhone NumbersContact GroupsWebhook EndpointsWhatsApp

    Error Handling

    Understand the error response format and common error codes.

    The ErzyCall REST API uses standard HTTP status codes and returns errors in a consistent JSON envelope.

    Error Envelope

    All error responses follow this format:

    {
      "error": {
        "code": "VALIDATION_ERROR",
        "message": "Invalid query parameters",
        "details": [
          {
            "field": "phone",
            "message": "Must be E.164 format (e.g., +14155551234)"
          }
        ]
      }
    }
    FieldTypeDescription
    codestringMachine-readable error code (use this for programmatic handling)
    messagestringHuman-readable description
    detailsarrayOptional — field-level validation errors

    HTTP Status Codes

    Success Codes

    StatusMeaning
    200OK — request succeeded
    201Created — resource was created
    204No Content — deletion succeeded (no body)

    Client Error Codes

    StatusMeaning
    400Bad Request — malformed JSON or invalid parameters
    401Unauthorized — missing, invalid, expired, or revoked API key
    403Forbidden — API key lacks required scope
    404Not Found — resource doesn't exist or belongs to another organization
    409Conflict — duplicate resource or idempotency key mismatch
    422Unprocessable Entity — request is valid but cannot be fulfilled
    429Too Many Requests — rate limit exceeded

    Server Error Codes

    StatusMeaning
    500Internal Server Error — unexpected failure

    Error Codes Reference

    CodeStatusDescription
    UNAUTHORIZED401Missing or invalid API key
    KEY_REVOKED401API key has been revoked
    KEY_EXPIRED401API key has expired
    INSUFFICIENT_SCOPE403Key lacks required scope for this endpoint
    VALIDATION_ERROR400Request body or query params failed validation
    INVALID_JSON400Request body is not valid JSON
    INVALID_ID400Missing or malformed resource ID
    NOT_FOUND404Resource not found (or belongs to another org)
    CONFLICT409Duplicate resource (e.g., contact with same phone)
    IDEMPOTENCY_MISMATCH409Idempotency key reused with different request body
    INVALID_STATE422Operation not allowed in current state (e.g., cancelling a finished call)
    INVALID_PHONE422Phone number not assigned to your organization
    MAX_ENDPOINTS422Maximum 5 webhook endpoints per organization
    RATE_LIMITED429Rate limit exceeded
    INTERNAL_ERROR500Unexpected server error

    Idempotency

    For POST requests, you can include an Idempotency-Key header to safely retry requests without creating duplicate resources.

    curl -X POST "https://app.erzycall.com/api/v1/calls" \
      -H "X-API-Key: ek_live_abc123" \
      -H "Idempotency-Key: unique-request-id-12345" \
      -H "Content-Type: application/json" \
      -d '{"to": "+14155551234", "from": "+14155559999"}'
    • The first request creates the resource and caches the response.
    • Subsequent requests with the same Idempotency-Key, method, and path return the cached response.
    • If you reuse the key with a different request body, the API returns a 409 IDEMPOTENCY_MISMATCH error.

    Best Practices

    • Always check the error.code field for programmatic error handling, not the HTTP status alone.
    • Handle 429 errors with backoff and retry logic. See Rate Limiting.
    • Use idempotency keys for all POST requests to safely handle network retries.
    • Log error responses including the full error envelope for debugging.

    Rate Limiting

    Understand the ErzyCall API rate limits and how to handle 429 responses.

    Webhooks

    Receive real-time event notifications via webhooks.

    On this page

    Error EnvelopeHTTP Status CodesSuccess CodesClient Error CodesServer Error CodesError Codes ReferenceIdempotencyBest Practices