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

# Status Codes

> Every CUFinder API response returns a standard HTTP status code alongside a JSON body. Learn what each code means, why it happens, and how to resolve it.

Every request to the CUFinder API returns a standard **HTTP status code** together with a JSON body that includes a **`status`** field. Check both to confirm whether a request succeeded and to handle failures programmatically.

## Response shape

Successful and failed requests share a consistent envelope, so you can branch on `status` before reading `data`.

<CodeGroup>
  ```json Success theme={null}
  {
    "status": 1,
    "data": {
      "confidence_level": 97,
      "query": "cufinder.io",
      "emails": ["info@cufinder.io"],
      "credit_count": 9981
    }
  }
  ```

  ```json Error theme={null}
  {
    "status": -1,
    "message": "API key verification failed!"
  }
  ```
</CodeGroup>

<ResponseField name="status" type="integer">
  `1` when the request succeeds, `-1` when it fails. Always check `status` in addition to the HTTP status code.
</ResponseField>

<ResponseField name="message" type="string">
  Present only on errors. A human-readable explanation of what went wrong.
</ResponseField>

## Quick reference

| Code  | Name                 | Meaning                                                  |
| ----- | -------------------- | -------------------------------------------------------- |
| `200` | OK                   | The request succeeded and `data` was returned.           |
| `400` | Bad Request          | Not enough credits to complete the request.              |
| `401` | Unauthorized         | The API key is missing or invalid.                       |
| `422` | Unprocessable Entity | The request is malformed or a required field is missing. |
| `500` | Server Error         | Something went wrong on our side.                        |

## 200 — OK

<Check>The request was processed successfully.</Check>

The response `data` object contains your result, and `credit_count` reports your remaining balance. A `200` is only returned when `status` is `1`.

```json Response theme={null}
{
  "status": 1,
  "data": {
    "query": "cufinder.io",
    "credit_count": 9981
  }
}
```

## 400 — Not enough credits

Your account does not have enough credits to complete the request.

**How to resolve**

* Review your remaining balance from the [dashboard](https://dashboard.cufinder.io).
* Top up credits or upgrade your plan, then retry the request.

```json Response theme={null}
{
  "status": -1,
  "message": "Not enough credits!"
}
```

## 401 — Unauthorized

The `x-api-key` header is missing, malformed, or invalid.

**How to resolve**

* Confirm you are sending the `x-api-key` header on every request.
* Copy your key exactly from **Account » API key** in the [dashboard](https://dashboard.cufinder.io) — keys are case-sensitive and contain no spaces.
* Make sure the key has not been rotated or revoked.

```json Response theme={null}
{
  "status": -1,
  "message": "API key verification failed!"
}
```

## 422 — Unprocessable Entity

The request reached the API but could not be processed — usually a missing required field, a typo in a parameter name, or a value in the wrong format.

**How to resolve**

* Check the **Attributes** section of the endpoint for required parameters and accepted formats.
* Send the body as `application/x-www-form-urlencoded` (or JSON) with the exact field names shown in the request sample.

```json Response theme={null}
{
  "status": -1,
  "message": "Invalid or missing parameters."
}
```

## 500 — Server Error

Something went wrong on our side. These are rare.

**How to resolve**

* Retry the request after a short delay.
* If the error persists, [contact support](https://cufinder.io/contact-sales) with the request details so we can investigate.

```json Response theme={null}
{
  "status": -1,
  "message": "Internal server error."
}
```

<Note>
  Before contacting support, double-check your request against the endpoint's **Attributes** and the codes above — most errors are resolved by correcting the API key, credits, or parameters.
</Note>
