Skip to main content

Private, protected and public files

Every file you upload lands in one of three areas. The area decides who can read the file and what they have to send to get it.

Private (default)ProtectedPublic
Upload toPOST /{folder}POST /protected/{folder}POST /public/{folder}
ReadGET /{tenant}/{folder}/{name}GET /protected/{tenant}/{folder}/{name}GET /public/{tenant}/{folder}/{name}
Reader needsBearer token of the same tenant + file tokenUser session token (ufaToken) + file tokenFile token only. No login
DeleteYesNoNo
Use forDocuments, imports, anything internalFiles shown to signed-in users in a browser: images in dashboards, attachmentsAvatars, logos, images on public pages
Works in <img src>No (needs a header)Yes (tokens in the URL)Yes

Uploading always needs a valid Bearer token of the tenant (user, app or backend service), whatever the area.

Choose the area​

Should anyone with the link be able to see it? -> Public
Should only signed-in users of your tenant see it,
in a browser, e.g. in <img> tags? -> Protected
Is it only for your servers and apps (Bearer token)? -> Private

Not sure? Use private. It is the safest and the default.

The URL you get back​

Every upload answers with the file and a ready-to-use url:

{
"name": "contract-aB3xYz.pdf",
"originalName": "contract.pdf",
"mimeType": "application/pdf",
"size": 48213,
"folder": "documents",
"path": "documents/contract-aB3xYz.pdf",
"contentHash": "…",
"createdAt": "2026-09-30T08:12:44.000Z",
"url": "https://file-service.scenid.cloud/5b8c1f0e/documents/contract-aB3xYz.pdf?token=9f2c…",
"variants": {}
}

The URL contains the tenant, folder, generated file name and a file token (?token=…). Store the url as returned. Do not build it yourself.

For images, Scenid also creates WebP variants, each with its own URL and token:

VariantDescription
originalThe image converted to WebP
x2048, x1024, x512Scaled, aspect ratio kept
avatar-x512, avatar-x256, avatar-x128, avatar-x32Square crops
const { result } = await files.upload('public/avatars', fromDisk('./anja.png'))
const thumbnail = result.variants['avatar-x128'] // a full URL, ready for <img src>

Use the variant URLs as returned. The token of the original file does not work for a variant.

The two tokens​

The file token: token​

  • Belongs to one file. Nothing else can be opened with it.
  • Is created at upload and is part of the url (and of every variant URL).
  • Has no expiry, is not a login and carries no user. It works like a secret link.
  • Is sent as the query parameter ?token=…. There is no header for it.
  • Every read needs it, in all three areas. That is also true for "public": public means no login is required, not guessable.
Treat file URLs like passwords

Anyone who has a URL with its token can read that file (public: without login). Do not put private file URLs in places you do not control, and use the private area for sensitive files.

Re-uploading identical content to the same folder does not store the file twice. It answers 201 with the existing file and a new token, and the token issued before stops working. Always use the newest url you received.

The ufaToken: proof of a signed-in user (protected files)​

The protected area adds a second requirement: the reader must prove they are a signed-in user of Scenid Cloud. That proof is the ufaToken.

What it isA short-lived signed token (a JWT) for a user session. It carries the tenant and the user id
LifetimeOne hour
How it is sentAs the query parameter ?ufaToken=…, together with ?token=…
Why in the URLBrowsers cannot send headers for <img>, <video> or <a href>. A token in the URL lets them load protected files
Who gets oneUsers signed in to a Scenid Cloud web app. The sign-in returns the ufaToken next to the access token
Who does notApps that authenticate with a service key (client_credentials) and the OpenID Connect login flow of your own apps do not receive a ufaToken today, and the SDK has no call for it. The upload response does not include one either

So the complete URL to read a protected file in a browser looks like this:

https://file-service.scenid.cloud/protected/5b8c1f0e/insights-media/chart-x512-aB3xYz.webp
?token=<file token>
&ufaToken=<user session token>

Scenid's own web apps store the ufaToken in the browser next to the session and add it to protected URLs when they render them, so the stored url (with only the file token) stays valid for good, while the ufaToken is always fresh:

const withUfaToken = (url, ufaToken) => `${url}${url.includes('?') ? '&' : '?'}ufaToken=${ufaToken}`

What this means for your integration:

  • Server-side code that reads files: use the private area with a Bearer token. It works with a service key.
  • Public assets for websites and mails: use the public area.
  • Protected files are meant for Scenid's own signed-in web apps. If you build a browser app that needs them, contact Scenid about how your app gets a ufaToken.
Keep the ufaToken out of logs

A token in a URL ends up in server logs, browser history and Referer headers. It expires after an hour, which limits the damage, but do not paste URLs containing it into tickets or chats.

Reading files​

Private​

Send a Bearer token of the same tenant and the file token:

curl -s -o contract.pdf \
-H "Authorization: Bearer $TOKEN" \
"https://file-service.scenid.cloud/5b8c1f0e/documents/contract-aB3xYz.pdf?token=$FILE_TOKEN"

A Bearer token of another tenant is refused.

Public​

No header. The file token in the URL is enough, so it works in a browser:

<img src="https://file-service.scenid.cloud/public/5b8c1f0e/branding/logo-aB3xYz-x512.webp?token=…" alt="Logo">

Protected​

Add the ufaToken (see above):

<img src="https://file-service.scenid.cloud/protected/5b8c1f0e/insights-media/chart-aB3xYz-x512.webp?token=…&ufaToken=…" alt="Chart">

Uploading to an area​

With the SDK, choose the area by prefixing the folder:

import sdk, { fromDisk } from '@scenid/cloud-sdk'

const files = sdk.asAdmin().Files()

await files.upload('documents', fromDisk('./contract.pdf')) // private
await files.upload('protected/attachments', fromDisk('./plan.pdf')) // protected
await files.upload('public/branding', fromDisk('./logo.png')) // public

With REST, use the matching path, see Files REST reference.

Delete​

Only private files can be deleted, one file at a time, with the Bearer token and the file token:

curl -s -X DELETE \
-H "Authorization: Bearer $TOKEN" \
"https://file-service.scenid.cloud/5b8c1f0e/documents/contract-aB3xYz.pdf?token=$FILE_TOKEN"

Answers 204. Image variants are separate files and are not deleted with the original.

Errors​

SituationResponse
Upload without a valid Bearer token401, empty body
Private read or delete with a token of another tenant401 permission-denied
Missing or wrong file token (private)401 permission-denied
Unknown file (private)404
Image larger than 2 MB (multipart upload)413
Any other upload failure500, empty body

There is no 403: access problems are 401.

Summary​

To read a … file you sendBearer token?token=?ufaToken=
privateyes (same tenant)yesno
protectednoyesyes
publicnoyesno