Getting started overview
Akamai provides a suite of cloud services for securing and delivering digital experiences, primarily through its global edge network. Getting started with Akamai involves setting up an account, generating API credentials, and making an initial API request to manage your Akamai services. This guide focuses on the programmatic interaction with Akamai's platform, which is typically done through its extensive set of management APIs.
The Akamai Control Center serves as the central hub for managing all Akamai products and services. While many configurations can be performed through the web interface, Akamai's developer experience emphasizes API-driven automation. Developers can use various APIs to configure content delivery, security policies, and other edge functionalities programmatically. This approach supports integration into existing CI/CD pipelines and automated infrastructure management systems.
Before making any API calls, you need to establish an Akamai account and obtain the necessary authentication credentials. Akamai utilizes an API client model where you create a set of keys and tokens that grant specific permissions to your applications or scripts. Understanding the scope of these permissions is crucial for maintaining security and adhering to the principle of least privilege.
Quick Reference: Akamai Getting Started Steps
| Step | What to Do | Where |
|---|---|---|
| 1. Sign Up | Contact Akamai sales for an enterprise account. | Akamai Contact Us page |
| 2. Access Control Center | Log in to the Akamai Control Center with provided credentials. | Akamai Control Center login |
| 3. Create API Client | Generate client tokens, client secret, and access token. Define access permissions. | Control Center > IAM > API Clients |
| 4. Configure Environment | Install an Akamai CLI or SDK (Python, Go, Java, Node.js) or prepare a cURL environment. | Akamai CLI documentation |
| 5. Make First Request | Execute a simple API call (e.g., list properties or groups) using your credentials. | Your preferred development environment (terminal, IDE) |
Create an account and get keys
Akamai operates on an enterprise sales model, meaning direct self-service sign-up for a free tier is not typically available. To begin, you will need to engage with Akamai's sales team to establish an enterprise account. This process often involves discussions about your specific use cases, traffic volumes, and security requirements to tailor a solution and pricing model. You can initiate this by visiting the Akamai contact page.
Once your account is provisioned, you will receive login credentials for the Akamai Control Center. This web portal is where you manage your services, view analytics, and, critically for developers, generate API credentials. The Control Center is the gateway to configuring and monitoring your Akamai deployments.
To obtain API keys, navigate to the Identity & Access Management (IAM) section within the Control Center. Here, you will create an "API Client." An API Client is a set of credentials that allows programmatic access to Akamai's APIs. When creating a new API Client, you will be prompted to:
- Name the client: Choose a descriptive name, such as "MyApplication_Dev" or "CI_CD_Integration."
- Define access permissions: This is a critical step. You must assign specific API collections and their respective access levels (e.g., read-only, read-write). For a first request, consider starting with read-only access to a non-sensitive API collection, such as the Property Manager API for listing properties. This adheres to the principle of least privilege, minimizing potential security risks.
- Generate credentials: Upon creation, the Control Center will display your Client Token, Client Secret, and Access Token. These are unique identifiers that authenticate your API calls. It is imperative to record these credentials immediately, as the Client Secret is typically shown only once and cannot be retrieved later. Treat these credentials like sensitive passwords.
Akamai's API authentication model is based on EdgeGrid authentication, a proprietary scheme that combines HMAC (Hash-based Message Authentication Code) signatures with HTTP headers. This method ensures that requests are both authenticated and tamper-proof. The generated Client Token, Client Secret, and Access Token are the core components used to construct these signatures.
Your first request
After obtaining your API client credentials, you can make your first API request. Akamai provides SDKs for Python, Go, Java, and Node.js, which simplify the EdgeGrid authentication process. Alternatively, you can use the Akamai CLI or construct requests manually using tools like cURL.
Using Akamai CLI (Recommended for initial testing)
The Akamai CLI is a command-line interface that simplifies interaction with Akamai APIs. It handles EdgeGrid authentication automatically once configured. Install it using pip (for Python environments):
pip install akamai-cli
Then, configure it with your credentials:
akamai config init
Follow the prompts to enter your Client Token, Client Secret, Access Token, and the host for the API (e.g., akab-xxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxx.luna.akamaiapis.net). The CLI will save these to a .edgerc file in your home directory.
To make a first request, install a relevant CLI package, for example, the Property Manager package:
akamai install property
Then, list available properties (requires read access to the Property Manager API):
akamai property list
This command should return a JSON array of your configured properties on the Akamai platform, confirming successful authentication and API access.
Using Python SDK
If you prefer a programmatic approach, the Python SDK simplifies EdgeGrid authentication. First, install the SDK:
pip install akamai-edgegrid
Then, create a Python script:
import requests
from akamai.edgegrid import EdgeGridAuth
from urllib.parse import urljoin
# Replace with your actual credentials or load from .edgerc
# For simplicity, we're hardcoding here, but use environment variables or .edgerc in production
CLIENT_TOKEN = 'YOUR_CLIENT_TOKEN'
CLIENT_SECRET = 'YOUR_CLIENT_SECRET'
ACCESS_TOKEN = 'YOUR_ACCESS_TOKEN'
HOST = 'akab-xxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxx.luna.akamaiapis.net'
base_url = f'https://{HOST}'
session = requests.Session()
session.auth = EdgeGridAuth(
client_token=CLIENT_TOKEN,
client_secret=CLIENT_SECRET,
access_token=ACCESS_TOKEN
)
try:
# Example: List property groups (requires 'read' access to 'Property Manager' API collection)
response = session.get(urljoin(base_url, '/papi/v1/groups'))
response.raise_for_status() # Raise an exception for HTTP errors
print(response.json())
except requests.exceptions.HTTPError as err:
print(f"HTTP error occurred: {err}")
print(f"Response content: {err.response.text}")
except Exception as err:
print(f"An error occurred: {err}")
This script attempts to list property groups. A successful JSON response indicates that your credentials are correct and have the necessary permissions.
Common next steps
After successfully making your first API call, you can explore more advanced Akamai functionalities:
- Configure Content Delivery: Use the Property Manager API to create and manage properties, which define how Akamai delivers your web content. This includes setting up hostnames, origins, and caching rules. The Property Manager API resources documentation provides detailed endpoints.
- Implement Security Policies: Akamai offers extensive security products like App & API Protector and Bot Manager. Integrate with their respective APIs to automate the deployment and management of WAF rules, bot detection, and DDoS protection policies. For example, the App & API Protector API allows for programmatic security configuration.
- Monitor and Report: Utilize Akamai's reporting APIs to fetch real-time and historical data on traffic, performance, and security events. This data can be integrated into your existing monitoring dashboards or SIEM systems.
- Explore Akamai CLI extensions: The Akamai CLI supports a wide range of extensions for various products. Install additional packages (e.g.,
akamai install appsecfor App & API Protector) to manage other Akamai services from your terminal. - Consult Akamai's Developer Resources: The Akamai Developer Documentation is a comprehensive resource for all Akamai APIs, SDKs, and developer tools. It includes tutorials, API references, and best practices.
- Review EdgeGrid Authentication Details: For advanced use cases or when using languages without an official SDK, it's beneficial to understand the EdgeGrid authentication process in detail. This ensures robust and secure integration. This detailed guide is available on Akamai's community forum, providing further insights into the cryptographic signing process.
Troubleshooting the first call
Encountering issues during your first API call is common. Here are some troubleshooting steps:
- Check Credentials: Double-check that your Client Token, Client Secret, and Access Token are correctly entered. Even a single character mismatch will result in an authentication failure. Remember that the Client Secret is only displayed once during API Client creation. If lost, you'll need to generate a new API Client.
- Verify Permissions: Ensure the API Client you created has the necessary read/write permissions for the specific API collection you are trying to access. For example, if you attempt to list properties, your API Client must have at least read access to the "Property Manager" API collection. You can review and modify permissions in the Akamai Control Center under IAM > API Clients.
- Correct Hostname: Confirm that the API hostname (e.g.,
akab-xxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxx.luna.akamaiapis.net) is accurate. This hostname is unique to your API Client and is provided when you generate credentials. - Time Skew: EdgeGrid authentication is sensitive to time synchronization. If your local system's clock is significantly out of sync with Akamai's servers, authentication may fail. Ensure your system's time is accurate and synchronized with an NTP server.
- Network Connectivity: Verify that your machine has outbound internet connectivity to Akamai's API endpoints. Corporate firewalls or proxies might block access.
- Review Error Messages: Akamai API error messages often provide specific clues. Common errors include
401 Unauthorized(authentication failure, check credentials/time sync),403 Forbidden(permission denied, check API client permissions), or404 Not Found(incorrect API endpoint or resource ID). Consult the Akamai API error messages documentation for detailed explanations. - SDK/CLI Configuration: If using an SDK or the Akamai CLI, ensure it is correctly configured to load your
.edgercfile or that credentials are passed correctly as environment variables or directly in the code. The Python SDK'sEdgeGridAuthclass, for instance, can also read from the.edgercfile if no explicit credentials are provided, simplifying setup. - Consult Logs: If you are running an application, check your application logs for any errors generated by the Akamai SDK or HTTP client.