# Test mode

> Build and test the whole integration for free with pf_test_ keys and simulated outcomes.

Every account has two modes:

| | Test | Live |
|---|---|---|
| Keys | `pf_test_…` | `pf_live_…` |
| Cost | Free | Uses credit |
| Values | Sample values in your schema's shape | Read from the document |
| Speed | A few seconds | Seconds to minutes |
| Webhooks | Signed and delivered to public `https` endpoints | Public `https` only |

Test mode is for building and testing integrations. It does not read the document:
uploads are checked and stored, but extraction returns deterministic samples, such as
`"Sample invoice number"` for strings and dates like `2026-01-16`, with synthetic
sources: quotes are snippets of the document's text that are not related to the
values. Sample numbers are not consistent with each other (a tax can exceed the
subtotal), so do not test business rules on them.

## What is shared

- **Schemas** are shared by both modes, so you can test with the exact `schema_id` and
  `schema_version` you will use in production.
- **Documents, jobs and webhook endpoints** belong to one mode. A test key cannot see
  live data and the other way around; doing so returns `403 mode_mismatch` or
  `404`.

## Simulate outcomes

Choose the outcome with `metadata.test_outcome`:

```json
{ "document_id": "doc_…", "schema_id": "sch_…", "metadata": { "test_outcome": "needs_review" } }
```

| `test_outcome` | Job status | Use it to test |
|---|---|---|
| `completed` (default) | `completed` | The normal path. |
| `needs_review` | `completed_with_unresolved` | `review_required`, `unresolved_fields` and your review queue. |
| `failed` | `failed` | Error handling and the `extraction.failed` webhook. |

Without metadata, the uploaded **file name** decides: a name containing
`needs_review` (or `needs-review`) or `failed` produces that outcome, so
`invoice-needs-review.pdf` always comes back for review.

## Not available in test mode

- Schema suggestions use real models and need a live key or the console
  (`test_mode_unsupported`).
- Engine debugging routes for large results; test results are small, so use
  `/result` or `/result/export` (`not_available_in_test_mode`).

## Console

The mode switch in the console's top bar chooses which data you see and which mode new
runs use. Runs started in the playground in test mode are free as well.
