API Overview

Table of Contents

Overview

Welcome to the CacheGenie API documentation. Our API empowers you to efficiently manage your CDN Zones and DNS Zones. This documentation is your comprehensive resource for harnessing the full potential of our API, which adheres to RESTful principles and exclusively uses JSON. All timestamps provided or requested through the API are represented as UNIX timestamps and adhere to the UTC timezone.

Please note that JSON format will be employed in all API responses, including error messages. To ensure successful interaction with our API, it's crucial to set the "Content-Type" header to "application/json" for all requests. Moreover, for security reasons, all API requests must be made over HTTPS (SSL); requests over Plain HTTP will not be accepted.

Getting Started

To start using our API (excluding the Status API, which requires no authentication), you'll need an API Key. Obtaining one is a simple process. First, create an account with us if you haven't already. Once your account is set up, you can locate your API Key in the Account Settings section of our Dashboard, specifically under the API section. From there, you can also enable API access for your account and generate a new API Key if necessary. It's important to keep your API Key securely stored for safe and authorized access.

Authentication

To use our CDN & DNS Endpoints, you'll need to authenticate your requests using Your API Key. This is achieved by providing a Bearer Token in the Authentication Header, with the Token being Your API Key.

Here's a straightforward example of how to authenticate your requests:

curl -X GET "https://cachegenie.com/api/cdn" -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json"

Simply replace https://cachegenie.com/api/cdn with the actual URL of the API Endpoint you intend to access, and ensure that you substitute YOUR_API_KEY with your API Key. Additionally, remember to set the Content-Type header to application/json to indicate the JSON format for your request and response.

Response Codes

This section provides a comprehensive list of potential response codes from our API:

  • 200 OK - The API Request was successful, and everything proceeded as expected.
  • 400 Bad Request - An error occurred due to the information provided in the API Request.
  • 401 Unauthorized - Authentication credentials for the API Request were provided but are invalid.
  • 403 Forbidden - No authentication credentials were provided for the API Request.
  • 404 Not Found - The requested API endpoint could not be located.
  • 405 Method Not Allowed - An attempt was made to access the API Endpoint with an invalid method.
  • 5XX Internal Server Error - An error has occurred on our end, please try again.

Response Parameters

For all API requests, you can expect to receive the following response parameters in JSON format:

  • CODE - This code reflects the result of the API request.
  • MESSAGE - Provides a message describing the outcome of the API request.
  • DATA - This field carries the payload data in response to the API request.

Errors

CacheGenie relies on standard HTTP Response Codes to convey the outcome of an API Request, be it a success or an error. Here's a quick breakdown:

  • Response codes starting with 2XX signify a successful operation.
  • Codes beginning with 4XX signify an error stemming from the data you submitted (e.g., a missing or invalid required parameter).
  • Those starting with 5XX denote an error that occurred on our end.

It's worth noting that while many errors align with HTTP response codes, some may not map directly to them.

Still Have Questions?
We're on hand to help 7 days a week.