Uploading files
Presigned URLs
Presigned uploads let a browser, NUI, or other client PUT bytes straight to storage while your trusted server holds the long-lived API key.
When to use this
Client-side or NUI uploads where you want a short-lived PUT URL. For same-origin large uploads without storage CORS, use chunked uploads instead.
Flow
- Your trusted server calls the CDNForge presign endpoint with a Bearer key.
- CDNForge returns a server-generated
publicIdand a short-liveduploadUrl. - The client PUTs the file bytes to that URL.
- Your server (or an authorized client) calls complete with the same
publicIdso CDNForge creates the file record.
Media upload example
Image / video / audio keys use the upload family. File keys use /api/v1/file/presign and /api/v1/file/complete with the same JSON fields.
1) Presign
curl -X POST https://app.back2rp.org/api/v1/upload/presign \
-H "Authorization: Bearer cnf_img_your_key" \
-H "Content-Type: application/json" \
-d '{
"filename": "shot.png",
"mimeType": "image/png",
"size": 240112
}'Example presign response
{
"publicId": "abc123xyz.png",
"uploadUrl": "https://...signed-put-url...",
"mimeType": "image/png",
"originalName": "shot.png",
"storageBucket": "cdnforge-media"
}2) PUT bytes to the returned uploadUrl
curl -X PUT "$UPLOAD_URL" \
-H "Content-Type: image/png" \
--data-binary @shot.png3) Complete
curl -X POST https://app.back2rp.org/api/v1/upload/complete \
-H "Authorization: Bearer cnf_img_your_key" \
-H "Content-Type: application/json" \
-d '{
"publicId": "abc123xyz.png",
"filename": "shot.png",
"mimeType": "image/png",
"size": 240112,
"storageBucket": "cdnforge-media"
}'Request fields
- Presign body uses
filename,mimeType, andsize. Do not sendcontentType. - Complete must use the server-provided
publicId. Do not invent storage keys or akeyfield. - Include
storageBucketon complete when the presign response returned one. - Optional on either step:
folder,folderId,metadata.
Limits
Maximum file size is 100 MB for all upload paths. For large media over same-origin HTTP without a client PUT, see large files & chunked uploads.
Interactive docs
Explore live request fields in the interactive API.
