# Errors

OCTO responds to every request with either `200 OK` when everything is valid or `400 Bad Request` when it is not. In the case of `400 Bad Request`, the response body looks like this:

```json
{
  "error": "INVALID_PRODUCT_ID",
  "errorMessage": "The Product ID was invalid or missing",
  "productId": "123"
}
```

You will always receive `error` and `errorMessage`:

| Field          | Description                                                                                                           |
| -------------- | --------------------------------------------------------------------------------------------------------------------- |
| `error`        | The error code. A table of possible error codes is shown below.                                                       |
| `errorMessage` | A human-readable error message that is translated depending on the language provided by the `Accept-Language` header. |

Depending on the error code, we may also pass additional fields that make it easier to understand what is wrong with your request. In the example above, we provide `productId` and pass the value that was sent in the request, indicating that the `productId` of `123` is not valid.

## List of Error Codes

Below is a list of the error codes and a description of what each means. Further down this page, we also provide example response bodies for the error codes that include additional attributes.

| Code                      | Description                                                                                                                                                         |
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `INVALID_PRODUCT_ID`      | Missing or invalid `productId` in the request.                                                                                                                      |
| `INVALID_OPTION_ID`       | Missing or invalid `optionId` in the request.                                                                                                                       |
| `INVALID_UNIT_ID`         | Missing or invalid `unitId` in the request.                                                                                                                         |
| `INVALID_AVAILABILITY_ID` | Missing or invalid `availabilityId` in the request.                                                                                                                 |
| `INVALID_BOOKING_UUID`    | Missing or invalid booking UUID, or if you are confirming the booking, the booking may already have expired.                                                        |
| `BAD_REQUEST`             | The request body is not formatted correctly, has missing required fields, or contains incorrect data types.                                                         |
| `UNPROCESSABLE_ENTITY`    | The request body is technically correct but cannot be processed for other reasons, for example if a booking is cancelled after the cancellation cutoff has elapsed. |
| `INTERNAL_SERVER_ERROR`   | The backend server is down or there is a network outage.                                                                                                            |
| `UNAUTHORIZED`            | The API key was not sent in the `Authorization` header to an endpoint that requires authentication.                                                                 |
| `FORBIDDEN`               | The API key was invalid or revoked by the backend system, or you are trying to access an endpoint/resource you do not have access to.                               |

As explained above, it is also possible for specific error codes to have additional attributes that help you diagnose what is wrong with your request. Below are all specific errors that contain these attributes:

### `INVALID_PRODUCT_ID`

```json
{
  "error": "INVALID_PRODUCT_ID",
  "errorMessage": "The Product ID was invalid or missing",
  "productId": "123"
}
```

### `INVALID_OPTION_ID`

```json
{
  "error": "INVALID_OPTION_ID",
  "errorMessage": "The Option ID was invalid or missing",
  "optionId": "321"
}
```

### `INVALID_UNIT_ID`

```json
{
  "error": "INVALID_UNIT_ID",
  "errorMessage": "The Unit ID was invalid or missing",
  "unitId": "senior"
}
```

### `INVALID_AVAILABILIY_ID`

```json
{
  "error": "INVALID_AVAILABILIY_ID",
  "errorMessage": "The Availability ID was invalid or missing",
  "availabilityId": "2020-01-01T10:30+08:00"
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ventrata.com/getting-started/errors.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
