Skip to content

Headers

Authentication, actor attribution, and permission context headers for the LoonFS HTTP API.

This page explains the shared HTTP headers used across the LoonFS API for authentication, actor attribution, and permission checks.

LoonFS doesn’t manage user logins or group memberships. Your application authenticates your users, authenticates itself to LoonFS with a bearer token, and tells LoonFS on each request who is acting and which permissions apply. Each endpoint page in the API reference lists which of these headers the endpoint requires, and its curl examples include them.

Include your deployment’s bearer token on every request:

HTTP
Authorization: Bearer <your-token>

The bearer token authenticates your application to the LoonFS server. It authorizes your application to call the API, while per-user access inside a namespace is controlled by the request context header described below.

Include Loonfs-Actor on writes and upload-session requests to identify the user or background job responsible for the request:

HTTP
Loonfs-Actor: user_123

Use a stable, opaque ID from your application (1 to 256 printable ASCII characters) rather than an email address or display name, because emails and display names can change. LoonFS records this ID as created_by on namespaces and forks, records it as committed_by on commits, and checks that every call in an upload session uses the same actor ID that started the session.

Loonfs-Actor is for audit attribution and upload ownership, not authorization. It doesn’t grant permissions on its own, which lets a trusted backend job record a worker ID (such as Loonfs-Actor: document-importer) alongside Loonfs-Context: service, or lets a user request check grants across multiple group principals while attributing the commit to one user ID.

Every request that reads or modifies a namespace’s contents must include one of two context headers:

  • Loonfs-Principals: checks file and folder permissions against the combined grants for the listed principals.
  • Loonfs-Context: service: bypasses per-user permission checks and uses the bearer token’s full authority.

If a request includes both headers, or omits both on an endpoint that requires a context header, LoonFS returns invalid_request.

Send a comma-separated list of opaque principal IDs (with no spaces) for the user and any groups the user belongs to:

HTTP
Loonfs-Principals: user_123,team_design

LoonFS evaluates permissions using the combined grants for every principal in the header. The server caps how many principals one request can include via access.max_principals_per_request (64 by default on the reference server). See Permissions for how grants and folder inheritance work.

For trusted backend work such as indexing, migrations, or administrative jobs, send:

HTTP
Loonfs-Context: service

The value must be lowercase service. Warning: never let an untrusted client set Loonfs-Context: service, because this header skips all per-user permission checks. The curl examples in the API reference use Loonfs-Context: service to keep the examples short, so replace that header with Loonfs-Principals when forwarding requests for a user.

A write made on behalf of a user includes all three headers together:

HTTP
Authorization: Bearer <your-token>
Loonfs-Actor: user_123
Loonfs-Principals: user_123,team_design

For a trusted service write, keep Loonfs-Actor (for example, Loonfs-Actor: document-importer) and replace Loonfs-Principals with Loonfs-Context: service.

OperationLoonfs-ActorLoonfs-Principals or Loonfs-Context
Create namespaceRequiredIgnored
Commits, merges, replays, forks, and rebase forksRequiredRequired (one)
All upload-session endpointsRequiredRequired (one)
Reads, downloads, trash, and searchNot requiredRequired (one)
Delete namespace, snapshots, changes, diffs, and merge rangesNot requiredRequired (one)
Get namespace and get capabilitiesNot requiredIgnored

When you use Loonfs-Principals, namespace-level operations such as forking, deleting a namespace, and managing snapshots require the admin right on the root folder.

Send Content-Type: application/json for JSON request bodies and Content-Type: application/octet-stream for raw file bytes on service-proxied uploads.

When uploading or downloading directly through a presigned object-storage URL returned by LoonFS, use the exact HTTP method and headers returned in that presigned response. Warning: don’t forward your Authorization token or Loonfs-* headers to a presigned object-storage URL, because those headers leak credentials to the storage provider and can invalidate the presigned signature.

Headers specific to one endpoint, such as Range for partial file reads, are documented on that endpoint’s page.

When you retry a commit with the same commit ID (commit_id), send the same Loonfs-Actor, context header, and request body. Reusing a commit_id with a different actor returns commit_id_reuse_conflict because the actor ID is part of the commit’s semantic fingerprint. Every request in an upload session must also use the same Loonfs-Actor that opened the session, so store the actor and context alongside any saved retry state.

Header names are case-insensitive, while header values are case-sensitive (for example, Loonfs-Context must be lowercase service).