Skip to main content
POST
/
cdn
/
files
Upload a CDN file
curl --request POST \
  --url https://shardcloud.app/api/cdn/files \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: multipart/form-data' \
  --form file='@example-file' \
  --form 'filename=<string>' \
  --form 'folder=<string>' \
  --form 'mime_type=<string>' \
  --form expire_at=2023-11-07T05:31:56Z
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "filename": "images/logo.png",
  "size": 123,
  "mime_type": "image/png",
  "created_at": "2023-11-07T05:31:56Z",
  "expire_at": "2023-11-07T05:31:56Z",
  "url": "https://cdn.example.com/{user_id}/{filename}"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

multipart/form-data
file
file
required

The file to upload (6KB–100MB)

filename
string
required

Name for the file (validated CDN name format)

folder
string

Optional folder prefix (validated CDN name format). File is stored as folder/filename.

mime_type
string

MIME type override. If omitted, detected from the uploaded file's Content-Type header.

expire_at
string<date-time>

Optional expiration time in RFC3339 format. Must be in the future.

Response

File created successfully

id
string<uuid>
user_id
string<uuid>
filename
string
Example:

"images/logo.png"

size
integer<int64>

File size in KB

mime_type
string
Example:

"image/png"

created_at
string<date-time>
expire_at
string<date-time>
url
string

Full CDN URL to access the file

Example:

"https://cdn.example.com/{user_id}/{filename}"