Storage
Upload, organize, serve and protect files with the storage module, on local disk, Amazon S3 or Google Cloud Storage, including resumable uploads.
The storage module stores files ("objects") and their metadata. Objects can be referenced from bucket properties of type storage, organized into folders, protected with policies and served with HTTP caching.

Objects
{
"_id": "6b0b1b47a5611972c29c2648",
"name": "cover.png",
"content": {"type": "image/png", "size": 29159},
"created_at": "2026-11-28T18:19:51.477Z",
"updated_at": "2026-11-28T18:19:51.477Z",
"url": "https://api.example.com/api/storage/cover.png/view"
}| Field | Description |
|---|---|
name | Unique name. Slashes create folders: images/2026/cover.png. |
content.type | MIME type. |
content.size | Size in bytes. |
url | Where the content can be downloaded. Depends on the storage strategy. |
Upload
curl -X POST https://api.example.com/api/storage \
-H "Authorization: APIKEY <key>" \
-F "files=@cover.png;type=image/png"Both forms accept several files in one request and return an array of objects.
Folders
A folder is an empty object whose name ends with /. Create the folder before uploading into it:
[{"name": "images/", "content": {"type": "", "data": ""}}][{"name": "images/banner.png", "content": {"type": "image/png", "data": "<base64>"}}]Browse a folder with GET /storage/browse?path=images/.
Resumable uploads
Large files and unreliable networks are better served by resumable uploads. Spica implements the tus protocol at /storage/resumable. Send the file name and type as filename and filetype metadata:
import * as tus from "tus-js-client";
const upload = new tus.Upload(file, {
endpoint: "https://api.example.com/api/storage/resumable",
headers: {Authorization: `APIKEY ${key}`},
metadata: {filename: file.name, filetype: file.type},
onProgress: (sent, total) => console.log(`${Math.round((sent / total) * 100)}%`),
onSuccess: () => console.log("Uploaded")
});
upload.start();Unfinished uploads are discarded after --resumable-upload-expires-in milliseconds (two days by default).
Download
/storage/:idOrName/viewThe response streams the content with Content-Type, ETag and caching headers, and supports Range, If-None-Match and If-Modified-Since. Requests need an Authorization header.
curl https://api.example.com/api/storage/cover.png/view -H "Authorization: APIKEY <key>" -o cover.pngGET /storage/:idOrName returns the metadata only.
List, rename, replace and delete
| Endpoint | Action | Purpose |
|---|---|---|
GET /storage | storage:index | List objects. Accepts filter, sort, limit, skip, paginate. |
GET /storage/browse?path= | storage:browse | List one folder. |
PATCH /storage/:id | storage:update | Rename: {"name": "new-name.png"}. |
PUT /storage/:id | storage:update | Replace the content. |
DELETE /storage/:idOrName | storage:delete | Delete one object. |
DELETE /storage | storage:delete | Delete several: body ["<id>", "images/old.png"]. Nothing is deleted unless all are allowed. |
curl -G https://api.example.com/api/storage -H "Authorization: APIKEY <key>" \
--data-urlencode 'filter={"name": "hello.txt"}' --data-urlencode "paginate=true"{"meta": {"total": 1}, "data": [{"_id": "6b0b1b47a5611972c29c264a", "name": "hello.txt", "content": {"type": "text/plain", "size": 11}}]}Access control
Storage endpoints accept identities and API keys. Use policies to control access, down to folders: storage statements match object ids and names, so an exclusion such as private/* hides a folder.
{
"name": "Public Media",
"description": "Everything except the private folder",
"statement": [
{"action": "storage:show", "module": "storage", "resource": {"include": ["*"], "exclude": ["private/*"]}}
]
}To let end users upload files, accept the upload in an HTTP function that checks the user's token and stores the file with an API key.
Storage strategies
Choose where content is kept with --storage-strategy:
| Strategy | Content lives in | Object url | Options |
|---|---|---|---|
default | --persistent-path/--default-storage-path on the API's disk | <default-storage-public-url>/storage/<name>/view | --default-storage-path (relative, default storage), --default-storage-public-url (defaults to --public-url) |
awss3 | An S3 bucket | https://<bucket>.s3.<region>.amazonaws.com/<name> | --awss3-bucket-name, --awss3-credentials-path (optional, otherwise the AWS default credential chain such as EKS IRSA) |
gcloud | A Google Cloud Storage bucket | https://storage.googleapis.com/download/storage/v1/b/<bucket>/o/<name>?alt=media | --gcloud-bucket-name, --gcloud-service-account-path |
With several API replicas, use awss3 or gcloud, or a shared volume, so that every replica sees the same files.
Limits
| Option | Default | Effect |
|---|---|---|
--storage-object-size-limit | 35 | Maximum size of one object in MiB. |
--storage-total-size-limit | Maximum total size of all objects in MB. |
Behind a proxy, also raise the proxy's body size limit. The Helm chart sets nginx.ingress.kubernetes.io/proxy-body-size for this.
Referencing files from buckets
A bucket property of type storage stores the object's URL. In the panel, editors pick or upload the file. Over the API, upload the file first and write its url into the document.