# Errors

This section explains the HTTP response codes and error format you may encounter when using the Sail API.

Sail uses standard HTTP response codes to indicate the success or failure of an API request. Codes in the `2xx` range indicate a successful request, `4xx` codes indicate an error with the request or the information provided, and `5xx` codes indicate an error on Sail’s side.

All errors use the same response envelope, so you only need to handle a single error format.

```
{ "error":
 { "code": "invalid_request", 
   "message": "...", 
   "param": "..." 
  } 
}
```

## HTTP status codes

See what codes are returned by Sail's Rest API.

| Status | Code | Description |
| :--- | :--- | :--- |
| 400 | `invalid_request` | The request body or parameters are malformed or missing. |
|  | `invalid_key_configuration` | The key's scope combination is not valid (for example, `token_admin` combined with another scope). |
| 401 | `unauthorized` | The API key is missing or invalid. |
|  | `user_token_required` | This endpoint needs an ephemeral user token in the `x-sail-user-token` header. |
|  | `user_token_expired` | The ephemeral user token has expired. Mint a new one. |
|  | `invalid_user_token` | The ephemeral user token is malformed or revoked. |
| 403 | `insufficient_key_scope` | Your API key doesn't have the scope this endpoint needs. |
|  | `insufficient_token_scope` | Your ephemeral user token doesn't have the scope this endpoint needs, even though your key does. |
|  | `product_not_enabled` | Your key and token are fine, but the connection doesn't have this capability turned on. |
|  | `token_scope_mismatch` | The token's scope doesn't match what this endpoint needs. |
| 404 | `not_found` | The requested resource doesn't exist. |
| 409 | `conflict` | The request conflicts with the current state of the resource. |
|  | `connection_not_external` | You tried to push transactions to a connection that isn't `external`. |
|  | `connection_not_reconnectable` | You tried to reconnect an `external` connection, which has no credentials to refresh. |
| 429 | `rate_limited` | Too many requests. Back off and retry. |
| 5xx | `server_error` | Something went wrong on Sail's side. |