> ## 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`.

# Deploy Checkfu

> Deploy Checkfu into your own Cloudflare account, update it, and delete it.

You need Node.js 22 or later and a Cloudflare account on Workers Paid with R2 enabled. Deploy from macOS or Linux (`arm64` or `x64`).

## Install the CLI

```sh theme={"theme":{"light":"github-light","dark":"github-dark"}}
npm install -g checkfu
checkfu deploy
```

The installed CLI selects the latest immutable, qualified release. The first run signs you in to Cloudflare. Choose OAuth, keep **All Scopes**, and switch on **Account API Token Provisioning** before you approve. It generates the deployment's API key and asks `Deploy Checkfu to "live"?`. When it finishes, it prints your addresses:

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
Checkfu is live at https://<api-worker>.workers.dev

  API key    saved to ~/.config/checkfu/config.json
  API docs   https://<api-worker>.workers.dev/openapi.json
  Dashboard  https://<app-worker>.workers.dev
  MCP        https://<mcp-worker>.workers.dev/mcp
```

The CLI now uses that connection. Sign in to the **Dashboard** and add a model provider credential under **Vaults** (or export a provider key before deploying), then select it when creating an Agent. Continue with the [Quickstart](https://docs.checkfu.com/quickstart.md).

## Update

Run `checkfu deploy --stage <name>` to update that stage. It reuses the saved stage, account, and API key, and stops with `Update refused` if the plan would delete or replace resources. Run `npm install -g checkfu@latest` when updating the CLI itself.

Use `--release v1.2.3` to select a specific release. When updating an existing stage, the CLI requires the release manifest to allow the last applied source revision. Use `checkfu deploy --edge --stage staging` to try current `origin/main` on a separate development stage. Use the [source journal](#inspect-the-recorded-source) to inspect the last applied revision. If it lists a pending `candidate`, run `checkfu deploy --stage <name>` from the same configuration directory to finish that apply before starting another. If the apply finished but readiness failed, the retry checks the same revision before selecting a new release.

A release can declare a verified code rollback to an earlier revision. Run `checkfu deploy --stage <name> --release <previous-tag> --rollback` to use that path if the target was previously verified on the same stage. The plan still checks for resource replacements and deletions. Rollback uses the current stored data.

## Stages

```sh theme={"theme":{"light":"github-light","dark":"github-dark"}}
checkfu deploy --stage staging
```

Each stage is a separate deployment with its own data and API key. The default first stage is `live`.

`checkfu deploy` remembers the last stage you deployed in `deploy/active.json`. After `checkfu deploy --stage staging`, a later `checkfu deploy` without `--stage` updates `staging`, not `live`. Pass `--stage` explicitly when switching back. A stage named `production` enables extra safeguards against destructive updates.

## Unattended deploys

```sh theme={"theme":{"light":"github-light","dark":"github-dark"}}
export CLOUDFLARE_API_TOKEN=...
export CLOUDFLARE_ACCOUNT_ID=...
export ANTHROPIC_API_KEY=...
checkfu deploy --yes
```

## Destroy

```sh theme={"theme":{"light":"github-light","dark":"github-dark"}}
checkfu destroy --stage live
```

This permanently deletes the stage and all of its data. It asks first; `--yes` skips the question.

If the provider finished removing a managed stage and local cleanup was interrupted, run the same `destroy --stage` command again. The CLI uses its saved confirmation to finish local cleanup.

> [accordion] Config files and failed deploys
>
> The CLI keeps its files in `CHECKFU_CONFIG_DIR`, then `$XDG_CONFIG_HOME/checkfu`, or `~/.config/checkfu` by default. Keep this directory private, and update and destroy a stage from the same directory that deployed it.
>
> The CLI records the stage before applying changes. Retry any interrupted upgrade before destroying the stage.
>
> | Message | Fix |
> | :- | :- |
> | `Deploy did not finish` | Run the same command again. |
> | `did not accept its API key within ...` | The server is deployed but was slow to start. Run `checkfu deploy` again. |
> | `Another Checkfu deployment operation holds ...` | Wait for the other run. If it was killed, delete `deploy/operation.lock`. |
> | `Another Checkfu command holds ...` | Wait for that command. If it was killed, confirm it has exited and remove the named lock file. |
> | `recorded "<stage>" in Cloudflare account ...` | Your credentials act on a different account. Check `ALCHEMY_PROFILE` and `CLOUDFLARE_*`. |
> | `CHECKFU_API_KEY in your shell differs` | Unset `CHECKFU_API_KEY` or make it match the saved key. |

## Inspect the recorded source

Use a POSIX shell and `jq` to read the revisions and destroy phase recorded locally for the `live` stage. Set `CHECKFU_CONFIG_DIR` to the absolute configuration directory used to deploy that stage. The deployment output shows the saved `config.json` path. Its parent is the configuration directory. For another stage, use its directory under `deploy/stages`. The directory name may differ from the stage name.

```sh stage-revisions.sh theme={"theme":{"light":"github-light","dark":"github-dark"}}
set -eu
config_dir=${CHECKFU_CONFIG_DIR:?Set CHECKFU_CONFIG_DIR to the stage configuration directory}
case "$config_dir" in
  /*) ;;
  *) echo "Use an absolute CHECKFU_CONFIG_DIR." >&2; exit 1 ;;
esac

journal="$config_dir/deploy/stages/live/.checkfu/revision.json"
if [ -e "$journal" ]; then
  jq -es '
    def image_pin: type == "string"
      and test("^registry[.]cloudflare[.]com/[a-f0-9]{32}/checkfu-sandbox@sha256:[a-f0-9]{64}$");
    def pin: . == null or (type == "object"
      and (.revision | type == "string" and test("^[a-f0-9]{40}$"))
      and (.image | image_pin) and (.nativeImage | image_pin));
    def destroy: type == "object" and (.stage | type == "string") and (.owner | type == "string")
      and ((has("connection") | not) or (.connection | type == "string"))
      and (.phase | IN("prepared", "applying", "confirmed"));
    if length != 1 then error("Expected one stage source record") else .[0] end
    | if type == "object" and has("applied") and has("candidate")
       and (.applied | pin) and (.candidate | pin)
       and ((has("destroy") | not) or (.destroy | destroy))
    then {applied_revision: .applied.revision,
          candidate_revision: .candidate.revision,
          destroy_phase: .destroy.phase}
    else error("Invalid stage source journal") end
  ' "$journal"
else
  echo "No deployment source is recorded for live."
fi
```

An applied revision records the last completed apply. A candidate revision records an apply that may have reached Cloudflare. Run `checkfu deploy --stage live` from the same configuration directory to finish it. If both revisions are empty, the journal has no apply to resume.

A destroy marked `confirmed` has finished in Cloudflare. Run `checkfu destroy --stage live` to finish local cleanup. A destroy marked `applying` may still need the provider operation. The `prepared` phase records a request before the operation starts. The inspection reports local records. Use the deployment's API to check its current availability.


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