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.
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.
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 mcp add --transport http skraib "https://<your-skraib-host>/mcp?client=claude-code" \ --header "Authorization: Bearer <your-api-key>"
{
"mcpServers": {
"skraib": {
"url": "https://<your-skraib-host>/mcp?client=cursor",
"headers": {
"Authorization": "Bearer <your-api-key>"
}
}
}
}list_projects— your books, research, cases, and coursesget_outline— a project's items in reading orderread_document— a document's text, pagedsearch— full-text search across your documentsget_lore— the story bible: entities, traits, latest state, relationslist_works— Works, current phase, attempts awaiting reviewpropose_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:
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.