# Core concepts

> Account, jobs, candidates and reports; one apply link per job; sandbox and live keys; idempotency with client_id.

Source: https://docs.b55.online/concepts

## The resource model

```txt
Account          you: a company hiring, or an HR / recruitment product calling the API
 └─ Job          one opening: the recruiter's description, a catalog role, one apply link
     └─ Candidate one person for that job, from the apply link or added by email
         └─ Report evidence, verdict, confidence, role fit and interview questions
```

- **Account.** In the sandbox there is no sign-up: your browser's sandbox key is enough.
- **Job.** The work in the recruiter's words, the role it maps to (`role.base`, `seniority`, `must`, `nice`), open or closed, and **one `apply_url`** that every candidate gets. See [Jobs](/jobs).
- **Candidate.** One person on one job. They arrive through the apply link (signing in with GitHub) or you add them by email. They move `invited → opened → consented → scanned → ready | insufficient_evidence`. See [Candidates](/candidates).
- **Report.** Built when the candidate's scan lands. It keeps identity, attribution and assessment apart, and says which numbers are checked and which are self-reported. See [Reports](/reports).

**HR platforms:** there are no separate tenants. Tag each job with your own customer and requisition id in `client_id` (for example `tenant-42:req-981`) and filter with `GET /v0/jobs?client_id=…`. **Production plan:** keys scoped to a `client_id` prefix, so you can hand one to each customer.

## Keys

Send the key on every request:

```http
Authorization: Bearer b55_test_Ab3dEf6hIj9kLm2nOp5qRs8t
```

| Key | Prefix | Status |
|---|---|---|
| Sandbox key | `b55_test_` | **Sandbox.** Made in your browser on the console's [API keys](http://localhost:3100/api-keys) page. Any `b55_test_` key sees all local data, and data resets when the console restarts. |
| Live key | `b55_live_` | **Live.** Created in the hosted console, shown once. Manages every job in your account. Rejected by the local sandbox with `401 live_keys_unavailable`. See [Authentication](/authentication). |

Two routes take **no key**, because the candidate calls them, never your backend: `POST /v0/jobs/{job_id}/apply` (the apply page) and `POST /v0/candidates/{candidate_id}/scan` (the CLI). The SDKs do not wrap them.

## Idempotency with `client_id`

Every create takes an optional `client_id`: your own id for the thing.

- Repeating `POST /v0/jobs` with a `client_id` you already used (anywhere in the account) returns the existing job unchanged.
- Repeating `POST /v0/jobs/{job_id}/candidates` with a `client_id`, **or an email**, already on that job returns the existing candidate.
- Applying twice through the link with the same GitHub account is the same candidate.
- `client_id` must be a string; anything else is `422 invalid_client_id`. An empty string counts as no `client_id`.

So it is safe to retry a create after a timeout.

## Statuses and verdicts

Candidate statuses and event names are snake_case (`insufficient_evidence`, `report.ready`). Report verdicts keep their kebab-case values (`insufficient-evidence`, `partially-verified`). A candidate has both: `status: "insufficient_evidence"` and `verdict: "insufficient-evidence"` say the same thing from two angles.

## Sandbox and production

| | Sandbox | Live |
|---|---|---|
| Base URL | `http://localhost:3100/api` (the console) | The hosted console's `/api` (a custom domain is not set up yet; `https://api.b55.ai` is the SDK default for later) |
| Keys | `b55_test_…`, made in the browser | `b55_live_…`, from a signed-in console |
| Candidates | 8 fictional developers; the apply page lets you pick one as the "GitHub sign-in" | Real candidates, real GitHub sign-in (live jobs) |
| The scan | `pnpm b55 scan --candidate cand_… --demo` from the repo, or **Simulate scan** | `npx -y github:Perfstaq/b55-cli scan --candidate b55ct_…`, a signed, single-use token valid for 2 hours |
| Webhooks | Signed deliveries shown in the playground's inspector; nothing is sent | Delivered to your endpoints, retried for 24 hours (live jobs) |
| Data | In memory; gone on restart | Postgres, retention per account |

## Responses

- Objects carry an `object` field: `job`, `candidate`, `report`, `event`, `role_suggestion` or `list`.
- Lists are `{ "object": "list", "data": [...] }`. Jobs come newest first; candidates ranked (or `sort=newest|oldest`); events oldest first. There is no pagination in the sandbox (production plan: `limit` and `page_token`; the ranking already breaks ties by id so pages stay stable).
- Ids have a prefix: `job_`, `cand_`, `rpt_`, `evt_`.
- Times are ISO 8601 UTC strings.
- Errors are `{ name, message, code, docs }`. See [Errors](/errors).
