> ## Documentation Index
> Fetch the complete documentation index at: https://docs.checkfu.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Checkfu is open source (https://github.com/checkfu/checkfu) and runs in the reader's own Cloudflare account. There is no shared hosted base URL: `checkfu deploy` prints the deployment's API URL (`https://<api-worker>.workers.dev` or the CHECKFU_API_DOMAIN hostname, exported as `CHECKFU_BASE_URL` for the CLI, SDK, and curl) and MCP URL (`.../mcp`). Local development serves the API on http://localhost:1337 and MCP on http://localhost:1338/mcp.
> Authenticated HTTP requests send the deployment's CHECKFU_API_KEY as `Authorization: Bearer $CHECKFU_API_KEY` (or `x-api-key`) and `Content-Type: application/json` for JSON bodies. Pass `Idempotency-Key` on retriable writes.
> Core workflow: create an Agent (`POST /v1/agents`) and an Environment (`POST /v1/environments`), create a Session that references both (`POST /v1/sessions`), send a `user.message` event (`POST /v1/sessions/{session_id}/events`), and follow `GET /v1/sessions/{session_id}/events/stream` until `session.status_idle`.
> Other resources: Memory stores (`/v1/memory_stores`), Files (`/v1/files`), Artifacts (`/v1/artifacts`), Vaults and credentials (`/v1/vaults`), Provider credentials (`/v1/provider_credentials`), Automations (`/v1/automations`), Inbound bindings (`/v1/inbound_bindings`), and Webhooks (`/v1/webhooks`). The deployment serves its OpenAPI 3.1 specification at `GET /openapi.json`.

# CLI reference

> Install the checkfu CLI, connect it to a deployment, and look up its commands.

Requires Node.js 22.0.0 or later.

```sh theme={"theme":{"light":"github-light","dark":"github-dark"}}
npm install -g checkfu
checkfu --base-url "$CHECKFU_BASE_URL" login
checkfu models list
```

