Skip to main content
Upload a health document and Mirobody parses it into the Subject’s store. PDFs and images go through OCR; Excel / CSV are parsed structurally into health records. The chat agent then reads uploaded files automatically when it answers.
Uploads are capped at 100 MB per file — larger requests return 413. For big exports or realtime streams, use the WebSocket upload path.

Upload & parse

Response:
The file’s identifier is id (a slash-containing key) — use it as {file_key} in the fetch and list calls below. created_at on the upload response is epoch seconds. The upload response does not include an indicator count or an abstract.
Images and PDFs are OCR’d to text the agent can read; structured-indicator extraction is asynchronous / best-effort. For guaranteed structured data, use POST /v1/data or upload a CSV / Excel file.

List files

data holds the files; subject echoes the Subject. Each item exposes both id and file_key (identical values). created_at is epoch seconds, matching the upload response.

Fetch parsed text

Returns the parsed text for one file — the same content the agent reads:
abstract may be empty (it isn’t generated for every file type).

WebSocket upload

For large exports or realtime capture, wss://…/v1/files/stream uploads over one socket with chunking and progress. Auth rides the query string (browsers can’t set WebSocket headers):
Frame sequence (all JSON text frames):
  1. Server → you: {"type": "connection_established"} — send nothing before this.
  2. You → server: {"type": "upload_start", "messageId": "<batch-id>", "files": [{"filename", "contentType", "size"}]} — one messageId for the whole batch.
  3. You → server, per 256 KB chunk: {"type": "upload_chunk", "messageId", "filename", "chunk": "<base64>", "chunkIndex", "totalChunks"}.
  4. You → server: {"type": "upload_end", "messageId"} → server replies upload_end_response when every file is stored + parsed.
Same 100 MB per-file cap, same Subject isolation, and the stored files are identical to a POST /v1/files upload — list them with GET /v1/files.

Delete a file

Removes the file from the API surface immediately (404 if it isn’t the Subject’s file or is already deleted):
Time-bounded uploads are also removed automatically by retention expiry. To erase everything about a Subject at once, use DELETE /v1/subjects/{user} — see Compliance.