Skip to content

API Overview & Authentication

The ManyClaws Controller exposes a REST API at https://admin.your-domain.net/api/* and https://<agent>.your-domain.net/api/*.

URLPurpose
https://admin.your-domain.net/api/*Admin and agent API access
https://<agent>.your-domain.net/api/*Portal and auth endpoints (scoped to agent)

The API uses three authentication levels:

Full access to all API routes. Set via ADMIN_TOKEN environment variable on the controller.

Terminal window
# Via query parameter
curl https://admin.your-domain.net/api/agents?token=YOUR_ADMIN_TOKEN
# Via header
curl https://admin.your-domain.net/api/agents \
-H "Authorization: Bearer YOUR_ADMIN_TOKEN"

Scoped access to /api/auth/* and /api/friends/* routes. Used by agents to manage friends and generate portal sessions.

Terminal window
curl https://admin.your-domain.net/api/friends \
-H "Authorization: Bearer YOUR_AGENT_TOKEN"

The agent token is stored as AGENT_API_TOKEN in the controller and MANYCLAWS_API_TOKEN in the agent’s secrets.

Scoped access to /api/portal/* routes only. Created via magic link authentication.

Terminal window
curl https://my-agent.your-domain.net/api/portal/me \
-H "Authorization: Bearer SESSION_TOKEN"

Sessions are created by POST /api/auth/portal-session and expire after 30 days.

These endpoints require no authentication:

MethodPathDescription
GET/api/healthCluster health status
GET/api/auth/verify/:tokenConsume magic link (redirects to portal)

All API responses are JSON. Errors follow this pattern:

{"error": "Description of what went wrong"}

Successful mutations typically return:

{"ok": true}

There is no rate limiting at the API level. Cloudflare Access provides the authentication boundary, and all traffic must pass through the Cloudflare tunnel.