# API Error Responses

This guide explains the HTTP status codes and messages returned by the API when a request fails.

When a request fails due to request errors, an error response message is returned in JSON format. The error response message includes a unique error code for the endpoint, an HTTP response message, and an HTTP response code. When enabled, the response contains HATEOAS links.

### Example Response

```json
{
  "error": {
    "code": "not_found",
    "message": "Listing was not found or expired, provided UUID: d3bfa3e1-e",
    "http_code": 404
  },
  "links": [
    {
      "method": "GET",
      "rel": "docs",
      "href": "https://docs.bemyguest.com.sg/openapi//products/product"
    }
  ],
  "timestamp": "2018-08-02T16:43:33.184+08:00"
}
```

### HTTP Status Codes

| HTTP Status | API Error Code | Message (Example) |
|  --- | --- | --- |
| 400 | `error` |  |
| 400 | `invalid_params` | City not found, provided UUID: |
| 400 | `malformed_json` | JSON processing result: |
| 400 | `invalid_params` | Disallowed parameters provided |
| 401 | `GEN-UNAUTHORIZED` | Unauthorized |
| 403 | `insufficient_balance` | Wallet balance too low to create a booking. Current balance: |
| 404 | `not_found` | Listing was not found or expired, provided UUID: |
| 404 | `upload_failed` | Uploaded file is too big |
| 404 | `upload_failed` | No upload content |
| 409 | `invalid_action` | Booking does not have a `reserved` status. You cannot confirm this booking: |
| 409 | `invalid_action` | Booking has status waiting. You cannot request cancellation until approved. |
| 409 | `invalid_action` | Booking is already cancelled. You cannot cancel this booking again: |
| 410 | `gone` | Product is no longer available |
| 422 | `invalid_data` | Arrival date is unavailable. Please choose another one. |
| 422 | `no_product` | ProductType not found, UUID: |
| 422 | `no_product` | Number of elements in 'perPax' array must be equal to number of guests. |
| 422 | `no_product` | Product is not available for booking via API |
| 422 | `prices_mismatch` | Arrival date is not available anymore. Please choose another one. |
| 422 | `GEN-UNPROCESSABLE` | Arrival date is unavailable. Please choose another one. (See the [Availability Alternatives](/guides/availability-alternatives) guide — opt-in partners receive `alternatives` in this response.) |
| 500 | `internal_error` | internal_error_default |