Storage
Base URL: https://storage-api.pcampus.co
Overview
Storage is the object storage service for storing and serving all file types used in the Pcampus ecosystem — from brand assets in Content OS and creative files in Cockpit, to files that customer developers upload through their own apps. It supports CDN delivery so end users receive files quickly.
Who uses this
| Persona | What they do |
|---|---|
| Internal service | Content OS, Cockpit call the API to store assets and retrieve URLs |
| Developer (customer) | Upload and serve files for their own app (user avatars, documents, etc.) |
| End user | Upload a profile picture or document via an app |
| Admin | View storage usage, manage buckets |
Key features
- File upload — Supports direct upload and presigned URL upload (for client-side uploads)
- Bucket management — Buckets are separated by organization and use case (public, private)
- CDN delivery — All public files are served through a global CDN endpoint
- Image transformation — Resize, crop, and compress on-the-fly via URL parameters
- Access control — Public bucket (no auth required) vs. Private bucket (requires a signed URL)
- Usage tracking — Track storage used and bandwidth consumed per org
- File metadata — Store MIME type, file size, tags, and custom metadata
User stories
Content OS (internal):
"When a brand manager uploads a logo, I need it stored and a CDN URL returned for display."
→ Content OS calls POST /storage/upload → receives file_url → stores it in the Content OS DB → renders via CDN URL
Developer (customer):
"I want users to upload profile pictures without the file passing through my backend."
→ POST /storage/presigned-url → receive a presigned URL → client uploads directly to Storage → receive a public URL
Admin:
"I want to see an org's storage usage to check whether it's approaching the limit."
→ Console → Storage → Usage dashboard → see used / limit per bucket
How it works
Direct upload flow:
Presigned URL flow (client-side upload):
Data model
Integration
- Content OS — Stores brand logos, images, and content attachments
- Cockpit — Stores campaign creative files
- PIP — Every upload goes through an access check (
storage.upload,storage.read) - Billing — Sends usage metrics (bytes used, bandwidth) to Billing for calculation
Image transformation
Public images support on-the-fly transformation via URL query params:
# Resize to 400x300
https://cdn.pcampus.co/files/abc123.jpg?w=400&h=300
# Crop (center) and compress
https://cdn.pcampus.co/files/abc123.jpg?w=400&h=300&fit=cover&q=80
# Convert format
https://cdn.pcampus.co/files/abc123.jpg?format=webpAPI overview
| Method | Endpoint | Description |
|---|---|---|
POST | /storage/upload | Upload file directly |
POST | /storage/presigned-url | Get presigned URL for client upload |
GET | /storage/files | List files in org |
GET | /storage/files/:id | Get file metadata |
DELETE | /storage/files/:id | Delete file |
PATCH | /storage/files/:id | Update file metadata / tags |
GET | /storage/buckets | List buckets |
POST | /storage/buckets | Create bucket |
GET | /storage/usage | Get storage usage for org |
Upload response
{
"fileId": "file_xxxx",
"filename": "logo.png",
"mimeType": "image/png",
"sizeBytes": 204800,
"url": "https://storage-api.pcampus.co/files/file_xxxx",
"cdnUrl": "https://cdn.pcampus.co/files/file_xxxx/logo.png"
}Private bucket files require a time-limited signed URL — never expose storage_path directly.