DocsAPI

API

Build on top of Skraib with our REST API. Generate writing suggestions, execute agents, and review documents programmatically. All API access requires an API key and counts against your plan's token limit.

Authentication

All API requests require a Bearer token in the Authorization header. Generate API keys from your Dashboard → Settings → API Keys.

Authorization header

Authorization: Bearer <your-api-key>

API keys are scoped to your account and carry the same permissions. You can create multiple keys with different usage limits. The Pro plan includes API access. Free and Starter plans do not.

Security: Never expose API keys in client-side code. Use them only in server-side applications or secure environments. If a key is compromised, revoke it immediately from the Dashboard and generate a new one.

Scribe endpoint

Generate writing suggestions for a given context. This powers Super Scribe's Layer 2 and Layer 3 predictions.

POST/api/scribe/suggest

Request body

{
  "textBeforeCursor": "The lighthouse stood",
  "textAfterCursor": "against the grey Atlantic.",
  "documentTitle": "Chapter One",
  "layer": 2
}

Response

{
  "suggestions": [
    {
      "type": "completion",
      "text": " tall against the grey Atlantic,",
      "confidence": 0.87
    }
  ],
  "tokensUsed": 45
}

Parameters:

  • textBeforeCursor — Text preceding the cursor (required)
  • textAfterCursor — Text following the cursor (optional)
  • documentTitle — Title for context lookup (optional)
  • layer — 1 (instant), 2 (fast), or 3 (deep). Default: 2

Agent execution

Execute an AI agent with a specific task. The agent runs asynchronously and returns a task ID you can poll for status.

POST/api/agent/execute

Request body

{
  "agentId": "novel-agent-001",
  "task": "Draft an opening paragraph for Chapter 3",
  "context": {
    "documentId": "doc_123",
    "style": "descriptive prose"
  }
}

Response

{
  "taskId": "task_456",
  "status": "running",
  "estimatedDuration": "15s"
}

Streaming: For real-time output, use /api/agent/stream with the same payload. The server returns an SSE stream with partial results as they are generated.

MCP server

Skraib MCP is part of Pro. Generate a key in the app under Integrations → Connect an AI assistant, then connect Claude Code, Claude Desktop, Cursor, or any MCP client to /mcp with your API key as a Bearer token. Add ?client=<name> so proposals are labelled with the tool that made them. The assistant can read your writing and propose revisions; proposals land as Work attempts or branches, and nothing changes until you accept. Limit: 60 requests per minute.

Claude Code
claude mcp add --transport http skraib "https://<your-skraib-host>/mcp?client=claude-code" \
  --header "Authorization: Bearer <your-api-key>"
Cursor / Claude Desktop (mcpServers)
{
  "mcpServers": {
    "skraib": {
      "url": "https://<your-skraib-host>/mcp?client=cursor",
      "headers": {
        "Authorization": "Bearer <your-api-key>"
      }
    }
  }
}
  • list_projects — your books, research, cases, and courses
  • get_outline — a project's items in reading order
  • read_document — a document's text, paged
  • search — full-text search across your documents
  • get_lore — the story bible: entities, traits, latest state, relations
  • list_works — Works, current phase, attempts awaiting review
  • propose_revision — propose a rewrite as markdown, with an optional note shown to you; never edits the document

Troubleshooting

  • 401 — the key is missing, mistyped, or revoked. Generate a new one in Integrations.
  • 402 — Skraib MCP needs Pro. Upgrade from Pricing; existing keys start working again right away.
  • 429 — more than 60 requests in a minute. Wait a moment and retry.
  • Each key shows when it was last used in Integrations, so you can spot and revoke one you no longer use.

Rate limits

Rate limits are tied to your subscription plan and shared across the web app and API:

Free10/min50K/mo1 concurrent
Starter30/min500K/mo2 concurrent
Pro100/min2M/mo5 concurrent

Headers: Every response includes X-RateLimit-Remaining and X-RateLimit-Reset headers. When you hit a limit, the API returns 429 Too Many Requests with a Retry-After header.