---
title: Errors
description: Status codes and the error body each API returns.
url: https://hexelstudio.com/docs/api/errors
---

Failed requests return a `4xx` or `5xx` status with a JSON body that explains what went wrong. Each endpoint page lists the statuses it can return.

## Status codes

| Status | Meaning |
| --- | --- |
| `400` | The request is invalid, for example a missing or malformed field. |
| `404` | The resource does not exist. |
| `409` | The request conflicts with the resource's current state. Agent Registry only. |
| `500` | The service hit an unexpected error. |
| `502` | An upstream service failed. Compute only. |
| `503` | The service cannot handle the request right now. Compute only. |

## Error body

The two APIs use slightly different error objects.

<Tabs>
  <Tab title="Compute API">
    <ResponseField name="code" type="integer">
      The HTTP status code.
    </ResponseField>
    <ResponseField name="error_code" type="string">
      A machine-readable error code.
    </ResponseField>
    <ResponseField name="message" type="string">
      A human-readable description of the error.
    </ResponseField>

    ```json
    {
      "code": 404,
      "error_code": "string",
      "message": "string"
    }
    ```
  </Tab>
  <Tab title="Agent Registry API">
    <ResponseField name="error" type="string">
      A short error identifier.
    </ResponseField>
    <ResponseField name="message" type="string">
      A human-readable description of the error.
    </ResponseField>

    ```json
    {
      "error": "string",
      "message": "string"
    }
    ```
  </Tab>
</Tabs>

<Tip>
  Branch on the status code and the machine-readable field, not on `message`: messages are for people and can change.
</Tip>
