Getting started overview

Integrating with the Akamai API enables programmatic control over Akamai's content delivery network (CDN), cloud security, and edge compute services. This guide focuses on the essential steps required to make an initial authenticated API call: account creation, credential generation, and executing a basic request. Akamai's API ecosystem is designed for enterprise-scale operations, offering fine-grained control over configurations.

Before proceeding, ensure you have an Akamai customer account. Akamai primarily operates on a custom enterprise pricing model, and there is no public free tier available to new users without an existing commercial engagement.

Akamai API quickstart steps

The following table outlines the high-level process for getting started with the Akamai API:

Step What to do Where
1. Sign Up/Log In Access your Akamai Control Center account. Akamai homepage or direct Control Center login
2. Create API Client Generate EdgeGrid API credentials (client token, secret, access token). Akamai Control Center: Identity & Access > API Clients
3. Configure Permissions Assign necessary API collections and roles to your API client. Akamai Control Center: Identity & Access > API Clients (within client configuration)
4. Install SDK/Client Set up an Akamai EdgeGrid-compatible client or SDK in your development environment. Akamai API Getting Started documentation
5. Make First Call Execute a simple authenticated API request. Your preferred development environment (e.g., Python script, cURL)

Create an account and get keys

Access to Akamai's APIs requires an active Akamai customer account. If you do not have one, you will need to engage with Akamai sales to establish a service agreement, as there is no public self-service signup for a free tier or trial account for API access. Once you have an account, you can log into the Akamai Control Center, which is the centralized management portal for Akamai services.

Generating Akamai API credentials

Akamai uses a proprietary authentication scheme known as Akamai EdgeGrid. This method involves generating a set of credentials within the Akamai Control Center. Follow these steps to obtain your API keys:

  1. Log into Akamai Control Center: Navigate to the Akamai Control Center using your customer credentials.
  2. Access API Clients: In the Control Center, go to Identity & Access > API Clients.
  3. Create New API Client: Click the button to create a new API client. You will be prompted to provide a name and description for your client. Choose a descriptive name that indicates the purpose of this API client (e.g., MyApplication-CDN-Config).
  4. Configure Permissions: This is a critical step. You must assign specific API Collections and Roles to your new API client. API Collections are groups of related APIs (e.g., Property Manager API, Traffic Management API), and Roles define the level of access (e.g., read-only, read-write). For a first request, consider assigning read-only access to a non-sensitive API collection, such as the Diagnostic Tools API or a specific monitoring API, to minimize potential impact. Ensure you select the minimum necessary permissions.
  5. Generate Credentials: After configuring permissions, the system will generate your EdgeGrid credentials. These typically include:
    • Client Token: A public identifier for your API client.
    • Client Secret: A private key used for signing requests.
    • Access Token: A token associated with the specific permissions assigned to the client.
    • Host: The base URL for the Akamai API endpoint.

    Important: The Client Secret is only displayed once. Copy and store it securely, as you will not be able to retrieve it again. If you lose it, you will need to generate new credentials.

Your first request

With your EdgeGrid credentials in hand, you can now construct and send your first authenticated API request. Akamai provides SDKs for Python, Java, Go, and Node.js that simplify the EdgeGrid authentication process. Alternatively, you can use a generic HTTP client like cURL, but you will need to manually construct the EdgeGrid authorization header.

Using an Akamai SDK (Python example)

The Akamai Python SDK is a common choice for initial setup. First, install the SDK:

pip install akamai-edgegrid

Next, create a .edgerc file in your home directory (~/.edgerc) or project directory. This file stores your credentials, keeping them out of your code. An example .edgerc file looks like this:

[default]
client_token = YOUR_CLIENT_TOKEN
client_secret = YOUR_CLIENT_SECRET
access_token = YOUR_ACCESS_TOKEN
host = YOUR_HOST_WITHOUT_HTTPS

Replace YOUR_CLIENT_TOKEN, YOUR_CLIENT_SECRET, YOUR_ACCESS_TOKEN, and YOUR_HOST_WITHOUT_HTTPS with the values obtained from the Akamai Control Center. The host should be the base URL without https:// (e.g., akab-xxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxx.luna.akamaiapis.net).

