Download docs/API_OVERVIEW.md from danishk84/Jeffy: direct link, hf CLI and curl.
- Browser
- Download file 18.3 kB
-
https://huggingface.co/spaces/danishk84/Jeffy/resolve/main/docs/API_OVERVIEW.md
- Command line
-
hf download hf://spaces/danishk84/Jeffy/docs/API_OVERVIEW.md
-
curl -L -o API_OVERVIEW.md https://huggingface.co/spaces/danishk84/Jeffy/resolve/main/docs/API_OVERVIEW.md
API Overview
Base URLs
Local backend:
http://127.0.0.1:8000
Local Docker:
http://localhost:7860
Swagger:
http://127.0.0.1:8000/docs
FastAPI Entry Point
backend.main:app
Endpoints
| Method | Path | Auth | Purpose |
|---|---|---|---|
| GET | /health |
No | Health check |
| GET | /health/deployment |
No | Safe deployment readiness summary; reports configured/missing status without secret values |
| POST | /api/auth/login |
No | Login and receive JWT |
| GET | /api/auth/me |
Yes | Return current user profile |
| POST | /api/chat |
Yes | Send chat message to Jeffy |
| GET | /api/session/history |
Yes | Retrieve message history |
| GET | /api/agents/status |
Yes | Return available agents for user role |
| GET | /api/agents/catalog |
Yes | Return Phase 3 agent catalog and permission flags |
| POST | /api/agents/route |
Yes | Route a message to a permitted lightweight agent and create a task |
| GET | /api/tasks |
Yes | Return current user's recent agent tasks |
| GET | /api/tasks/{task_id} |
Yes | Return one current-user agent task |
| POST | /api/tasks/{task_id}/cancel |
Yes | Cancel a queued/running/waiting task |
| GET | /api/kids/pet |
Child only | Return child pet stats |
| POST | /api/kids/pet |
Child only | Apply pet action |
| POST | /api/pet/feed |
Child only | Feed Jeffy |
| POST | /api/pet/water |
Child only | Give Jeffy water |
| POST | /api/location/share |
Yes | Explicitly share current user location |
| GET | /api/location/latest |
Yes | Return own latest location for children, child locations for adults |
| GET | /api/location/latest/{user_id} |
Yes | Return latest permitted location for a user |
| POST | /api/sos/create |
Yes | Create a user-triggered SOS alert |
| GET | /api/sos/active |
Yes | Return permitted active SOS alerts |
| POST | /api/sos/{sos_id}/resolve |
Adult/admin | Resolve an active SOS alert |
| POST | /api/voice/transcribe |
Yes | Canonical guarded voice transcription endpoint; returns whisper-disabled until a real provider is configured |
| POST | /api/audio/transcribe |
Yes | Legacy compatibility route delegating to /api/voice/transcribe |
| POST | /api/video/snapshot |
Yes | Placeholder for image/video snapshot |
| POST | /api/rag/upload |
Adult/admin | Upload .txt or .md documents into an allowed RAG collection |
| GET | /api/rag/documents |
Yes | List visible RAG documents |
| GET | /api/rag/documents/{document_id} |
Yes | Return one visible RAG document |
| DELETE | /api/rag/documents/{document_id} |
Adult/admin | Delete an allowed RAG document |
| POST | /api/rag/query |
Yes | Query visible/curated RAG documents |
| POST | /api/search/query |
Yes | Run permitted search with demo fallback, or saved-source search when search_type=source_registry, source_id, or category is provided. Saved-source search uses safe backend fetch/extraction for active public sources. |
| GET | /api/search/history |
Yes | Return current user's search history |
| GET | /api/admin/dashboard |
Admin | Return Admin Control Center summary data, dashboard widgets, agents, tasks, sources, events, runtime diagnostics, safe configuration registry, and management registry |
| GET | /api/admin/release-readiness |
Admin | Return Development Monitor release-readiness status, Release Blockers, User Validation, Validation Results, Repository Status, Delivered, Backlog, and Archived categories without secret values or running release commands |
| GET | /api/admin/repository-documents |
Admin | List allowlisted read-only repository documents for Development Monitor Repository Status |
| GET | /api/admin/repository-documents/{doc_id} |
Admin | Return one allowlisted markdown/text repository document for read-only admin viewing |
| GET | /api/admin/security/status |
Admin | Return whether Admin Console second verification is configured |
| POST | /api/admin/security/verify |
Admin | Verify the configured admin code before opening Admin Console |
| GET | /api/admin/commands |
Admin | Return backend-mediated Admin Command / Action Router commands |
| POST | /api/admin/commands/run |
Admin | Resolve and run a supported admin command through FastAPI |
| GET | /api/admin/users |
Admin | Return safe user management fields without password hashes or secrets |
| POST | /api/admin/users |
Admin | Create an admin-managed user with validation |
| PATCH | /api/admin/users/{user_id} |
Admin | Update safe user fields and status with current-admin/last-admin protection |
| DELETE | /api/admin/users/{user_id} |
Admin | Archive a user where protected-user rules allow it |
| POST | /api/admin/users/{user_id}/reset-access |
Admin | Reset user access without returning password hashes |
| GET | /api/admin/events |
Admin | Return recent system events |
| GET | /api/admin/agents |
Admin | List persisted admin agent registry records |
| POST | /api/admin/agents |
Admin | Create an agent registry record |
| PATCH | /api/admin/agents/{agent_id} |
Admin | Update an agent registry record |
| DELETE | /api/admin/agents/{agent_id} |
Admin | Archive an agent registry record through permission/approval checks where configured |
| GET | /api/admin/tools |
Admin | List tool registry records |
| POST | /api/admin/tools |
Admin | Create a tool registry record |
| PATCH | /api/admin/tools/{tool_id} |
Admin | Update a tool registry record |
| DELETE | /api/admin/tools/{tool_id} |
Admin | Archive a tool registry record through permission/approval checks where configured |
| GET | /api/admin/capabilities |
Admin | List Phase 15 capability safety-contract records |
| POST | /api/admin/capabilities |
Admin | Create a capability safety-contract record; does not execute the capability |
| PATCH | /api/admin/capabilities/{capability_id} |
Admin | Update a capability safety-contract record |
| DELETE | /api/admin/capabilities/{capability_id} |
Admin | Archive a capability safety-contract record through permission/approval checks where configured |
| POST | /api/admin/capabilities/{capability_id}/assign |
Admin | Assign a capability contract to an agent |
| DELETE | /api/admin/capabilities/assignments/{assignment_id} |
Admin | Archive an agent capability assignment |
| POST | /api/admin/capabilities/{capability_id}/policy-check |
Admin | Check capability safety policy without executing the capability |
| GET | /api/admin/task-registry |
Admin | List task registry records |
| POST | /api/admin/task-registry |
Admin | Create a task registry record |
| PATCH | /api/admin/task-registry/{task_id} |
Admin | Update a task registry record |
| POST | /api/admin/task-registry/{task_id}/run |
Admin | Run a task through permission/approval checks where configured |
| DELETE | /api/admin/task-registry/{task_id} |
Admin | Archive a task registry record through permission/approval checks where configured |
| POST | /api/admin/workflows/agent-diagnostic/run |
Admin | Run Agent Diagnostic Workflow behind FastAPI |
| POST | /api/admin/workflows/storage-diagnostic/run |
Admin | Run Storage Diagnostic Workflow behind FastAPI |
| GET | /api/admin/workflows/runs |
Admin | List workflow runs |
| GET | /api/admin/workflows/runs/{run_id} |
Admin | Return workflow run detail |
| GET | /api/admin/storage |
Admin | List provider-agnostic storage records |
| POST | /api/admin/storage |
Admin | Create storage metadata/configuration record |
| PATCH | /api/admin/storage/{storage_id} |
Admin | Update storage metadata/configuration record |
| DELETE | /api/admin/storage/{storage_id} |
Admin | Archive storage record through permission/approval checks where configured |
| POST | /api/admin/storage/{storage_id}/test-access |
Admin | Test safe storage access through backend adapter and permission checks |
| GET | /api/admin/storage/activity |
Admin | List storage activity logs |
| GET | /api/admin/credentials/status |
Admin | Return Credential Vault readiness without secrets |
| GET | /api/admin/credentials |
Admin | List credential references with masked/encrypted status only |
| POST | /api/admin/credentials |
Admin | Create credential reference or encrypted credential when encryption is configured |
| PATCH | /api/admin/credentials/{credential_id} |
Admin | Update credential metadata/status without exposing decrypted values |
| DELETE | /api/admin/credentials/{credential_id} |
Admin | Archive credential record through permission/approval checks where configured |
| POST | /api/admin/credentials/{credential_id}/test |
Admin | Test credential usability without returning secret values |
| GET | /api/admin/llm/providers |
Admin | List backend LLM provider configurations |
| POST | /api/admin/llm/providers |
Admin | Create LLM provider configuration such as OpenRouter |
| PATCH | /api/admin/llm/providers/{provider_config_id} |
Admin | Update LLM provider configuration |
| DELETE | /api/admin/llm/providers/{provider_config_id} |
Admin | Archive LLM provider configuration through permission/approval checks where configured |
| POST | /api/admin/llm/providers/{provider_config_id}/test |
Admin | Test provider configuration through backend adapter only |
| GET | /api/admin/llm/models |
Admin | List LLM model definitions |
| POST | /api/admin/llm/models |
Admin | Create LLM model definition |
| PATCH | /api/admin/llm/models/{llm_config_id} |
Admin | Update LLM model definition |
| DELETE | /api/admin/llm/models/{llm_config_id} |
Admin | Archive LLM model definition through permission/approval checks where configured |
| POST | /api/admin/llm/models/{llm_config_id}/test |
Admin | Test model configuration through backend adapter only |
| GET | /api/admin/llm/assignments |
Admin | List agent/model assignments |
| POST | /api/admin/llm/assignments |
Admin | Assign model definition to an agent/task type through approval checks where configured |
| DELETE | /api/admin/llm/assignments/{assignment_id} |
Admin | Archive model assignment through approval checks where configured |
| GET | /api/admin/llm/activity |
Admin | List LLM activity logs without secrets |
| GET | /api/admin/approvals |
Admin | List approval requests |
| POST | /api/admin/approvals/{approval_id}/approve |
Admin | Approve an approval-gated action |
| POST | /api/admin/approvals/{approval_id}/reject |
Admin | Reject an approval-gated action |
| POST | /api/admin/approvals/{approval_id}/cancel |
Admin | Cancel own pending approval request where allowed |
| POST | /api/events |
Yes | Record a frontend/system event for admin monitoring |
| GET | /api/search/sources |
Admin | List admin website sources |
| POST | /api/search/sources |
Admin | Add a public website source |
| PATCH | /api/search/sources/{source_id} |
Admin | Update source metadata/status |
| DELETE | /api/search/sources/{source_id} |
Admin | Disable a website source |
| POST | /api/search/sources/{source_id}/refresh |
Admin | Refresh public page metadata/summary |
| POST | /api/search/sources/refresh-all |
Admin | Refresh up to 25 active public sources and log diagnostics |
| POST | /api/search/sources/search |
Admin | Canonical saved-source search endpoint. Loads active saved sources, validates public URLs, fetches bounded single-page text, extracts snippets, logs diagnostics, and returns Jeffy-formatted findings. |
| POST | /api/search/assistant/inspect |
Admin | Inspect public website reachability, title, description, useful links, API/doc signals, source type, usefulness score, and diagnostics |
| POST | /api/search/diagnostics/outbound |
Admin | Validate safe public outbound fetch reachability from the current runtime and log diagnostics |
| GET | /{full_path:path} |
No | Serve React SPA if frontend/dist exists |
Auth
Protected endpoints use Bearer token authentication.
Header:
Authorization: Bearer <token>
Login Request
{
"username": "dkbash",
"password": "jeffy123"
}
Login Response
{
"access_token": "...",
"token_type": "bearer",
"user": {
"id": 1,
"username": "dkbash",
"display_name": "Danish",
"role": "admin",
"age_group": "adult",
"safety_level": "standard",
"mode": "admin"
}
}
Chat Request
{
"message": "Hello Jeffy",
"session_id": null,
"mode": null
}
Chat Response
{
"reply": "...",
"avatar_state": "speaking",
"agent": "conversation_agent",
"session_id": "...",
"safety_mode": "standard"
}
Pet Action Request
{
"action": "feed"
}
Allowed current actions:
feedwaterstar
Saved-Source Search Behavior
Canonical endpoint:
POST /api/search/sources/search
/api/search/query delegates to the same saved-source search path when search_type is source_registry, or when source_id or category is provided.
Current behavior:
- Loads active saved website sources for the admin user.
- Supports all active sources, a specific
source_id, acategory, or an explicit public URL included in the query. - Validates URLs before fetch and blocks local/private/internal hosts.
- Fetches one public HTTP/HTTPS page per source with timeout and response-size guard.
- Extracts title, meta description, readable bounded text, useful links, snippets, HTTP status, response size, fetch duration, and extraction length.
- Updates existing source summary/status/error fields where available.
- Logs search/fetch/extraction/failure events for the Admin Command Center Event Monitor.
- Returns Jeffy-formatted
summary,key_findings,sources_used,limitations, andsuggested_next_action.
Known limitations:
- No multi-page crawling.
- No scheduled background crawler.
- No persistent vector index.
- Login-required/private pages are intentionally unsupported.
- Production fetch success still depends on target website behavior and Hugging Face outbound network access.
Admin Console Security
Admin Console access now has two layers:
- Normal authenticated admin JWT session.
- A second Admin Console verification code.
Configure the second factor with:
ADMIN_REAUTH_CODE_SHA256=<sha256 hash of the admin code>
Deployment status: configured in the deployment environment. The plain code is never hardcoded in the app and should not be committed. If the setting is missing in a local/dev environment, the frontend shows a setup warning and does not silently open the Admin Console.
Admin Control Center
Admin users are routed toward the Admin Control Home after login through the admin second-verification flow. Non-admin users continue to land in the Family Area.
The Admin Control Center is a separate full-screen operations area with:
- left sidebar navigation
- fixed top command/search/voice control bar
- fixed bottom notification bar
- dashboard monitoring using real backend data
- controlled and assist agent sections
- operational agent, task, tool, storage, credential, LLM provider/model, assignment, user, and approval management where visible
- Management Configuration Center for Storage Configuration, Source Registry, LLM Configuration, Credential Vault, Tool Configuration, Agent Assignments, and runtime settings where data exists
- Logs and Events
- Reports using real available data only
- Settings
- reusable status badges
- detail drawer pattern
The /api/admin/dashboard response includes safe configuration visibility only. It reports configured/not configured/enabled/disabled status for environment-backed settings and never returns secret values, password hashes, tokens, DATABASE_URL, or JEFFY_CREDENTIAL_ENCRYPTION_KEY.
Deployment Readiness
Required deployment secrets are:
DATABASE_URL
JEFFY_CREDENTIAL_ENCRYPTION_KEY
Document names only. Do not document, print, commit, log, or return actual secret values.
The /health/deployment endpoint returns safe readiness statuses for runtime, database, credential vault, LangGraph/package availability, storage readiness, and frontend/dist presence. It must not include secret values.
The admin-only /api/admin/release-readiness endpoint reuses deployment readiness data and adds the current Phase 14.6 release-baseline status. It does not run git, npm, compile, Capacitor, APK, sync, upload, or destructive commands. Checks that cannot be automatically verified are returned as manual_confirmation_required.
Admin Command Router
Admin commands are backend-mediated through /api/admin/commands and /api/admin/commands/run. The Family Area must not call admin command endpoints. Family-safe voice/text commands remain handled through family preference and voice-command paths.
Workflows
LangGraph workflows run behind FastAPI only. The frontend calls Jeffy workflow endpoints and never calls LangGraph directly. Workflow runs are persisted and visible through Admin Logs/Events and workflow run detail views.
Storage, Credential, and LLM Configuration
Storage is provider-agnostic and configurable. Hugging Face bucket or mounted-storage support is represented as storage records; no bucket URI is hardcoded.
Credential records use references and encrypted storage only when JEFFY_CREDENTIAL_ENCRYPTION_KEY is configured. Decrypted values are never returned to the frontend.
OpenRouter is represented as an LLM provider configuration plus model definitions and agent/model assignments. The frontend must not call OpenRouter directly.
Voice Output Modes
Frontend voice controls support:
voice_and_chat: speech input, chat text, and TTS output.stt_only: speech input and chat text, with TTS muted.chat_only: typed chat only.
The current implementation stores the selected output mode in browser local storage to avoid a database schema migration in Phase 9B.
Family Area
The Family Area now exposes Pet and Learn modes. Pet Mode behavior is preserved. Learn Mode includes German, coding, homework, Story, Quiz, and Drawing actions. Pro/admin capabilities remain available through the separate Admin Console instead of the Family Area mode selector.
API Change Rule
When endpoints change, update this file in the same task.