Skip to main content
POST
/
3
/
abtests
curl
curl --request POST \
  --url https://analytics.us.algolia.com/3/abtests \
  --header 'accept: application/json' \
  --header 'content-type: application/json' \
  --header 'x-algolia-api-key: ALGOLIA_API_KEY' \
  --header 'x-algolia-application-id: ALGOLIA_APPLICATION_ID' \
  --data '{"name":"Custom ranking sales rank test","variants":[{"index":"delcourt_production","trafficPercentage":60,"description":"Current production index"},{"index":"delcourt_production","trafficPercentage":60,"description":"Current production index"}],"metrics":[[{"name":"revenue","dimension":"USD"},{"name":"conversionRate"},{"name":"clickThroughRate"},{"name":"trackedSearchCount"}]],"configuration":{"minimumDetectableEffect":{"size":0,"metric":"addToCartRate"},"filters":[{"domain":"abtesting","name":"isOutlier","trackEffects":true,"includes":true}],"errorCorrection":"bonferroni"},"endAt":"2023-06-17T00:00:00Z"}'
{
  "index": "delcourt_production",
  "abTestID": 224,
  "taskID": 1514562690001
}
Required ACL: editSettings

Authorizations

x-algolia-application-id
string
header
required

Your Algolia application ID.

x-algolia-api-key
string
header
required

Your Algolia API key with the necessary permissions to make the request. Permissions are controlled through access control lists (ACL) and access restrictions. The required ACL to make a request is listed in each endpoint's reference.

Body

application/json
name
string
required

A/B test name.

Example:

"Custom ranking sales rank test"

variants
object[]
required

A/B test variants.

Minimum length: 2
  • Option 1
  • Option 2
metrics
object[]
required

A/B test metrics involved in the test. Only these metrics will be considered when calculating results.

endAt
string
required

End date and time of the A/B test, in RFC 3339 format.

Example:

"2023-06-17T00:00:00Z"

configuration
object

A/B test configuration.

Response

OK

index
string
required

Index name of the A/B test variant (case-sensitive).

Example:

"delcourt_production"

abTestID
integer
required

Unique A/B test identifier.

Example:

224

taskID
integer
required

Unique identifier of a task.

A successful API response means that a task was added to a queue. It might not run immediately. You can check the task's progress with the task operation and this task ID.

Example:

1514562690001

I