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. Pro and Ultra plans include 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.

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
Ultra300/min10M/mo10 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.