REST API Reference

Storage Endpoints

Direct HTTP endpoint specifications for managing media, generating presigned S3/R2 upload tickets, and querying file trees.

POST

/api/storage/presign

Generates a time-limited S3 presigned PUT URL allowing clients to stream directly to Cloudflare R2 storage.

Request
curl -X POST https://cloudizero.wismannur.pro/api/storage/presign \
  -H "Authorization: Bearer cz_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "projectId": "ca2454ff-7f1e-421b-b134-4c800f6d58de",
    "fileName": "avatar.png",
    "mimeType": "image/png",
    "fileSize": 1048576,
    "folderId": null
  }'
Response (200 OK)
{
  "presignedUrl": "https://<account-id>.r2.cloudflarestorage.com/<bucket>/<r2Key>?X-Amz-...",
  "r2Key": "ca2454ff-7f1e.../172873..._avatar.png"
}
POST

/api/storage/record

Registers the uploaded asset into the relational Neon Postgres database after the client finishes streaming to R2.

Request
curl -X POST https://cloudizero.wismannur.pro/api/storage/record \
  -H "Authorization: Bearer cz_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "projectId": "ca2454ff-7f1e-421b-b134-4c800f6d58de",
    "r2Key": "ca2454ff-7f1e.../172873..._avatar.png",
    "fileName": "avatar.png",
    "fileSize": 1048576,
    "mimeType": "image/png",
    "folderId": null
  }'
GET

/api/storage/list

Fetches all files, virtual folders, and navigation breadcrumbs for a given projectId.

Request
curl -X GET "https://cloudizero.wismannur.pro/api/storage/list?projectId=ca2454ff-7f1e-421b-b134-4c800f6d58de" \
  -H "Authorization: Bearer cz_live_..."