Using the Cloudflare API, requires authenticatation so that Cloudflare knows who is making requests and what permissions they have. An API Token can be created to grant access to the API to perform actions. See creating an API Token for more on this.
Legacy Note: Existing customers may be familiar with API Keys. These allow for less granular access and each user can only have one. For these reasons, we advice customers using API Keys to transition to using API Tokens.
Once you have your API Token created, all API requests are authorized in the same way. Cloudflare uses the RFC standard
Authorization: Bearer <Token> interface. When used in an example Cloudflare API request it looks like this:
curl -X GET "https://api.cloudflare.com/client/v4/zones/cd7d0123e3012345da9420df9514dad0" \ -H "Content-Type:application/json" \ -H "Authorization: Bearer YQSn-xWAQiiEh9qM58wZNnyQS7FUdoqGIUAbrh7T"
The above example is just that, an example. Never send anyone or store you API Token secret in plaintext. Also be sure not to check it into code repositories especially public ones like on github.
For specific guidance on making API calls, see the following: