# Company details in bulk

> Company details for up to 1,000 domains in one call.

`POST https://mmkuffhlzytnmgraagbp.supabase.co/functions/v1/api-company-bulk`

## Request

```bash
curl -X POST "https://mmkuffhlzytnmgraagbp.supabase.co/functions/v1/api-company-bulk" \
  -H "Authorization: Bearer $PLATINUX_API_KEY" -H "Content-Type: application/json" \
  -d '{"domains": ["miro.com", "loom.com", "airtable.com"]}'
```

| Body field | Type | Required | Notes |
|---|---|---|---|
| `domains` | array of strings | Yes | 1 to 1,000 domains |

How it answers depends on the size of the list:

| Domains | Answer |
|---|---|
| **Up to 100** | Results straight away, `200` |
| **101 to 1,000** | `202` with a `batch_id`; collect the results with `GET`. Usually ready within a minute |

## Up to 100 domains: `200`

```json
{ "status": "complete", "total": 3, "found": 3, "not_found": 0, "credits_charged": 2,
  "rejected": [],
  "results": [
    { "domain": "miro.com", "status": "found", "company": { "name": "Miro", "…": "…" }, "domain_match": true, "cached": false, "credits_charged": 1 },
    { "domain": "loom.com", "status": "found", "company": { "name": "Loom", "…": "…" }, "domain_match": true, "cached": false, "credits_charged": 1 },
    { "domain": "airtable.com", "status": "found", "company": { "name": "Airtable", "…": "…" }, "domain_match": true, "cached": true, "credits_charged": 0 } ] }
```

Each `company` has the same fields as [`api-company`](/company). A not-found item:

```json
{ "domain": "zz-unknown.com", "status": "not_found", "company": null, "domain_match": null, "cached": false, "credits_charged": 0 }
```

## 101 to 1,000 domains

### Started: `202`

```json
{ "status": "processing", "batch_id": "7c2f…", "total": 640, "rejected": [ { "domain": "x.com/acme", "reason": "invalid_domain" } ], "check_after_seconds": 30 }
```

### Check

```bash
curl "https://mmkuffhlzytnmgraagbp.supabase.co/functions/v1/api-company-bulk?batch_id=7c2f…&page=1" -H "Authorization: Bearer $PLATINUX_API_KEY"
```

Still running, `202`:

```json
{ "status": "processing", "batch_id": "7c2f…", "total": 640 }
```

Done, `200`, 100 results per page:

```json
{ "status": "complete", "batch_id": "7c2f…", "total": 640, "found": 598, "not_found": 42, "credits_charged": 571,
  "results": [ { "domain": "…", "status": "found", "…": "…" } ], "page": 1, "pages": 7 }
```

Failed (data source down), `200`, nothing charged:

```json
{ "status": "failed", "batch_id": "7c2f…", "total": 640, "error": "provider_unavailable", "message": "nothing was charged; start again" }
```

## Credits

1 credit per company found. Cached (looked up in the last 30 days) and not-found domains are free. Credits are checked up front for the domains not in the cache.

## Errors

| HTTP | `error` | When |
|---|---|---|
| 400 | `invalid_input` | `domains` missing or empty |
| 400 | `invalid_domain` | No usable domain in the list |
| 400 | `too_many_domains` | More than 1,000 domains |
| 401 | `unauthorized` | Missing, wrong or revoked key |
| 402 | `insufficient_credits` | Not enough credits for the domains not in the cache |
| 404 | `batch_not_found` | Wrong `batch_id`, or another account's batch |
| 502 | `provider_unavailable` | The data source didn't answer. Nothing was charged |
