# API reference

The API is a small set of JSON endpoints under one base URL. This page covers what they share; each endpoint has its own page with every field, enum and error.

## Endpoints

| Method | Path | Description | Credits |
|---|---|---|---|
| POST | [/phone](/docs/api-reference/phone) | Validate and describe a phone number | 1 basic, 3 live |
| POST | [/email](/docs/api-reference/email) | Verify an email address | 1 |
| POST | [/ip](/docs/api-reference/ip) | Locate an IP address and describe its network | 1 |
| POST | [/batch](/docs/api-reference/batch) | Run up to 100 mixed checks in one request | Sum of the items |
| POST | [/bulk](/docs/api-reference/bulk) | Start a background job on a CSV file | Sum of the rows |
| GET | [/bulk/{id}](/docs/api-reference/bulk) | Read a bulk job's progress and download link | 0 |
| GET | [/account](/docs/api-reference/account) | Read your plan, balance, limits and calling key | 0 |

## Base URL and versions

```text
https://api.qelka.com/v1
```

The version is part of the path: every endpoint on these pages is under `/v1`. All traffic is HTTPS.

## Authentication

Send your secret key in the `Authorization` header of every request:

```http
Authorization: Bearer sk_live_your_key
```

Keys starting with `sk_live_` run real checks; keys starting with `sk_test_` return simulated results without debiting credits. See [Authentication](/docs/authentication) and [Test mode](/docs/test-mode).

## Requests

- Check endpoints take a JSON body. Send `Content-Type: application/json`.
- Checks use `POST` so that email addresses and phone numbers travel in the request body, not in URLs, which tend to end up in proxy and server logs.
- Request bodies are strict: a field that is not part of the endpoint is rejected with `400 invalid_request` rather than silently ignored. A typo in a field name cannot go unnoticed.
- Optional fields have defaults, listed on each endpoint's page.
- `POST /bulk` is the exception: it takes a CSV file as `text/csv` or as `multipart/form-data`, with its options in the query string.

## Responses

Successful responses are JSON objects. Every object has an `object` field that names its kind:

| `object` | Returned by |
|---|---|
| `phone` | `POST /phone`, phone items of a batch |
| `email` | `POST /email`, email items of a batch |
| `ip` | `POST /ip`, IP items of a batch |
| `list` | `POST /batch` |
| `error` | Failed items inside a batch |
| `bulk_job` | `POST /bulk`, `GET /bulk/{id}` |
| `account` | `GET /account` |

Field names are `snake_case`. Parse responses leniently: read the fields you use and ignore the others.

### Identifiers

Each check returns an `id` made of `lkp_` and 26 characters of Crockford base32, for example `lkp_01M84BPVKXRNA90357Q2RGMZV0`. Bulk jobs use the same format with `bulk_`. Store the `id` next to your own record if you may need to discuss a result with support.

### Null values

A field that is documented as nullable is always present, with `null` as its value when there is nothing to report. For yes-or-no fields, `null` means "not determined", never "no": `"ported": null` means the call could not tell, `"ported": false` means the number has not been ported. Each field's description says when it is null.

### Timestamps

Dates are ISO 8601 strings in UTC, such as `2026-11-23T14:02:11.482Z`. The `X-RateLimit-Reset` header is the exception: it is a Unix time in seconds.

## Response headers

| Header | Description |
|---|---|
| `X-Request-Id` | Unique identifier of the request. Quote it when you contact support. |
| `X-Credits-Remaining` | Your credit balance after the call |
| `X-RateLimit-Limit` | Request limit of your tightest rate limit window |
| `X-RateLimit-Remaining` | Requests left in that window |
| `X-RateLimit-Reset` | Unix time, in seconds, when that window resets |
| `Retry-After` | On `429` responses: seconds to wait before retrying |

See [Rate limits](/docs/rate-limits) for how the two windows combine.

## Errors

Errors use HTTP statuses of 400 and above and one envelope:

```json
{
  "error": {
    "type": "invalid_request",
    "message": "Unknown field: level.",
    "docs": "https://qelka.com/docs/errors#invalid_request"
  }
}
```

There are nine types, from `invalid_request` to `upstream_unavailable`, and none of them is billed. [Errors](/docs/errors) describes each one and what to do about it.

## OpenAPI document

The API is described by a public OpenAPI 3.1 document:

```text
https://api.qelka.com/v1/openapi.json
```

It is generated from the schemas that define the requests and responses described on these pages. Import it into an API client to explore the endpoints, or into a generator to build a client in your language. For JavaScript and TypeScript, the [SDK](/docs/sdk-js) is ready to use.

## Credits and caching

Each endpoint's page states its cost. Results are cached for 7 days, and cached results cost the same as fresh ones. Send `"fresh": true` to recompute. See [Credits](/docs/credits) and [Caching](/docs/caching).
