Skip to main content

Start Experiment

Endpoint

/i/ab-testing/start-experiment

Enterprise Only
This API is available exclusively in Countly Enterprise.

Overview

Start an experiment and transition it from draft to running status. Creates cohorts for variant-goal tracking.

Authentication

Authentication Methods:

  • API Key (parameter): api_key=YOUR_API_KEY
  • Auth Token (parameter): auth_token=YOUR_AUTH_TOKEN
  • Auth Token (header): countly-token: YOUR_AUTH_TOKEN

Permissions

  • Update (ab_testing feature)

Request Parameters

ParameterTypeRequiredDescription
api_keyStringYes (or use auth_token)API key for authentication
auth_tokenStringYes (or use api_key)Auth token for authentication
app_idStringYesApplication identifier
experiment_idStringYesExperiment ObjectId to start

Response

Success Response

{
"result": "Success"
}

Response Fields

FieldTypeDescription
resultStringResult message

Error Responses

  • HTTP 500 - Experiment doesn't 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/Processing

  • Creates cohorts for each variant-goal combination.
  • Sets status to running and stores started_at timestamp.

Database Collections

CollectionUsed forData touched by this endpoint
countly_out.ab_testing_experiments{appId}Primary:Updates experiment status and start time.
countly.cohortsRelated:Creates tracking cohorts for each variant-goal combination.

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"

Ⓔ Enterprise

This feature is part of Countly Enterprise.

Get Access:

Already a Customer? Use support portal if you have any questions


Last Updated

2026-02-16