REST API and WebSocket API
The FastAPI application is created by robot.api.create_app().
The API is mounted under /api/v1. FastAPI also serves its generated
OpenAPI document and interactive documentation (/docs, /redoc) when the
API is running.
Health
GET /api/v1/health- Health checkGET /api/v1/version- Version info
State and status
GET /api/v1/state- Current robot statePOST /api/v1/state- Transition stateGET /api/v1/config- Current configuration (sensitive values masked)GET /api/v1/perception- Perception statusGET /api/v1/audio- Audio output statusGET /api/v1/conversation- Conversation status
Commands
POST /api/v1/speak- Speak text (injected into the conversation pipeline)POST /api/v1/speak-direct- Speak text directly via TTS (bypasses STT and LLM)POST /api/v1/emotion- Set emotion
/speak injects text into the conversational pipeline. /speak-direct
bypasses STT and LLM and sends text directly to the configured TTS.
Conversations
GET /api/v1/conversations- List conversationsGET /api/v1/conversations/{conversation_id}- Get a conversationDELETE /api/v1/conversations/{conversation_id}- Delete a conversation
These operate on the configured conversation store.
Preferences
GET /api/v1/preferences- List all preferencesGET /api/v1/preferences/{key}- Get a specific preferenceDELETE /api/v1/preferences/{key}- Delete a preference
See Preference Tracking.
Learning
GET /api/v1/learning/status- Learning service statusGET /api/v1/learning/preferences- Learned preferencesGET /api/v1/learning/config- Learning configurationPOST /api/v1/learning/train- Force a training cycle
These return "not available" responses when learning is disabled. See
Local Brain. /api/v1/learning/status reports
enabled from settings.learning.enabled (not a hard-coded value).
Teaching
The teaching loop (human demonstration + feedback) is exposed under
/api/v1/teaching/*. POST endpoints require the API key
(DESKBOT_API__API_KEY) when one is configured. See
Teaching Mode.
GET /api/v1/teaching/status- Teaching-loop status (enabled, in_teaching_mode, session_id, mode, trigger_gesture, desired_action, total_experiences, min_experiences_for_practice)GET /api/v1/teaching/transitions- Recent transitions with a conversation-free state summary (teaching_context / interaction_active / person_present / gesture), reward, feedback_source, interaction_id, teaching_session_id. Query params:limit(1-256, default 20),action(case-insensitive substring on action name),success(true/false),feedback(true= only transitions with attributed feedback,false= none),interaction_id(exact match). Filters apply against a 256-entry working-memory pool beforelimit, so narrowing does not empty the result window.totalis the count after filtering, beforelimit.POST /api/v1/teaching/feedback- Submit explicit human feedback{polarity, magnitude, source, text}; attributes to the most-recent eligible real transition. Returns{attributed, transition_id?, delta?}-attributed=falsewhen no eligible transition (feedback dropped, never invented). API key required.POST /api/v1/teaching/demonstration- Arm a session from a constrainedinstructionand/or inject agesture;mode=demonstrate|practice. Returns{session_id?, trigger_gesture?, desired_action?, executed_action?, executed_action_index?}. API key required.GET /api/v1/teaching/qvalues- Current policy Q-values for the encoder state, as a{action_name: float}map
Configuration validation
GET /api/v1/config/schema- Configuration JSON SchemaPOST /api/v1/config/validate- Validate proposed configuration
The validator checks a candidate configuration (YAML or env-style) against
the AppSettings schema without applying it. The JSON Schema endpoint
exposes the full Pydantic schema for tooling and the browser config
validator at /config.
Calibration
GET /api/v1/calibration/servos- List all servosPOST /api/v1/calibration/servos/{name}/move- Move a servo to an anglePOST /api/v1/calibration/servos/{name}/release- Release a servoPOST /api/v1/calibration/servos/release_all- Release all servosPOST /api/v1/calibration/servos/calibrate/{name}- Run servo calibration sequenceGET /api/v1/calibration/display- Get display configurationPOST /api/v1/calibration/display/test_pattern- Show a test patternPOST /api/v1/calibration/display/clear- Clear the display
Settings (hardware test)
The settings router backs the hardware test page at /settings/.
Info
GET /api/v1/settings/info- Hardware & subsystem overview
Camera
GET /api/v1/settings/camera/info- Camera infoGET /api/v1/settings/camera/frame- Capture a single frameGET /api/v1/settings/camera/stream- Live MJPEG camera preview
Microphone
GET /api/v1/settings/mic/info- Microphone infoGET /api/v1/settings/mic/level- Current microphone input levelPOST /api/v1/settings/mic/test- Record and play back a mic testWS /api/v1/settings/mic/stream- Live microphone audio stream (see WebSocket). Backs the Live View "RON's Ears" card: the first frame is a text header{"sample_rate","channels","frame_ms","type","is_mock"}(or{"error":"no_microphone"}), then continuous binary frames of raw signed-16-bit little-endian PCM. A temporary microphone is created per connection so the conversation audio loop is undisturbed. Send"stop"to end.
Audio output
GET /api/v1/settings/audio/info- Audio output infoGET /api/v1/settings/audio/devices- List available audio output devicesGET /api/v1/settings/audio/input-devices- List available audio input devicesPOST /api/v1/settings/audio/switch- Switch the active audio output devicePOST /api/v1/settings/audio/test-device- Play a test tone through a specific devicePOST /api/v1/settings/audio/tone- Play a test tonePOST /api/v1/settings/audio/stop- Stop audio playback
Sound effects
GET /api/v1/settings/sound-effects- List available sound effectsPOST /api/v1/settings/sound-effect/{name}- Play a sound effect
LLM / TTS test
POST /api/v1/settings/tts/test- Speak a test phrasePOST /api/v1/settings/llm/test- Send a test prompt to the LLM
System
GET /api/v1/system/info- System informationGET /api/v1/system/logs- Recent log entries from the in-memory ring buffer. Query params:level(DEBUG/INFO/WARNING/ERROR, orALLfor no filter),search(case-insensitive text across event/logger/data),logger(substring on logger name),event(substring on event name),exclude(comma-separated event names to omit, e.g.DisplayUpdated,LookRequested),since(POSIX epoch; only entries withcreated_epoch>= this, for live tailing),limit(1-500, default 200). Entries carrytimestamp,created_epoch,level,logger,event,data.GET /api/v1/system/logs/filters- Distinctlevels,loggers, andeventscurrently in the buffer (for populating the dashboard filter dropdowns), plus the server-configurednoisy_eventshide list (LoggingConfig.noisy_events) so the dashboard can mirror the default "hide noisy events" set without hardcoding it in JS.DELETE /api/v1/system/logs- Clear log buffer. API key required.GET /api/v1/system/bluetooth- Bluetooth status
See Logging for how structured events are captured into the ring buffer.
Performance
GET /api/v1/performance- Combined performance summaryGET /api/v1/performance/frames- Frame budget statsGET /api/v1/performance/servos- Servo latency statsGET /api/v1/performance/bus- Event bus throughput
WebSocket
Connect to:
The server streams event envelopes containing an event type and serialized
event data. The event bus itself stays unfiltered — every subscriber still
receives every event — but each connection can opt out of event types it
does not care about, so a browser can avoid the high-frequency firehose
(DisplayUpdated, LookRequested, ...) without affecting other clients.
Connect-time filtering (query params)
ws://HOST:8000/api/v1/ws/events?exclude=DisplayUpdated,LookRequested
ws://HOST:8000/api/v1/ws/events?include=StateChanged,EmotionChanged
include wins over exclude when both are given: only the listed event
types are delivered. Both accept a comma-separated list of event type names.
Runtime filter update
After connect, send a JSON message to change the filter (alongside ping):
Either field may be omitted or null to clear it.
Envelope and ping
Example frame:
Sending the literal ping receives pong.
Live microphone stream
A second WebSocket streams RON's microphone audio to the browser, backing the Live View panel's "RON's Ears" card:
The first frame is a text message with the audio format:
or {"error": "no_microphone"} (then the socket closes). Every following frame
is binary: raw signed-16-bit little-endian PCM, frame_ms long. The client
plays them with the Web Audio API. Send the text message "stop" to end the
stream; closing the socket also tears it down. A temporary microphone is
created per connection so the conversation audio loop is never disturbed.
OpenAPI
FastAPI serves its generated OpenAPI document and interactive documentation
when the API is running. The checked-in
../assets/openapi.yaml is the human-maintained
portable specification.
When changing an endpoint, update both the implementation and the checked-in specification.