Skip to content
On this page

API Reference

Complete REST API reference for Spooled Cloud. All endpoints require authentication via Bearer token (JWT) or API key.

Base URL: https://api.spooled.cloud

Quick Examples

Common operations across all languages:

Create a Job

curl -X POST https://api.spooled.cloud/api/v1/jobs \
  -H "Authorization: Bearer sp_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "queue_name": "my-queue",
    "payload": {
      "event": "user.created",
      "user_id": "usr_123",
      "email": "alice@example.com"
    },
    "idempotency_key": "user-created-usr_123"
  }'

Claim Jobs

# Claim up to 5 jobs
curl -X POST https://api.spooled.cloud/api/v1/jobs/claim \
  -H "Authorization: Bearer sp_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "queue_name": "my-queue",
    "worker_id": "worker-1",
    "limit": 5
  }'

Complete a Job

# Complete a job (echo lease_id from the claim response)
curl -X POST https://api.spooled.cloud/api/v1/jobs/job_xyz123/complete \
  -H "Authorization: Bearer sp_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "worker_id": "worker-1",
    "lease_id": "lease_abc",
    "result": {"processed": true}
  }'

Authentication

Include your API key or JWT token in the Authorization header:

# All API requests require authentication
curl -X POST https://api.spooled.cloud/api/v1/jobs \
  -H "Authorization: Bearer sp_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"queue_name": "my-queue", "payload": {...}}'

See Authentication for details on obtaining tokens.

Endpoints

Authentication

Method Endpoint Description
POST /api/v1/auth/login Exchange API key for JWT tokens
POST /api/v1/auth/refresh Refresh access token
GET /api/v1/auth/me Get current user/organization info
POST /api/v1/auth/logout Logout and invalidate tokens
POST /api/v1/auth/email/start Start passwordless email login
POST /api/v1/auth/email/verify Verify email login code

Jobs

Method Endpoint Description SDK
POST /api/v1/jobs Create/enqueue a new job client.jobs.create(...)
GET /api/v1/jobs List jobs with filtering client.jobs.list(...)
GET /api/v1/jobs/:id Get job details client.jobs.get(id)
POST /api/v1/jobs/bulk Bulk enqueue multiple jobs client.jobs.bulkEnqueue(...)
POST /api/v1/jobs/claim Claim jobs for processing client.jobs.claim(...)
POST /api/v1/jobs/:id/complete Mark job as completed client.jobs.complete(id, ...)
POST /api/v1/jobs/:id/fail Mark job as failed client.jobs.fail(id, ...)
POST /api/v1/jobs/:id/heartbeat Extend job lease client.jobs.heartbeat(id, ...)
POST /api/v1/jobs/:id/retry Manually retry a job client.jobs.retry(id)
PUT /api/v1/jobs/:id/priority Boost job priority client.jobs.boostPriority(id, ...)
DELETE /api/v1/jobs/:id Cancel a job client.jobs.cancel(id)
GET /api/v1/jobs/stats Get job statistics (filter: queue_name or alias queue) client.jobs.getStats(...)
GET /api/v1/jobs/status Batch status for up to 100 job IDs client.jobs.batchStatus(...)

Dead Letter Queue

Method Endpoint Description SDK
GET /api/v1/jobs/dlq List DLQ jobs client.jobs.dlq.list(...)
POST /api/v1/jobs/dlq/retry Retry DLQ jobs client.jobs.dlq.retry(...)
POST /api/v1/jobs/dlq/purge Purge DLQ jobs client.jobs.dlq.purge(...)

Queues

Method Endpoint Description SDK
GET /api/v1/queues List all queues client.queues.list()
GET /api/v1/queues/:name Get queue details client.queues.get(name)
GET /api/v1/queues/:name/stats Get queue statistics client.queues.getStats(name)
POST /api/v1/queues/:name/pause Pause queue processing client.queues.pause(name)
POST /api/v1/queues/:name/resume Resume queue processing client.queues.resume(name)

Workers

Method Endpoint Description SDK
POST /api/v1/workers/register Register a new worker client.workers.register(...)
GET /api/v1/workers List active workers client.workers.list()
POST /api/v1/workers/:id/heartbeat Send worker heartbeat client.workers.heartbeat(id)
POST /api/v1/workers/:id/deregister Deregister a worker client.workers.deregister(id)

Schedules

Method Endpoint Description SDK
POST /api/v1/schedules Create a schedule client.schedules.create(...)
GET /api/v1/schedules List schedules client.schedules.list()
GET /api/v1/schedules/:id Get schedule details client.schedules.get(id)
PUT /api/v1/schedules/:id Update schedule client.schedules.update(id, ...)
DELETE /api/v1/schedules/:id Delete schedule client.schedules.delete(id)
POST /api/v1/schedules/:id/pause Pause schedule client.schedules.pause(id)
POST /api/v1/schedules/:id/resume Resume schedule client.schedules.resume(id)

