Skip to content

API Reference

ben-ic edited this page Mar 15, 2026 · 5 revisions

API Reference

Base URL: https://teamrc.ai

All /api/teams* endpoints require Ed25519 signature auth (the CLI handles this automatically). Rate limit: 60 requests/minute.

Team Endpoints

POST /api/teams

Create or update a team.

Request:

{
  "token": "trc_ak_...",
  "team": {
    "name": "My Team",
    "members": [
      {
        "name": "backend-dev",
        "role": "Backend developer",
        "description": "Designs APIs and business logic. Use when tasks involve endpoints or server-side architecture.",
        "soul": "You are...",
        "skills": ["write-tests"]
      }
    ],
    "skills": [
      {
        "id": "write-tests",
        "title": "Write Tests",
        "body": "Always write tests...",
        "alwaysApply": true,
        "globs": null,
        "userInvocable": false
      }
    ],
    "knowledge": "Shared knowledge text...",
    "platforms": ["claude-code", "cursor"]
  },
  "base_hash": "64-char-sha256-hex",
  "team_id": "existing-team-id"
}

Responses:

  • 201: {"team": <team_data>}
  • 409: {"error": "conflict", "server_hash": "<sha256>"} (remote changed since your last pull)
  • 400: {"error": "<validation message>"}

Validation limits: Team name max 64 bytes. Members max 20 (name 64B, role 256B, description 1KB, soul 10KB). Skills max 50 (body 10KB). Knowledge max 100KB. Platforms must be: claude-code, cursor, codex, gemini, openclaw, claude-desktop.


GET /api/teams/:token

Get full team data.

Query params: team_id (optional, for multi-team tokens)

Response: 200: {"team": <team_data>} | 404: {"error": "not_found"}


GET /api/teams/:token/head

Get team hash metadata for conflict detection.

Query params: team_id (optional)

Response: 200: hash data object | 404: {"error": "not_found"}


GET /api/teams/all/:token

Get all teams associated with a token.

Response: 200: {"teams": [<team_data>, ...]} | 404: {"error": "not_found"}


POST /api/join

Join a team by invite code.

Request: {"invite_code": "trc_inv_...", "token": "trc_ak_..."}

Response: 200: {"team": <team_data>, "token": "trc_ak_..."} | 404: {"error": "invalid_invite"}


POST /api/teams/preview

Preview a team by invite code without joining.

Request: {"invite_code": "trc_inv_..."}

Response: 200: {"team": <team_data>} | 404: {"error": "invalid_invite"}


POST /api/teams/invite

Create an invite code.

Request: {"ttl_hours": 24, "team_id": "..."}

TTL capped at 168 hours (7 days).

Response: 200: {"invite_code": "trc_inv_...", "expires_at": "ISO8601"} | 403: {"error": "not a team member"}


POST /api/teams/visibility

Set team visibility (owner only).

Request: {"visibility": "public"|"private", "team_id": "..."}

Responses:

  • 200: {"visibility": "public", "clone_token": "trc_cl_..."}
  • 403: {"error": "not a team member"} or {"error": "only the team owner can change visibility..."}

POST /api/teams/claim

Claim team ownership with the secret from teamrc init.

Request: {"claim_secret": "trc_ocs_..."}

Responses:

  • 200: {"status": "claimed"}
  • 403: {"error": "link your account first with \teamrc login`"}`
  • 409: {"error": "team already has an owner"}

DELETE /api/token/:token/erase

Disconnect a token from the relay. Removes team associations.

Query params: team_id (optional) - scope disconnection to a single team.

Response: 200: {"status": "disconnected", "teams_removed": 3}


Public Endpoints

No auth required. Rate limit: 60 requests/minute.

GET /api/teams/clone/:clone_token

Fetch a public team by clone token.

Response: 200: {"team": <team_data>} | 404: {"error": "invalid_clone_token"}


Device Auth Endpoints

POST /api/auth/device

Start device authorization flow (for teamrc login).

Response:

{
  "device_code": "...",
  "user_code": "XXXX-XXXX",
  "verification_url": "https://teamrc.ai/auth/verify",
  "expires_in": 900,
  "interval": 5
}

GET /api/auth/device/:device_code

Poll for authorization status.

Responses:

  • 200 (pending): {"status": "pending"}
  • 200 (confirmed): {"status": "confirmed", "email": "...", "machine_count": 2, "team_count": 3}
  • 404: {"error": "not_found"}

Account Endpoints

Require web session auth. Used by the dashboard.

Method Path Description
GET /api/account Account info and machines
GET /api/account/teams Teams with machine associations
GET /api/account/export Export all data as JSON download
DELETE /api/account/machines/:token Revoke a machine token
DELETE /api/account Delete account and all data
POST /api/account/reassociate Move team associations to new token

WebSocket API

Socket Connection

URL: wss://teamrc.ai/socket/websocket?ticket=<ticket>&vsn=2.0.0

Auth: Ed25519 signed ticket passed as query parameter.

Ticket format: <timestamp>.<token>.<signature> where the signed message is <timestamp>.<token>. TTL: 30 seconds.

Channel: knowledge:<team_id>

Real-time knowledge sync for CLI daemons.

Join: Returns { knowledge_hash, knowledge_size, knowledge_cap }.

Client → Server: knowledge:push

{ "content": "full knowledge file content" }

Reply: { "knowledge_hash": "...", "knowledge_size": 45000 } or { "reason": "rate_limited" }.

Rate limit: 1 push per second per token.

Server → Client: knowledge:updated

{
  "content": "merged knowledge content",
  "knowledge_hash": "...",
  "knowledge_size": 45000
}

Broadcast when any machine pushes knowledge (via channel or REST). Not echoed back to the source.

Clone this wiki locally