Skip to main content
This guide shows you how to handle errors from the Chirp API in your application. For a full reference of the error format, see Errors. For details on specific error codes, see Error Codes.

API Error Handling

Basic Error Handling

Every error response from the Chirp API has the same structure. Start by checking the error.type field to determine the category of the problem.

Handling Specific Error Codes

When an error includes a code field, you can use it to branch your logic and take specific actions.
Handling specific error codes

Handling Provider Errors

When an error has a provider object, you can access the raw error from Meta or Telnyx for additional debugging context.
Handling provider errors

Handling Validation Errors

When the param field is present, it tells you which request parameter caused the error. Use this to provide targeted feedback in your UI.
Handling validation errors

Webhook Error Handling

When a message fails to deliver, Chirp sends a webhook event with the error details in the same format as API errors.

Receiving Failed Events

Failed delivery events include an error object in the data payload.
Webhook error handling

Webhook Failure Payload

Here is an example of a failed WhatsApp message webhook:
WhatsApp failure webhook

Retry Strategies

Not all errors should be retried. Use the following table to determine whether an error is retryable.

When to Retry

Never retry invalid_request_error or authentication_error automatically. These indicate a problem with your request that will not resolve on its own. Retrying will waste your rate limit budget.

Exponential Backoff

For retryable errors, use exponential backoff to avoid overwhelming the API.
Exponential backoff
Add random jitter to your retry delays to prevent multiple clients from retrying at the same time (thundering herd problem).

Logging Best Practices

Log error details to help your team debug issues in production.
Error logging
When contacting Meta support about a WhatsApp issue, always include the fbtrace_id from the error response. This allows Meta to look up the exact request in their systems.