Management API
Management API
The Management API is a JSON API under /api/management. Most routes require authentication and the admin role. Grant administration and ownership transfer also allow the bucket owner. Listing one's own grants (GET /grants/me) requires only authentication. Responses use Cache-Control: no-store.
Errors use this shape:
{
"error": {
"code": "invalid_request",
"message": "message"
}
}Common error codes are:
invalid_requestnot_foundunauthorizedforbiddeninternal_error
Authentication Errors
Missing credentials return 401 and set:
WWW-Authenticate: Bearer realm="fbs"Malformed, invalid, or unsupported credentials return 401. Inactive users or callers without the required role return 403.
Resource Grants (mini-IAM)
Normalized resource grants are the sharing model for S3 data-plane access. They are not AWS IAM policies, bucket policies, or ACLs. See plan/access-control/access-control.md.
List grants on a bucket (admin or owner):
GET /api/management/buckets/{bucket}/grantsCreate grants (admin or owner). One row is created per action. The request is atomic: either every action is stored or, on any failure, nothing changes. An action that already has an active grant with the same grantee and prefix is not duplicated; the response returns the existing grant for it:
POST /api/management/buckets/{bucket}/grants
Content-Type: application/json
{
"grantee_user_id": "user-uuid",
"actions": ["s3:GetObject", "s3:ListBucket"],
"key_prefix": "docs/",
"note": "optional label"
}Alternatively identify the grantee with grantee_access_key_id (resolved server-side to user id). Grantable actions:
s3:ListBuckets3:GetObjects3:PutObjects3:DeleteObjects3:ListMultipartUploadPartss3:AbortMultipartUpload
s3:CreateBucket and s3:DeleteBucket are not grantable.
Update a grant (prefix, active, note):
PATCH /api/management/buckets/{bucket}/grants/{grantID}Delete a grant:
DELETE /api/management/buckets/{bucket}/grants/{grantID}List my grants:
GET /api/management/grants/meList grants for a user (admin only):
GET /api/management/users/{userID}/grantsTransfer bucket ownership (admin or current owner):
POST /api/management/buckets/{bucket}/transfer-ownership
Content-Type: application/json
{
"new_owner_user_id": "user-uuid"
}Metrics
GET /api/management/metricsReturns:
{
"bucket_count": 1,
"object_count": 12,
"total_object_bytes": 4096,
"user_count": 2,
"active_user_count": 2
}Config Info
GET /api/management/configReturns runtime-safe configuration:
{
"region": "us-east-1",
"dev_mode": false,
"public_base_url": "https://storage.example.com",
"limits": {
"s3_max_keys": 1000,
"s3_delete_objects": 1000,
"management_object_list_limit": 1000,
"management_activity_limit": 500
}
}Buckets
List buckets:
GET /api/management/bucketsGet one bucket:
GET /api/management/buckets/{bucket}Delete a bucket and all objects:
DELETE /api/management/buckets/{bucket}Empty a bucket but keep the bucket:
POST /api/management/buckets/{bucket}/emptyBucket summaries include:
nameowner_idcreated_atobject_counttotal_object_bytes
Management bucket deletion removes the bucket and its object metadata in one database transaction, then removes the captured backing files. If any multipart upload remains, in any state, it returns HTTP 409 with bucket_has_multipart_uploads before deleting objects or files. Complete or abort pending uploads before retrying; stale failed uploads follow the normal multipart cleanup lifecycle. The multipart check and metadata deletion share the database write lock, including against concurrent upload creation. After commit, file cleanup uses an independent five-second context and attempts every captured path. The five-second budget covers the whole cleanup, not each file; deadline exhaustion can leave remaining paths for reconciliation. Errors report the failed-file count and the first failure. Postcommit activity writes use a separate five-second context that ignores client cancellation. A cleanup error returns HTTP 500 after metadata has been deleted; remaining orphan files are removed by startup reconciliation.
Objects
List objects:
GET /api/management/buckets/{bucket}/objects?prefix=&delimiter=&cursor=&limit=100Parameters:
prefix: optional key prefix.delimiter: optional grouping delimiter.cursor: last key cursor from a previous response.limit: positive integer, default 100, capped at 1000.
Response:
{
"bucket": "photos",
"prefix": "",
"delimiter": "/",
"limit": 100,
"is_truncated": false,
"next_cursor": "",
"objects": [],
"common_prefixes": ["2026/"]
}Get object metadata:
GET /api/management/buckets/{bucket}/objects/{key}Object metadata includes:
keybucketsizeetagcontent_typecreated_atupdated_at
Signed Public Object URLs
Create a signed public URL:
POST /api/management/buckets/{bucket}/objects/{key}/public-url
Content-Type: application/json
{
"expires_in_seconds": 3600,
"response_content_disposition": "attachment; filename=\"image.jpg\""
}This endpoint requires FBS_PUBLIC_READ_SIGNING_SECRET or --public-read-signing-secret. If signing is not configured, it returns 503.
If expires_in_seconds is omitted, the configured default public read TTL is used. The requested TTL must be positive and no larger than the configured max TTL.
response_content_disposition is optional. If you omit it, FBS does not set Content-Disposition. Set it to a valid value such as attachment; filename="image.jpg" to force a download. The URL signature covers the value. Changing or adding the value later invalidates the URL.
Response:
{
"url": "https://storage.example.com/public/photos/a.jpg?expires=...&response-content-disposition=...&signature=...",
"expires_at": "2026-05-17T12:00:00Z",
"cache_control": "public, max-age=3600, must-revalidate"
}Public reads are served from:
GET /public/{bucket}/{key}?expires={unix_seconds}&signature={hex_hmac}[&response-content-disposition={value}]
HEAD /public/{bucket}/{key}?expires={unix_seconds}&signature={hex_hmac}[&response-content-disposition={value}]Public read URLs do not use Bearer or SigV4 auth. They require exactly one expires and signature parameter, and may include one response-content-disposition parameter. The signature covers that optional value.
Public object GET and HEAD responses preserve the stored Content-Type and include X-Content-Type-Options: nosniff.
Share Links
Share links are short, revocable URLs such as https://storage.example.com/s/x7Kp2mQa9Z that serve an object directly. They are an fbs extension, not part of the S3 API, and they do not need FBS_PUBLIC_READ_SIGNING_SECRET. These endpoints require the admin role.
Create a share link:
POST /api/management/share-links
Content-Type: application/json
{
"bucket": "videos",
"key": "2026/clip.mp4",
"alias": "clip-2026",
"expires_in_seconds": 604800,
"response_content_disposition": "inline; filename=\"clip.mp4\""
}bucketandkeyare required, and the object must exist.aliasis optional. Without it, fbs generates a random 10-character base62 code. An alias must be 3–64 letters, digits,-or_, starting with a letter or digit. Aliases are easy to remember and therefore easy to guess, so use random codes for anything private. A taken alias returns409.expires_in_secondsis optional. Without it, the link does not expire until revoked.response_content_dispositionis optional and is sent asContent-Dispositionon every read.
Response (201):
{
"code": "clip-2026",
"url": "https://storage.example.com/s/clip-2026",
"bucket": "videos",
"key": "2026/clip.mp4",
"response_content_disposition": "inline; filename=\"clip.mp4\"",
"created_by": "user-id",
"expires_at": "2026-10-09T12:00:00Z",
"created_at": "2026-10-02T12:00:00Z"
}expires_at is null for links without an expiry.
List share links, optionally for one bucket:
GET /api/management/share-links[?bucket={bucket}]Revoke a share link:
DELETE /api/management/share-links/{code}Share links are served from:
GET /s/{code}[/{filename}]
HEAD /s/{code}[/{filename}]The response is the object itself, not a redirect, so chat apps such as Discord unfurl it as direct media. It keeps the stored Content-Type and supports Range and conditional requests, which video players need for seeking. The optional trailing {filename} is ignored. It only lets a link end in a name like clip.mp4.
Reads send Cache-Control: public, max-age=0, must-revalidate, so caches revalidate and revocation takes effect quickly. Services that already copied the media, such as Discord's media proxy, may keep showing it.
A share link points at bucket + key, not at a fixed object version:
- Overwriting the key makes the link serve the new content.
- Deleting the object makes the link return
404. - Deleting the bucket deletes its share links.
- On every read, fbs checks that the link's creator is still an active user with read access to the object. Deactivating or deleting the creator disables their links.
Unknown, expired, revoked, and unauthorized links all return 404 with Cache-Control: no-store, so codes cannot be probed.
Keys
List keys:
GET /api/management/keysCreate a key:
POST /api/management/keys
Content-Type: application/json
{
"display_name": "CI uploader",
"role": "member"
}role is optional and defaults to member. Valid roles are admin and member.
Create response includes the raw Bearer token and SigV4 secret key once:
{
"key": {
"id": "...",
"display_name": "CI uploader",
"access_key_id": "fbsa_...",
"sigv4_access_key_id": "fbsv4_...",
"role": "member",
"is_active": true,
"created_at": "...",
"updated_at": "..."
},
"bearer_token": "fbsa_....secret",
"sigv4": {
"access_key_id": "fbsv4_...",
"secret_key": "..."
}
}Patch a key:
PATCH /api/management/keys/{id}
Content-Type: application/json
{
"display_name": "CI uploader renamed",
"is_active": true
}At least one field is required. display_name must be non-empty. is_active must be boolean.
Delete a key:
DELETE /api/management/keys/{id}Activity
List activity:
GET /api/management/activity?bucket=&action=&limit=100Parameters:
bucket: optional bucket filter.action: optional action filter.limit: positive integer, default 100, capped at 500.
Activity is recorded for bucket creation/deletion, object writes/deletes/copies, multipart completion, bucket emptying, forced bucket deletion, and batch delete operations.