Skip to main content
urBackend handles file and image uploads for you. Upload a file and receive a public CDN URL you can use directly in your application. Base URL: https://api.ub.bitbros.in
All uploaded files are publicly accessible via the returned URL. Do not upload sensitive or private documents.

Upload a file

Send a POST request with a multipart/form-data body containing the file. Endpoint: POST /api/storage/upload
const formData = new FormData();
formData.append('file', fileInput.files[0]);

const res = await fetch('https://api.ub.bitbros.in/api/storage/upload', {
  method: 'POST',
  headers: {
    'x-api-key': 'YOUR_KEY'
  },
  body: formData
});

const { url, path, provider } = await res.json();
// Save `path` if you need to delete the file later
Do not set the Content-Type header manually. When you pass a FormData object, the browser sets the correct multipart/form-data boundary automatically. Setting it yourself will break the upload.
Response:
{
  "message": "File uploaded successfully",
  "url": "https://xyz.supabase.co/storage/v1/object/public/dev-files/PROJECT_ID/file.png",
  "path": "PROJECT_ID/file.png",
  "provider": "internal"
}
FieldDescription
urlPublicly accessible CDN URL for the file
pathStorage path — save this to delete the file later
providerThe underlying storage provider used

Delete a file

To delete a file, pass the path returned from the upload response. Endpoint: DELETE /api/storage/file
await fetch('https://api.ub.bitbros.in/api/storage/file', {
  method: 'DELETE',
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': 'YOUR_KEY'
  },
  body: JSON.stringify({
    path: 'YOUR_PROJECT_ID/your_file_name.png'
  })
});
If the path is invalid or the file has already been removed, the API returns 404.

Limits

LimitValue
Maximum file size10 MB per file
Total storage per project100 MB (default plan)

Troubleshooting

The file field is missing from the multipart form body. Make sure you are appending the file to a FormData object with the key file before sending.
The x-api-key header is missing or contains an invalid key. Check that you are using a valid key from your project dashboard.
The file exceeds the 10 MB per-file limit. Compress or resize the file before uploading.