Storage Endpoints¶
Image storage operations on the Compute Server. All paths are automatically prefixed with compute/ when using R2 storage.
Overview¶
| Method | Endpoint | Description |
|---|---|---|
| GET | /storage/images |
List stored images |
| GET | /storage/images/{path:path} |
Get image (302 redirect to CDN for R2) |
| POST | /storage/images/{path:path} |
Save image to storage |
| DELETE | /storage/images/{path:path} |
Delete image from storage |
| HEAD | /storage/images/{path:path} |
Check if image exists |
Details¶
List Images¶
Returns a list of stored image paths matching the optional prefix filter.
Get Image¶
- R2 backend: Returns a 302 redirect to the CDN URL
- Disk backend: Returns the image content directly via the API
Save Image¶
Saves the uploaded file to storage. Returns the stored path and public URL.
Delete Image¶
Removes the image from storage.
Check Existence¶
Returns 200 if the image exists, 404 otherwise.
Storage Backend¶
The Compute Server selects its storage backend at startup:
| Condition | Backend | Notes |
|---|---|---|
R2_ENDPOINT_URL and R2_ACCESS_KEY_ID configured |
R2ImageStorage | All keys prefixed with compute/ |
| Otherwise | DiskImageStorage | Local filesystem, public URLs via API endpoint |
Path validation prevents directory traversal attacks — absolute paths and .. segments are rejected.
Note: The Backend ingests compute results into its MediaResource system via
MediaResourceService.ingest_from_storage_key(relocate=True), copying files fromcompute/to canonicalmedia/{resource_id}/file.{ext}paths and marking the source for deferred deletion.
API Reference¶
Custom API - Storage 1.0.0¶
This is a very custom OpenAPI schema
Storage¶
GET /api/v1/storage/images¶
List Images
Description
List stored images.
Input parameters
| Parameter | In | Type | Default | Nullable | Description |
|---|---|---|---|---|---|
HTTPBearer |
header | string | N/A | No | JWT Bearer token |
limit |
query | integer | 100 | No | |
prefix |
query | string | No |
Responses
GET /api/v1/storage/images/{path}¶
Get Image
Description
Get image by path. Redirects to CDN when using R2 storage.
Input parameters
| Parameter | In | Type | Default | Nullable | Description |
|---|---|---|---|---|---|
HTTPBearer |
header | string | N/A | No | JWT Bearer token |
path |
path | string | No |
Responses
POST /api/v1/storage/images/{path}¶
Save Image
Description
Save image to storage.
Input parameters
| Parameter | In | Type | Default | Nullable | Description |
|---|---|---|---|---|---|
HTTPBearer |
header | string | N/A | No | JWT Bearer token |
path |
path | string | No |
Request body
Responses
DELETE /api/v1/storage/images/{path}¶
Delete Image
Description
Delete image from storage.
Input parameters
| Parameter | In | Type | Default | Nullable | Description |
|---|---|---|---|---|---|
HTTPBearer |
header | string | N/A | No | JWT Bearer token |
path |
path | string | No |
Responses
HEAD /api/v1/storage/images/{path}¶
Check Image Exists
Description
Check if image exists.
Input parameters
| Parameter | In | Type | Default | Nullable | Description |
|---|---|---|---|---|---|
HTTPBearer |
header | string | N/A | No | JWT Bearer token |
path |
path | string | No |
Responses
Schemas¶
Body_save_image_api_v1_storage_images__path__post¶
| Name | Type | Description |
|---|---|---|
file |
string(binary) |
HTTPValidationError¶
| Name | Type | Description |
|---|---|---|
detail |
Array<ValidationError> |
ValidationError¶
| Name | Type | Description |
|---|---|---|
loc |
Array<> | |
msg |
string | |
type |
string |
Security schemes¶
| Name | Type | Scheme | Description |
|---|---|---|---|
| HTTPBearer | http | bearer |