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

  1. Your trusted server calls the CDNForge presign endpoint with a Bearer key.
  2. CDNForge returns a server-generated publicId and a short-lived uploadUrl.
  3. The client PUTs the file bytes to that URL.
  4. Your server (or an authorized client) calls complete with the same publicId so 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.png
3) 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, and size. Do not send contentType.
  • Complete must use the server-provided publicId. Do not invent storage keys or a key field.
  • Include storageBucket on 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.