- Connect Kameleoon with Git repositories to manage variation code.
- Design custom dashboards populated with real-time experiment results.
- Automate the creation of goals and segments across multiple projects.
Contact the Kameleoon team to request an enhancement to the Automation API. We appreciate your feedback and can quickly add existing UI features to the API.
Tutorials
Create an experiment
This tutorial provides step-by-step instructions for performing key tasks on the Kameleoon platform. You will learn how to:- Create a new experiment
- Push and modify JavaScript code in a variation
- Create a new segment
- Create a new goal
- Update and launch an experiment
Retrieve experiment results
After you launch an experiment, it generates results that provide insights to determine the best-performing variation. Learn how to request results and identify the winning variation in the Retrieving Experiments Results tutorial.Authentication
The Automation API uses the OAuth 2.0 framework for authorization. Kameleoon supports two primary flows depending on your use case:- Client Credentials Flow: Use this flow if you are a Kameleoon customer using the API for internal purposes. This flow allows you to programmatically manage your own account and web properties.
- Authorization Code Flow: Use this flow if you are a technology partner integrating an application with Kameleoon. This flow allows you to securely access data on behalf of other Kameleoon users.
Client Credentials flow
The Client Credentials flow is the simplest authentication method. To use this flow, exchange your client credentials for an access token.1. Obtain an access token
Send a POST request to the token endpoint with your credentials.curl
access_token:
2. Access the API
Include the access token as a Bearer token in theAuthorization HTTP header of your requests.
curl
- Access tokens remain valid for 2 hours by default.
- The Client Credentials flow does not use refresh tokens.
- You must use HTTPS for all API requests. Requests made over plain HTTP will fail.
Authorization Code flow
The Authorization Code flow allows third-party developers to integrate their applications with Kameleoon data. You must obtain explicit permission from a user to access their account resources.Contact your Kameleoon Technical Account Manager to request an OAuth application. You must provide a redirect URL for your application. Kameleoon will then provide a
client_id and client_secret.1. Redirect the user for authorization
Redirect users from your application to the authorization URL:2. Obtain access and refresh tokens
Exchange the authorization code for tokens. Base64 encode theclient_id:client_secret string and include it in the Authorization: Basic header.
curl
3. Refresh an expired token
To obtain a new access token without re-authorizing the user:curl
Rate limiting
Rate limiting for the Automation API occurs per user access token. Kameleoon uses two rate-limiting windows:- 10-second interval: Up to 50 requests.
- 1-hour interval: Up to 1,000 requests.
HTTP 429 Too Many Requests error. To minimize rate limiting:
- Implement caching: Store API responses locally and avoid calling the API on every page load.
- Use the Data API: If your application requires real-time tracking at scale, use the Data API.
HTTP status codes
| Code | Status | Description |
|---|---|---|
| 200 | OK | The request was successful. |
| 201 | Created | The resource was successfully created. |
| 400 | Bad Request | The request body is invalid. Ensure the Content-Type: application/json header is present. |
| 401 | Unauthorized | The API token is missing or malformed. |
| 403 | Forbidden | You lack required permissions or the token is revoked. |
| 429 | Too Many Requests | You exceeded the rate limit. |
| 5xx | Server Error | An internal error occurred. Contact Kameleoon support if the issue persists. |
Query parameters
For endpoints that retrieve multiple objects, use query parameters to paginate, filter, or sort data.Pagination
Queries return 20 items per page by default (maximum 200). UseperPage=-1 to retrieve the maximum limit.
| Parameter | Type | Description |
|---|---|---|
page | integer | The page number to retrieve. |
perPage | integer | Items per page (default 20, max 200). |
filter | array | Filtering parameters. |
sort | array | Sorting parameters. |
Filtering
You must percent-encode filters when sending them in a URL. Example:filter=[{"field":"name","operator":"EQUAL","parameters":["Test"]}]
| Field | Type | Description |
|---|---|---|
field | string | The field to filter by. |
operator | enum | Options include: EQUAL, NOT_EQUAL, LESS, GREATER, LIKE, IN, IS_NULL, etc. |
parameters | array | The specific values to match. |
Sorting
| Field | Type | Description |
|---|---|---|
field | string | The field to sort by. |
direction | enum | ASC (ascending) or DESC (descending). |