API Quick Reference.

All endpoints at a glance. Base URL: https://the-intern-backend.vksh1cool.workers.dev

Authentication header

Authorization: Bearer <firebase_jwt> — Required on all /api/* endpoints. Get a token via Firebase Auth signInWithEmailAndPassword() or signInWithPopup(). Tokens expire after 1 hour.

Health check

GET /health — No auth required. Returns { status, version, timestamp, infrastructure: { hyperdrive, queues, durableObjects, kv, database, anthropic } }. Use this to verify the backend is operational before making API calls.

Chat (streaming)

POST /api/chat/stream — Body: { message: string, userId: string, agentId?: string, history?: [{role, content}] }. Returns SSE stream. Events: { type: "status", phase }, { type: "token", text }, { type: "tool_call", name, status }, { type: "done", iterations, toolCalls }.

Error format

All errors return { success: false, error: string } with appropriate HTTP status codes. 400 for validation errors, 401 for auth failures, 404 for not found, 500 for server errors. The error field contains a human-readable message safe to display.

Pagination

List endpoints accept limit (default 20, max 100) and offset query parameters. Responses include { success, data: [], total, limit, offset }.