All HTTP endpoints are served by the FastAPI sidecar on port 8010. Public endpoints (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/GustavoNightmare/InformacionMuseo/llms.txt
Use this file to discover all available pages before exploring further.
/tts/*, /qr/*) require the ?key=<TTS_API_KEY> query parameter. Internal endpoints (/internal/*) require the X-API-Key: <MUSEO_API_KEY> header. Debug endpoints require no authentication.
GET /health
Returns the service status and the configured Edge TTS voice. No authentication required. Use this endpoint for readiness probes in Docker Compose or a load balancer.200 OK
Always
true when the service is running.Fixed identifier string
"museo-tts".Active Edge TTS voice, as set by
EDGE_TTS_VOICE (default: es-CO-GonzaloNeural).POST /internal/species/sync
Pre-generates all three narration-style MP3 files (ficha, narrativo, corto) for a species and registers its QR mapping. Called by the Flask app after every species create or edit operation.
Authentication: X-API-Key: <MUSEO_API_KEY> header.
Request Body — SpeciesSyncRequest
Canonical identifier for the species. Must match
^[A-Za-z0-9_-]+$. Used as the audio directory name under AUDIO_CACHE_DIR/species/.QR code value printed on the physical exhibit label. If
null, defaults to species_id internally. Must match ^[A-Za-z0-9_-]+$.Common name of the species (e.g.,
"Cóndor Andino").Scientific/Latin name (e.g.,
"Vultur gryphus").Main description text for the species.
Natural habitat description.
Diet or feeding description.
Interesting facts. Accepts a string, a JSON-encoded string, a list of strings, or a dict of values. All formats are normalised into a list of sentences before TTS synthesis.
200 OK
true on success.Canonical species ID as stored.
QR ID registered in
_qr_index.json.List of styles for which MP3 files were generated:
["ficha", "narrativo", "corto"].Map of
style → absolute file path for each generated MP3.| Status | Detail | Cause |
|---|---|---|
400 | invalid_species_id | species_id fails regex or is empty |
400 | invalid_qr_id | qr_id fails regex |
401 | unauthorized | Missing or wrong X-API-Key header |
422 | empty_tts_text_<style> | All species fields empty; nothing to synthesise |
500 | tts_generation_error: … | Edge TTS call failed |
POST /internal/species/delete
Removes a species’ audio directory and clears all its QR index entries. Called by the Flask app when a species is deleted. Authentication:X-API-Key: <MUSEO_API_KEY> header.
Request Body — SpeciesDeleteRequest
Species to delete. Must be non-empty.
Optional explicit QR ID to also remove from the index. If
null, only entries pointing to species_id are removed.200 OK
| Status | Detail | Cause |
|---|---|---|
400 | invalid_species_id | species_id is blank after sanitisation |
401 | unauthorized | Missing or wrong X-API-Key header |
GET /tts/by-qr/
Serves a pre-generated MP3 file for the species associated with the given QR ID. The audio must have been pre-generated by/internal/species/sync beforehand; this endpoint does not synthesise audio on the fly.
Authentication: ?key=<TTS_API_KEY> query parameter.
Parameters
The QR code value from the exhibit label. Must match
^[A-Za-z0-9_-]+$. Resolved through _qr_index.json to find the species audio directory.Narration style to serve. One of
ficha, narrativo, corto. Defaults to ficha.Your
TTS_API_KEY.200 OK — audio/mpeg
Binary MP3 stream with the following response headers:
The
qr_id that was resolved.The narration style that was served (
ficha, narrativo, or corto).The resolved
species_id whose audio directory was used.| Status | Detail | Cause |
|---|---|---|
400 | invalid_qr_id | qr_id path segment fails regex |
400 | invalid_style | style is not one of the three allowed values |
401 | unauthorized | Missing or wrong key param |
404 | species_audio_not_found | QR ID not in index and no matching species directory |
404 | pregenerated_audio_not_found | Species exists but MP3 for requested style not yet generated |
POST /tts/from-text
Synthesises speech from arbitrary text on demand using Edge TTS. The result is returned directly and not cached. Useful for prototyping or generating one-off audio clips. Authentication:?key=<TTS_API_KEY> query parameter.
Request Body — TextToTTSRequest
Plain text to synthesise. HTML tags are stripped automatically. Must be non-empty after cleaning.
200 OK — audio/mpeg
Binary MP3 stream with the following response headers:
Edge TTS voice used for synthesis (from
EDGE_TTS_VOICE).Length in characters of the cleaned input text.
| Status | Detail | Cause |
|---|---|---|
400 | empty_text | text is blank after HTML-tag stripping |
401 | unauthorized | Missing or wrong key param |
500 | tts_generation_error: … | Edge TTS synthesis call failed |
POST /qr/resolve-frame
Accepts a raw JPEG image, runs QR detection, and returns the matching species text and audio URL. Use this when you need the species metadata without immediately streaming audio — for example to display species information in a UI before playing sound. Authentication:?key=<TTS_API_KEY> query parameter.
The detection pipeline tries four strategies in sequence, stopping at the first success:
- Color — direct detection on the original BGR image
- Grayscale — convert to single-channel and retry
- Otsu threshold — binarise with Otsu’s method and retry
- 2× upscale — resize grayscale image by 2× (cubic interpolation) and retry
Parameters
Narration style for the returned
text field. One of ficha, narrativo, corto. Defaults to ficha.Your
TTS_API_KEY.Content-Type: image/jpeg).
Response 200 OK — QR found
true when a valid QR code was detected and the species was resolved.Raw QR code string decoded from the image.
Canonical species ID resolved from the QR index.
Narration text built from species fields in the requested
style.Full URL to retrieve the pre-generated MP3 via
GET /tts/by-qr/{qr_id}.Cleaned and normalised species fields used to build the narration text.
Which detection strategy succeeded:
color, grayscale, threshold_otsu, or upscaled_gray.Path to retrieve the saved debug frame via
/debug/last-frame.404 — QR not found
| Status | Detail | Cause |
|---|---|---|
400 | empty_image | Request body is empty |
401 | unauthorized | Missing or wrong key param |
404 | qr_not_found_in_frame | No QR code detected after all four strategies |
POST /tts/from-frame
Combines QR detection and audio delivery into a single request. Accepts a raw JPEG image, detects the QR code, and streams back the pre-generated MP3 for the identified species. Ideal for embedded clients (e.g., ESP32-CAM) that need audio with the fewest round-trips. Authentication:?key=<TTS_API_KEY> query parameter.
Parameters
Narration style for the served MP3. One of
ficha, narrativo, corto. Defaults to ficha.Your
TTS_API_KEY.Content-Type: image/jpeg).
Response 200 OK — audio/mpeg
Binary MP3 stream. Response headers are identical to GET /tts/by-qr/{qr_id}:
Detected QR ID.
Narration style served.
Resolved species ID.
| Status | Detail | Cause |
|---|---|---|
400 | empty_image | Request body is empty |
401 | unauthorized | Missing or wrong key param |
404 | qr_not_found_in_frame | No QR code detected in image |
404 | pregenerated_audio_not_found | QR resolved but MP3 for style not generated yet |
GET /debug/view
Renders a browser-viewable HTML page displaying the last received JPEG frame alongside the currentLAST_DEBUG_INFO status JSON. The page auto-refreshes every 3 seconds via <meta http-equiv="refresh">. No authentication required.
GET /debug/last-frame
Returns the most recently received JPEG frame saved toDEBUG_FRAMES_DIR/last_frame.jpg. No authentication required.
200 OK — image/jpeg
Raw JPEG bytes of the last processed frame.
Errors
| Status | Detail | Cause |
|---|---|---|
404 | no_debug_frame_yet | No frame has been received since service start |
GET /debug/last-status
Returns the in-memory debug state as JSON, reflecting the outcome of the most recent frame processed by/qr/resolve-frame, /tts/from-frame, or the WebSocket stream. No authentication required.
200 OK
QR code string decoded from the last frame, or
"" if none was found.Detection strategy that last ran:
color, grayscale, threshold_otsu, upscaled_gray, or not_found.true if the last frame yielded a valid QR code.Error string from the last failed detection, e.g.,
"qr_not_found_in_frame", or "" on success.Absolute path to the last debug frame file written to
DEBUG_FRAMES_DIR.Unix timestamp (seconds) of the last processed frame.