/api/v1/ that drives every workspace, crew, agent, and credential operation. This page covers the cross-cutting conventions — base URL, the five authentication methods, RBAC roles, request/response format, pagination, and the RFC 7807 error shape — then links out to each resource group. Real-time updates and inbound triggers ride alongside REST over WebSocket and Webhooks.
Base URL
/api/v1/ unless otherwise noted. Exceptions:
- Health check:
GET /api/health - NextAuth endpoints:
/api/auth/* - WebSocket upgrade:
GET /ws
Authentication
Crewship supports five authentication methods depending on the context.1. Session Cookie (Browser)
The web UI authenticates via JWT session tokens stored in HTTP-only cookies. The Go backend validates these tokens directly (no external NextAuth server required).
Tokens are set by the
POST /api/auth/callback/credentials login endpoint and expire after 30 days.
2. CLI Token (Programmatic)
CLI tokens are long-lived bearer tokens prefixed withcrewship_cli_. Create them via the API or CLI:
3. WebSocket Token (Real-time)
Short-lived JWT tokens for establishing WebSocket connections.4. Internal Token (IPC)
Used by the crewshipd sidecar process for internal communication over Unix socket. Passed viaX-Internal-Token header. Not available to external clients.
5. Webhook Secret (Inbound)
Per-agent HMAC secrets for authenticating inbound webhook triggers:Authorization (RBAC)
Workspace membership is required for all workspace-scoped endpoints. The
workspace_id query parameter (or {workspaceId} path parameter) identifies the workspace context.
Permission mapping:
These are the five action gates checked by
canRole (internal/api/helpers.go:438). create/update share the same tier, as do manage/delete.
Request Format
- Content-Type:
application/json - Body size limit: 16 MiB on the authed API surface (
maxAPIBodyBytes,internal/api/middleware.go). OversizedContent-Lengthis rejected up front with413; chunked/unlabelled bodies are bounded by aMaxBytesReaderbackstop. Individual handlers may impose a stricter cap (e.g. user preferences at 16 KB). - Timestamps: ISO 8601 / RFC 3339 in UTC (e.g.,
2024-01-15T10:30:00Z) - IDs: CUID strings (e.g.,
cm1a2b3c4d5e6f7g8h9i) - Slugs: Lowercase alphanumeric with hyphens, 2-50 characters (regex:
^[a-z0-9][a-z0-9_-]*$) - Soft delete:
DELETEendpoints setdeleted_atrather than removing rows (credentials, crews, agents)
Pagination
List endpoints use offset-based pagination:Error Format
Errors use RFC 7807 Problem Details where supported:Common Status Codes
Communication Layers
Endpoint Groups
Crews
CRUD for crews, members, container config, network policies.
Agents
CRUD for agents, skills, credentials, chats, runs, persona, hire/rehire.
Missions
Mission lifecycle, tasks, start/restart/resume/clone, metrics.
Issues
Issue tracking, labels, comments, relations, activity, projects.
Credentials
Credential vault CRUD, testing, agent assignment.
Skills
Skill marketplace, import, workflow templates, crew templates.
Integrations
MCP server integrations at workspace/crew/agent level, OAuth flow.
Webhooks
Inbound webhook trigger endpoint.
WebSocket
Real-time channels, subscriptions, chat, event types.
Connectors
Curated connector catalog — browse, verify credentials, install.
Feature Flags
Feature flag CRUD with percentage rollout and per-workspace overrides.
Instance Settings
Instance-wide settings with sensitive-value redaction and protected keys.
Policies
Per-crew autonomy levels and behavior modes.
Privacy
GDPR peer-card access — view, purge, consent / opt-out.
Slash Commands
Capability-filtered slash-command catalog for the composer and CLI.
Additional Endpoints
These endpoints are documented here for completeness but do not have dedicated pages — health, system status, auth, onboarding, admin, audit, runs, and workspaces.Health Check
{"status": "ok"} with HTTP 200.
Request: no body. Response: {"status":"ok"}. Statuses: 200
healthy; 503 when the service is unavailable.
System
All system rows below areGET requests with no body. Response: the named
system JSON object. Statuses: 200 success; 401 when authentication is
required but missing; 403 for an admin-only surface; 500 on server failure.
Activity
Auth / Signup
Request: JSON forPOST rows and no body for GET; response: the
operation’s JSON result. Statuses: 200/202 on success; 400 invalid
input; 401 when auth is required; 403 when disabled or unauthorized.
NextAuth Compatibility
Request: CSRF/session cookies as required by the browser flow; otherwise no JSON body. Response: NextAuth JSON or redirect. Statuses:200 success;
401 invalid credentials/session; 403 CSRF/origin failure; 405 wrong method.
Onboarding
Request: JSON for setup/complete and no body for status. Response: wizard state or completion JSON. Statuses:200 success; 400 invalid step;
401 unauthenticated; 500 server failure.
Admin (ADMIN / OWNER)
Request: no body for theseGET routes. Response: the resource JSON
described in each row. Statuses: 200 success; 403 insufficient admin
role; 500 server failure.
All rows above take no request body and return JSON. The health, legacy, and
rate-limit reads return
200 on success; admin authorization failures return
403 (and 401 when workspace authentication is absent). The rate-limit
mutation returns 400 for invalid values, 404 for an unknown key, and
503 when its configuration store is unavailable. See the Admin API
for complete response shapes.
Audit
Request: optional query filters, no body. Response: paginated audit JSON. Statuses:200 success; 403 missing manage permission.
Runs
Request: optional query filters, no body. Response: workspace-scoped run list. Statuses:200 success; 401 unauthenticated; 403 forbidden.
Workspaces
Request: JSON for mutation rows and no body forGET; response: workspace
or membership JSON. Statuses: 200/201 on success; 400 invalid input;
401 unauthenticated; 403 insufficient role; 404 unknown workspace.