- Developer home
- Embed editors
- Opening files
Opening files
This page is not yet translated into your language; it is shown in English.
Opening files
By URL: MR Office fetches file.url from its servers over https, from public addresses only, following at most three redirects, within 60 seconds and up to your app's size limit (100 MB by default). Use a short-lived signed URL to your own storage.
By upload: send the bytes from your server, then name the upload in the token within 24 hours.
curl -X POST "https://mroffice.ai/api/v1/embed/files?name=contract.docx" \
-H "Authorization: Bearer $MROFFICE_SECRET_KEY" \
-H "Content-Type: application/octet-stream" \
--data-binary @contract.docx
# → { "upload_id": "…", "size": 48211, "sha256": "…", "expires_at": "…" }
# then put "file": { "key": "contract-42", "name": "contract.docx", "upload_id": "…" } in the tokenVersions and conflicts
The first token for a file key opens the file; later tokens for the same key join the document already open, together, in one collaborative room. If a token names a different file.version than the one open while people are still in it, the session is refused with 409 embed_document_version_conflict (the open sessions keep going); when nobody has it open, the new version replaces our copy. Your callback can answer with your new version so the next tokens match it (see Save callback).
Our copy of a file is kept while it is in use and for 7 days after its last session, with its newest 3 saved versions (the Pro plan keeps everything); then it is deleted. Your server receives every save, so keep each saved file on your side: the next token for a deleted file's key opens your file again, and its version numbers go on. You can delete our copy at once (DELETE /api/v1/embed/documents/{key}), which also ends its sessions. GET /api/v1/embed/documents/{key} tells you its version, whether anyone has it open ("locked") and its last save.