Portfolio Assets
Presigned image uploads for portfolio avatars, project covers, and social images.
Description
Portfolio images (avatars, project cover images, social share images) are uploaded directly to Cloudflare R2 using presigned URLs — the API never proxies file bytes. The flow is:
POST /portfolio-assets/upload-url— request a presigned PUT URL (10-minute expiry) for a JPG, PNG, or WebP image up to 5MB.- Upload the file directly to that URL with a matching
Content-Type/Content-Length. POST /portfolio-assets/complete— the server issues aHEADrequest against R2 to verify the uploaded object's size, content type, and (optionally) checksum match what was declared, then marks the assetREADYso it can be referenced from a portfolio.
Assets left in PENDING for more than 24 hours (upload never completed) are cleaned up
automatically.
Authentication
All routes in this group require a session cookie — none accept an API key.
Available Endpoints
POST /portfolio-assets/upload-url— Create Upload URLPOST /portfolio-assets/complete— Complete UploadDELETE /portfolio-assets/{id}— Delete Asset
Get Portfolio AnalyticsGET
Views for the last 30 days plus top referrer hosts. Returns all-zero data if the caller has never published.
Create Portfolio Asset Upload URLPOST
Issues a presigned Cloudflare R2 PUT URL (10-minute expiry) for a JPG, PNG, or WebP image up to 5MB. Upload the file directly to `uploadUrl` with a matching Content-Type/Content-Length, then call `POST /portfolio-assets/complete` to verify and activate it. Session-authenticated only.