Documentation

POST /upload

Uploads an image file and returns CDN URLs for your image.

Request

https://api.magecdn.com/upload

FieldTypeRequiredDescription
fileFile✅ YesImage file to upload
pathString❌ No
Folder path (e.g., /path/to). If folder doesn’t exist, it’s created.
nameString❌ No
New file name (e.g., new_title.jpeg)

Response 200 OK

FieldDescription
url
Serves the image with the most optimized settings.
url_original
Serves the original/unmodified image.
{
  "url": "https://i.magecdn.com/:user-id/:file-id_:file-name",
  "url_original": "https://i.magecdn.com/:user-id/:file-id_:file-name?f=o",
}

All URLs are public and can be embedded directly in websites or apps. You can also access these images from the dashboard.

To understand how to resize or transform image: Serving, Transforming Images.


Error Codes

Status CodeMessageCause
400No file uploaded.Missing file field
403Invalid userBad or missing API token
500Error uploading file.Internal server error