> ## Documentation Index
> Fetch the complete documentation index at: https://docs.jojapi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Gateway Generated Responses

> Understand the meaning of the responses produced by the API gateway.

For some API requests, the response body is created by the gateway itself — usually in error situations, or when the gateway must replace the upstream server's response.

You can detect these responses by a dedicated header — when it is present, the response body was generated by the gateway:

```
X-Jojapi-Gateway-Response: true
```

The gateway-generated error responses are listed below.

## **Error Messages**

Every error response carries a `message` field. An example response:

```
{"message":"Invalid Server"}
```

Billing-related errors (status `402`) also carry machine-readable fields so your code does not have to parse the message: `reason` (`not_included`, `quota_exceeded`, `insufficient_balance`, or for agent payments `payment_required`, `payment_invalid`, `renewal_required`, `settlement_failed`, `sign_in_required`) and — when a specific billable object caused the rejection — `object` with that object's slug. Agent-payment `402`s additionally carry the payment offer in the `PAYMENT-REQUIRED` (x402) and `WWW-Authenticate: Payment` (MPP) headers — see [Agent payments](/consumers/agents). An example response:

```
{"message":"Plan Does Not Include AI Tokens","object":"ai-tokens","reason":"not_included"}
```

Below is a list of error messages:

| Message content | Status code | Description |
| - | - | - |
| Invalid Server | 400 | The request was sent to the wrong gateway address. |
| Invalid URL | 400 | The request was sent to the wrong gateway URL. |
| Invalid Path | 400 | The request was sent to the wrong gateway path. |
| Invalid Endpoint | 400 | The request was sent to the wrong gateway endpoint. |
| Unauthorized | 401 | The request carried no API key. Include your API key in the request. |
| Invalid API Key | 401 | The API key you submitted is invalid. |
| Subscription Not Found | 401 | You do not have an active subscription for the current API. Please check if you have a valid subscription. |
| Not Enough \{Object} | 402 | Your plan's included quota for the named billable object (e.g. "Not Enough Credits") has run out. Renew your plan or upgrade to a higher plan. |
| Plan Does Not Include \{Object} | 402 | Your plan does not cover the named billable object, which this endpoint consumes. Switch to a plan that includes it. |
| Insufficient Balance | 402 | You don't have enough funds to fulfill the request. Add funds to your account. Use the auto top-up feature for a smoother experience. Agent accounts receive a payable top-up offer in the same response. |
| Payment required | 402 | Keyless call to an endpoint sold per request: the response carries an x402 / MPP offer — pay and repeat. `reason: payment_required`. |
| Payment settlement failed | 402 | The payment verified but could not be settled after the upstream answered; the body is withheld and a fresh offer is attached. `reason: settlement_failed`. |
| Unauthorized (`api_key_required`) | 401 | Keyless call to an endpoint that is not sold per request. The body links to the API's agent catalog (plans, top-up). |
| Your API Key is not available on this API | 403 | Your API key is restricted and does not include this API. |
| User Blocked | 403 | Your account has been blocked. |
| Not Found | 404 | You sent a request to an address that does not exist. |
| API Not Found | 404 | You sent a request to an API address that does not exist. |
| Endpoint Not Found | 404 | You sent a request to an endpoint address that does not exist. |
| Method Not Allowed | 405 | The request method is not supported. The gateway currently supports GET, POST, PUT, PATCH and DELETE. |
| API Gateway Error | 500 | The API provider did not configure the API correctly. |
| Server Timeout | 500 | The upstream request timed out. The gateway waits for a response for a maximum of 90 seconds. |
| Server Error | 500 | An error occurred due to the target API server. Possible causes:<br />- The target server is unreachable.<br />- The target server SSL verification failed. |
| Invalid Response Code | 500 | The target API server returned an unsupported response status code. |
| Bad Response | 500 | The target API server returned an unsupported response body. |
| Target Server Error | 500 | The target servers specified by the API provider are invalid. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.