# Use Parsefox with a coding agent

> Let Claude Code, Codex or another coding agent integrate Parsefox safely, starting with a free test key.

Parsefox is designed so a coding agent can build the integration for you. The agent
needs three things: these docs, the name of the environment variable that holds the
key, and the schema to use. It never needs to see the key itself.

## The quick way: copy instructions from the console

The console has a **Copy instructions for your agent** button on **Get started**,
**API keys** and each schema's **Use in code** tab. It produces a short prompt with the
docs URL, the variable names, your schema id and version, and the safety rules below.
Paste it into your agent.

## Set up the key yourself

Store the key where your program reads configuration, for example a `.env` file that
is already git-ignored or your platform's secret store:

```bash
PARSEFOX_BASE_URL=https://parsefox.dev
PARSEFOX_API_KEY=pf_test_...
```

Tell the agent the variable names, not the value. Start with a **test key**: test
requests are free and return sample values, so the agent can build and test the whole
flow, including webhooks, before you switch to a live key.

## Rules for agents

If you are a coding agent reading this page, follow these rules:

- Read the key from `PARSEFOX_API_KEY` and the base URL from `PARSEFOX_BASE_URL`.
  Never print, log, echo or commit the key, and never put it in source files, test
  fixtures, prompts or error messages.
- Build and test with a `pf_test_` key. Do not switch to a live key or start live
  extractions unless the user asks; live runs cost money.
- Use the schema the user chose (`schema_id`, pinned with `schema_version`) instead
  of writing a new one, unless asked.
- Treat `review_required` and `unresolved_fields` as part of the result: route those
  fields to a person or mark them as missing; do not fill them with guesses.
- Prefer webhooks over polling in services, and verify the `Parsefox-Signature`
  header.
- Send an `Idempotency-Key` header when creating extractions so retries never start
  duplicate jobs.
- On `429` wait for the `Retry-After` seconds; on `5xx` retry with backoff; do not
  retry other `4xx` errors without fixing the request.

## Docs your agent can read

- [`/llms.txt`](https://parsefox.dev/llms.txt): an index of all pages as Markdown links.
- [`/llms-full.txt`](https://parsefox.dev/llms-full.txt): everything in one file.
- Any page as Markdown by adding `.md`, for example
  [`/docs/pipeline.md`](/docs/pipeline.md).
- [`/openapi.json`](https://parsefox.dev/openapi.json) for exact request and response models.

## Agent skill

[Download the Parsefox skill](https://parsefox.dev/docs/parsefox-skill.zip). It contains a
`SKILL.md` with the rules above and the integration recipe, plus tested examples:

| File | What it shows |
|---|---|
| `SKILL.md` | When and how to use Parsefox, safety rules, the API in brief |
| `examples/pipeline.py` | Upload, extract with idempotency, wait, read the result (Python, httpx) |
| `examples/pipeline.ts` | The same in TypeScript (Node 20+, no dependencies) |
| `examples/verify_webhook.py` | Verify a webhook signature in Python |
| `examples/verify_webhook.ts` | Verify a webhook signature in TypeScript |

Unpack it where your agent looks for skills, for example `.claude/skills/parsefox/`
in a project for Claude Code, or keep it in the repository and point your agent at
`SKILL.md`.

## A good first prompt

> Integrate Parsefox document extraction into this project. Docs:
> https://parsefox.dev/llms.txt. The base URL is in `PARSEFOX_BASE_URL` and a test key is in
> `PARSEFOX_API_KEY`; never print or commit the key. Use schema `sch_…` version 1.
> Upload the file, create the extraction with an Idempotency-Key, receive the result
> by webhook, store `data`, and send fields listed in `unresolved_fields` to review.
> Write tests that run against the test key.
