# Test API and magic values

`https://api-test-pp.keikkis.fi` with a `kl_test_` key.

- **Every request is validated exactly like production**: the same field checks, your own work
  types, the real VAT rate on the gig date, the per-worker amount limit and the per-gig worker
  limit. What passes here passes in production.
- **Answers come from fixed test data and the request itself.** Nothing you send is stored — not
  even a log row. Ids are derived from the request (`gig_test_…`, `con_test_…`), so the same
  request always gets the same answer.
- `GET /v1/work_types` and `GET /v1/me` are real.

## Magic values

| Request | Test API answers |
|---|---|
| `POST /v1/connections`, any email | `pending` |
| email local part `active`, `declined`, `expired` or `revoked` (e.g. `active@example.com`) | that status |
| `GET /v1/connections/:external_user_id` ending `_active`, `_declined`, `_expired`, `_revoked` | that status |
| `POST /v1/gigs`, any valid gig | created; every worker `received`, with the real VAT % and totals |
| worker `external_user_id` ending `_pending` | that worker `awaiting_worker` |
| gig `external_id` ending `_invoiced`, `_paid`, `_completed`, `_cancelled`, `_rejected` | every worker in that status; `invoiced` and later carry test invoice details (`TEST-` number and reference, a test IBAN) |
| gig `external_id` ending `_conflict` | `409 idempotency_conflict` |
| `GET /v1/gigs/:external_id` | a fixture gig whose status follows the same suffixes |
| `GET /v1/gigs`, `GET /v1/connections` | a fixed list covering every status |
| `DELETE /v1/gigs/:id` | `204`; `409 already_invoiced` for an id ending `_invoiced`, `_paid` or `_completed` |
| `?dry_run=true` | exactly what production answers |

Every validation error can be produced by sending the invalid value itself, e.g. `"amount": 200`
(a number) gives `invalid_amount`.

## What the test API cannot show

- A `GET` returns fixture data, not the gig you just posted.
- The **daily euro cap** needs stored totals and is enforced only in production.
