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:Documentation Index
Fetch the complete documentation index at: https://docs.ub.bitbros.in/llms.txt
Use this file to discover all available pages before exploring further.
https://api.ub.bitbros.in
Upload a file
Uploads use a presigned URL three-step flow so the binary is sent directly to storage.Step 1 — Request an upload URL
Endpoint:POST /api/storage/upload-request
Request body (size in bytes):
| Field | Description |
|---|---|
signedUrl | Presigned URL to upload the binary directly to storage |
token | Provider-specific token (only returned for some external providers) |
filePath | Opaque storage path (format: projectId/uuid_sanitizedFilename) — save this to confirm or delete the file later |
This endpoint enforces the 10 MB max file size and checks available headroom against your plan’s project storage quota before the upload is confirmed. On the free tier, the default project storage limit is 20 MB.
Step 2 — Upload the binary to storage
Send a browserPUT request to signedUrl with the raw file contents and the correct Content-Type header.
Step 3 — Confirm the upload
Endpoint:POST /api/storage/upload-confirm
Request body:
| Field | Description |
|---|---|
message | Confirmation message |
path | Normalized storage path — use this to delete the file later |
provider | Storage backend used (internal or external) |
url | Public URL for the file. If unavailable, this is null. |
warning | Optional warning message when a public URL is unavailable |
url: null and includes a warning field explaining that a public URL is not available.
The confirm step verifies the object exists, checks the size matches, and then charges quota atomically.
Full browser example
SDK users (
urbackend-sdk) do not need to change anything — client.storage.upload() uses this flow internally.Required bucket CORS (S3/R2)
If you use AWS S3 or Cloudflare R2 with presigned browser uploads, configure bucket CORS so browser uploads tosignedUrl can pass preflight.
Required methods:
PUTOPTIONSGETHEAD
AllowedHeaders (not ExposeHeaders) should include at least:
content-type— required for presignedPUTrequestscontent-length— typically safelisted, but some providers still require it to be allow-listed
POST /api/storage/upload-request and POST /api/storage/upload-confirm are correct.
Delete a file
To delete a file, pass thepath returned from the upload response.
Endpoint: DELETE /api/storage/file
404.
Limits
| Limit | Value |
|---|---|
| Maximum file size | 10 MB per file |
| Total storage per project | 20 MB (free tier; higher limits on paid plans) |
Troubleshooting
400 Bad Request
400 Bad Request
Ensure
filename, contentType, and size are provided for the upload request, and that filePath and size are sent to the confirm endpoint.401 Unauthorized
401 Unauthorized
413 Payload Too Large
413 Payload Too Large
The file exceeds the 10 MB per-file limit. Compress or resize the file before uploading.
CORS errors on PUT to signedUrl
CORS errors on PUT to signedUrl
If you use an external S3/R2 bucket, configure bucket CORS to allow
PUT, OPTIONS, GET, and HEAD, and allow content-type and content-length headers from your client origin.