This document describes the HTTP surface of the user-service FastAPI app. The service powers provider discovery, chat orchestration, agent lifecycle management, demo generation, and deployment management. All routes are relative to the service root (e.g., http://localhost:8000).
The auth provider is selected by APP_ENV (and the per-provider config under auth/). Three modes:
dev_stub provider. The browser-side login flow is GET /auth/login/dev_stub → backend picker → callback sets the gofannon_sid httpOnly cookie. API calls then carry the cookie automatically.dev_stub. Same cookie carries the session.Authorization: Bearer <ID token>; the token is verified with Firebase and the decoded user is attached to request.state.user.Most routes rely on dependency injection for authorization (get_current_user); admin-only routes require require_admin_access.
{"detail": <message>} when validation or downstream services fail.GET /, GET /healthPOST /log/clientGET /providers, /providers/{provider}, /providers/{provider}/models, /providers/{provider}/models/{model}GET /users/me, PUT /users/me/monthly-allowance, PUT /users/me/allowance-reset-date, PUT /users/me/spend-remaining, POST /users/me/usage, POST /users/me/reset-allowanceGET /admin/users, PUT /admin/users/{user_id}POST /chat, GET /chat/{ticket_id}POST /sessions/{session_id}/config, GET /sessions/{session_id}/config, DELETE /sessions/{session_id}/agents plus POST /agents/generate-code, POST /agents/run-codePOST /agents/{agent_id}/deploy, DELETE /agents/{agent_id}/undeploy, GET /agents/{agent_id}/deployment, GET /deployments, POST /rest/{friendly_name}POST /mcp/toolsPOST /specs/fetchPOST /demos/generate-code, CRUD at /demosGET / → Simple heartbeat payload with service name.GET /health → { "status": "healthy", "service": "user-service" } for readiness probes.POST /log/client{ "eventType": string, "message": string, "level": "INFO"|"WARN"|..., "metadata": object? }client_host and user_agent, then writes to observability service. Returns { "status": "logged" }.GET /providers → Map of provider configurations keyed by provider slug.GET /providers/{provider} → Provider config, 404 if missing.GET /providers/{provider}/models → List of model slugs for the provider.GET /providers/{provider}/models/{model} → Model configuration, 404 if provider or model missing.GET /users/me → Current user profile (User schema with basicInfo, billingInfo, usageInfo).PUT /users/me/monthly-allowance{ "monthlyAllowance": number }PUT /users/me/allowance-reset-date{ "allowanceResetDate": number }PUT /users/me/spend-remaining{ "spendRemaining": number }POST /users/me/usage{ "responseCost": number, "metadata"?: object }POST /users/me/reset-allowance → Resets usage tracking for the current user.GET /admin/users → Lists all users (admin-only dependency).PUT /admin/users/{user_id}monthlyAllowance, allowanceResetDate, spendRemaining.POST /chatChatRequest containing messages (role user|assistant|system), provider, model, optional parameters, and builtInTools.{ "ticket_id": <uuid>, "status": "pending" }.GET /chat/{ticket_id} → ChatResponse with status, result, and error once processing completes.POST /sessions/{session_id}/configProviderConfig (provider, model, parameters).GET /sessions/{session_id}/config → Stored provider_config for the session.DELETE /sessions/{session_id} → Deletes session and returns { "message": "Session deleted" }.POST /agentsCreateAgentRequest (name, description, code, optional friendlyName, tool metadata, schemas, invokable models, composer metadata).Agent with _id and _rev.GET /agents → List of all agents.GET /agents/{agent_id} → Single agent document.PUT /agents/{agent_id}UpdateAgentRequest (partial updates across the same fields as creation).DELETE /agents/{agent_id} → Deletes agent, 204 on success.POST /agents/generate-codeGenerateCodeRequest (description, tools, input/output schemas, composer modelConfig, optional swagger specs and invokable models).POST /agents/run-codeRunCodeRequest (code, inputDict, tools, optional gofannonAgents).result or raises with logged failure details.POST /agents/{agent_id}/deploy → Registers agent for REST exposure; 201 with deployment info.DELETE /agents/{agent_id}/undeploy → Removes deployment; 204 on success.GET /agents/{agent_id}/deployment → Deployment metadata for the agent, or 404 if not deployed.GET /deployments → List of deployed APIs (DeployedApi objects).POST /rest/{friendly_name} → Runs a deployed agent by its public name using the JSON body as input_dict.POST /specs/fetch{ "url": string }POST /mcp/tools{ "mcp_url": string, "auth_token"?: string }{ "mcp_url": ..., "tools": [...] }.POST /demos/generate-codeGenerateDemoCodeRequest (user prompt, selected deployed APIs, composer modelConfig, optional builtInTools).html, css, js, and optional thoughts.POST /demosCreateDemoAppRequest (name, description, selected APIs, composer config, prompt, generated code, optional composer thoughts).DemoApp.GET /demos → List of saved demo apps.GET /demos/{demo_id} → Single demo app.PUT /demos/{demo_id} → Replace demo app content using the same schema as creation.DELETE /demos/{demo_id} → Deletes demo app, 204 on success.