Upload Public File
curl --request POST \
--url https://{baseurl}/api/v1/management/storage \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data '
{
"allowedFileExtensions": [
"png",
"jpg",
"jpeg"
],
"fileName": "profile.png",
"fileType": "image/png",
"workspaceId": "env123"
}
'import requests
url = "https://{baseurl}/api/v1/management/storage"
payload = {
"allowedFileExtensions": ["png", "jpg", "jpeg"],
"fileName": "profile.png",
"fileType": "image/png",
"workspaceId": "env123"
}
headers = {
"x-api-key": "<x-api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
allowedFileExtensions: ['png', 'jpg', 'jpeg'],
fileName: 'profile.png',
fileType: 'image/png',
workspaceId: 'env123'
})
};
fetch('https://{baseurl}/api/v1/management/storage', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{baseurl}/api/v1/management/storage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'allowedFileExtensions' => [
'png',
'jpg',
'jpeg'
],
'fileName' => 'profile.png',
'fileType' => 'image/png',
'workspaceId' => 'env123'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <x-api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{baseurl}/api/v1/management/storage"
payload := strings.NewReader("{\n \"allowedFileExtensions\": [\n \"png\",\n \"jpg\",\n \"jpeg\"\n ],\n \"fileName\": \"profile.png\",\n \"fileType\": \"image/png\",\n \"workspaceId\": \"env123\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<x-api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{baseurl}/api/v1/management/storage")
.header("x-api-key", "<x-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"allowedFileExtensions\": [\n \"png\",\n \"jpg\",\n \"jpeg\"\n ],\n \"fileName\": \"profile.png\",\n \"fileType\": \"image/png\",\n \"workspaceId\": \"env123\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{baseurl}/api/v1/management/storage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<x-api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"allowedFileExtensions\": [\n \"png\",\n \"jpg\",\n \"jpeg\"\n ],\n \"fileName\": \"profile.png\",\n \"fileType\": \"image/png\",\n \"workspaceId\": \"env123\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"fileUrl": "http://localhost:3000/storage/cm1ubebtj000614kqe4hs3c67/public/profile--fid--abc123.png",
"presignedFields": {
"Policy": "base64EncodedPolicy",
"X-Amz-Algorithm": "AWS4-HMAC-SHA256",
"X-Amz-Credential": "your-credential",
"X-Amz-Date": "20250312T000000Z",
"X-Amz-Signature": "your-signature",
"key": "uploads/public/profile--fid--abc123.png"
},
"signedUrl": "https://s3.example.com/your-bucket",
"updatedFileName": "profile--fid--abc123.png"
}
}{
"error": "fileName is required"
}{
"error": "Not authenticated"
}{
"error": "User does not have access to environment env123"
}Management API - Storage
Upload Public File
API endpoint for uploading public files. Uploaded files are public and accessible by anyone. This endpoint requires authentication and enforces a hard limit of 5 MB for all uploads. It accepts a JSON body with fileName, fileType, workspaceId, and optionally allowedFileExtensions to restrict file types. On success, it returns a signed URL for uploading the file to S3.
POST
/
api
/
v1
/
management
/
storage
Upload Public File
curl --request POST \
--url https://{baseurl}/api/v1/management/storage \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data '
{
"allowedFileExtensions": [
"png",
"jpg",
"jpeg"
],
"fileName": "profile.png",
"fileType": "image/png",
"workspaceId": "env123"
}
'import requests
url = "https://{baseurl}/api/v1/management/storage"
payload = {
"allowedFileExtensions": ["png", "jpg", "jpeg"],
"fileName": "profile.png",
"fileType": "image/png",
"workspaceId": "env123"
}
headers = {
"x-api-key": "<x-api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
allowedFileExtensions: ['png', 'jpg', 'jpeg'],
fileName: 'profile.png',
fileType: 'image/png',
workspaceId: 'env123'
})
};
fetch('https://{baseurl}/api/v1/management/storage', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{baseurl}/api/v1/management/storage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'allowedFileExtensions' => [
'png',
'jpg',
'jpeg'
],
'fileName' => 'profile.png',
'fileType' => 'image/png',
'workspaceId' => 'env123'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <x-api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{baseurl}/api/v1/management/storage"
payload := strings.NewReader("{\n \"allowedFileExtensions\": [\n \"png\",\n \"jpg\",\n \"jpeg\"\n ],\n \"fileName\": \"profile.png\",\n \"fileType\": \"image/png\",\n \"workspaceId\": \"env123\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<x-api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{baseurl}/api/v1/management/storage")
.header("x-api-key", "<x-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"allowedFileExtensions\": [\n \"png\",\n \"jpg\",\n \"jpeg\"\n ],\n \"fileName\": \"profile.png\",\n \"fileType\": \"image/png\",\n \"workspaceId\": \"env123\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{baseurl}/api/v1/management/storage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<x-api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"allowedFileExtensions\": [\n \"png\",\n \"jpg\",\n \"jpeg\"\n ],\n \"fileName\": \"profile.png\",\n \"fileType\": \"image/png\",\n \"workspaceId\": \"env123\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"fileUrl": "http://localhost:3000/storage/cm1ubebtj000614kqe4hs3c67/public/profile--fid--abc123.png",
"presignedFields": {
"Policy": "base64EncodedPolicy",
"X-Amz-Algorithm": "AWS4-HMAC-SHA256",
"X-Amz-Credential": "your-credential",
"X-Amz-Date": "20250312T000000Z",
"X-Amz-Signature": "your-signature",
"key": "uploads/public/profile--fid--abc123.png"
},
"signedUrl": "https://s3.example.com/your-bucket",
"updatedFileName": "profile--fid--abc123.png"
}
}{
"error": "fileName is required"
}{
"error": "Not authenticated"
}{
"error": "User does not have access to environment env123"
}Headers
Body
application/json
The name of the file to be uploaded.
The MIME type of the file.
The ID of the workspace.
Optional. List of allowed file extensions.
Available options:
heic, png, jpeg, jpg, webp, ico, pdf, eml, doc, docx, xls, xlsx, ppt, pptx, txt, csv, mp4, mov, avi, mkv, webm, mp3, zip, rar, 7z, tar Response
OK - Returns the signed URL, presigned fields, updated file name, and file URL.
Show child attributes
Show child attributes
Was this page helpful?
⌘I