# API overview

> Authentication, error shape and the endpoint surface.

Source: https://croombit.com/en/docs/api

## Authentication

Every `/v1/*` authenticates with an API key in `Authorization: Bearer <key>`. The prefix selects environment (`test`/`live`) and type (`pk`/`sk`). Endpoints marked *sk-only* reject `pk_` keys with `403`.

## Error shape

```json
{ "code": "validation_failed", "message": "…", "hint": "how to fix it", "issues": [{ "path": "…", "message": "…" }] }
```

## Endpoints

- `POST /v1/consent` (+ `/batch`), `POST /v1/preferences` — record (with `Idempotency-Key`)
- `POST /v1/preferences/confirmation-token` — trigger double opt-in email
- `GET /v1/subjects/{ref}/consent` · `/consent/history` (sk) · `/preferences` · `/preferences/history` (sk)
- `POST /v1/subjects` (sk) · `/subjects/{ref}/identifiers` (sk) · `/subjects/merge` (sk)
- `GET /v1/purposes` · `/purposes/{key}/current` · `/preference-template`
- `GET /v1/policy?country=` · `/v1/banner` (pk) · `/v1/cookies`
- `GET /v1/consent/tcstring` · `/v1/consent/google-consent-mode` · `/v1/consent/google-additional-consent` · `/v1/consent/gpp`
- `GET /v1/tcf/vendor-list` · `GET /v1/receipts/{id}` · `GET /.well-known/jwks.json`
- `POST /v1/data-requests` (sk) · `POST /v1/data-requests/portal` (pk)
- `GET /v1/webhook-events` — the webhook event catalog and delivery contract (any key)

The full, browsable "try it now" reference is at [/reference](https://croombit.com/en/reference).