Folders

Organize a tenant's assets into a folder tree, and create, rename, move, or delete folders through the API.

Folders organize your tenant's files into a tree, the same way folders work on a filesystem. Every asset lives in a folder; if you don't specify one at upload, it goes to the tenant root. The folder a file sits in also shapes its delivery path: https://storage.revenexx.com/{tenant}/{folder}/{file}.

All folder calls go through the gateway at https://api.revenexx.com/v1/storage with the auth headers.

Create a folder

A folder has a name. Pass parent_id to nest it under another folder; omit it to create the folder at the tenant root.

Bash
curl -X POST https://api.revenexx.com/v1/storage/folders \
  -H "X-Revenexx-Api-Key: <API_KEY>" \
  -H "X-Revenexx-Tenant: <TENANT_SLUG>" \
  -H "Content-Type: application/json" \
  -d '{ "name": "product-images", "parent_id": "<PARENT_FOLDER_ID>" }'

The response includes the folder id. Use it as folder_id when you upload a file or move one.

List folders

Bash
curl https://api.revenexx.com/v1/storage/folders \
  -H "X-Revenexx-Api-Key: <API_KEY>" \
  -H "X-Revenexx-Tenant: <TENANT_SLUG>"

Get one folder

Bash
curl https://api.revenexx.com/v1/storage/folders/<FOLDER_ID> \
  -H "X-Revenexx-Api-Key: <API_KEY>" \
  -H "X-Revenexx-Tenant: <TENANT_SLUG>"

Rename or move a folder

A PATCH renames a folder when you send name, and moves it when you send a new parent_id.

Bash
curl -X PATCH https://api.revenexx.com/v1/storage/folders/<FOLDER_ID> \
  -H "X-Revenexx-Api-Key: <API_KEY>" \
  -H "X-Revenexx-Tenant: <TENANT_SLUG>" \
  -H "Content-Type: application/json" \
  -d '{ "name": "archive", "parent_id": "<NEW_PARENT_ID>" }'

Delete a folder

By default a folder must be empty to delete. To delete a folder and everything inside it, pass recursive=true. System folders can't be deleted.

Bash
curl -X DELETE "https://api.revenexx.com/v1/storage/folders/<FOLDER_ID>?recursive=true" \
  -H "X-Revenexx-Api-Key: <API_KEY>" \
  -H "X-Revenexx-Tenant: <TENANT_SLUG>"

What's next

Was this page helpful?