Now, you can make a simple request using the Python SDK. This example uses the Diagnostic Tools API to fetch a list of available tools, which typically requires read-only access.

import requests
from akamai.edgegrid import EdgeGridAuth, EdgeGridSigner
import os

# Path to your .edgerc file
edgerc_path = os.path.expanduser('~/.edgerc') 

# Create an EdgeGridAuth object
session = requests.Session()
session.auth = EdgeGridAuth.from_edgerc(edgerc_path, 'default')

# Define the API endpoint (example: Diagnostic Tools API)
# The 'host' from .edgerc will be prepended automatically
api_path = '/diagnostic-tools/v2/tools'

try:
    # Make the GET request
    response = session.get(f"https://{session.auth.client_host}{api_path}")
    response.raise_for_status()  # Raise an exception for HTTP errors

    # Print the JSON response
    print(response.json())

except requests.exceptions.RequestException as e:
    print(f"An error occurred: {e}")
    if hasattr(e, 'response') and e.response is not None:
        print(f"Response content: {e.response.text}")

Executing this script should return a JSON array listing the diagnostic tools available through your Akamai account.

Using cURL

While SDKs are recommended, you can also use cURL, but you'll need to generate the EdgeGrid authorization header manually or use a script that does it for you. This often involves a more complex setup to handle cryptographic signing. For simplicity and to confirm your credentials, it's often easier to start with an SDK.

The EdgeGrid authentication process requires signing each request with your client secret. Tools like Akamai's API Gateway Request Signer can assist, but for a true first request, the SDK approach is generally more straightforward.

Common next steps

After successfully making your first Akamai API call, consider these next steps:

  • Explore API Reference: Dive into the Akamai API Reference to understand the various available APIs (e.g., Property Manager API for CDN configurations, Cloud Security APIs for WAF and DDoS settings, EdgeGrid APIs for user and access management).
  • Refine Permissions: Review and adjust the permissions assigned to your API client in the Akamai Control Center. Adhere to the principle of least privilege, granting only the necessary access for your application's specific tasks.
  • Implement Error Handling: Incorporate robust error handling in your code to manage API rate limits, authentication failures, and other common issues. Akamai APIs typically return detailed error messages in JSON format.
  • Integrate with CI/CD: For enterprise users, integrate Akamai API calls into continuous integration/continuous deployment (CI/CD) pipelines to automate deployments, configuration changes, and security policy updates, as described in guides for AWS CodePipeline or similar platforms.
  • Review Best Practices: Consult Akamai's documentation on API best practices for security, performance, and maintainability.
  • Explore Additional SDKs: If your project uses a different language, investigate the Akamai SDKs for Java, Go, or Node.js.

Troubleshooting the first call

If your initial API call fails, consider these common issues:

  • Incorrect Credentials: Double-check that the Client Token, Client Secret, Access Token, and Host in your .edgerc file (or direct configuration) exactly match what was generated in the Akamai Control Center. Remember the Client Secret is shown only once.
  • Missing or Incorrect Permissions: The most frequent issue. Ensure your API client has the specific API Collection and Role assigned that grants access to the endpoint you are trying to call. For instance, if you're calling a Property Manager API endpoint, your client needs access to the Property Manager API collection with appropriate read/write roles. Review Akamai API client permissions.
  • Host Mismatch: The host value in your credentials should be the exact base URL provided by Akamai, without https://.
  • Time Skew: EdgeGrid authentication is sensitive to time synchronization. Ensure your system's clock is accurate. Significant clock skew between your client and Akamai's servers can lead to authentication failures. For time synchronization, Network Time Protocol (NTP) is commonly used, as detailed in RFC 5905 for NTPv4.
  • Firewall/Network Issues: Verify that your network allows outbound HTTPS connections to the Akamai API host.
  • Incorrect API Endpoint: Ensure the api_path in your request matches an existing and accessible endpoint in the Akamai API reference.
  • SDK Configuration: If using an SDK, confirm it's correctly installed and configured to read your .edgerc file or accept credentials directly.
  • Verbose Logging: Enable verbose logging in your HTTP client or SDK to see the full request and response, including headers, which can provide clues about the failure.