Files
Host: https://file-service.<domain>. Allowed: users, tenant apps and backend services.
Upload
/{folder}file-servicemultipart/form-data with the file in the field file.
- curl
- JavaScript
- Python
- R
curl -s https://file-service.scenid.cloud/documents \
-H "Authorization: Bearer $TOKEN" \
-F "file=@./contract.pdf"
import { openAsBlob } from 'fs'
const form = new FormData()
form.append('file', await openAsBlob('./contract.pdf'), 'contract.pdf')
const response = await fetch('https://file-service.scenid.cloud/documents', {
method: 'POST',
headers: { Authorization: `Bearer ${token}` },
body: form
})
console.log(response.status, await response.json())
import requests
with open("contract.pdf", "rb") as file:
response = requests.post(
"https://file-service.scenid.cloud/documents",
headers={"Authorization": f"Bearer {token}"},
files={"file": file},
)
print(response.status_code, response.json())
library(httr2)
response <- request("https://file-service.scenid.cloud/documents") |>
req_auth_bearer_token(token) |>
req_body_multipart(file = curl::form_file("contract.pdf")) |>
req_error(is_error = \(r) FALSE) |>
req_perform()
resp_status(response)
resp_body_json(response)
Response 201 with the file document, its url and, for images, variants.
folderis one path segment. Private files are stored underfiles/<tenant>/<folder>.- The tenant always comes from the token. You cannot upload into another tenant.
- Images over 2 MB are rejected with
413and an empty body. Other types have no size limit in multipart mode. - Same content (
contentHash) in the same folder returns the existing file with201, and a new file token. The earlier token stops working. - Any other failure returns
500with an empty body. A missing or invalid Bearer token returns401with an empty body.
Areas
The area is chosen by the upload path. Read the concept page for when to use which.
| Area | Upload | Read | Delete |
|---|---|---|---|
| Private | POST /{folder} | GET /{tenantId}/{folder}/{name} | DELETE /{tenantId}/{folder}/{name} |
| Protected | POST /protected/{folder} | GET /protected/{tenantId}/{folder}/{name} | none |
| Public | POST /public/{folder} | GET /public/{tenantId}/{folder}/{name} | none |
Response
201:
{
"_id": "…",
"name": "contract-aB3xYz.pdf",
"originalName": "contract.pdf",
"mimeType": "application/pdf",
"size": 48213,
"encoding": "7bit",
"folder": "documents",
"path": "documents/contract-aB3xYz.pdf",
"contentHash": "<sha256>",
"createdAt": "2026-09-30T08:12:44.000Z",
"createdBy": { "uid": "…", "displayName": "…" },
"url": "https://file-service.scenid.cloud/<tenant>/documents/contract-aB3xYz.pdf?token=<file token>",
"variants": {}
}
urlis the address to read the file, including its file token (?token=). Public and protected uploads answer with the matching/public/…or/protected/…URL.- For images
variantscontains a URL per variant:original,x2048,x1024,x512and the squareavatar-x512,avatar-x256,avatar-x128,avatar-x32. All are WebP files, each with its own token. - File names are generated:
<slugified original name>-<6 characters><extension>.
Raw upload (large files)
POST /{folder}?mode=raw (private area only) takes the file as the request body, up to 500 MB.
| Header | Description |
|---|---|
x-filename | Required. The file name. Without it the call fails with 500 |
Content-Type | The file's type |
curl -s "https://file-service.scenid.cloud/imports?mode=raw" \
-H "Authorization: Bearer $TOKEN" \
-H "x-filename: data.jsonl" \
-H "Content-Type: application/x-ndjson" \
--data-binary @data.jsonl
Raw uploads are not size-limited for images, and no variants are created. Response 201 as above with variants: {}.
Read
/{tenantId}/{folder}/{name}file-serviceQuery: token (file token, required).
| Area | Also required |
|---|---|
| Private | Authorization: Bearer <token> of the same tenant |
| Protected | Query ufaToken=<user session token>. See the ufaToken |
| Public | Nothing |
- curl
- JavaScript
- Python
- R
curl -s -o contract.pdf \
-H "Authorization: Bearer $TOKEN" \
"https://file-service.scenid.cloud/$TENANT_ID/documents/contract-aB3xYz.pdf?token=$FILE_TOKEN"
import { writeFile } from 'fs/promises'
const response = await fetch(fileUrl, { headers: { Authorization: `Bearer ${token}` } })
await writeFile('contract.pdf', Buffer.from(await response.arrayBuffer()))
import requests
response = requests.get(file_url, headers={"Authorization": f"Bearer {token}"})
with open("contract.pdf", "wb") as file:
file.write(response.content)
library(httr2)
response <- request(file_url) |>
req_auth_bearer_token(token) |>
req_perform()
writeBin(resp_body_raw(response), "contract.pdf")
Answers 200 with the file. The Content-Type follows the file extension. No cache headers are set.
| Status | Cause |
|---|---|
401 permission-denied | Wrong tenant, or missing or wrong file token (private) |
401 empty | Missing or invalid Bearer token (private) |
404 | Unknown file (private) |
Delete
/{tenantId}/{folder}/{name}file-servicePrivate area only. Requires the Bearer token of the same tenant and ?token=<file token>. Answers 204.
Deletes only that file. Image variants are separate files and stay.
curl -s -X DELETE \
-H "Authorization: Bearer $TOKEN" \
"https://file-service.scenid.cloud/$TENANT_ID/documents/contract-aB3xYz.pdf?token=$FILE_TOKEN"