S3 API
S3 API
The S3-compatible API is rooted at /. Protected S3 routes accept Bearer tokens or AWS SigV4 credentials.
The implemented region is us-east-1.
SigV4 payload digests are checked against the consumed body before control
requests mutate metadata or upload streams are published. This includes a digest
in the authenticated X-Amz-Content-SHA256 query parameter on presigned uploads.
Header and authenticated query digests must both match when both are supplied.
UNSIGNED-PAYLOAD remains supported; it intentionally does not bind the body to a
digest. Object and multipart-part uploads are hashed while streaming.
Authorization
After authentication, each data-plane operation is authorized through a fixed action catalog (s3:ListBucket, s3:GetObject, s3:PutObject, and related actions). Evaluation order is: admin → bucket owner → active resource grant (optional key prefix) → deny. Denied calls return S3 AccessDenied. Grants are managed via the Management API, not via S3 ?acl or ?policy (those remain unsupported). See plan/access-control/access-control.md.
Supported Bucket Operations
| Operation | Request | Notes |
|---|---|---|
| List buckets | GET / |
Admins see all buckets. Members see owned buckets plus any bucket with an active grant. |
| Create bucket | PUT /{bucket} |
Empty body or CreateBucketConfiguration with empty or us-east-1 location. Any authenticated user may create; becomes owner. |
| Head bucket | HEAD /{bucket} |
Requires s3:ListBucket (or owner/admin). |
| Get bucket location | GET /{bucket}?location |
Requires s3:ListBucket (or owner/admin). |
| List objects v1 | GET /{bucket} or GET /{bucket}?list-type=1 |
Requires s3:ListBucket; supports prefix, delimiter, marker, max-keys, encoding-type=url. |
| List objects v2 | GET /{bucket}?list-type=2 |
Requires s3:ListBucket; supports prefix, delimiter, start-after, continuation-token, max-keys, encoding-type=url. |
| Delete bucket | DELETE /{bucket} |
Admin or owner only; not grantable. Requires bucket to be empty. |
| Delete objects | POST /{bucket}?delete (also DELETE /{bucket}?delete) |
Each key authorized for s3:DeleteObject; denied keys are always returned as per-key errors. Quiet mode suppresses only successful <Deleted> entries. AWS clients use POST. |
Supported Object Operations
| Operation | Request | Notes |
|---|---|---|
| Put object | PUT /{bucket}/{key} |
Stores object, computes MD5 ETag, validates checksums when present. |
| Get object | GET /{bucket}/{key} |
Uses http.ServeContent; supports range and conditional behavior. response-content-disposition sets the Content-Disposition response header. |
| Head object | HEAD /{bucket}/{key} |
Same metadata headers as GET without body, including response overrides. |
| Delete object | DELETE /{bucket}/{key} |
Idempotent success for missing objects. |
| Copy object | PUT /{bucket}/{key} with x-amz-copy-source |
Supports copy and content-type replacement via x-amz-metadata-directive. |
Object reads return:
ETagContent-LengthLast-ModifiedContent-Type- configured
Cache-Control - optional
Content-Dispositionselected withresponse-content-disposition.
Object GET and HEAD responses include X-Content-Type-Options: nosniff. FBS preserves the stored Content-Type, including for binary objects. To force a download, add the optional query parameter:
GET /{bucket}/archive.tar.gz?response-content-disposition=attachment%3B%20filename%3D%22archive.tar.gz%22Omitting response-content-disposition leaves normal S3 object-read behavior unchanged. SigV4 clients must include this parameter in the signed query string.
Browser scripts from configured CORS origins can read Content-Disposition. See CORS configuration.
Multipart Uploads
| Operation | Request | Notes |
|---|---|---|
| Create multipart upload | POST /{bucket}/{key}?uploads |
Returns upload ID. |
| Upload part | PUT /{bucket}/{key}?partNumber={n}&uploadId={id} |
Part number must be 1 through 10000. |
| Complete multipart upload | POST /{bucket}/{key}?uploadId={id} |
Requires XML part list in ascending order. |
| Abort multipart upload | DELETE /{bucket}/{key}?uploadId={id} |
Deletes metadata and uploaded part files. |
Completion validates:
- All requested part numbers exist.
- Requested ETags match stored part ETags.
- Parts are strictly ascending with no duplicates.
- Every part except the last is at least 5 MiB by default.
Multipart ETags use the standard MD5-of-part-MD5s format with a -{part_count} suffix.
Completion supports If-Match and If-None-Match against the current object. A failed condition returns 412 PreconditionFailed, or 404 NoSuchKey when If-Match names a missing key. The upload remains active with its parts intact, and the existing object is unchanged. Clients can abort the upload or retry completion once the condition is satisfied. Each retry checks the current object again; failed assembly files are discarded.
Destination Write Conditions
PUT and CopyObject accept destination If-Match and If-None-Match conditions.
The condition check and replacement occur in the same SQLite write transaction.
A rejected condition returns 412 PreconditionFailed; If-Match on a missing
object returns 404 NoSuchKey. A failed write discards its new backing file and
preserves the existing object. The path returned by the transaction identifies
the version actually replaced, so concurrent writes clean up the correct file.
Delimited listings count Unicode characters consistently with SQLite and include the entire delimiter when forming a common prefix.
Checksums
Put object and upload part compute MD5 while streaming. The computed MD5 hex string is stored as the object or part ETag.
The server validates these request headers when present:
Content-MD5X-Amz-Content-SHA256, exceptUNSIGNED-PAYLOADx-amz-checksum-sha1x-amz-checksum-sha256x-amz-checksum-crc32x-amz-checksum-crc32cx-amz-checksum-crc64nvme
Invalid digest encoding returns an S3 digest error. Checksum mismatch rejects the upload before metadata commit and deletes the new backing file.
Multi-object delete requires a signed digest:
Content-MD5, orX-Amz-Content-SHA256with a real SHA-256 payload hash.
Unsigned delete digests are rejected.
Bucket Name Rules
Bucket names must:
- Be 3 to 63 characters.
- Be lowercase.
- Use only lowercase letters, digits,
-, and.. - Start and end with a letter or digit.
- Not look like an IP address.
- Not contain
..,.-, or-.. - Not be
public, which is reserved for signed public read URLs.
Share links are served from /s/{code}. That path cannot collide with a bucket, because s is shorter than the 3-character minimum, so share links need no reserved bucket name.
Object Key Rules
Object keys must:
- Be non-empty.
- Be at most 1024 bytes.
- Be valid UTF-8.
- Not start with
/. - Not equal
.or... - Not contain null bytes, newlines, carriage returns, or path traversal segments.
Keys may contain /. The final object backing filename is still an opaque UUID path; the key is stored in metadata.
Listing
max-keys defaults to 1000 and is capped at 1000.
ListObjectsV2 continuation tokens are base64 URL encoding of the last returned cursor key. Tokens longer than 1500 characters, or decoded keys longer than 1024 bytes, are rejected.
When delimiter is present, keys are grouped into common prefixes at the first delimiter after the requested prefix.
encoding-type=url URL-encodes keys, prefixes, delimiters, markers, and start-after values in list responses.
Unsupported S3 Features
Requests for these features currently return S3-style not-implemented behavior:
- ACL operations.
- Bucket CORS and policy operations through S3 routes.
- Bucket versioning.
- Object version IDs in copy source.
- Listing active multipart uploads through bucket-level
?uploads. - Operations not listed above.