Run `checkfu <command> --help` to see its flags, or `checkfu deploy` to [deploy Checkfu](https://docs.checkfu.com/self-hosting/deploy.md).

## Connect to a deployment

`checkfu deploy` saves a connection for the deployment it creates. For an existing deployment, run `login` with its API URL. It reads `CHECKFU_API_KEY` or prompts for it, verifies it, and saves both. `checkfu logout` removes the saved connection. The CLI stores one connection in the absolute `CHECKFU_CONFIG_DIR` you select. Otherwise it uses the first available absolute location from `$XDG_CONFIG_HOME/checkfu`, `$APPDATA/checkfu`, `$HOME/.config/checkfu`, or `$USERPROFILE/.config/checkfu`.

The API URL resolves in order from `--base-url`, `CHECKFU_BASE_URL`, the saved connection in the active config directory, or `http://localhost:1337`. The key comes from `CHECKFU_API_KEY`, or the saved key when the target URL matches the saved connection (the CLI never sends a saved key to a different URL). When targeting a different URL with `--base-url` or `CHECKFU_BASE_URL`, either run `checkfu login` for it or export its `CHECKFU_API_KEY`.

## Global flags

| Flag | Description |
| :- | :- |
| `--base-url URL` | API URL. |
| `--format FORMAT` | `auto` (default), `json`, `jsonl`, `yaml`, `pretty`, or `raw`. `auto` uses `pretty` in a terminal, `json` in a pipe, and `jsonl` for streaming commands. |
| `--transform EXPR` | Extract fields with a GJSON-style path. |
| `--raw-output`, `-r` | Print string values without quotes. |
| `--help`, `-h` / `--version`, `-v` | Help and version. |

```sh theme={"theme":{"light":"github-light","dark":"github-dark"}}
checkfu agents list --transform 'data.#.id'   # every id
checkfu agents retrieve --agent-id "$AGENT_ID" --transform '{id,name}'
```

## Input

Body fields map to flags (`--name`, `--environment-id`). You can also pipe a JSON or YAML object on stdin; single-value flags override piped fields, while repeatable structured flags (`--event`, `--initial-event`, `--file`) cannot be combined with stdin. Text-body and structured flags (such as `--system`, `--content`, and JSON flags) accept `@path` to read from a file (use `@@` for a literal leading `@`).

```sh theme={"theme":{"light":"github-light","dark":"github-dark"}}
checkfu agents create < agent.yaml
checkfu agents update --agent-id "$AGENT_ID" --system @prompt.md
```

Writes that accept one take `--idempotency-key`. `sessions:events send`, `automations create`, and `files upload` generate a key if omitted and print it to stderr. Paginated list commands take `--limit` and `--page`. `sessions:resources list` returns all remaining resources when you omit `--limit`.

## Sessions

`sessions connect` streams a Session and sends each line you type as a `user.message`. Pass `--after SEQ` to replay from a sequence number.

| Input | Effect |
| :- | :- |
| A line of text | Send it as a message. |
| `/interrupt`, or Ctrl-C while a turn runs | Send `user.interrupt`. |
| `/exit`, `/quit`, or a second Ctrl-C | Disconnect. |

Messages (`agent.message`, `user.message`, `system.message`) print to stdout; tool calls, thinking, and status print to stderr. With piped stdin, the command waits for each turn and exits, returning code `3` if a turn pauses waiting for a tool answer:

```sh theme={"theme":{"light":"github-light","dark":"github-dark"}}
echo "Write a short status report." | checkfu sessions connect "$SESSION_ID"
```

## Files

```sh theme={"theme":{"light":"github-light","dark":"github-dark"}}
FILE_ID=$(checkfu --transform id -r files upload ./report.pdf) &&
  checkfu files download --file-id "$FILE_ID" -o ./downloaded-report.pdf
```

```sh theme={"theme":{"light":"github-light","dark":"github-dark"}}
checkfu artifacts download --artifact-id "$ARTIFACT_ID" --file index.html -o ./downloaded-index.html
```

Downloads refuse to overwrite an existing file and verify size and SHA-256 before writing. For curl examples that run against the File endpoints, see [Files](https://docs.checkfu.com/concepts/files.md).

## Agents as code and deploy

| Command | Description |
| :- | :- |
| `agent info <file>` | Validate an agent file offline. |
| `apply [<path>...]` | Reconcile local files with the deployment. `--dry-run`, `--yes`, `--force`, `--prune`, `--lock-file`. See [Agents as code](https://docs.checkfu.com/guides/agents-as-code.md). |
| `deploy` | Deploy or update Checkfu in your Cloudflare account. `--stage NAME`, `--yes`. See [Deploy](https://docs.checkfu.com/self-hosting/deploy.md). |
| `destroy --stage NAME` | Delete a deployment and its data. Prompts unless `--yes` is passed. |

## Resource commands

There is one command per HTTP endpoint. Path parameters become flags such as `--agent-id`, and subresources use a colon: `checkfu sessions:events send`.

| Group | Commands |
| :- | :- |
| `agents` | `create`, `list`, `retrieve`, `update`, `archive` |
| `agents:versions` | `list` |
| `environments` | `create`, `list`, `retrieve`, `update`, `archive`, `delete` |
| `sessions` | `create`, `list`, `retrieve`, `select-runtime`, `archive`, `connect` |
| `sessions:events` | `send`, `list`, `stream` |
| `sessions:outputs` | `retrieve`, `history` |
| `sessions:resources` | `list`, `retrieve`, `update` |
| `sessions:usage` | `retrieve` |
| `sessions:usage:requests` | `list` |
| `memory-stores` | `create`, `list`, `retrieve`, `update`, `archive`, `delete` |
| `memory-stores:memories` | `create`, `list`, `retrieve`, `update`, `delete` |
| `files` | `upload`, `list`, `retrieve`, `download`, `delete` |
| `inbound-bindings` | `list`, `create`, `setup`, `confirm`, `set-signing-secret`, `revoke` |
| `artifacts` | `create`, `list`, `retrieve`, `publish`, `unpublish`, `delete`, `download` |
| `artifacts:versions` | `create`, `retrieve`, `file`, `link` |
| `artifacts:data` | `describe`, `list`, `add`, `put`, `retrieve`, `delete` |
| `vaults` | `create`, `list`, `retrieve`, `update`, `archive`, `delete` |
| `vaults:credentials` | `create`, `list`, `retrieve`, `update`, `archive`, `delete` |
| `automations` | `create`, `list`, `retrieve`, `update`, `pause`, `unpause`, `run`, `archive` |
| `automations:runs` | `list`, `retrieve` |
| `automation-runs` | `list`, `retrieve` |
| `models` | `list` |
| `webhooks` | `create`, `list`, `retrieve`, `update`, `pause`, `resume`, `rotate-secret`, `test`, `delete` |
| `webhooks:deliveries` | `list`, `retrieve`, `redeliver` |

## Exit codes

| Code | Meaning |
| :- | :- |
| `0` | Success |
| `1` | Other failure |
| `2` | Invalid arguments or configuration |
| `3` | Action required, such as a turn waiting for a tool answer |
| `4` | Not found (`404`) |
| `5` | Conflict (`409`, `412`) |
| `6` | Authentication or permission denied (`401`, `403`) |
| `7` | Transient failure (`429`, `502`, `503`, `504`, or network). Retry. |
| `130` | Ctrl-C |
| `143` | `SIGTERM` |

API errors print to stderr as `Error: API error (<status> <type>): <message> [request_id: <id>]`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.