> ## Documentation Index
> Fetch the complete documentation index at: https://developer.runa.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Error types

> Error types and handling in the Runa API

Our endpoints return standard HTTP status codes to indicate the success or failure of a request. In the event of an error, the response body will contain a JSON object with `type`, `message`, and `help` keys. For example:

```json theme={null}
{
  "type": "example",
  "message": "This is an example error",
  "help": "This is how you can fix it"
}
```

You can use the `type` key to programmatically handle different error scenarios. The `message` and `help` keys offer human readable descriptions of the error and may vary depending on the specific error.

## Error types

The following is a list of error types that may be returned by our API. The message and help fields are examples and may vary depending on the specific error.

| Type                                                                  | HTTP Status | Message (example)                                                                                                                  | Help (example)                                                                                                                                                                                            |
| --------------------------------------------------------------------- | ----------- | ---------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `unauthorized`                                                        | `401`       | Missing or invalid 'X-Api-Key' header.                                                                                             | Generate a key on [https://app.runa.io/api-keys](https://app.runa.io/api-keys) and pass using the 'X-Api-Key' header.                                                                                     |
| `forbidden`                                                           | `403`       | You don't have permission to access the requested resource                                                                         | Please check the path you are trying to access is correct and you have permission to access it. Also ensure you are using the correct API key in the 'X-Api-Key' header.                                  |
| `bad_request`                                                         | `400`       | There is a problem with your request payload or JSON format.                                                                       | Please ensure your payload is being passed or check issues with a JSON validator.                                                                                                                         |
| `invalid_api_key`                                                     | `401`       | Missing or invalid 'X-Api-Key' header                                                                                              | Generate a key on [https://app.runa.io/api-keys](https://app.runa.io/api-keys) and pass using the 'X-Api-Key' header.                                                                                     |
| `not_found`                                                           | `404`       | The requested resource does not exist                                                                                              | The request path is likely incorrect, please check and try again.                                                                                                                                         |
| `timeout`                                                             | `504`       | The request timed out                                                                                                              | We were unable to process your request in time. This is a temporary issue, please try again. If the problem persists please contact [ordersupport@runa.io](mailto:ordersupport@runa.io)                   |
| `internal_server_error`                                               | `500`       | An internal server error occurred                                                                                                  | Please try again, or contact [ordersupport@runa.io](mailto:ordersupport@runa.io) for assistance.                                                                                                          |
| `invalid_version`                                                     | `400`       | Invalid API version                                                                                                                | Please use a valid API version. See [https://developer.runa.io/docs/api-versioning](https://developer.runa.io/docs/api-versioning) for more information.                                                  |
| `version_removed`                                                     | `410`       | API version is no longer supported and has been removed                                                                            | The requested API version has been removed. See [https://developer.runa.io/docs/api-versioning](https://developer.runa.io/docs/api-versioning) for more information.                                      |
| `validation_error`                                                    | `422`       | There was an issue with the request payload                                                                                        | Please check your request matches the structure outlined in our API documentation: [https://developer.runa.io/reference](https://developer.runa.io/reference)                                             |
| `pagination_error`                                                    | `400`       | There was an issue with the pagination parameters                                                                                  | Please check the pagination parameters are valid and try again.                                                                                                                                           |
| `idempotency_validation_error`                                        | `400`       | Request payload does not match previous payload for this idempotency key.                                                          | Please use a new idempotency key if this is a new request, or check your payload has not changed if you're retrying a request.                                                                            |
| `idempotency_in_progress`                                             | `400`       | We are already processing an order for this idempotency key                                                                        | Please wait until this order has finished processing before resending this request.                                                                                                                       |
| `insufficient_funds`                                                  | `400`       | Insufficient funds in {currency} balance to create order.                                                                          | Please add more funds to your {currency} balance and try again.                                                                                                                                           |
| `product_validation_error`                                            | `400`       | Not allowed to order products: \<detail>                                                                                           | None                                                                                                                                                                                                      |
| `currency_mismatch`                                                   | `400`       | The currency requested in the payment\_method, '\<currency>', does not match the currency of the selected products, '\<currency>'. | When the payment\_method type is 'ACCOUNT\_BALANCE', the currency specified must be the same as the currency of all of the products in the order.                                                         |
| `payment_method_unavailable`                                          | `400`       | The requested payment method is not available.                                                                                     | None                                                                                                                                                                                                      |
| <del>`invalid_card_id`</del><br /><small> (deprecated)</small>        | `400`       | Invalid card id.                                                                                                                   | The card id provided is invalid. Please verify the card id in your Runa account and try again.                                                                                                            |
| <del>`currency_not_supported`</del><br /><small> (deprecated)</small> | `400`       | The currency of the requested products, '\<currency>', is not supported for card payments.                                         | When the payment\_method type is 'CARD', the currency specified must be one of the following: ...                                                                                                         |
| `invalid_execution_mode`                                              | `400`       | Invalid execution mode.                                                                                                            | None                                                                                                                                                                                                      |
| `ordering_restricted`                                                 | `403`       | You cannot complete this order as you have reached your spending limit                                                             | We will send you an email with instructions with what to do next so you can continue to order as soon as possible. Please contact [compliance@runa.io](mailto:compliance@runa.io) if you do not get this. |
| `insecure_protocol`                                                   | `400`       | HTTPS required                                                                                                                     | For security the Runa API only supports requests over HTTPS. Please try again with an HTTPS URL.                                                                                                          |
