# Bulk jobs

A bulk job checks one column of a CSV file in the background: phone numbers, email addresses or IP addresses. You send the file, get a job back right away, and download a result file when the job is done. Bulk jobs need a live key.

| Method | Path | Credits |
|---|---|---|
| POST | `/bulk` | The sum of the rows, reserved when the job is created |
| GET | `/bulk/{id}` | 0 |

## Create a job

```http
POST https://api.qelka.com/v1/bulk?type=email&column=email
```

Send the file as the request body with `Content-Type: text/csv`, or as the field `file` of a `multipart/form-data` request. The options go in the query string. The API answers right away with the HTTP status `202` and the new [bulk job](#the-bulk-job-object), while the rows are processed in the background.

| Query parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| `type` | string | Yes | none | `phone`, `email` or `ip`: what the column holds. |
| `column` | string | Yes | none | Header of the column to check, as it appears in the header row of the file, 1 to 128 characters. |
| `country` | string | No | none | Phone jobs: ISO 3166-1 alpha-2 code used to read numbers written without a `+` prefix. |
| `level` | string | No | `basic` | Phone jobs: `basic` or `live`. |
| `mode` | string | No | `full` | Email jobs: `full` or `fast`. |

### The file

- CSV with a header row. The `column` parameter names one of its headers. An exact match wins; otherwise the match ignores letter case.
- Fields separated by commas, semicolons or tabs. The delimiter is detected from the header row.
- Up to 2,000,000 rows or 100 MB, whichever comes first.
- Every other column is kept as it is and comes back in the result file. If you do not need them back, upload only the column to check: it keeps the upload small and the personal data you send to the minimum.

```csv
email,first_name,signup_date
jane@example.com,Jane,2026-10-02
john@example.org,John,2026-10-05
```

### Credits are reserved up front

Creating a job reserves the credits for every row: rows times 1 for an email job, rows times 1 or 3 for a phone job depending on `level`, rows times 1 for an IP job. If your balance cannot cover the reservation, the job is refused with `402 insufficient_credits` and nothing is reserved.

When the job ends, the credits that were reserved but not used go back to your balance: rows that failed, checks that could not complete, a job that stopped early. `credits_reserved` and `credits_used` on the job show both numbers.

Every row is checked afresh, without the result cache, and duplicates cost a check each. Deduplicate the column before you upload.

## The bulk job object

```json
{
  "id": "bulk_01M84BSX8MDFXRWMW580GKJWEY",
  "object": "bulk_job",
  "type": "email",
  "status": "queued",
  "rows_total": 48210,
  "rows_done": 0,
  "credits_reserved": 48210,
  "credits_used": 0,
  "created_at": "2026-11-23T14:02:11.482Z",
  "completed_at": null,
  "download_url": null,
  "error": null
}
```

| Field | Type | Description |
|---|---|---|
| `id` | string | Identifier of the job: `bulk_` and 26 characters. |
| `object` | string | Always `bulk_job`. |
| `type` | string | `phone`, `email` or `ip`, as sent at creation. |
| `status` | string | Where the job stands. See [statuses](#statuses). |
| `rows_total` | integer | Number of data rows in the file, header excluded. |
| `rows_done` | integer | Rows processed so far. `rows_done` divided by `rows_total` is the progress. |
| `credits_reserved` | integer | Credits reserved at creation for every row. |
| `credits_used` | integer | Credits actually used so far. When the job ends, the difference with `credits_reserved` returns to your balance. |
| `created_at` | string | When the job was created, ISO 8601 in UTC. |
| `completed_at` | string or null | When the job ended, ISO 8601 in UTC. Null while it runs. |
| `download_url` | string or null | Signed link to the result file, valid for 24 hours. Set when the status is `completed`, null before. |
| `error` | string or null | What went wrong, when the status is `failed`. Null otherwise. |

### Statuses

| `status` | Meaning | Final |
|---|---|---|
| `queued` | The file is stored and waiting to be processed. | No |
| `processing` | Rows are being checked. `rows_done` grows. | No |
| `completed` | Every row was processed. The result file is ready at `download_url`. | Yes |
| `failed` | The job could not finish. `error` says why. Unused credits are returned. | Yes |
| `cancelled` | The job was stopped before it finished. Unused credits are returned. | Yes |

## Follow a job

```http
GET https://api.qelka.com/v1/bulk/{id}
```

Returns the bulk job object. It costs nothing. Poll it every few seconds for small files and every minute or so for large ones, or skip polling altogether: the `bulk.completed` [webhook](/docs/webhooks) sends you the job object when it finishes.

## The result file

The result file is a CSV with every original column, in the original order, followed by result columns whose names start with `result_`. It uses the same delimiter as your file.

| Job type | Result columns |
|---|---|
| `email` | `result_status`, `result_reason`, `result_did_you_mean`, `result_syntax`, `result_mx`, `result_smtp`, `result_catch_all`, `result_disposable`, `result_role`, `result_free_provider`, `result_spf`, `result_dmarc`, `result_score`, `result_error` |
| `phone` | `result_valid`, `result_status`, `result_e164`, `result_national`, `result_country`, `result_region`, `result_timezones`, `result_line_type`, `result_carrier`, `result_carrier_source`, `result_mcc`, `result_mnc`, `result_ported`, `result_error` |
| `ip` | `result_version`, `result_country`, `result_region`, `result_city`, `result_asn`, `result_asn_org`, `result_asn_type`, `result_tor`, `result_vpn`, `result_proxy`, `result_datacenter`, `result_risk_score`, `result_risk_level`, `result_error` |

Each column holds the field of the same name in the [phone](/docs/api-reference/phone), [email](/docs/api-reference/email) or [IP](/docs/api-reference/ip) result: `result_country` is the country code, `result_asn` the AS number. Booleans are written `true` or `false`, a null value is an empty cell, and several time zones are separated by `|`.

A row that could not be checked has an empty result and a `result_error`: `empty_value` when the cell is empty, `value_too_long` when it is longer than the endpoint accepts, or an [error type](/docs/errors) such as `unprocessable_input` or `upstream_unavailable`. These rows are not billed.

### Download the file

Download the file from `download_url` once the status is `completed`. The link is signed, needs no API key, and stays valid for 24 hours: if it has expired, call `GET /bulk/{id}` again to get a new one. Treat it as an opaque link: use it as it comes, do not build it yourself.

Input files and result files are deleted after 30 days. Download the results before then and keep your own copy.

## Examples

### Create a job from a file

```bash
curl "https://api.qelka.com/v1/bulk?type=email&column=email&mode=full" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: text/csv" \
  --data-binary @contacts.csv
```

The same upload as a form, which some HTTP clients find easier:

```bash
curl "https://api.qelka.com/v1/bulk?type=phone&column=phone&country=US&level=basic" \
  -H "Authorization: Bearer $API_KEY" \
  -F "file=@contacts.csv"
```

Use `--data-binary`, not `-d`, for the raw upload: `-d` strips the line breaks out of the file.

### Create, wait and download in Node.js

```javascript
import { readFile, writeFile } from 'node:fs/promises'

const API = 'https://api.qelka.com/v1'
const headers = { Authorization: `Bearer ${process.env.API_KEY}` }
const sleep = (milliseconds) => new Promise((resolve) => setTimeout(resolve, milliseconds))

const created = await fetch(`${API}/bulk?type=email&column=email`, {
  method: 'POST',
  headers: { ...headers, 'Content-Type': 'text/csv' },
  body: await readFile('contacts.csv'),
})
if (!created.ok) throw new Error(`Bulk job refused: ${(await created.json()).error.type}`)
let job = await created.json()

while (job.status === 'queued' || job.status === 'processing') {
  await sleep(15000)
  job = await (await fetch(`${API}/bulk/${job.id}`, { headers })).json()
  console.log(`${job.rows_done} of ${job.rows_total} rows`)
}

if (job.status !== 'completed') throw new Error(`Job ${job.id} ended as ${job.status}: ${job.error}`)
const result = await fetch(job.download_url)
await writeFile('contacts-checked.csv', Buffer.from(await result.arrayBuffer()))
console.log(`Used ${job.credits_used} of ${job.credits_reserved} reserved credits`)
```

The [JavaScript SDK](/docs/sdk-js) wraps the same calls as `client.bulk.create()` and `client.bulk.get()`.

A finished job:

```json
{
  "id": "bulk_01M84BSX8MDFXRWMW580GKJWEY",
  "object": "bulk_job",
  "type": "email",
  "status": "completed",
  "rows_total": 48210,
  "rows_done": 48210,
  "credits_reserved": 48210,
  "credits_used": 47988,
  "created_at": "2026-11-23T14:02:11.482Z",
  "completed_at": "2026-11-23T14:31:51.904Z",
  "download_url": "https://api.qelka.com/v1/bulk/bulk_01M84BSX8MDFXRWMW580GKJWEY/download?expires=1795530712&signature=9c1e5a3f7b2d4e6a8c0f1b3d5e7a9c2e4f6a8b0d1c3e5f7a9b2d4c6e8f0a1b3c",
  "error": null
}
```

Values in the examples are illustrative.

## Errors

| Status | Type | When |
|---|---|---|
| 400 | [invalid_request](/docs/errors#invalid_request) | `type` or `column` is missing, or an option has a value outside its allowed set |
| 401 | [invalid_api_key](/docs/errors#invalid_api_key) | The key is missing, invalid or revoked |
| 402 | [insufficient_credits](/docs/errors#insufficient_credits) | Your balance cannot cover the reservation for every row |
| 403 | [forbidden](/docs/errors#forbidden) | The key is a test key or is restricted to other endpoints, or a download link is invalid or expired |
| 404 | [not_found](/docs/errors#not_found) | `GET /bulk/{id}` with an id that does not match a job of your organization, or a download link whose file was already deleted |
| 429 | [rate_limited](/docs/errors#rate_limited) | Too many requests; wait `Retry-After` seconds |
| 500 | [internal_error](/docs/errors#internal_error) | Unexpected error on our side; retry with backoff |

None of these responses is billed. Files over 2,000,000 rows or 100 MB are refused when you create the job.

## Related

- [Clean an email list](/docs/guides/clean-an-email-list): what to keep, fix or remove once the results are in.
- [Webhooks](/docs/webhooks): get the `bulk.completed` event instead of polling.
