Create a new experiment
Goal
Create a new experiment, Experiment_1, as explained in the graphic editor guide using the Automation API Create Experiment endpoint.
Requirements
access token
The Automation API requires an access token. Retrieve the token programmatically by following the instructions in the obtaining an access token section.
-
siteId-
Retrieve the
siteIddirectly in code with thesiteCodeby calling the get a site by code endpoint. -
Alternatively, log into the Kameleoon account, navigate to the bottom-left corner, and select Projects under the Admin section:

Click Edit on the project:

The
siteIdis the five-digit number in the URL (for example, 29353):
-
Steps
1. Create the experiment
Endpoint:
POST [https://api.kameleoon.com/experiments](https://api.kameleoon.com/experiments)
| Name | Type | Description |
|---|---|---|
| baseURL | String | URL of the page to load in the Graphic Editor. |
| name | String | Experiment name. |
| siteId | String | The project’s siteId. |
| type | String | Type of experiment (for example, DEVELOPER for code-based experiments). See API reference. |
Example:
curl -L -X POST 'https://api.kameleoon.com/experiments' \
-H 'Content-Type: application/json' \
-H 'Accept: */*' \
-H 'Authorization: Bearer <ACCESS_TOKEN>' \
--data-raw '{"baseURL":"https://test-site.fr/","name":"Experiment_1","siteId":29353,"type":"DEVELOPER"}'
Response:
{
"id": 283505,
"siteId": 29353,
"name": "Experiment_1",
"baseURL": "https://test-site.fr/",
"type": "DEVELOPER",
"status": "draft",
"variations": [1053310],
"isArchived": false
}
2. Verify the experiment
Go to the Experiments Dashboard and refresh the page.
Experiment_1 should now appear:
