Skip to content

Storage

Frontend Cloud storage is a per-project media store for images, audio, video, PDFs, and any other files your app uploads or serves. Files are managed through the /api/media endpoints and served publicly through /files.

Storage is available once Frontend Cloud is enabled on your project.

MethodPathDescription
POST/api/mediaUpload a file (multipart form-data)
GET/api/mediaList files (optional search and pagination)
GET/api/media/{id}Download / stream a single file
DELETE/api/media/{id}Delete a file
GET/files/{projectId}/media/{id}Public, read-only URL for a file

All /api/media requests are authenticated with your project API key. The /files route is public and requires no key — it’s the URL you embed in your deployed site.

Send a multipart/form-data request with the file in a file field:

Terminal window
curl -X POST "https://cloud.frontend.co/api/media" \
-H "x-api-key: YOUR_API_KEY" \
-F "file=@./product.png"

The response is a MediaItem:

{
"id": "5f3c1a9e-...-product.png",
"url": "https://cloud.frontend.co/files/YOUR_PROJECT_ID/media/5f3c1a9e-...-product.png",
"name": "product.png",
"mimeType": "image/png"
}

Use the returned url to display the file anywhere — it resolves through the public /files route, so it works directly in <img> tags and links on your deployed site.

Terminal window
curl "https://cloud.frontend.co/api/media?query=product" \
-H "x-api-key: YOUR_API_KEY"

Returns a MediaPage:

{
"items": [
{ "id": "...", "url": "...", "name": "product.png", "mimeType": "image/png" }
],
"nextCursor": "eyJ..."
}
  • query (optional) filters items whose name contains the term.
  • cursor (optional) fetches the next page — pass back the nextCursor from the previous response. When nextCursor is absent, you’ve reached the last page.
Terminal window
curl "https://cloud.frontend.co/api/media/5f3c1a9e-...-product.png" \
-H "x-api-key: YOUR_API_KEY" \
--output product.png

This streams the raw file with its stored content type. For public, unauthenticated access from a browser or a deployed page, use the file’s url (the /files route) instead.

Terminal window
curl -X DELETE "https://cloud.frontend.co/api/media/5f3c1a9e-...-product.png" \
-H "x-api-key: YOUR_API_KEY"
{ "success": true, "id": "5f3c1a9e-...-product.png" }
async function upload(file: File) {
const form = new FormData();
form.append('file', file);
const res = await fetch('https://cloud.frontend.co/api/media', {
method: 'POST',
headers: { 'x-api-key': process.env.FRONTEND_API_KEY! },
body: form,
});
const item = await res.json();
return item.url as string; // public URL, ready to embed
}