Uploads an image file and returns CDN URLs for your image.
https://api.magecdn.com/upload
Field | Type | Required | Description |
---|---|---|---|
file | File | ✅ Yes | Image file to upload |
path | String | ❌ No | Folder path (e.g., /path/to ). If folder doesn’t exist, it’s created. |
name | String | ❌ No | New file name (e.g., new_title.jpeg ) |
Field | Description |
---|---|
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.
Status Code | Message | Cause |
---|---|---|
400 | No file uploaded. | Missing file field |
403 | Invalid user | Bad or missing API token |
500 | Error uploading file. | Internal server error |