API Reference
API Reference
This document describes the current API routes implemented in ArchonHQ (src/app/api) for multi-agent workloads.
Authentication
GET/POST /api/auth/[...nextauth]
NextAuth route handlers for Google OAuth session login.
Required env:
GOOGLE_CLIENT_IDGOOGLE_CLIENT_SECRETNEXTAUTH_SECRET
Gateway Proxy
GET /api/gateway/[...path]
Forwards a GET request to:
{GATEWAY_URL}/{path}
Behavior:
- Returns upstream body/status/content-type
- Returns
502JSON when upstream is unreachable
Example:
/api/gateway/status -> ${GATEWAY_URL}/status
Tasks
GET /api/tasks
Returns all tasks ordered by createdAt.
POST /api/tasks
Creates a task from JSON body.
Expected fields:
title(required)descriptionstatusagentpriority
PATCH /api/tasks
Updates a task by id with partial fields.
Also updates updatedAt.
DELETE /api/tasks
Deletes task by id.
Task Stream (SSE)
GET /api/tasks/stream
SSE endpoint that publishes full task list snapshots every 5 seconds.
Headers:
Content-Type: text/event-streamCache-Control: no-cacheConnection: keep-alive
Behavior:
- Sends initial state immediately
- Polls every 5 seconds
- Closes after 5 minutes
Workspace Files
GET /api/workspace/files
Returns all .md files in WORKSPACE_PATH.
GET /api/workspace/file?name=<file>
Returns raw file contents from WORKSPACE_PATH.
Filename is sanitized via path.basename.
POST /api/workspace/file
Writes markdown content to file.
Body:
{
"name": "example.md",
"content": "# Updated content"
}Google Callback (Legacy)
GET /api/gog-callback
Exchanges OAuth code and writes token JSON to a local config path.
Important:
- This route currently uses hardcoded client credentials and redirect URI in source.
- Treat this route as legacy/dev-only until refactored to env-driven config.