- Request errors: the API rejects your request. The response has an HTTP status code of
400or higher and a body that describes the error. You know right away. - Delivery errors: the API accepts a message, and the message fails later. The request succeeded, so there’s no HTTP error. Wavix reports the failure in a webhook. See Delivery errors.
Request errors
Endpoints return request errors in one of two formats: the standard error format, or the problem details format. The API reference page of each endpoint shows the format it uses.Standard error format
Most endpoints, including the SMS and MMS endpoints, return errors in this format. Errors are JSON withsuccess set to false and a message that describes the error:
Use the HTTP status code to decide what to do. Don’t parse
message: its wording can change.
Problem details format
Some endpoints return errors in the problem details format. Today, these are the WhatsApp endpoints (/v1/whatsapp/...). The format follows RFC 9457 and uses the application/problem+json content type:
Use
error_code in your code to tell errors apart. The type URL is the address of the error’s page, and its last part, such as sender-not-found, names the same error. Don’t parse title or detail: their wording can change.
Each error type has a page at the type URL that says what happened, whether to try again, and how to fix it.
Error classes
Theerror_class field tells you whether to retry the request:
When you retry a WhatsApp message send, send the same
idempotency_key with each attempt. The API then sends the message only once.
Handle problem details in your code
The following example sends a request and handles a problem details error. It retriesretriable and rate_limited errors up to three times, and stops on any other error. It calls the WhatsApp senders endpoint, which returns this format: