# Errors

Use the HTTP status to handle errors. Error details are returned as JSON objects, JSON strings or plain text. JSON objects can include `message`, `error` or `internalCode`.

| Status | Action                                                                                                     |
| ------ | ---------------------------------------------------------------------------------------------------------- |
| `400`  | Check the input, account requirements and current delivery state. Completed deliveries cannot be canceled. |
| `401`  | Check credentials, timestamp and [signature](https://docs.armadadelivery.com/v2/authentication.md).                                         |
| `403`  | Check the endpoint's key permission and the response's validation message.                                 |
| `404`  | Check the resource identifier and the key's access.                                                        |
| `409`  | A test delivery changed during cancellation. Read its state before retrying.                               |
| `5xx`  | Retry reads with bounded backoff. Check write outcomes before resubmitting.                                |

## Retrying requests

Read requests can be retried after transient network errors or `5xx`, with a limited number of attempts and increasing delay.

Delivery creation is not automatically deduplicated by `reference`. After a timeout or error, check the saved delivery code or resolve the outcome with Armada before creating another order.

## Support

Send the endpoint, time, HTTP status and delivery code to Armada support. Exclude API keys and secrets.
