Files: storage rules
Section titled “Files: storage rules”This page is for developers who upload, attach and serve files through the API. It explains the rules behind those calls: how long a file lives, what happens when a record that uses it is saved, which files are accepted, how storage limits apply, and how to show a file in a browser without a token.
The calls themselves — upload, attach to a record, download, and their errors — are in Working with files. Start there.
How files are held {#how-file—image—document-fields-use-storage}
Section titled “How files are held {#how-file—image—document-fields-use-storage}”A file, image or document field never holds the bytes. It holds the descriptor the upload returned:
{ "id": "5f0e9b2a-…", "name": "invoice.pdf", "mimeType": "application/pdf", "size": 20481 }The id is the file’s handle everywhere: in record values, in downloads and in signed
links. Upload first, then put the descriptor in the record.
Temporary and permanent files
Section titled “Temporary and permanent files”Temporary (?temp=true) | Permanent (the default) | |
|---|---|---|
| Lifetime | Deleted automatically after one day, unless a save keeps it | Kept until the platform cleans it up |
| Use it for | A file you are about to attach to a record | A file you manage yourself |
| Download | Same call, same id | Same call, same id |
Upload attachments as temporary files Since 1.10. When you then save a record
that names the file, the platform keeps it: it becomes permanent under the same
id, and the platform records that the record uses it. A temporary file that no save
keeps is gone after a day.
What a save does with files Since 1.10
Section titled “What a save does with files Since 1.10”When a record — or an entity, view, page, report or reaction — is saved with file descriptors in it, the platform checks every file that is new to that record:
- A temporary file is kept and becomes permanent.
- A permanent file is recorded as used by that record.
- A file that no longer exists fails the save (below).
Files the record already held are not checked again, so re-saving an old record never fails because of them.
Errors on save
Section titled “Errors on save”| Status / code | Meaning | What to do |
|---|---|---|
400 FILE_EXPIRED | A file named in the save does not exist — usually a temporary upload older than a day. details lists each file with its field ({fileId, fieldName}) or position ({fileId, path}) and a reason. | Upload the file again and save again. |
503 STORAGE_SERVICE_UNAVAILABLE | File storage could not be reached, and the save adds a new file. A save that adds no new file goes ahead. | Retry with backoff. |
Which files are accepted
Section titled “Which files are accepted”Uploads through the API are checked in three ways:
-
File type, by extension. Files with no extension are refused. By default these extensions are accepted (your operator can change the list):
.jpg .jpeg .png .gif .bmp.txt .csv .pdf .md .rtf .html.doc .docx .xls .xlsx .ppt .pptx .odt .ods .odp.mp3 .mp4 .avi .mov .wmv .flv .mkv .webm .wav .m4a .3gp.psd .ai .indd .xd .fig.css.ttf .otf .woff .woff2.zip .rar -
Content matches the type
Since 1.8. For binary types — images, PDF, Office files, media, Photoshop, fonts, archives — the platform reads the start of the file and refuses it if the content does not match the extension. Text formats (.txt,.csv,.md,.html,.rtf,.css) and some design formats (.ai,.indd,.xd,.fig) are checked by extension only. -
No JavaScript in PDFs
Since 1.8. A PDF that contains a JavaScript action is refused.
| Refusal | Meaning |
|---|---|
400 INVALID_FILE_TYPE | The extension is not accepted, or there is none. |
400 INVALID_FILE_CONTENT | The content does not match the extension. |
400 PDF_JAVASCRIPT_NOT_ALLOWED | The PDF contains JavaScript. |
There is no per-file size limit of the platform’s own; a limit may come from the network in front of your deployment. Downloads are always sent as attachments, never shown as active content.
Storage limits Since 1.10
Section titled “Storage limits Since 1.10”If the tenant’s plan limits storage, an upload is refused with
403 STORAGE_CAP_EXCEEDED when the tenant is already at the limit, or when the
upload would cross it — also part-way through a large upload, in which case the partial
file is removed. details carries capBytes and usedBytes. Temporary files count
too. Retrying does not help; the limit has to be raised for the tenant. How to read the
tenant’s limits is in Plan limits.
Show a file in a browser without a token Since 1.6
Section titled “Show a file in a browser without a token Since 1.6”A browser can load a file with a plain <img src> or link if you give it a short-lived
signed link:
-
Ask for links, with your normal credential, for up to 100 file ids at once:
Terminal window curl -s -X POST "https://acme.example.com/api/storage/v2/files/links" \-H "Authorization: Bearer <access-token>" \-H "Content-Type: application/json" \-d '{"ids": ["5f0e9b2a-…", "a71c…"]}'The answer is
[{ id, url, expiresAt }]. Ids that do not exist are left out silently. Invalid ids (not 1–64 letters, digits,_or-, or more than 100) are refused with400 INVALID_FILE_IDS. -
Use each
urldirectly. It needs no credential and works untilexpiresAt— between one and two hours with the default settings.
What the link answers:
200with the file. Images, video, audio and PDF are sent to display inline; SVG and everything else as a download. Responses are cacheable until the link expires, and a repeat request with the sameETaganswers304. There is no byte-range support, so for seeking in video use the normal download.403 LINK_INVALID(tampered) or403 LINK_EXPIRED;404if the file is gone.503 FILE_LINKS_NOT_CONFIGUREDfrom both calls when your operator has not set links up. Fall back to the normal download.
These refusals use file storage’s own error shape: read the code from
result.details.error, not from error.code (see
Errors from the storage service).
Links for the same file are identical within a signing window, so browsers cache them
across page loads. Request new links shortly before expiresAt.
Missing files answer 404 Since 1.6
Section titled “Missing files answer 404 Since 1.6”A download or signed link for a file whose record exists but whose stored bytes are
gone answers 404, like an unknown id.
Automatic clean-up Since 1.10
Section titled “Automatic clean-up Since 1.10”The platform can delete files that nothing uses any more, but carefully:
- Only files that were kept by a save (uploaded as temporary, then saved) are ever considered. Files uploaded straight to permanent storage are never cleaned up automatically.
- A file is considered only after every record that used it let it go, and a grace period (7 days by default) has passed.
- Every record that ever used the file must confirm it no longer does. Any doubt keeps the file.
- A record keeps every file in its history, so files are not deleted while the record exists.
Your operator decides whether clean-up actually deletes or only reports; the platform ships it in report-only mode.
Downloading a tenant export Since 1.10
Section titled “Downloading a tenant export Since 1.10”A tenant data export (see the backup API) is
downloaded through a single-use link that the platform issues, valid for 5 to 10
minutes, on the tenant’s own host. It needs no credential; the link is the credential.
A used link answers 410 LINK_USED, an expired or altered one 403 LINK_EXPIRED or
403 LINK_INVALID, an unknown export 404 EXPORT_NOT_FOUND. The download is a gzip
archive.
Deleting a package version or an export record keeps its stored file.
Platform 1.10.0 · Backend 1.11.0-alpha.11 · Frontend 1.11.0-alpha.6 · Mobile 1.10.2 · Chart 1.11.8 · Gateway 2.6.11 · MCP 0.2.0 · Grafana DS 1.2.0Docs build 2026-11-27