OpenSDK

REST API

OpenSDK REST API endpoints for programmatic access.

Base URL: https://opensdk.ca/api

All responses follow the shape { success: boolean, data?: T, error?: { code, message } }.

Authentication

Pass your API key via the X-API-Key header. Create an API key from the dashboard.

curl -H "X-API-Key: YOUR_API_KEY" https://opensdk.ca/api/dispatch/tasks

Endpoints

POST /api/dispatch

Create a new SDK generation task.

From a docs URL:

curl -X POST https://opensdk.ca/api/dispatch \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://docs.example.com/api",
    "task": "auth, list users, and delete users",
    "language": "typescript",
    "options": { "packageName": "@my-org/sdk" }
  }'

From an OpenAPI spec:

curl -X POST https://opensdk.ca/api/dispatch \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "spec": { "openapi": "3.1.0", "info": { "title": "My API", "version": "1.0.0" }, "..." : "..." },
    "language": "typescript"
  }'

Response (201):

{
  "success": true,
  "data": {
    "taskId": "abc-123",
    "status": "queued",
    "inputType": "docs",
    "message": "Task created. Poll GET /api/dispatch/tasks/{taskId} for status."
  }
}
FieldTypeRequiredDescription
urlstringOne of url or specDocumentation URL to analyze
specobjectOne of url or specOpenAPI 3.1 spec object
taskstringNoPlain English description of what to build
languagestringNoTarget language (default: typescript)
options.packageNamestringNoCustom package name
options.versionstringNoPackage version

GET /api/dispatch/tasks

List all tasks with optional filtering and pagination.

curl "https://opensdk.ca/api/dispatch/tasks?status=completed&limit=10&offset=0" \
  -H "X-API-Key: YOUR_API_KEY"

Response:

{
  "success": true,
  "data": {
    "tasks": [{ "id": "abc-123", "status": "completed", "..." : "..." }],
    "total": 1,
    "limit": 10,
    "offset": 0
  }
}
ParameterTypeDefaultDescription
statusstringallFilter by status: queued, analyzing, building, generating, completed, failed
limitinteger50Max results (max 200)
offsetinteger0Pagination offset

GET /api/dispatch/tasks/:taskId

Get a task by ID. Returns the full task including analysis, spec, and SDK when completed.

curl https://opensdk.ca/api/dispatch/tasks/abc-123 \
  -H "X-API-Key: YOUR_API_KEY"

Response:

{
  "success": true,
  "data": {
    "id": "abc-123",
    "status": "completed",
    "sourceUrl": "https://docs.example.com/api",
    "language": "typescript",
    "inputType": "docs",
    "createdAt": "2026-04-02T18:00:00.000Z",
    "updatedAt": "2026-04-02T18:00:05.000Z",
    "analysis": { "pagesExamined": 42, "..." : "..." },
    "spec": { "..." : "..." },
    "sdk": { "..." : "..." }
  }
}

POST /api/dispatch/tasks/:taskId/revise

Revise a completed task with new instructions. The task must have status completed (returns 409 otherwise).

curl -X POST https://opensdk.ca/api/dispatch/tasks/abc-123/revise \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"revision": "add a search endpoint for filtering users by email"}'

Response:

{
  "success": true,
  "data": {
    "id": "abc-123",
    "status": "completed",
    "revision": "add a search endpoint for filtering users by email",
    "..." : "..."
  }
}

GET /api/dispatch/tasks/:taskId/export/:format

Export a completed task. The task must have status completed (returns 409 otherwise).

curl https://opensdk.ca/api/dispatch/tasks/abc-123/export/sdk \
  -H "X-API-Key: YOUR_API_KEY"
FormatDescription
sdkGenerated SDK files (TypeScript package)
openapiOpenAPI 3.1 JSON document
specRaw API spec

Response (sdk):

{
  "success": true,
  "data": {
    "language": "typescript",
    "packageName": "@opensdk/example-api",
    "version": "1.0.0",
    "files": [
      { "path": "src/client.ts", "content": "..." },
      { "path": "src/models.ts", "content": "..." }
    ],
    "entryPoint": "src/index.ts",
    "dependencies": {}
  }
}

GET /api/health

Health check. No authentication required.

curl https://opensdk.ca/api/health

Response:

{
  "success": true,
  "data": {
    "status": "ok",
    "version": "0.0.1",
    "languages": ["typescript"],
    "timestamp": "2026-04-02T18:42:39.121Z"
  }
}

Credit Costs

OperationCreditsEndpoint
Dispatch (analyze or import)25POST /api/dispatch
Revise10POST /api/dispatch/tasks/:id/revise
Export5GET /api/dispatch/tasks/:id/export/:format

Listing tasks, getting task status, and health checks are free.

Rate Limiting

100 requests per minute per API key. Returns 429 with Retry-After header when exceeded.

Error Responses

All errors follow the same envelope:

{
  "success": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Either 'url' (string) or 'spec' (object) is required"
  }
}
CodeHTTP StatusDescription
VALIDATION_ERROR400Invalid request body or parameters
UNAUTHORIZED401Missing or invalid API key
PAYMENT_REQUIRED402Insufficient credits
NOT_FOUND404Task not found
CONFLICT409Task not in required status
RATE_LIMITED429Too many requests
PIPELINE_ERROR500Internal processing error

On this page