Skip to Content

Storage

All endpoints require Authorization: Bearer TOKEN.

Create Bucket

POST /api/v1/storage

Body:

{ "name": "my-assets", "project_id": "prj_abc123" }

List Buckets

GET /api/v1/storage

Get Bucket

GET /api/v1/storage/:id

Delete Bucket

DELETE /api/v1/storage/:id

Get Credentials

Returns S3-compatible credentials.

GET /api/v1/storage/:id/credentials

Response: 200

{ "endpoint": "https://s3.espace-tech.com", "access_key_id": "GKxxxxxxxx", "secret_key": "xxxxxxxx", "bucket": "st-myassets-a1b2c3d4", "region": "espace-garage" }

Rotate Credentials

POST /api/v1/storage/:id/rotate
POST /api/v1/storage/:id/link POST /api/v1/storage/:id/unlink

Body:

{ "project_id": "prj_abc123" }

Injects S3_ENDPOINT, S3_ACCESS_KEY, S3_SECRET_KEY, and S3_BUCKET into the project.

Expose / Unexpose

Make bucket publicly accessible or restrict access.

POST /api/v1/storage/:id/expose POST /api/v1/storage/:id/unexpose

Presigned Upload URL

Generate a time-limited URL for client-side uploads.

POST /api/v1/storage/:id/presign/upload

Body:

{ "key": "uploads/photo.jpg", "content_type": "image/jpeg", "expiry": 3600 }

Response: 200

{ "upload_url": "https://s3.espace-tech.com/bucket/key?X-Amz-Signature=...", "expires_in": 3600 }

Presigned Download URL

Generate a time-limited URL for accessing private files.

POST /api/v1/storage/:id/presign/download

Body:

{ "key": "images/photo.jpg", "expiry": 3600 }

Response: 200

{ "download_url": "https://s3.espace-tech.com/bucket/key?X-Amz-Signature=...", "expires_in": 3600 }

Presigned URLs can be used directly in browsers (<img>, <video>, fetch) — no authentication headers needed.