# Score a domain

> Score a company from its website domain. 10 credits.

`POST https://mmkuffhlzytnmgraagbp.supabase.co/functions/v1/score/domain`

Scoring checks a company's buying signals with your live template and returns one number from 0 to 100. It runs in the background: **start** a job, then **check** it. Other inputs: [email](/score-email), [LinkedIn URL](/score-social), or [a whole list](/score-list).

## Start

```bash
curl -X POST "https://mmkuffhlzytnmgraagbp.supabase.co/functions/v1/score/domain" \
  -H "Authorization: Bearer $PLATINUX_API_KEY" -H "Content-Type: application/json" \
  -d '{"domain": "asana.com", "template_id": "4d286e65-11b6-4f86-8eff-2a41105b0e09"}'
```

| Body field | Type | Required | Notes |
|---|---|---|---|
| `domain` | string | Yes | The company's website. `https://www.Asana.com/pricing` is cleaned to `asana.com` |
| `template_id` | string (UUID) | Yes | Your live template, from [`api-templates`](/templates) |

The domain is screened first: social links, file names, IP addresses, parked domains and similar inputs are rejected with a one-word `reason` and cost nothing ([Domain checks](/domain-checks)).

### Started: `202`, 10 credits

```json
{ "status": "processing", "job_id": "8184a513-…", "domain": "asana.com", "template_id": "4d286e65-…",
  "check_after_seconds": 30, "input": "asana.com", "input_type": "domain", "credits_charged": 10 }
```

**Every run scores again and is charged again.** If the same company is already being scored for your account, that running job is returned instead, free.

## Check the score

```bash
curl "https://mmkuffhlzytnmgraagbp.supabase.co/functions/v1/score/domain?job_id=8184a513-…" -H "Authorization: Bearer $PLATINUX_API_KEY"
```

`202` while `processing`; `200` when finished. Check every `check_after_seconds` (30). Any of the three paths works for `GET`.

```json
{ "status": "complete", "job_id": "8184a513-…", "domain": "asana.com", "template_id": "4d286e65-…",
  "score": 100, "scored_at": "2026-11-19T14:48:49Z", "credits_charged": 10 }
```

`status` is `complete`, or `partial` when some data didn't arrive within 10 minutes (scored with what arrived).

## Errors

| HTTP | `error` | When |
|---|---|---|
| 400 | `invalid_domain` | Not a company website; `reason` says why. Free |
| 400 | `invalid_input` | Missing or malformed `template_id` / `job_id` |
| 401 | `unauthorized` | Missing, wrong or revoked key |
| 402 | `insufficient_credits` | Fewer than 10 credits |
| 403 | `template_not_allowed` | The template isn't yours |
| 404 | `job_not_found` | Wrong `job_id` |
| 409 | `template_not_live` | Use the template with `is_live: true` |
| 422 | `template_empty` | Your live template has nothing switched on |