Workflows

Method Endpoint Description SDK
POST /api/v1/workflows Create a workflow DAG client.workflows.create(...)
GET /api/v1/workflows List workflows client.workflows.list()
GET /api/v1/workflows/:id Get workflow details client.workflows.get(id)
POST /api/v1/workflows/:id/cancel Cancel a workflow client.workflows.cancel(id)
POST /api/v1/workflows/:id/retry Retry a failed workflow client.workflows.retry(id)

Incoming Webhooks

Method Endpoint Description
POST /api/v1/webhooks/:org_id/custom Ingest Spooled-format JSON (header X-Webhook-Token)
GET /api/v1/organizations/webhook-token Get webhook token + URL
POST /api/v1/organizations/webhook-token/regenerate Rotate webhook token

Outgoing Webhooks

Method Endpoint Description
POST /api/v1/outgoing-webhooks Create org outgoing webhook (optional HMAC X-Spooled-Signature)
GET /api/v1/outgoing-webhooks List outgoing webhooks
GET /api/v1/outgoing-webhooks/:id Get webhook details
DELETE /api/v1/outgoing-webhooks/:id Delete webhook
POST /api/v1/outgoing-webhooks/:id/test Test webhook delivery

Real-time

Method Endpoint Description
GET /api/v1/events SSE event stream
GET /api/v1/events/jobs/:id SSE for specific job
GET /api/v1/events/queues/:name SSE for specific queue
WS /api/v1/ws WebSocket connection

System

Method Endpoint Description
GET /health Health check (not version proof)
GET /health/live Liveness probe
GET /health/ready Readiness probe
GET /metrics Prometheus metrics

gRPC API

Spooled also provides a gRPC API for high-performance worker communication using HTTP/2 + Protobuf. The gRPC API supports streaming for real-time job delivery.

Endpoints
  • Spooled Cloud (TLS): grpc.spooled.cloud:443
  • Self-hosted / local: localhost:50051 (or GRPC_PORT)

gRPC Services

Service RPC Description
QueueService Enqueue Create a new job
QueueService Dequeue Claim jobs for processing (batch)
QueueService Complete Mark job as completed
QueueService Fail Mark job as failed
QueueService RenewLease Extend a job lease (heartbeat)
QueueService GetJob Fetch a job by id
QueueService GetQueueStats Queue depth / status counts
QueueService StreamJobs Server streaming job delivery
QueueService ProcessJobs Bidirectional stream (claim + complete/fail on one connection)
WorkerService Register Register a worker
WorkerService Heartbeat Send worker heartbeat
WorkerService Deregister Deregister a worker

Proto JSON field names use camelCase (jobId, leaseId). Echo leaseId from dequeue/claim on Complete / Fail / RenewLease for lease fencing (stale workers get 409 LEASE_EXPIRED). Omitting maxRetries / timeoutSeconds on Enqueue applies server settings defaults (typically 3 retries / 300s); gRPC cannot express “zero retries” the way REST max_retries: 0 can.

gRPC Authentication

Include your API key in gRPC metadata as x-api-key (API keys only — JWT is not accepted on the gRPC path). REST uses Authorization: Bearer … (API key or JWT); X-API-Key is not a REST header.

x-api-key: sp_live_your_api_key

When to Use gRPC vs REST

Use Case Recommended
Web/mobile appsREST API
Dashboard/adminREST API
High-throughput workersgRPC
Streaming job deliverygRPC

Response Format

All responses are JSON. Successful responses include the data directly:

{
  "id": "job_abc123",
  "queue_name": "emails",
  "status": "pending",
  "payload": { "to": "user@example.com" },
  "created_at": "2024-01-15T10:30:00Z"
}

Error responses include an error object:

{
  "error": "validation_error",
  "message": "queue_name is required",
  "status": 422
}

Rate Limiting

API requests are rate-limited based on your plan. When exceeded, responses are 429 Too Many Requests with a Retry-After header (seconds to wait).

HTTP/1.1 429 Too Many Requests
Retry-After: 12

See Rate Limits for plan-specific RPS / burst / quota numbers.

Rate Limited?

Account → Usage

What to look for:

  • Current request rate
  • Daily job count
  • Retry-After header value

Actions:

  • Implement exponential backoff
  • Use bulk operations
  • Consider upgrading your plan

Pagination

List endpoints support cursor-based pagination:

  • limit — Number of items per page (default: 20, max: 100)
  • cursor — Cursor for next page (from previous response)
GET /api/v1/jobs?limit=50&cursor=eyJpZCI6Impv...

Need more details?

Last updated 2026-08-05