# Errors and troubleshooting

> The StrideHQ API's status codes, its one error shape, and what each error type means.

The StrideHQ API uses standard HTTP status codes, together with its own error types and codes.

In general:

- A `2xx` status means the request worked.
- A `4xx` status means something in the request needs fixing.
- A `5xx` status means something went wrong at our end.

Every error has the same shape:

```json
{
  "error": {
    "type": "invalid_request",
    "code": "invoice_already_approved",
    "message": "This invoice has been approved, so it can't be changed.",
    "param": "total_amount",
    "request_id": "req_3Fk9Zp"
  }
}
```

| Status | Type              | Meaning                                                                         |
| ------ | ----------------- | ------------------------------------------------------------------------------- |
| 400    | `invalid_request` | Something in the request is missing or wrong                                    |
| 401    | `authentication`  | The key is missing, revoked or sent to the wrong environment                    |
| 403    | `permission`      | The key doesn't have the scope for this action                                  |
| 404    | `not_found`       | Nothing with that ID exists in your organisation                                |
| 409    | `conflict`        | The action clashes with the current state, for example a duplicate invoice      |
| 422    | `validation`      | The request is well formed but can't be done, for example nothing is due to pay |
| 429    | `rate_limited`    | Too many requests. Wait and retry                                               |
| 500    | `api_error`       | Something went wrong at our end                                                 |

Include the `request_id` if you contact support.
