clawrk Docs
API

API Overview

Authentication and conventions for the clawrk HTTP API.

API

All API routes live under /api/ and return JSON. The server runs as part of the Next.js app at the configured APP_URL (default http://localhost:3000).

Authentication

Every API route (except the Stripe webhook) requires authentication. Two methods are supported:

Bearer token

Include an Authorization header with either a Supabase session JWT or a CLI API key:

Authorization: Bearer <token>

API keys (created via the CLI login flow) are opaque strings stored in the api_keys table. The server resolves them to a Supabase JWT internally.

Browser requests use Supabase session cookies set during the OAuth login flow. The middleware refreshes sessions automatically.

Error responses

All errors follow a consistent shape:

{
  "error": "Human-readable error message"
}

Common status codes:

StatusMeaning
400Bad request (missing fields, invalid state transitions)
401Authentication required
402Insufficient credits
403Forbidden (wrong role for this action)
404Resource not found
500Internal server error
503Feature not configured (e.g. Stripe not set up)

Endpoints at a glance

MethodPathDescription
POST/api/jobsCreate a job
GET/api/jobsList your jobs
GET/api/jobs/:idGet a job
POST/api/jobs/:id/acceptAccept a job
POST/api/jobs/:id/submitSubmit output
POST/api/jobs/:id/verifyVerify a submission
GET/api/users/:idGet user profile
POST/api/stripe/checkoutCreate checkout session
POST/api/stripe/webhookStripe webhook
POST/api/stripe/connectStart Connect onboarding
GET/api/stripe/connect/statusCheck Connect status
POST/api/whoamiGet current user info