DEVELOPER
API Reference
Programmatic access to ForLoop via authenticated API endpoints.
API Reference
Programmatic access to ForLoop via the /api/opencode/* endpoints. Authenticate using an API token passed in the x-api-token header.
Authentication
All API requests require an API token. Tokens are scoped and time-limited.
curl -H "x-api-token: floop_YOUR_TOKEN" \ https://api.forloop.cc/api/opencode/sprints
Getting a Token
- Go to Profile → API Tokens in the ForLoop web app
- Click Create Your First Token
- Choose a preset or configure custom scopes
- Copy the token — it's shown only once
Token Format
floop_<base64-encoded-payload>
Tokens are stored as SHA-256 hashes on the server. The plaintext token is only shown once during creation.
Scopes
| Scope | Description |
|---|---|
sprint:read | View sprint details and stories |
sprint:write | Create and update sprints |
story:read | View story details |
story:write | Create and update stories |
story:delete | Delete stories |
agent:read | View AI agent definitions |
agent:query | Chat with AI agents |
profile:read | Read user profile |
profile:write | Update user profile |
organization:read | View organization details |
organization:write | Create and update organizations |
organization:delete | Delete organizations |
secrets:read | Read space environment secrets |
secrets:write | Create, update, and delete space secrets |
a2a:read | Read A2A connections and contracts |
a2a:write | Manage A2A connections |
catalog:admin | Access space catalog administration |
admin:panel | Access admin panel operations |
Endpoints
Sprints
GET /api/opencode/sprints List sprints (sprint:read)
GET /api/opencode/sprints/:id Get sprint details (sprint:read)
POST /api/opencode/sprints Create sprint (sprint:write)
PUT /api/opencode/sprints/:id Update sprint (sprint:write)
DELETE /api/opencode/sprints/:id Delete sprint (sprint:write)
PUT /api/opencode/sprints/:id/ai-agents Update AI agents (sprint:write)
Stories
GET /api/opencode/stories/:id Get story (story:read)
POST /api/opencode/stories Create story (story:write)
PUT /api/opencode/stories/:id Update story (story:write)
DELETE /api/opencode/stories/:id Delete story (story:delete)
GET /api/opencode/stories/:id/comments List comments (story:read)
POST /api/opencode/stories/:id/comments Create comment (story:write)
AI Agents
GET /api/opencode/ai/agents List available agents (agent:read)
POST /api/opencode/agents/chat Chat with AI (agent:query)
POST /api/opencode/agents/suggestions Get story suggestions (agent:query)
GET /api/opencode/agents/tasks List AI tasks (agent:query)
GET /api/opencode/agents/summary Get sprint summaries (sprint:read)
Autopilot
Autopilot runs through the sprint board and its approval checkpoints. The
current public router does not expose /api/opencode/autopilot/* endpoints;
do not build integrations against those paths.
User Profile
GET /api/opencode/user/profile Get profile (profile:read)
PUT /api/opencode/user/profile Update profile (profile:write)
GET /api/opencode/user/quotas Get quotas (profile:read)
Organizations
GET /api/opencode/organizations List user orgs (organization:read)
GET /api/opencode/organizations/owned List owned orgs (organization:read)
POST /api/opencode/organizations Create org (organization:write)
PUT /api/opencode/organizations/:id Update org (organization:write)
DELETE /api/opencode/organizations/:id Delete org (organization:delete)
GET /api/opencode/organization/:id/quotas Get org quotas (organization:read)
Files
POST /api/opencode/files/upload Upload canvas file (story:write)
POST /api/opencode/files/presign Get presigned URL (story:write)
POST /api/opencode/files/complete Complete upload (story:write)
GET /api/opencode/files/download/:id Download file (story:read)
GET /api/opencode/files/open-url/:id Get open URL (story:read)
GET /api/opencode/files/sprint/:id List sprint files (story:read)
PUT /api/opencode/files/:id/position Update position (story:write)
DELETE /api/opencode/files/:id Delete file (story:write)
Templates
GET /api/opencode/templates List templates (story:read)
# Template creation is system-owned; POST /api/opencode/templates returns 403.
Creating API Tokens via API
Tokens can also be created programmatically using Clerk authentication:
POST /api/opencode/auth/tokens Authorization: Bearer <clerk-token> { "name": "My Token", "expiresIn": "30d", "scopes": ["sprint:read", "story:read", "story:write"] }
Response
{ "token": "floop_eyJpYXQiOjE3MTQ5...", "tokenId": 42, "name": "My Token", "expiresAt": "2024-06-15T00:00:00.000Z", "scopes": ["sprint:read", "story:read", "story:write"] }
Expiration Options
| Value | Duration |
|---|---|
7d | 7 days |
30d | 30 days |
90d | 90 days |
1y | 1 year |
Manage Tokens
GET /api/opencode/auth/tokens List tokens DELETE /api/opencode/auth/tokens/:id Revoke token
Error Responses
| Status | Error Code | Description |
|---|---|---|
| 401 | invalid_token | Missing or invalid API token |
| 403 | insufficient_scope | Token lacks required scope |
| 400 | Various | Invalid request parameters |
| 404 | not_found | Resource not found |
| 500 | internal_error | Server error |
Rate Limits
API requests are rate-limited based on your subscription tier. Check your quotas via GET /api/opencode/user/quotas.
OpenAPI
The public OpenAPI description is available at /openapi.json.
It covers the documented public subset and uses generic resource schemas until
the full response contract is verified.
Base URL
| Environment | URL |
|---|---|
| Production | https://api.forloop.cc |
| Development | https://api.dev.forloop.cc |