Find answers, guides, and tutorials to supercharge your content delivery.

Using a CDN API

Updated on October 4, 2018
Using a CDN API

A CDN API provides users the flexibility to integrate their Zones and other KeyCDN features directly into their applications. This article covers some of the use cases, features, and integration methods of using a CDN API.

CDN API use cases

There are a couple of use-cases where using a CDN API can provide some major benefits. These include:

  • Automation: Having the ability to integrate an API into your existing application can help improve automation and thus save you time from performing mundane tasks.
  • Reselling: Facilitating the addition of a new CDN Zone with the API each time a customer signs up for a service (e.g. a hosting provider) can help enhance the customer's experience and is more convenient for the reseller.

How to get started

To get started with the CDN API, log in to your KeyCDN dashboard and navigate to Account > Authentication. Here you will find your secret CDN API key which you will need for authentication purposes. At this point, head over to the KeyCDN API documentation where you will find a list of available API calls. There are various example requests and responses listed to provide users with the ability to perform various tasks while also showing what to expect when an API call is run.

Developer tools

The KeyCDN API can be used in combination with developer tools including the ones mentioned below.


Postman provides users the ability to integrate with your current workflow allowing you to explore, build, and test APIs in the way that works best for you. Developers can use this tool to test their application in combination with the CDN API calls to ensure everything is working as expected.


curl is a tool used to transfer data to and from a server. With the KeyCDN API, you can run curl commands directly from your terminal or command line to retrieved desired information. Anything from the creation of new Zones, Zone Aliases, Zone Referrers, generation of reports, etc. can be achieved through running simple commands. For example, running a curl command to list all of your Zones would resemble (replacing {apikey} with your KeyCDN API key).

curl "" -u {apikey}:

CDN API wrappers

KeyCDN offers various API wrappers to give users the ability to integrate directly into the application they are working on. This helps improve automation as the user is not required to perform tasks from the KeyCDN dashboard but can rather can generate reports, purge the cache, add Zones, etc. directly from the application. KeyCDN currently offers three CDN API wrappers:

Using a CDN API with Gulp and Grunt

Gulp and Grunt are both task/build runners for development. They help automate some of the more repetitive tasks involved in the development workflow such as compressing CSS/JS files, image optimization, compiling Sass files and more. KeyCDN offers a plugin for both task runners to enable interaction with the CDN API.

Purging and stats

The CDN API allows users to quickly purge an entire Zone or section of a Zone as well as offer statistics within a given time range. There are currently three ways to perform a purge request via the KeyCDN API.

CDN Statistics are also available via the API. Information such as traffic, storage, status, and credit statistics are all able via reports. Parameters can be defined within your API calls to retrieve specific information such as the Zone ID, start time, end time, interval, and type.

Overall, using a CDN API can help improve efficiency and allow for seamless integrate between your applications. For more information about KeyCDN's API, visit our API Documentation page.

Supercharge your content delivery 🚀

Try KeyCDN with a free 14 day trial, no credit card required.

Get started
KeyCDN uses cookies to make its website easier to use. Learn more about cookies.