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

# Artifacts

> Versioned sets of files you can mount in a Session, share by link, or publish as a site.

An Artifact is a named set of files, such as a web page or report. Every update creates a new immutable version.

```ts theme={"theme":{"light":"github-light","dark":"github-dark"}}
import Checkfu from "@checkfu/sdk"

const client = new Checkfu()

const artifact = await client.waitForPending(
	await client.artifacts.create({
		name: "Status page",
		files: [
			{ path: "index.html", content: '<link rel="stylesheet" href="style.css"><h1>All good</h1>' },
			{ path: "style.css", content: "h1 { font-family: sans-serif; }" },
		],
	}),
)
```

On create, supply each file inline with `content` or point to an uploaded [File](https://docs.checkfu.com/concepts/files.md) with `file_id`.

## Versions

When adding a new version, pass the current `version` you expect to replace. You can carry forward unchanged files from the previous version by referencing their `sha256` instead of resending their contents:

```ts theme={"theme":{"light":"github-light","dark":"github-dark"}}
const style = artifact.files.find((file) => file.path === "style.css")!
await client.artifacts.versions.create(artifact.id, {
	version: artifact.version,
	files: [
		{ path: "index.html", content: '<link rel="stylesheet" href="style.css"><h1>Degraded</h1>' },
		{ path: "style.css", sha256: style.sha256 },
	],
})
```

## Use one in a Session

Agents have a `save_artifact` tool. Saving again under the same name in the same Session adds a new version.

To give an agent an existing Artifact, mount it when you create the Session. It appears read-only at `/mnt/artifacts/<name>` (`Status page` becomes `status-page`):

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{ "type": "artifact", "artifact_id": "art_...", "version": 2 }
```

## Share and publish

A viewing link shows one pinned version until it expires. A publication creates a permanent public address that follows the latest version by default.

```ts theme={"theme":{"light":"github-light","dark":"github-dark"}}
const link = await client.artifacts.versions.link(artifact.id, 2, { expires_in: 600 })
const published = await client.artifacts.publish(
	artifact.id,
	{},
	{ idempotencyKey: crypto.randomUUID() },
)
```

Pages run in a sandboxed origin, so reference sibling files with relative paths. [Publish an Artifact](https://docs.checkfu.com/guides/publish-an-artifact.md) walks through a full example.

## Start from a template type

A "type" is just another Artifact whose files act as a base layer so child Artifacts only need to provide content or data. The repository ships three starter types in [`packages/domain/src/Artifact/types`](https://github.com/checkfu/checkfu/tree/main/packages/domain/src/Artifact/types): `document`, `slides`, and `dashboard`. Upload a type once from its directory, then create Artifacts from it with `made_from`:

```ts theme={"theme":{"light":"github-light","dark":"github-dark"}}
import Checkfu, { ArtifactId } from "@checkfu/sdk"

const client = new Checkfu()

await client.artifacts.create({
	name: "Release notes",
	made_from: { artifact_id: ArtifactId.make(documentType.id), version: documentType.version },
	files: [{ path: "content.md", content: "# Release notes\n\n- Faster uploads" }],
})
```

## Store data

Each Artifact has a JSON document database shared across all of its versions:

```ts theme={"theme":{"light":"github-light","dark":"github-dark"}}
await client.artifacts.data.put(artifact.id, "numbers", "revenue", {
	data: { label: "Revenue", value: 1200, unit: "USD" },
})
```

A published page can only access collections that `artifact.json` exposes to visitors, capped further by the viewing link or publication's `access` level:

```json artifact.json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{ "capabilities": { "database": { "collections": { "responses": { "visitors": "add" } } } } }
```

| `access` | `visitors: read` | `visitors: add` | `visitors: write` |
| :- | :- | :- | :- |
| `view` (default) | nothing | nothing | nothing |
| `read` | list, get | nothing | list, get |
| `write` | list, get | add | everything |

In the page, load `_/data.js` and call `artifactData`:

```html theme={"theme":{"light":"github-light","dark":"github-dark"}}
<script src="_/data.js"></script>
<script>
	artifactData.collection("responses").add({ choice: "yes" }, { key: crypto.randomUUID() })
</script>
```

See [Limits](https://docs.checkfu.com/reference/limits.md#artifacts) for file, version, and database caps, or [Create an artifact](https://docs.checkfu.com/api-reference/artifacts/create-an-artifact.md) for all options.


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