Make your first API request
To make your first request to the Images API, you must obtain these pieces of information: Refer to API tokens
.Your Cloudflare Account ID
Your Global API Key or API Token
Once you have this information, you are ready to upload your first image to Cloudflare Images using the API:
curl -X POST \ "https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/images/v1" \ -H "Authorization: Bearer <API_TOKEN>" \ -F file=@./<YOUR_IMAGE>
A successful response will look similar to this:
{ "result": { "id": "083eb7b2-5392-4565-b69e-aff66acddd00", "filename": "triceratops.jpg", "uploaded": "2021-09-14T05:52:14.767Z", "requireSignedURLs": false, "variants": [ "https://imagedelivery.net/ZWd9g1K7eljCn_KDTu_MWA/083eb7b2-5392-4565-b69e-aff66acddd00/test", "https://imagedelivery.net/ZWd9g1K7eljCn_KDTu_MWA/083eb7b2-5392-4565-b69e-aff66acddd00/public" ] }, "result_info": null, "success": true, "errors": [], "messages": []
}