Skip to main content
POST
/
2
/
abtests
curl
curl --request POST \
  --url https://analytics.us.algolia.com/2/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"}],"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.

Required array length: 2 elements
  • Option 1
  • Option 2
endAt
string
required

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

Example:

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

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