Skip to content
forecraft
Sign in Get an API key
Menu
Get an API key Sign in
For agents

If you are an agent, start here.

Four steps: get a key, read the contract, connect, call. Everything below is plain text you can copy. A person can follow along too.

Read /llms.txt Fetch /openapi.json

1. Get a key

Keys start with fc_live_ and belong to one workspace. The secret is shown once; send it as a bearer token on every request.

  1. Sign up at /signup and a workspace is created with your account.
  2. In the dashboard, open API keys and create a key. Name it after the agent that will hold it.
  3. Store the secret where the agent reads its environment.

Running forecraft yourself? The seed prints a demo key, once:

shell
npm install
npm run seed     # prints a demo key once: fc_live_…
npm start        # http://localhost:3000

Then put the URL and the key where your tools can read them:

shell
export FORECRAFT_URL=http://localhost:3000
export FORECRAFT_API_KEY=fc_live_…

2. Read the contract

  • /llms.txt — the whole product in one text file, written for you.
  • /openapi.json — every endpoint, request and response, as OpenAPI.
  • /docs/for-agents — the exact curl sequence: create, preview, publish, submit, list, export.
  • /docs/definitions — the form definition: schema, ui, rules, appearance.
  • /docs/mcp — the MCP server: install, tools, resources.
  • GET /api/v1/vocabulary — the themes, accents and layouts a definition may name.

3. Connect over MCP

Add the server to your host's .mcp.json (Claude Code reads it from the project root). It speaks stdio and wraps the same REST API.

.mcp.json
{
  "mcpServers": {
    "forecraft": {
      "command": "node",
      "args": ["packages/mcp/index.mjs"],
      "env": {
        "FORECRAFT_URL": "http://localhost:3000",
        "FORECRAFT_API_KEY": "fc_live_…"
      }
    }
  }
}
The tools
Tool What it does
forecraft_create_form Create a form from a definition.
forecraft_update_form Replace the draft definition, status, limit or slug.
forecraft_get_form Read one form, its definition and its public URL.
forecraft_list_forms List the workspace's forms.
forecraft_preview_form Render the form and audit it: HTML, findings, rules.
forecraft_publish_form Snapshot the draft as a version; the public URL serves it.
forecraft_list_submissions Read answers, filtered by text, version or date.
forecraft_get_submission Read one submission.

The resource forecraft://form/{id} returns a form's definition.

4. Or call the API

A first call, to check the key:

curl
curl -s "$FORECRAFT_URL/api/v1/forms" \
  -H "Authorization: Bearer $FORECRAFT_API_KEY"

It answers { "items": [] } for a new workspace. Then create a form:

curl
curl -s "$FORECRAFT_URL/api/v1/forms" \
  -H "Authorization: Bearer $FORECRAFT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "definition": {
      "schema": {
        "title": "Beta waitlist",
        "type": "object",
        "properties": {
          "email": { "type": "string", "format": "email" },
          "plan": { "type": "string", "enum": ["Solo", "Team"] }
        },
        "required": ["email", "plan"]
      },
      "appearance": { "theme": "aurora" }
    }
  }'

Next: the full curl sequence — preview, publish, submit, list and export.

5. Issue your first invoice

The same key issues documents that print like a good accountant's: start from a starter, preview, publish, issue.

  1. GET /api/v1/report-starters — invoice, letter, business report, confirmation, survey summary.
  2. POST /api/v1/reports with { "starter": "invoice", "appearance": { "accent": "#0f4c5c" }, "sample": { "seller": … } }.
  3. POST /api/v1/reports/:id/preview — read the findings, look at the page images.
  4. POST /api/v1/reports/:id/publish, then POST /api/v1/reports/:id/documents with { "issue": true, "data": … } — you get the number, the PDF and a share link.

Every step as curl: the invoice sequence. The definition and its blocks: reports; what to choose: report style. Over MCP: forecraft_create_report, forecraft_preview_report (it returns the pages as images), forecraft_issue_document.

Rules of the road

  • Errors are application/problem+json (RFC 9457): type, title, status, detail and errors[]. Each error has a JSON pointer; a rejected submission also names the field and the rule it broke.
  • Rate limit: 240 requests a minute per key, announced in RateLimit-* headers. A 429 carries Retry-After.
  • Drafts and versions: edits change the draft; publish snapshots it. The public URL serves the latest published version.
  • Check your work: preview returns audit.passed and the findings. Publish what passes.