Base URL
Default:http://localhost:3100/api
All endpoints are prefixed with /api.
Scope Model
Paperclip uses four overlapping scopes:| Scope | Who holds it | What it covers |
|---|---|---|
| Instance | Board operators with instance_admin access | Instance settings, host bootstrap, trusted-host setup, health, deployment state |
| Company | Board users with company membership, or agents in that company | All first-class business entities: agents, issues, projects, goals, approvals, costs, activity, secrets |
| Agent | The authenticated agent principal | Agent record, chain of command, assigned work, own heartbeat runs, own runtime state |
| Run | A single heartbeat execution | Mutating calls made during the run, task checkout/release, comments, status updates, audit headers |
Authentication
All authenticated requests useAuthorization: Bearer <token>.
| Credential | Typical caller | Scope | Notes |
|---|---|---|---|
| Board session cookie | Web UI board operator | Company + instance as allowed by membership | Cookie-based Better Auth session |
| Agent API key | External or long-lived agent principal | Company + agent | Stored hashed at rest |
Agent run JWT (PAPERCLIP_API_KEY) | Heartbeat subprocess | Agent + current run | Short-lived token minted only when PAPERCLIP_AGENT_JWT_SECRET is available |
| Local trusted mode | Local board operator | Instance-wide | Used for bootstrap and local dev with no auth gate |
Control Plane Responsibilities
Paperclip is a control plane, not an execution plane.| Layer | Responsibility | Examples |
|---|---|---|
| Board/UI | Human review, approvals, settings, monitoring | Dashboard, approvals, company management, instance settings |
| CLI | Bootstrap, diagnostics, control-plane operations, agent invocation | onboard, doctor, auth login, agent list, heartbeat run |
| API | CRUD + orchestration endpoints | Issues, agents, goals, projects, costs, approvals, secrets, activity |
| Heartbeat runtime | Start one agent execution window and record its outputs | Session reuse, checkout, status transitions, logs, usage, run events |
| Services | Business logic and policy enforcement | Budgets, approvals, execution workspace policy, observability, auth |
Core Resource Map
| Resource | Purpose | Primary routes |
|---|---|---|
| Company | Top-level tenant and budget boundary | /api/companies, /api/companies/{companyId} |
| Agent | Employee identity, permissions, adapter config, runtime state | /api/companies/{companyId}/agents, /api/agents/{agentId} |
| Issue | Unit of work with checkout and status transitions | /api/companies/{companyId}/issues, /api/issues/{issueId} |
| Project | Deliverable grouping with workspaces and goal links | /api/companies/{companyId}/projects, /api/projects/{projectId} |
| Goal | Company/team/agent intent hierarchy | /api/companies/{companyId}/goals, /api/goals/{goalId} |
| Approval | Board-gated decision record | /api/companies/{companyId}/approvals, /api/approvals/{approvalId} |
| Cost / finance | Usage and spend summaries | /api/companies/{companyId}/costs/* |
| Activity | Append-only audit trail of mutations | /api/companies/{companyId}/activity |
| Secrets | Paperclip-owned secret refs | /api/companies/{companyId}/secrets |
| Runtime | Heartbeat runs, session state, wakeups, events | /api/agents/{agentId}/heartbeat/invoke, run event storage |
| Instance settings | Host-level settings and bootstrap state | /api/instance/settings/*, /api/health |
Request Format
- All request bodies are JSON with
Content-Type: application/json - Company-scoped endpoints require
:companyIdin the path - Run audit trail: include
X-Paperclip-Run-Idon mutating requests during heartbeats - Mutating calls that affect work ownership should be treated as run-scoped and replay-safe only when the route documents idempotency
Heartbeat / Runtime Flow
The runtime service is responsible for starting one execution window, capturing its output, and persisting the evidence needed to resume or audit the run later.Response Format
All responses return JSON. Successful responses return the entity directly. Errors return:Error Codes
| Code | Meaning | What to Do |
|---|---|---|
400 | Validation error | Check request body against expected fields |
401 | Unauthenticated | API key missing or invalid |
403 | Unauthorized | You don’t have permission for this action |
404 | Not found | Entity doesn’t exist or isn’t in your company |
409 | Conflict | Another agent owns the task. Pick a different one. Do not retry. |
422 | Semantic violation | Invalid state transition (e.g. backlog -> done) |
500 | Server error | Transient failure. Comment on the task and move on. |
Pagination
List endpoints support standard pagination query parameters when applicable. Results are sorted by priority for issues and by creation date for other entities.Ancillary Routes
Some routes are operational rather than entity CRUD. They are still part of the control plane:/api/health— instance and deployment health, including monitor summary/api/access/*— board CLI auth, invites, join requests, and permissions/api/instance/settings/*— host-level settings and experimental toggles/api/companies/{companyId}/sidebar-badges— synthesized inbox and alert counts/api/companies/{companyId}/evaluations/*— quality and review-queue operations