API token
Before you can start using Cloudflare Images API, you need to create an API token to authenticate and define what type of permissions different users have. For Images, you will have to create a custom token with account level permissions.
Refer to Creating API tokens to learn how to create a custom token.
Try your API token with the Images API
- Log in to the Cloudflare dashboard, and select your account.
- Click Images.
- In the Images tab, click Use API.
- In API token, paste your API token.
- Input the name of the image you want to use in Image File Name.
The cURL command message box will show you the complete command you can use:
curl -X POST -F file=@./MY_IMAGE -H "Authorization: Bearer MY_TOKEN" https://api.cloudflare.com/client/v4/accounts/ACCOUNT_ID/images/v1