Start Experiment
Enterprise
This endpoint is part of Countly Enterprise. To get access, contact sales or compare versions. Existing customers can reach the support portal with questions.
Endpoint
/i/ab-testing/start-experiment
Overview
Start an experiment and transition it from draft to running status. Creates cohorts for variant-goal tracking.
Authentication
Pass api_key or auth_token as a query parameter, or send countly-token as a header. See Authentication.
Permissions
- Update (ab_testing feature)
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
api_key | String | Yes (or use auth_token) | API key for authentication |
auth_token | String | Yes (or use api_key) | Auth token for authentication |
app_id | String | Yes | Application identifier |
experiment_id | String | Yes | Experiment ObjectId to start |
Examples
Example 1: Start an Experiment
Request:
curl "https://your-server.com/i/ab-testing/start-experiment" \
-d "api_key=YOUR_API_KEY" \
-d "app_id=YOUR_APP_ID" \
-d "experiment_id=5f9c8a3b4d1e2a001f3b4567"
Response
Success Response
{
"result": "Success"
}
Response Fields
| Field | Type | Description |
|---|---|---|
result | String | Result message |
Error Responses
- HTTP 500 - Experiment does not exist:
{
"result": "The experiment does not exist."
}
- HTTP 400 - Already running:
{
"result": "The experiment is already running."
}
- HTTP 400 - Already completed:
{
"result": "The experiment is already complete."
}
- HTTP 500 - Failed to start:
{
"result": "The experiment could not be started."
}
Behavior
- Creates cohorts for each variant-goal combination.
- Sets
statustorunningand storesstarted_attimestamp.
Related Endpoints
Implementation details
Database Collections
| Collection | Used for | Data touched by this endpoint |
|---|---|---|
countly_out.ab_testing_experiments{appId} | Primary: | Updates experiment status and start time. |
countly.cohorts | Related: | Creates tracking cohorts for each variant-goal combination. |