# Quickstart

> From a new API key to your first company score in a few minutes.

The flow is always: **API key → get your template → score → check back for the result.** You need the template before you can score.

## 1. Create an API key

Go to [platinux.net/dashboard/score](https://platinux.net/dashboard/score) and create a key. Copy the key straight away: it is shown only once. It looks like `plx_live_` followed by 32 letters and numbers.

Keep it in an environment variable on your server:

```bash
export PLATINUX_API_KEY="plx_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
export BASE="https://mmkuffhlzytnmgraagbp.supabase.co/functions/v1"
```

## 2. Get your template (before scoring)

```bash
curl "$BASE/api-templates" -H "Authorization: Bearer $PLATINUX_API_KEY"
```

```json
{ "templates": [
  { "template_id": "4d286e65-11b6-4f86-8eff-2a41105b0e09", "name": "Platinux", "is_live": true, "scoreable": true }
] }
```

Use the template with `"is_live": true`. Every scoring call needs its `template_id`.

## 3. Score a domain with that template

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

A new domain starts a job and answers `202`:

```json
{ "status": "processing", "job_id": "1f6c2a90-…", "domain": "acme.com", "template_id": "4d286e65-…", "check_after_seconds": 30 }
```

## 4. Check until it's finished

```bash
curl "$BASE/score/domain?job_id=1f6c2a90-…" -H "Authorization: Bearer $PLATINUX_API_KEY"
```

When `status` is no longer `processing`, the score is ready (`200`):

```json
{ "status": "complete", "job_id": "1f6c2a90-…", "domain": "acme.com", "template_id": "4d286e65-…",
  "score": 75, "scored_at": "2026-11-19T10:20:00Z", "credits_charged": 10 }
```

A domain usually takes 1 to 3 minutes and costs 10 credits. Have an email or a LinkedIn URL instead? Use [`/score/email`](/score-email) or [`/score/social`](/score-social) the same way.

## The same in code

```javascript
const BASE = "https://mmkuffhlzytnmgraagbp.supabase.co/functions/v1";
const headers = { Authorization: `Bearer ${process.env.PLATINUX_API_KEY}`, "Content-Type": "application/json" };

async function score(domain, templateId) {
  let r = await fetch(`${BASE}/score/domain`, { method: "POST", headers, body: JSON.stringify({ domain, template_id: templateId }) });
  let job = await r.json();
  if (!r.ok) throw new Error(job.reason ?? job.error);
  while (job.status === "processing") {
    await new Promise((ok) => setTimeout(ok, (job.check_after_seconds ?? 30) * 1000));
    job = await (await fetch(`${BASE}/score/domain?job_id=${job.job_id}`, { headers })).json();
  }
  return job.score;
}
```

```python
import os, time, requests

BASE = "https://mmkuffhlzytnmgraagbp.supabase.co/functions/v1"
H = {"Authorization": f"Bearer {os.environ['PLATINUX_API_KEY']}"}

def score(domain, template_id):
    r = requests.post(f"{BASE}/score/domain", headers=H, json={"domain": domain, "template_id": template_id})
    job = r.json()
    if r.status_code >= 400:
        raise RuntimeError(job.get("reason") or job["error"])
    while job["status"] == "processing":
        time.sleep(job.get("check_after_seconds", 30))
        job = requests.get(f"{BASE}/score/domain", headers=H, params={"job_id": job["job_id"]}).json()
    return job["score"]
```

## Next

- Score a whole list at once with [Score a list](/score-list).
- See every error and what to do about it in [Errors](/errors).
