Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.cf0.ai/llms.txt

Use this file to discover all available pages before exploring further.

The Lab API is the core of cf0’s research platform. It lets you start streaming AI research sessions, manage conversation threads, and retrieve message history. The primary chat endpoint uses Server-Sent Events to stream incremental responses. All Lab endpoints are prefixed with /api/lab.

Chat (streaming)

POST /api/lab/chat
Start a research session or continue an existing thread. Returns an SSE stream.
Rate limit: 12 requests per minute per user. Requests over the limit return HTTP 429.

Request body

prompt
string
required
The user’s message or research query.
threadId
string
Thread ID to continue an existing conversation. If omitted, a new thread is created automatically.
sessionId
string
Deprecated. Use threadId instead.
mentions
array
Contextual mentions to inject into the prompt. Each item has:
  • type (string) — mention type, e.g. "reports" or "screener"
  • items (array) — selected items, each with id, title, context, and optional subtitle
  • query (string, optional) — search query associated with this mention
budget_cap
number
Maximum spend in USD for this query. Range: 0.01–10.0. Defaults to null — the server applies its own default cap (currently around $1.50 per query for standard effort).
disabled_tools
array
List of tool names to exclude from this query.
disable_memories
boolean
Set to true to skip injecting the user’s saved memory context.

SSE event types

The response is a stream of data: lines, each containing a JSON object. Parse each line after stripping the data: prefix.
type
string
The event type. Possible values:

Example

curl -N https://api.cf0.ai/api/lab/chat \
  -X POST \
  -H "Authorization: Bearer <your-token>" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "What is NVIDIA'\''s revenue growth over the last 4 quarters?",
    "threadId": "jr-abc123"
  }'

Thread management

List threads

GET /api/lab/threads
Returns all research threads for the authenticated user.
threads
array
Array of thread objects, each with threadId, title, created_at, and updated_at.
curl https://api.cf0.ai/api/lab/threads \
  -H "Authorization: Bearer <your-token>"

Create thread

POST /api/lab/threads
title
string
Optional display title for the thread.
Returns the new thread object including the generated threadId.

Get thread

GET /api/lab/threads/{thread_id}
Returns the thread with its full message history.
threadId
string
Thread ID.
title
string
Thread title.
messages
array
Array of message objects with role (user or assistant) and content.

Update thread

PATCH /api/lab/threads/{thread_id}
title
string
New title for the thread.
Returns { "ok": true } on success.

Delete thread

DELETE /api/lab/threads/{thread_id}
Deletes the thread and all associated artifacts from storage. Returns { "ok": true } if deletion succeeded.

Audit trail

GET /api/lab/threads/{thread_id}/audit-trail
Export a thread as a compliance-ready audit trail. Serializes the full conversation including tool calls, assumptions, and the final output.
format
string
"markdown" (default) or "pdf". PDF is returned as a binary file download.
curl "https://api.cf0.ai/api/lab/threads/jr-abc123/audit-trail?format=pdf" \
  -H "Authorization: Bearer <your-token>" \
  -o audit-trail.pdf

Filesystem

GET /api/lab/filesystem
Lists the files visible to your cf0 workspace — uploads, artifacts, skills, memories, sessions.

Response

private
object
Your personal files and folders (uploads, threads, memory).
shared
object
Files shared at the organisation level (shared documents, org skills).
system_skills
object
Map of system-skill identifiers to their metadata. Useful for discovering which slash-command Skills are available in your workspace without calling /api/skills separately.

File upload

POST /api/lab/upload-attachment
Upload a file directly into the research session context. Accepts multipart/form-data.