Skip to main content

API Reference

The Workloom registry API is a Hono-based HTTP server with automatic OpenAPI 3.1 spec generation via @hono/zod-openapi. The live spec is always available at GET /v1/openapi.json.

Base URL​

EnvironmentURL
Developmenthttp://localhost:4050/v1
ProductionConfigured per deployment

Authentication​

All endpoints (except health and OpenAPI spec) require a Bearer token in the Authorization header:

Authorization: Bearer <token>

Auth Methods​

MethodUse caseEndpoint
Device LoginCLI interactive loginPOST /v1/auth/device/start
OIDCWeb app browser-based loginGET /v1/auth/oidc/authorize
CI TokenAutomated pipeline accessPOST /v1/auth/ci-token

SAML and service accounts were removed.

Device Login Flow (CLI)​

# 1. Start device login
curl -X POST http://localhost:4050/v1/auth/device/start

# Response: { "deviceCode": "...", "userCode": "...", "verificationUri": "..." }

# 2. User visits verificationUri and enters userCode

# 3. Poll for completion
curl -X POST http://localhost:4050/v1/auth/device/complete \
-H "Content-Type: application/json" \
-d '{"deviceCode": "..."}'

# Response: { "token": "wl_...", "role": "user" }

OIDC Flow (Web App)​

The web app authenticates against Supabase's OAuth server, brokered by the API (API-mediated OIDC with PKCE). The API exchanges the code, verifies the ES256 id_token against Supabase JWKS, and issues a wl_ session token:

  • Authorize: GET /v1/auth/oidc/authorize (returns a Supabase authorize URL)
  • Callback: POST /v1/auth/oidc/callback (exchanges the code for a wl_ token)

The user signs in to Supabase (email/password) and approves consent before the callback. See the full flow in the authentication docs.

Endpoints​

Health​

MethodPathAuthDescription
GET/v1/healthNoServer health and registry hash
GET/v1/openapi.jsonNoOpenAPI 3.1 specification

Packages​

MethodPathAuthDescription
GET/v1/packagesuserList published packages
GET/v1/packages/:name/:versionuserGet specific package version
POST/v1/packages/draftuserCreate a draft package
POST/v1/packages/:name/:version/publishadminPublish a draft package
POST/v1/packages/:name/:version/approveadminApprove a package

Workspaces​

MethodPathAuthDescription
GET/v1/workspaces/revisionsuserList all workspace revisions
POST/v1/workspaces/revisionsuserCreate a workspace revision
GET/v1/workspaces/:iduserGet workspace revision by ID
GET/v1/workspaces/:id/currentuserGet current workspace revision

Approvals​

MethodPathAuthDescription
GET/v1/approvalsadminList pending approvals

Objects​

MethodPathAuthDescription
PUT/v1/objects/:hashuserUpload object (returns 201 + ETag)
GET/v1/objects/:hashuserDownload object (supports Range)

Telemetry​

MethodPathAuthDescription
POST/v1/telemetry/ingestuserIngest telemetry events
GET/v1/telemetry/dashboarduserTelemetry dashboard summary

Audit​

MethodPathAuthDescription
GET/v1/auditadminQuery audit event log

Generated Client Usage​

The @workloom/workloom-api package provides type-safe access to all endpoints via generated React Query hooks and client functions.

React Query Hooks (Web App)​

import { useListPackages, useGetPackage } from "@workloom/workloom-api";

function PackageList() {
const { data, isLoading } = useListPackages({
client: { headers: { Authorization: `Bearer ${token}` } },
query: { enabled: !!token },
});

return <ul>{data?.map(pkg => <li key={pkg.name}>{pkg.name}</li>)}</ul>;
}

Client Functions (CLI / Server-side)​

import { listPackages, getPackage } from '@workloom/workloom-api'
import { setAuthToken } from '@workloom/fetch-client'

setAuthToken('wl_abc123...')

const packages = await listPackages()
const pkg = await getPackage({ name: 'my-package', version: '1.0.0' })

Non-Standard Responses​

Three endpoints have non-standard response formats:

EndpointBehavior
PUT /v1/objects/:hashReturns 201 with ETag header
GET /v1/objects/:hashSupports Range header, returns 206 with Content-Range

CORS​

The API includes CORS middleware allowing requests from the web app origin. Allowed headers: Authorization, Content-Type, X-Workloom-SHA256.