openapi: 3.0.2
info:
  title: A/B Testing API
  description: >
    The Algolia A/B Testing API lets you manage your Algolia A/B tests to
    optimize your search experience.


    ## Base URLs


    The base URLs for requests to the A/B testing API are:


    - `https://analytics.us.algolia.com` (alias:
    `https://analytics.algolia.com`)

    - `https://analytics.de.algolia.com`


    Use the URL that matches your [analytics
    region](https://dashboard.algolia.com/account/infrastructure/analytics).


    **All requests must use HTTPS.**


    ## Availability and authentication


    Access to the A/B testing API is available as part of the [Premium or
    Elevate plans](https://www.algolia.com/pricing).


    To authenticate your API requests, add these headers:


    - `x-algolia-application-id`. Your Algolia application ID.

    - `x-algolia-api-key`. An API key with the necessary permissions to make the
    request.
      The required access control list (ACL) to make a request is listed in each endpoint's reference.

    You can find your application ID and API key in the [Algolia
    dashboard](https://dashboard.algolia.com/account).


    ## Rate limits


    You can make up to **100 requests per minute per app** to the A/B testing
    API.

    The response includes headers with information about the limits.


    ## Parameters


    Query parameters must be
    [URL-encoded](https://developer.mozilla.org/en-US/docs/Glossary/Percent-encoding).

    Non-ASCII characters must be UTF-8 encoded.

    Plus characters (`+`) are interpreted as spaces.


    ## Response status and errors


    The A/B testing API returns JSON responses.

    Since JSON doesn't guarantee any specific ordering, don't rely on the order
    of attributes in the API response.


    Successful responses return a `2xx` status. Client errors return a `4xx`
    status. Server errors are indicated by a `5xx` status.

    Error responses have a `message` property with more information.


    ## Version


    The current version of the A/B Testing API is version 2, as indicated by the
    `/2/` in each endpoint's URL.
  version: 2.0.0
servers:
  - url: https://analytics.{region}.algolia.com
    variables:
      region:
        enum:
          - us
          - de
        default: us
  - url: https://analytics.algolia.com
security:
  - appId: []
    apiKey: []
tags:
  - name: abtest
    x-displayName: A/B testing
    description: >
      Manage A/B tests.


      A/B tests are configurations of two indices, usually your production index
      and an index with different settings that you want to test.
externalDocs:
  url: https://www.algolia.com/doc/guides/ab-testing/what-is-ab-testing/
  description: |
    Related guide: A/B testing.
paths:
  /{path}:
    get:
      operationId: customGet
      summary: Send requests to the Algolia REST API
      description: This method allow you to send requests to the Algolia REST API.
      parameters:
        - $ref: '#/components/parameters/PathInPath'
        - $ref: '#/components/parameters/Parameters'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/FeatureNotEnabled'
        '403':
          $ref: '#/components/responses/MethodNotAllowed'
        '404':
          $ref: '#/components/responses/IndexNotFound'
      x-codeSamples:
        - lang: csharp
          label: C#
          source: |
            // Initialize the client
            var client = new AbtestingClient(
              new AbtestingConfig("YOUR_APP_ID", "YOUR_API_KEY", "YOUR_APP_ID_REGION")
            );

            // Call the API
            var response = await client.CustomGetAsync("test/minimal");
        - lang: go
          label: Go
          source: >
            // Initialize the client with your application region, eg.
            abtesting.YOUR_APP_ID_REGION

            client, err := abtesting.NewClient("YOUR_APP_ID", "YOUR_API_KEY",
            abtesting.US)

            if err != nil {
              // The client can fail to initialize if you pass an invalid parameter.
              panic(err)
            }


            // Call the API

            resp, err := client.CustomGet(client.NewApiCustomGetRequest(
              "test/minimal",
            ))

            if err != nil {
              // handle the eventual error
              panic(err)
            }


            // use the model directly

            print(resp)
        - lang: java
          label: Java
          source: >
            // Initialize the client

            AbtestingClient client = new AbtestingClient("YOUR_APP_ID",
            "YOUR_API_KEY", "YOUR_APP_ID_REGION");


            // Call the API

            client.customGet("test/minimal");
        - lang: javascript
          label: JavaScript
          source: |
            // Initialize the client
            const client = abtestingClient(
              'YOUR_APP_ID',
              'YOUR_API_KEY',
              'YOUR_APP_ID_REGION'
            );

            // Call the API
            const response = await client.customGet({ path: 'test/minimal' });

            // use typed response
            console.log(response);
        - lang: kotlin
          label: Kotlin
          source: >
            // Initialize the client

            val client = AbtestingClient(appId = "YOUR_APP_ID", apiKey =
            "YOUR_API_KEY", region = "YOUR_APP_ID_REGION")


            // Call the API

            var response = client.customGet(
              path = "test/minimal",
            )


            // Use the response

            println(response)
        - lang: php
          label: PHP
          source: >
            // Initialize the client

            $client =
            Algolia\AlgoliaSearch\Api\AbtestingClient::create('<YOUR_APP_ID>',
            '<YOUR_API_KEY>', 'YOUR_APP_ID_REGION');


            // Call the API

            $response = $client->customGet(
                'test/minimal',
            );


            // play with the response

            var_dump($response);
        - lang: python
          label: Python
          source: >
            # Initialize the client

            _client = AbtestingClient("YOUR_APP_ID", "YOUR_API_KEY",
            "YOUR_APP_ID_REGION")


            # Call the API

            resp = await _client.custom_get(
                path="test/minimal",
            )


            # use the class directly

            print(resp)


            # print the JSON response

            print(resp.to_json())
        - lang: ruby
          label: Ruby
          source: >
            # Initialize the client

            client = Algolia::AbtestingClient.create('YOUR_APP_ID',
            'YOUR_API_KEY', 'YOUR_APP_ID_REGION')


            # Call the API

            resp = client.custom_get("test/minimal")


            # use the class directly

            puts resp


            # print the JSON response

            puts resp.to_json
        - lang: scala
          label: Scala
          source: >
            // Initialize the client

            val client = AbtestingClient(appId = "YOUR_APP_ID", apiKey =
            "YOUR_API_KEY", region = Option("YOUR_APP_ID_REGION"))


            // Call the API

            val res = client.customGet[JObject](
              path = "test/minimal"
            )


            // Use the response

            val value = Await.result(res, Duration(100, "sec"))
        - lang: swift
          label: Swift
          source: >
            // Initialize the client

            let client = try AbtestingClient(appID: "YOUR_APP_ID", apiKey:
            "YOUR_API_KEY", region: .us)


            // Call the API

            _ = try await client.customGet(path: "test/minimal")
    post:
      operationId: customPost
      requestBody:
        description: Parameters to send with the custom request.
        content:
          application/json:
            schema:
              type: object
      summary: Send requests to the Algolia REST API
      description: This method allow you to send requests to the Algolia REST API.
      parameters:
        - $ref: '#/components/parameters/PathInPath'
        - $ref: '#/components/parameters/Parameters'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/FeatureNotEnabled'
        '403':
          $ref: '#/components/responses/MethodNotAllowed'
        '404':
          $ref: '#/components/responses/IndexNotFound'
      x-codeSamples:
        - lang: csharp
          label: C#
          source: |
            // Initialize the client
            var client = new AbtestingClient(
              new AbtestingConfig("YOUR_APP_ID", "YOUR_API_KEY", "YOUR_APP_ID_REGION")
            );

            // Call the API
            var response = await client.CustomPostAsync("test/minimal");
        - lang: go
          label: Go
          source: >
            // Initialize the client with your application region, eg.
            abtesting.YOUR_APP_ID_REGION

            client, err := abtesting.NewClient("YOUR_APP_ID", "YOUR_API_KEY",
            abtesting.US)

            if err != nil {
              // The client can fail to initialize if you pass an invalid parameter.
              panic(err)
            }


            // Call the API

            resp, err := client.CustomPost(client.NewApiCustomPostRequest(
              "test/minimal",
            ))

            if err != nil {
              // handle the eventual error
              panic(err)
            }


            // use the model directly

            print(resp)
        - lang: java
          label: Java
          source: >
            // Initialize the client

            AbtestingClient client = new AbtestingClient("YOUR_APP_ID",
            "YOUR_API_KEY", "YOUR_APP_ID_REGION");


            // Call the API

            client.customPost("test/minimal");
        - lang: javascript
          label: JavaScript
          source: |
            // Initialize the client
            const client = abtestingClient(
              'YOUR_APP_ID',
              'YOUR_API_KEY',
              'YOUR_APP_ID_REGION'
            );

            // Call the API
            const response = await client.customPost({ path: 'test/minimal' });

            // use typed response
            console.log(response);
        - lang: kotlin
          label: Kotlin
          source: >
            // Initialize the client

            val client = AbtestingClient(appId = "YOUR_APP_ID", apiKey =
            "YOUR_API_KEY", region = "YOUR_APP_ID_REGION")


            // Call the API

            var response = client.customPost(
              path = "test/minimal",
            )


            // Use the response

            println(response)
        - lang: php
          label: PHP
          source: >
            // Initialize the client

            $client =
            Algolia\AlgoliaSearch\Api\AbtestingClient::create('<YOUR_APP_ID>',
            '<YOUR_API_KEY>', 'YOUR_APP_ID_REGION');


            // Call the API

            $response = $client->customPost(
                'test/minimal',
            );


            // play with the response

            var_dump($response);
        - lang: python
          label: Python
          source: >
            # Initialize the client

            _client = AbtestingClient("YOUR_APP_ID", "YOUR_API_KEY",
            "YOUR_APP_ID_REGION")


            # Call the API

            resp = await _client.custom_post(
                path="test/minimal",
            )


            # use the class directly

            print(resp)


            # print the JSON response

            print(resp.to_json())
        - lang: ruby
          label: Ruby
          source: >
            # Initialize the client

            client = Algolia::AbtestingClient.create('YOUR_APP_ID',
            'YOUR_API_KEY', 'YOUR_APP_ID_REGION')


            # Call the API

            resp = client.custom_post("test/minimal")


            # use the class directly

            puts resp


            # print the JSON response

            puts resp.to_json
        - lang: scala
          label: Scala
          source: >
            // Initialize the client

            val client = AbtestingClient(appId = "YOUR_APP_ID", apiKey =
            "YOUR_API_KEY", region = Option("YOUR_APP_ID_REGION"))


            // Call the API

            val res = client.customPost[JObject](
              path = "test/minimal"
            )


            // Use the response

            val value = Await.result(res, Duration(100, "sec"))
        - lang: swift
          label: Swift
          source: >
            // Initialize the client

            let client = try AbtestingClient(appID: "YOUR_APP_ID", apiKey:
            "YOUR_API_KEY", region: .us)


            // Call the API

            _ = try await client.customPost(path: "test/minimal")
    put:
      operationId: customPut
      requestBody:
        description: Parameters to send with the custom request.
        content:
          application/json:
            schema:
              type: object
      summary: Send requests to the Algolia REST API
      description: This method allow you to send requests to the Algolia REST API.
      parameters:
        - $ref: '#/components/parameters/PathInPath'
        - $ref: '#/components/parameters/Parameters'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/FeatureNotEnabled'
        '403':
          $ref: '#/components/responses/MethodNotAllowed'
        '404':
          $ref: '#/components/responses/IndexNotFound'
      x-codeSamples:
        - lang: csharp
          label: C#
          source: |
            // Initialize the client
            var client = new AbtestingClient(
              new AbtestingConfig("YOUR_APP_ID", "YOUR_API_KEY", "YOUR_APP_ID_REGION")
            );

            // Call the API
            var response = await client.CustomPutAsync("test/minimal");
        - lang: go
          label: Go
          source: >
            // Initialize the client with your application region, eg.
            abtesting.YOUR_APP_ID_REGION

            client, err := abtesting.NewClient("YOUR_APP_ID", "YOUR_API_KEY",
            abtesting.US)

            if err != nil {
              // The client can fail to initialize if you pass an invalid parameter.
              panic(err)
            }


            // Call the API

            resp, err := client.CustomPut(client.NewApiCustomPutRequest(
              "test/minimal",
            ))

            if err != nil {
              // handle the eventual error
              panic(err)
            }


            // use the model directly

            print(resp)
        - lang: java
          label: Java
          source: >
            // Initialize the client

            AbtestingClient client = new AbtestingClient("YOUR_APP_ID",
            "YOUR_API_KEY", "YOUR_APP_ID_REGION");


            // Call the API

            client.customPut("test/minimal");
        - lang: javascript
          label: JavaScript
          source: |
            // Initialize the client
            const client = abtestingClient(
              'YOUR_APP_ID',
              'YOUR_API_KEY',
              'YOUR_APP_ID_REGION'
            );

            // Call the API
            const response = await client.customPut({ path: 'test/minimal' });

            // use typed response
            console.log(response);
        - lang: kotlin
          label: Kotlin
          source: >
            // Initialize the client

            val client = AbtestingClient(appId = "YOUR_APP_ID", apiKey =
            "YOUR_API_KEY", region = "YOUR_APP_ID_REGION")


            // Call the API

            var response = client.customPut(
              path = "test/minimal",
            )


            // Use the response

            println(response)
        - lang: php
          label: PHP
          source: >
            // Initialize the client

            $client =
            Algolia\AlgoliaSearch\Api\AbtestingClient::create('<YOUR_APP_ID>',
            '<YOUR_API_KEY>', 'YOUR_APP_ID_REGION');


            // Call the API

            $response = $client->customPut(
                'test/minimal',
            );


            // play with the response

            var_dump($response);
        - lang: python
          label: Python
          source: >
            # Initialize the client

            _client = AbtestingClient("YOUR_APP_ID", "YOUR_API_KEY",
            "YOUR_APP_ID_REGION")


            # Call the API

            resp = await _client.custom_put(
                path="test/minimal",
            )


            # use the class directly

            print(resp)


            # print the JSON response

            print(resp.to_json())
        - lang: ruby
          label: Ruby
          source: >
            # Initialize the client

            client = Algolia::AbtestingClient.create('YOUR_APP_ID',
            'YOUR_API_KEY', 'YOUR_APP_ID_REGION')


            # Call the API

            resp = client.custom_put("test/minimal")


            # use the class directly

            puts resp


            # print the JSON response

            puts resp.to_json
        - lang: scala
          label: Scala
          source: >
            // Initialize the client

            val client = AbtestingClient(appId = "YOUR_APP_ID", apiKey =
            "YOUR_API_KEY", region = Option("YOUR_APP_ID_REGION"))


            // Call the API

            val res = client.customPut[JObject](
              path = "test/minimal"
            )


            // Use the response

            val value = Await.result(res, Duration(100, "sec"))
        - lang: swift
          label: Swift
          source: >
            // Initialize the client

            let client = try AbtestingClient(appID: "YOUR_APP_ID", apiKey:
            "YOUR_API_KEY", region: .us)


            // Call the API

            _ = try await client.customPut(path: "test/minimal")
    delete:
      operationId: customDelete
      summary: Send requests to the Algolia REST API
      description: This method allow you to send requests to the Algolia REST API.
      parameters:
        - $ref: '#/components/parameters/PathInPath'
        - $ref: '#/components/parameters/Parameters'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/FeatureNotEnabled'
        '403':
          $ref: '#/components/responses/MethodNotAllowed'
        '404':
          $ref: '#/components/responses/IndexNotFound'
      x-codeSamples:
        - lang: csharp
          label: C#
          source: |
            // Initialize the client
            var client = new AbtestingClient(
              new AbtestingConfig("YOUR_APP_ID", "YOUR_API_KEY", "YOUR_APP_ID_REGION")
            );

            // Call the API
            var response = await client.CustomDeleteAsync("test/minimal");
        - lang: go
          label: Go
          source: >
            // Initialize the client with your application region, eg.
            abtesting.YOUR_APP_ID_REGION

            client, err := abtesting.NewClient("YOUR_APP_ID", "YOUR_API_KEY",
            abtesting.US)

            if err != nil {
              // The client can fail to initialize if you pass an invalid parameter.
              panic(err)
            }


            // Call the API

            resp, err := client.CustomDelete(client.NewApiCustomDeleteRequest(
              "test/minimal",
            ))

            if err != nil {
              // handle the eventual error
              panic(err)
            }


            // use the model directly

            print(resp)
        - lang: java
          label: Java
          source: >
            // Initialize the client

            AbtestingClient client = new AbtestingClient("YOUR_APP_ID",
            "YOUR_API_KEY", "YOUR_APP_ID_REGION");


            // Call the API

            client.customDelete("test/minimal");
        - lang: javascript
          label: JavaScript
          source: >
            // Initialize the client

            const client = abtestingClient(
              'YOUR_APP_ID',
              'YOUR_API_KEY',
              'YOUR_APP_ID_REGION'
            );


            // Call the API

            const response = await client.customDelete({ path: 'test/minimal'
            });


            // use typed response

            console.log(response);
        - lang: kotlin
          label: Kotlin
          source: >
            // Initialize the client

            val client = AbtestingClient(appId = "YOUR_APP_ID", apiKey =
            "YOUR_API_KEY", region = "YOUR_APP_ID_REGION")


            // Call the API

            var response = client.customDelete(
              path = "test/minimal",
            )


            // Use the response

            println(response)
        - lang: php
          label: PHP
          source: >
            // Initialize the client

            $client =
            Algolia\AlgoliaSearch\Api\AbtestingClient::create('<YOUR_APP_ID>',
            '<YOUR_API_KEY>', 'YOUR_APP_ID_REGION');


            // Call the API

            $response = $client->customDelete(
                'test/minimal',
            );


            // play with the response

            var_dump($response);
        - lang: python
          label: Python
          source: >
            # Initialize the client

            _client = AbtestingClient("YOUR_APP_ID", "YOUR_API_KEY",
            "YOUR_APP_ID_REGION")


            # Call the API

            resp = await _client.custom_delete(
                path="test/minimal",
            )


            # use the class directly

            print(resp)


            # print the JSON response

            print(resp.to_json())
        - lang: ruby
          label: Ruby
          source: >
            # Initialize the client

            client = Algolia::AbtestingClient.create('YOUR_APP_ID',
            'YOUR_API_KEY', 'YOUR_APP_ID_REGION')


            # Call the API

            resp = client.custom_delete("test/minimal")


            # use the class directly

            puts resp


            # print the JSON response

            puts resp.to_json
        - lang: scala
          label: Scala
          source: >
            // Initialize the client

            val client = AbtestingClient(appId = "YOUR_APP_ID", apiKey =
            "YOUR_API_KEY", region = Option("YOUR_APP_ID_REGION"))


            // Call the API

            val res = client.customDelete[JObject](
              path = "test/minimal"
            )


            // Use the response

            val value = Await.result(res, Duration(100, "sec"))
        - lang: swift
          label: Swift
          source: >
            // Initialize the client

            let client = try AbtestingClient(appID: "YOUR_APP_ID", apiKey:
            "YOUR_API_KEY", region: .us)


            // Call the API

            _ = try await client.customDelete(path: "test/minimal")
  /2/abtests:
    post:
      tags:
        - abtest
      operationId: addABTests
      x-acl:
        - editSettings
      summary: Create an A/B test
      description: Creates a new A/B test.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              title: addABTestsRequest
              type: object
              additionalProperties: false
              properties:
                name:
                  $ref: '#/components/schemas/name'
                variants:
                  type: array
                  description: A/B test variants.
                  minItems: 2
                  maxItems: 2
                  items:
                    $ref: '#/components/schemas/AddABTestsVariant'
                endAt:
                  $ref: '#/components/schemas/endAt'
              required:
                - name
                - variants
                - endAt
      responses:
        '200':
          description: OK
          headers:
            x-ratelimit-limit:
              $ref: '#/components/headers/x-ratelimit-limit'
            x-ratelimit-remaining:
              $ref: '#/components/headers/x-ratelimit-remaining'
            x-ratelimit-reset:
              $ref: '#/components/headers/x-ratelimit-reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ABTestResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/FeatureNotEnabled'
        '403':
          $ref: '#/components/responses/MethodNotAllowed'
        '404':
          $ref: '#/components/responses/IndexNotFound'
      x-codeSamples:
        - lang: csharp
          label: C#
          source: |
            // Initialize the client
            var client = new AbtestingClient(
              new AbtestingConfig("YOUR_APP_ID", "YOUR_API_KEY", "YOUR_APP_ID_REGION")
            );

            // Call the API
            var response = await client.AddABTestsAsync(
              new AddABTestsRequest
              {
                EndAt = "2022-12-31T00:00:00.000Z",
                Name = "myABTest",
                Variants = new List<AddABTestsVariant>
                {
                  new AddABTestsVariant(
                    new AbTestsVariant { Index = "AB_TEST_1", TrafficPercentage = 30, }
                  ),
                  new AddABTestsVariant(new AbTestsVariant { Index = "AB_TEST_2", TrafficPercentage = 50, })
                },
              }
            );
        - lang: go
          label: Go
          source: >
            // Initialize the client with your application region, eg.
            abtesting.YOUR_APP_ID_REGION

            client, err := abtesting.NewClient("YOUR_APP_ID", "YOUR_API_KEY",
            abtesting.US)

            if err != nil {
              // The client can fail to initialize if you pass an invalid parameter.
              panic(err)
            }


            // Call the API

            resp, err := client.AddABTests(client.NewApiAddABTestsRequest(

              abtesting.NewEmptyAddABTestsRequest().SetEndAt("2022-12-31T00:00:00.000Z").SetName("myABTest").SetVariants(
                []abtesting.AddABTestsVariant{*abtesting.AbTestsVariantAsAddABTestsVariant(
                  abtesting.NewEmptyAbTestsVariant().SetIndex("AB_TEST_1").SetTrafficPercentage(30)), *abtesting.AbTestsVariantAsAddABTestsVariant(
                  abtesting.NewEmptyAbTestsVariant().SetIndex("AB_TEST_2").SetTrafficPercentage(50))}),
            ))

            if err != nil {
              // handle the eventual error
              panic(err)
            }


            // use the model directly

            print(resp)
        - lang: java
          label: Java
          source: >
            // Initialize the client

            AbtestingClient client = new AbtestingClient("YOUR_APP_ID",
            "YOUR_API_KEY", "YOUR_APP_ID_REGION");


            // Call the API

            client.addABTests(
              new AddABTestsRequest()
                .setEndAt("2022-12-31T00:00:00.000Z")
                .setName("myABTest")
                .setVariants(
                  List.of(
                    new AbTestsVariant().setIndex("AB_TEST_1").setTrafficPercentage(30),
                    new AbTestsVariant().setIndex("AB_TEST_2").setTrafficPercentage(50)
                  )
                )
            );
        - lang: javascript
          label: JavaScript
          source: |
            // Initialize the client
            const client = abtestingClient(
              'YOUR_APP_ID',
              'YOUR_API_KEY',
              'YOUR_APP_ID_REGION'
            );

            // Call the API
            const response = await client.addABTests({
              endAt: '2022-12-31T00:00:00.000Z',
              name: 'myABTest',
              variants: [
                { index: 'AB_TEST_1', trafficPercentage: 30 },
                { index: 'AB_TEST_2', trafficPercentage: 50 },
              ],
            });

            // use typed response
            console.log(response);
        - lang: kotlin
          label: Kotlin
          source: >
            // Initialize the client

            val client = AbtestingClient(appId = "YOUR_APP_ID", apiKey =
            "YOUR_API_KEY", region = "YOUR_APP_ID_REGION")


            // Call the API

            var response = client.addABTests(
              addABTestsRequest = AddABTestsRequest(
                endAt = "2022-12-31T00:00:00.000Z",
                name = "myABTest",
                variants = listOf(
                  AbTestsVariant(
                    index = "AB_TEST_1",
                    trafficPercentage = 30,
                  ),
                  AbTestsVariant(
                    index = "AB_TEST_2",
                    trafficPercentage = 50,
                  ),
                ),
              ),
            )


            // Use the response

            println(response)
        - lang: php
          label: PHP
          source: >
            // Initialize the client

            $client =
            Algolia\AlgoliaSearch\Api\AbtestingClient::create('<YOUR_APP_ID>',
            '<YOUR_API_KEY>', 'YOUR_APP_ID_REGION');


            // Call the API

            $response = $client->addABTests(
                ['endAt' => '2022-12-31T00:00:00.000Z',
                    'name' => 'myABTest',
                    'variants' => [
                        ['index' => 'AB_TEST_1',
                            'trafficPercentage' => 30,
                        ],

                        ['index' => 'AB_TEST_2',
                            'trafficPercentage' => 50,
                        ],
                    ],
                ],
            );


            // play with the response

            var_dump($response);
        - lang: python
          label: Python
          source: >
            # Initialize the client

            _client = AbtestingClient("YOUR_APP_ID", "YOUR_API_KEY",
            "YOUR_APP_ID_REGION")


            # Call the API

            resp = await _client.add_ab_tests(
                add_ab_tests_request={
                    "endAt": "2022-12-31T00:00:00.000Z",
                    "name": "myABTest",
                    "variants": [
                        {
                            "index": "AB_TEST_1",
                            "trafficPercentage": 30,
                        },
                        {
                            "index": "AB_TEST_2",
                            "trafficPercentage": 50,
                        },
                    ],
                },
            )


            # use the class directly

            print(resp)


            # print the JSON response

            print(resp.to_json())
        - lang: ruby
          label: Ruby
          source: >
            # Initialize the client

            client = Algolia::AbtestingClient.create('YOUR_APP_ID',
            'YOUR_API_KEY', 'YOUR_APP_ID_REGION')


            # Call the API

            resp = client.add_ab_tests(
              AddABTestsRequest.new(
                end_at: "2022-12-31T00:00:00.000Z",
                name: "myABTest",
                variants: [AbTestsVariant.new(index: "AB_TEST_1", traffic_percentage: 30),
                  AbTestsVariant.new(index: "AB_TEST_2", traffic_percentage: 50)]
              )
            )


            # use the class directly

            puts resp


            # print the JSON response

            puts resp.to_json
        - lang: scala
          label: Scala
          source: >
            // Initialize the client

            val client = AbtestingClient(appId = "YOUR_APP_ID", apiKey =
            "YOUR_API_KEY", region = Option("YOUR_APP_ID_REGION"))


            // Call the API

            val res = client.addABTests(
              addABTestsRequest = AddABTestsRequest(
                endAt = "2022-12-31T00:00:00.000Z",
                name = "myABTest",
                variants = Seq(
                  AbTestsVariant(
                    index = "AB_TEST_1",
                    trafficPercentage = 30
                  ),
                  AbTestsVariant(
                    index = "AB_TEST_2",
                    trafficPercentage = 50
                  )
                )
              )
            )


            // Use the response

            val value = Await.result(res, Duration(100, "sec"))
        - lang: swift
          label: Swift
          source: >
            // Initialize the client

            let client = try AbtestingClient(appID: "YOUR_APP_ID", apiKey:
            "YOUR_API_KEY", region: .us)


            // Call the API

            _ = try await client.addABTests(addABTestsRequest:
            AddABTestsRequest(
                name: "myABTest",
                variants: [
                    AddABTestsVariant.abTestsVariant(AbTestsVariant(index: "AB_TEST_1", trafficPercentage: 30)),
                    AddABTestsVariant.abTestsVariant(AbTestsVariant(index: "AB_TEST_2", trafficPercentage: 50)),
                ],
                endAt: "2022-12-31T00:00:00.000Z"
            ))
    get:
      tags:
        - abtest
      operationId: listABTests
      x-acl:
        - analytics
      summary: List all A/B tests
      description: Lists all A/B tests you configured for this application.
      parameters:
        - $ref: '#/components/parameters/Offset'
        - $ref: '#/components/parameters/Limit'
        - name: indexPrefix
          in: query
          description: >-
            Index name prefix. Only A/B tests for indices starting with this
            string are included in the response.
          example: dev_
          schema:
            type: string
        - name: indexSuffix
          in: query
          description: >-
            Index name suffix. Only A/B tests for indices ending with this
            string are included in the response.
          example: _development
          schema:
            type: string
      responses:
        '200':
          description: OK
          headers:
            x-ratelimit-limit:
              $ref: '#/components/headers/x-ratelimit-limit'
            x-ratelimit-remaining:
              $ref: '#/components/headers/x-ratelimit-remaining'
            x-ratelimit-reset:
              $ref: '#/components/headers/x-ratelimit-reset'
          content:
            application/json:
              schema:
                title: listABTestsResponse
                type: object
                additionalProperties: false
                properties:
                  abtests:
                    $ref: '#/components/schemas/ABTests'
                  count:
                    type: integer
                    description: Number of A/B tests.
                    example: 10
                  total:
                    type: integer
                    description: Number of retrievable A/B tests.
                    example: 12
                required:
                  - abtests
                  - count
                  - total
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/FeatureNotEnabled'
        '403':
          $ref: '#/components/responses/MethodNotAllowed'
        '404':
          $ref: '#/components/responses/IndexNotFound'
      x-codeSamples:
        - lang: csharp
          label: C#
          source: |
            // Initialize the client
            var client = new AbtestingClient(
              new AbtestingConfig("YOUR_APP_ID", "YOUR_API_KEY", "YOUR_APP_ID_REGION")
            );

            // Call the API
            var response = await client.ListABTestsAsync();
        - lang: go
          label: Go
          source: >
            // Initialize the client with your application region, eg.
            abtesting.YOUR_APP_ID_REGION

            client, err := abtesting.NewClient("YOUR_APP_ID", "YOUR_API_KEY",
            abtesting.US)

            if err != nil {
              // The client can fail to initialize if you pass an invalid parameter.
              panic(err)
            }


            // Call the API

            resp, err := client.ListABTests(client.NewApiListABTestsRequest())

            if err != nil {
              // handle the eventual error
              panic(err)
            }


            // use the model directly

            print(resp)
        - lang: java
          label: Java
          source: >
            // Initialize the client

            AbtestingClient client = new AbtestingClient("YOUR_APP_ID",
            "YOUR_API_KEY", "YOUR_APP_ID_REGION");


            // Call the API

            client.listABTests();
        - lang: javascript
          label: JavaScript
          source: |
            // Initialize the client
            const client = abtestingClient(
              'YOUR_APP_ID',
              'YOUR_API_KEY',
              'YOUR_APP_ID_REGION'
            );

            // Call the API
            const response = await client.listABTests();

            // use typed response
            console.log(response);
        - lang: kotlin
          label: Kotlin
          source: >
            // Initialize the client

            val client = AbtestingClient(appId = "YOUR_APP_ID", apiKey =
            "YOUR_API_KEY", region = "YOUR_APP_ID_REGION")


            // Call the API

            var response = client.listABTests()


            // Use the response

            println(response)
        - lang: php
          label: PHP
          source: >
            // Initialize the client

            $client =
            Algolia\AlgoliaSearch\Api\AbtestingClient::create('<YOUR_APP_ID>',
            '<YOUR_API_KEY>', 'YOUR_APP_ID_REGION');


            // Call the API

            $response = $client->listABTests();


            // play with the response

            var_dump($response);
        - lang: python
          label: Python
          source: >
            # Initialize the client

            _client = AbtestingClient("YOUR_APP_ID", "YOUR_API_KEY",
            "YOUR_APP_ID_REGION")


            # Call the API

            resp = await _client.list_ab_tests()


            # use the class directly

            print(resp)


            # print the JSON response

            print(resp.to_json())
        - lang: ruby
          label: Ruby
          source: >
            # Initialize the client

            client = Algolia::AbtestingClient.create('YOUR_APP_ID',
            'YOUR_API_KEY', 'YOUR_APP_ID_REGION')


            # Call the API

            resp = client.list_ab_tests


            # use the class directly

            puts resp


            # print the JSON response

            puts resp.to_json
        - lang: scala
          label: Scala
          source: >
            // Initialize the client

            val client = AbtestingClient(appId = "YOUR_APP_ID", apiKey =
            "YOUR_API_KEY", region = Option("YOUR_APP_ID_REGION"))


            // Call the API

            val res = client.listABTests(

            )


            // Use the response

            val value = Await.result(res, Duration(100, "sec"))
        - lang: swift
          label: Swift
          source: >
            // Initialize the client

            let client = try AbtestingClient(appID: "YOUR_APP_ID", apiKey:
            "YOUR_API_KEY", region: .us)


            // Call the API

            _ = try await client.listABTests()
  /2/abtests/{id}:
    get:
      tags:
        - abtest
      operationId: getABTest
      x-acl:
        - analytics
      summary: Retrieve A/B test details
      description: Retrieves the details for an A/B test by its ID.
      parameters:
        - $ref: '#/components/parameters/ID'
      responses:
        '200':
          description: OK
          headers:
            x-ratelimit-limit:
              $ref: '#/components/headers/x-ratelimit-limit'
            x-ratelimit-remaining:
              $ref: '#/components/headers/x-ratelimit-remaining'
            x-ratelimit-reset:
              $ref: '#/components/headers/x-ratelimit-reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ABTest'
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/FeatureNotEnabled'
        '403':
          $ref: '#/components/responses/MethodNotAllowed'
        '404':
          $ref: '#/components/responses/IndexNotFound'
      x-codeSamples:
        - lang: csharp
          label: C#
          source: |
            // Initialize the client
            var client = new AbtestingClient(
              new AbtestingConfig("YOUR_APP_ID", "YOUR_API_KEY", "YOUR_APP_ID_REGION")
            );

            // Call the API
            var response = await client.GetABTestAsync(42);
        - lang: go
          label: Go
          source: >
            // Initialize the client with your application region, eg.
            abtesting.YOUR_APP_ID_REGION

            client, err := abtesting.NewClient("YOUR_APP_ID", "YOUR_API_KEY",
            abtesting.US)

            if err != nil {
              // The client can fail to initialize if you pass an invalid parameter.
              panic(err)
            }


            // Call the API

            resp, err := client.GetABTest(client.NewApiGetABTestRequest(
              42,
            ))

            if err != nil {
              // handle the eventual error
              panic(err)
            }


            // use the model directly

            print(resp)
        - lang: java
          label: Java
          source: >
            // Initialize the client

            AbtestingClient client = new AbtestingClient("YOUR_APP_ID",
            "YOUR_API_KEY", "YOUR_APP_ID_REGION");


            // Call the API

            client.getABTest(42);
        - lang: javascript
          label: JavaScript
          source: |
            // Initialize the client
            const client = abtestingClient(
              'YOUR_APP_ID',
              'YOUR_API_KEY',
              'YOUR_APP_ID_REGION'
            );

            // Call the API
            const response = await client.getABTest({ id: 42 });

            // use typed response
            console.log(response);
        - lang: kotlin
          label: Kotlin
          source: >
            // Initialize the client

            val client = AbtestingClient(appId = "YOUR_APP_ID", apiKey =
            "YOUR_API_KEY", region = "YOUR_APP_ID_REGION")


            // Call the API

            var response = client.getABTest(
              id = 42,
            )


            // Use the response

            println(response)
        - lang: php
          label: PHP
          source: >
            // Initialize the client

            $client =
            Algolia\AlgoliaSearch\Api\AbtestingClient::create('<YOUR_APP_ID>',
            '<YOUR_API_KEY>', 'YOUR_APP_ID_REGION');


            // Call the API

            $response = $client->getABTest(
                42,
            );


            // play with the response

            var_dump($response);
        - lang: python
          label: Python
          source: >
            # Initialize the client

            _client = AbtestingClient("YOUR_APP_ID", "YOUR_API_KEY",
            "YOUR_APP_ID_REGION")


            # Call the API

            resp = await _client.get_ab_test(
                id=42,
            )


            # use the class directly

            print(resp)


            # print the JSON response

            print(resp.to_json())
        - lang: ruby
          label: Ruby
          source: >
            # Initialize the client

            client = Algolia::AbtestingClient.create('YOUR_APP_ID',
            'YOUR_API_KEY', 'YOUR_APP_ID_REGION')


            # Call the API

            resp = client.get_ab_test(42)


            # use the class directly

            puts resp


            # print the JSON response

            puts resp.to_json
        - lang: scala
          label: Scala
          source: >
            // Initialize the client

            val client = AbtestingClient(appId = "YOUR_APP_ID", apiKey =
            "YOUR_API_KEY", region = Option("YOUR_APP_ID_REGION"))


            // Call the API

            val res = client.getABTest(
              id = 42
            )


            // Use the response

            val value = Await.result(res, Duration(100, "sec"))
        - lang: swift
          label: Swift
          source: >
            // Initialize the client

            let client = try AbtestingClient(appID: "YOUR_APP_ID", apiKey:
            "YOUR_API_KEY", region: .us)


            // Call the API

            _ = try await client.getABTest(id: 42)
    delete:
      tags:
        - abtest
      operationId: deleteABTest
      x-acl:
        - editSettings
      summary: Delete an A/B test
      description: Deletes an A/B test by its ID.
      parameters:
        - $ref: '#/components/parameters/ID'
      responses:
        '200':
          description: OK
          headers:
            x-ratelimit-limit:
              $ref: '#/components/headers/x-ratelimit-limit'
            x-ratelimit-remaining:
              $ref: '#/components/headers/x-ratelimit-remaining'
            x-ratelimit-reset:
              $ref: '#/components/headers/x-ratelimit-reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ABTestResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/FeatureNotEnabled'
        '403':
          $ref: '#/components/responses/MethodNotAllowed'
        '404':
          $ref: '#/components/responses/IndexNotFound'
      x-codeSamples:
        - lang: csharp
          label: C#
          source: |
            // Initialize the client
            var client = new AbtestingClient(
              new AbtestingConfig("YOUR_APP_ID", "YOUR_API_KEY", "YOUR_APP_ID_REGION")
            );

            // Call the API
            var response = await client.DeleteABTestAsync(42);
        - lang: go
          label: Go
          source: >
            // Initialize the client with your application region, eg.
            abtesting.YOUR_APP_ID_REGION

            client, err := abtesting.NewClient("YOUR_APP_ID", "YOUR_API_KEY",
            abtesting.US)

            if err != nil {
              // The client can fail to initialize if you pass an invalid parameter.
              panic(err)
            }


            // Call the API

            resp, err := client.DeleteABTest(client.NewApiDeleteABTestRequest(
              42,
            ))

            if err != nil {
              // handle the eventual error
              panic(err)
            }


            // use the model directly

            print(resp)
        - lang: java
          label: Java
          source: >
            // Initialize the client

            AbtestingClient client = new AbtestingClient("YOUR_APP_ID",
            "YOUR_API_KEY", "YOUR_APP_ID_REGION");


            // Call the API

            client.deleteABTest(42);
        - lang: javascript
          label: JavaScript
          source: |
            // Initialize the client
            const client = abtestingClient(
              'YOUR_APP_ID',
              'YOUR_API_KEY',
              'YOUR_APP_ID_REGION'
            );

            // Call the API
            const response = await client.deleteABTest({ id: 42 });

            // use typed response
            console.log(response);
        - lang: kotlin
          label: Kotlin
          source: >
            // Initialize the client

            val client = AbtestingClient(appId = "YOUR_APP_ID", apiKey =
            "YOUR_API_KEY", region = "YOUR_APP_ID_REGION")


            // Call the API

            var response = client.deleteABTest(
              id = 42,
            )


            // Use the response

            println(response)
        - lang: php
          label: PHP
          source: >
            // Initialize the client

            $client =
            Algolia\AlgoliaSearch\Api\AbtestingClient::create('<YOUR_APP_ID>',
            '<YOUR_API_KEY>', 'YOUR_APP_ID_REGION');


            // Call the API

            $response = $client->deleteABTest(
                42,
            );


            // play with the response

            var_dump($response);
        - lang: python
          label: Python
          source: >
            # Initialize the client

            _client = AbtestingClient("YOUR_APP_ID", "YOUR_API_KEY",
            "YOUR_APP_ID_REGION")


            # Call the API

            resp = await _client.delete_ab_test(
                id=42,
            )


            # use the class directly

            print(resp)


            # print the JSON response

            print(resp.to_json())
        - lang: ruby
          label: Ruby
          source: >
            # Initialize the client

            client = Algolia::AbtestingClient.create('YOUR_APP_ID',
            'YOUR_API_KEY', 'YOUR_APP_ID_REGION')


            # Call the API

            resp = client.delete_ab_test(42)


            # use the class directly

            puts resp


            # print the JSON response

            puts resp.to_json
        - lang: scala
          label: Scala
          source: >
            // Initialize the client

            val client = AbtestingClient(appId = "YOUR_APP_ID", apiKey =
            "YOUR_API_KEY", region = Option("YOUR_APP_ID_REGION"))


            // Call the API

            val res = client.deleteABTest(
              id = 42
            )


            // Use the response

            val value = Await.result(res, Duration(100, "sec"))
        - lang: swift
          label: Swift
          source: >
            // Initialize the client

            let client = try AbtestingClient(appID: "YOUR_APP_ID", apiKey:
            "YOUR_API_KEY", region: .us)


            // Call the API

            _ = try await client.deleteABTest(id: 42)
  /2/abtests/{id}/stop:
    post:
      tags:
        - abtest
      operationId: stopABTest
      x-acl:
        - editSettings
      summary: Stop an A/B test
      description: |
        Stops an A/B test by its ID.

        You can't restart stopped A/B tests.
      parameters:
        - $ref: '#/components/parameters/ID'
      responses:
        '200':
          description: OK
          headers:
            x-ratelimit-limit:
              $ref: '#/components/headers/x-ratelimit-limit'
            x-ratelimit-remaining:
              $ref: '#/components/headers/x-ratelimit-remaining'
            x-ratelimit-reset:
              $ref: '#/components/headers/x-ratelimit-reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ABTestResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/FeatureNotEnabled'
        '403':
          $ref: '#/components/responses/MethodNotAllowed'
        '404':
          $ref: '#/components/responses/IndexNotFound'
      x-codeSamples:
        - lang: csharp
          label: C#
          source: |
            // Initialize the client
            var client = new AbtestingClient(
              new AbtestingConfig("YOUR_APP_ID", "YOUR_API_KEY", "YOUR_APP_ID_REGION")
            );

            // Call the API
            var response = await client.StopABTestAsync(42);
        - lang: go
          label: Go
          source: >
            // Initialize the client with your application region, eg.
            abtesting.YOUR_APP_ID_REGION

            client, err := abtesting.NewClient("YOUR_APP_ID", "YOUR_API_KEY",
            abtesting.US)

            if err != nil {
              // The client can fail to initialize if you pass an invalid parameter.
              panic(err)
            }


            // Call the API

            resp, err := client.StopABTest(client.NewApiStopABTestRequest(
              42,
            ))

            if err != nil {
              // handle the eventual error
              panic(err)
            }


            // use the model directly

            print(resp)
        - lang: java
          label: Java
          source: >
            // Initialize the client

            AbtestingClient client = new AbtestingClient("YOUR_APP_ID",
            "YOUR_API_KEY", "YOUR_APP_ID_REGION");


            // Call the API

            client.stopABTest(42);
        - lang: javascript
          label: JavaScript
          source: |
            // Initialize the client
            const client = abtestingClient(
              'YOUR_APP_ID',
              'YOUR_API_KEY',
              'YOUR_APP_ID_REGION'
            );

            // Call the API
            const response = await client.stopABTest({ id: 42 });

            // use typed response
            console.log(response);
        - lang: kotlin
          label: Kotlin
          source: >
            // Initialize the client

            val client = AbtestingClient(appId = "YOUR_APP_ID", apiKey =
            "YOUR_API_KEY", region = "YOUR_APP_ID_REGION")


            // Call the API

            var response = client.stopABTest(
              id = 42,
            )


            // Use the response

            println(response)
        - lang: php
          label: PHP
          source: >
            // Initialize the client

            $client =
            Algolia\AlgoliaSearch\Api\AbtestingClient::create('<YOUR_APP_ID>',
            '<YOUR_API_KEY>', 'YOUR_APP_ID_REGION');


            // Call the API

            $response = $client->stopABTest(
                42,
            );


            // play with the response

            var_dump($response);
        - lang: python
          label: Python
          source: >
            # Initialize the client

            _client = AbtestingClient("YOUR_APP_ID", "YOUR_API_KEY",
            "YOUR_APP_ID_REGION")


            # Call the API

            resp = await _client.stop_ab_test(
                id=42,
            )


            # use the class directly

            print(resp)


            # print the JSON response

            print(resp.to_json())
        - lang: ruby
          label: Ruby
          source: >
            # Initialize the client

            client = Algolia::AbtestingClient.create('YOUR_APP_ID',
            'YOUR_API_KEY', 'YOUR_APP_ID_REGION')


            # Call the API

            resp = client.stop_ab_test(42)


            # use the class directly

            puts resp


            # print the JSON response

            puts resp.to_json
        - lang: scala
          label: Scala
          source: >
            // Initialize the client

            val client = AbtestingClient(appId = "YOUR_APP_ID", apiKey =
            "YOUR_API_KEY", region = Option("YOUR_APP_ID_REGION"))


            // Call the API

            val res = client.stopABTest(
              id = 42
            )


            // Use the response

            val value = Await.result(res, Duration(100, "sec"))
        - lang: swift
          label: Swift
          source: >
            // Initialize the client

            let client = try AbtestingClient(appID: "YOUR_APP_ID", apiKey:
            "YOUR_API_KEY", region: .us)


            // Call the API

            _ = try await client.stopABTest(id: 42)
components:
  securitySchemes:
    appId:
      type: apiKey
      in: header
      name: x-algolia-application-id
      description: Your Algolia application ID.
    apiKey:
      type: apiKey
      in: header
      name: x-algolia-api-key
      description: >
        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.
  parameters:
    PathInPath:
      name: path
      in: path
      description: Path of the endpoint, anything after "/1" must be specified.
      required: true
      schema:
        type: string
        example: /keys
    Parameters:
      name: parameters
      in: query
      description: Query parameters to apply to the current query.
      schema:
        type: object
        additionalProperties: true
    Offset:
      in: query
      name: offset
      description: Position of the first item to return.
      schema:
        type: integer
        default: 0
        minimum: 0
    Limit:
      in: query
      name: limit
      description: Number of items to return.
      schema:
        type: integer
        default: 10
    ID:
      in: path
      name: id
      description: Unique A/B test identifier.
      required: true
      schema:
        $ref: '#/components/schemas/abTestID'
  schemas:
    ErrorBase:
      description: Error.
      type: object
      additionalProperties: true
      properties:
        message:
          type: string
          example: Invalid Application-Id or API-Key
    abTestID:
      type: integer
      description: Unique A/B test identifier.
      example: 224
    updatedAt:
      type: string
      description: Date and time when the A/B test was last updated, in RFC 3339 format.
      example: '2023-06-15T15:06:44.400601Z'
    createdAt:
      type: string
      description: Date and time when the A/B test was created, in RFC 3339 format.
      example: '2023-06-15T15:06:04.249906Z'
    endAt:
      type: string
      description: End date and time of the A/B test, in RFC 3339 format.
      example: '2023-06-17T00:00:00Z'
    name:
      type: string
      description: A/B test name.
      example: Custom ranking sales rank test
    Status:
      type: string
      description: >
        A/B test status.


        - `active`. The A/B test is live and search traffic is split between the
        two variants.

        - `stopped`. You stopped the A/B test. The A/B test data is still
        available for analysis.

        - `expired`. The A/B test was automatically stopped after reaching its
        end date.

        - `failed`. Creating the A/B test failed.
      example: active
      enum:
        - active
        - stopped
        - expired
        - failed
    currency:
      type: object
      properties:
        currency:
          type: string
          description: Currency code.
          example: USD
        revenue:
          type: number
          format: double
          description: Revenue for this currency.
          example: 120
        mean:
          type: number
          format: double
          description: Mean for this currency.
          example: 53.7
        standardDeviation:
          type: number
          format: double
          description: Standard deviation for this currency.
          example: 12.3
    currencies:
      type: object
      description: A/B test currencies.
      example:
        USD:
          currency: USD
          revenue: 120
          mean: 53.7
          standardDeviation: 12.3
        EUR:
          currency: EUR
          revenue: 100
          mean: 43.7
          standardDeviation: 10.3
      additionalProperties:
        $ref: '#/components/schemas/currency'
        x-additionalPropertiesName: currency code
    description:
      type: string
      description: Description for this variant.
      example: Current production index
    filterEffects:
      type: object
      description: A/B test filter effects resulting from configuration settings.
      properties:
        outliers:
          type: object
          description: >-
            Outliers removed from the A/B test as a result of configuration
            settings.
          example:
            usersCount: 1
            trackedSearchesCount: 237
          properties:
            usersCount:
              type: integer
              description: Number of users removed from the A/B test.
              example: 1
            trackedSearchesCount:
              type: integer
              description: Number of tracked searches removed from the A/B test.
              example: 237
        emptySearch:
          type: object
          description: >-
            Empty searches removed from the A/B test as a result of
            configuration settings.
          example:
            usersCount: 1
            trackedSearchesCount: 237
          properties:
            usersCount:
              type: integer
              description: Number of users removed from the A/B test.
              example: 1
            trackedSearchesCount:
              type: integer
              description: Number of tracked searches removed from the A/B test.
              example: 237
    index:
      type: string
      description: Index name of the A/B test variant (case-sensitive).
      example: delcourt_production
    trackedSearchCount:
      type: integer
      example: 2
      default: 0
      description: >-
        Number of tracked searches. Tracked searches are search requests where
        the `clickAnalytics` parameter is true.
    trafficPercentage:
      type: integer
      description: Percentage of search requests each variant receives.
      minimum: 0
      maximum: 100
      example: 60
    variant:
      type: object
      additionalProperties: false
      properties:
        addToCartCount:
          type: integer
          description: Number of add-to-cart events for this variant.
          example: 0
        addToCartRate:
          oneOf:
            - type: number
              format: double
              description: >
                [Add-to-cart
                rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#add-to-cart-rate)
                for this variant.
              example: 0
            - type: 'null'
        averageClickPosition:
          oneOf:
            - type: integer
              description: >
                [Average click
                position](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-position)
                for this variant.
              example: 0
            - type: 'null'
        clickCount:
          type: integer
          description: Number of click events for this variant.
          example: 65131
        clickThroughRate:
          oneOf:
            - type: number
              format: double
              description: >
                [Click-through
                rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate)
                for this variant.
              example: 0.22219857724813036
            - type: 'null'
        conversionCount:
          type: integer
          description: Number of click events for this variant.
          example: 4785
        conversionRate:
          oneOf:
            - type: number
              format: double
              description: >
                [Conversion
                rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#conversion-rate)
                for this variant.
              example: 0.14546725846658964
            - type: 'null'
        currencies:
          $ref: '#/components/schemas/currencies'
        description:
          $ref: '#/components/schemas/description'
        estimatedSampleSize:
          type: integer
          description: >
            Estimated number of searches required to achieve the desired
            statistical significance.


            The A/B test configuration must include a `mininmumDetectableEffect`
            setting for this number to be included in the response.
          example: 0
        filterEffects:
          $ref: '#/components/schemas/filterEffects'
        index:
          $ref: '#/components/schemas/index'
        noResultCount:
          oneOf:
            - type: integer
              description: >-
                Number of [searches without
                results](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#searches-without-results)
                for this variant.
              example: 0
            - type: 'null'
        purchaseCount:
          type: integer
          description: Number of purchase events for this variant.
          example: 0
        purchaseRate:
          oneOf:
            - type: number
              format: double
              description: >
                [Purchase
                rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#purchase-rate)
                for this variant.
              example: 0
            - type: 'null'
        searchCount:
          oneOf:
            - type: integer
              description: Number of searches for this variant.
              example: 86269
            - type: 'null'
        trackedSearchCount:
          $ref: '#/components/schemas/trackedSearchCount'
        trafficPercentage:
          $ref: '#/components/schemas/trafficPercentage'
        userCount:
          oneOf:
            - type: integer
              description: Number of users that made searches to this variant.
              example: 55501
            - type: 'null'
        trackedUserCount:
          oneOf:
            - type: integer
              description: Number of users that made tracked searches to this variant.
              example: 55501
            - type: 'null'
      required:
        - userCount
        - trackedUserCount
        - trafficPercentage
        - searchCount
        - noResultCount
        - index
        - description
        - conversionRate
        - conversionCount
        - clickThroughRate
        - clickCount
        - averageClickPosition
        - addToCartRate
        - addToCartCount
        - purchaseRate
        - purchaseCount
    variants:
      type: array
      description: >
        A/B test variants.


        The first variant is your _control_ index, typically your production
        index.

        The second variant is an index with changed settings that you want to
        test against the control.
      items:
        $ref: '#/components/schemas/variant'
    Outliers:
      type: object
      description: Configuration for handling outliers.
      properties:
        exclude:
          type: boolean
          description: Whether to exclude outliers when calculating A/B test results.
          default: true
    EmptySearch:
      type: object
      description: Configuration for handling empty searches.
      properties:
        exclude:
          type: boolean
          description: Whether to exclude empty searches when calculating A/B test results.
    Effect:
      type: string
      description: Metric for which you want to detect the smallest relative difference.
      enum:
        - addToCartRate
        - clickThroughRate
        - conversionRate
        - purchaseRate
    MinimumDetectableEffect:
      type: object
      description: >-
        Configuration for the smallest difference between test variants you want
        to detect.
      properties:
        size:
          type: number
          format: double
          minimum: 0
          maximum: 1
          description: >
            Smallest difference in an observable metric between variants.

            For example, to detect a 10% difference between variants, set this
            value to 0.1.
        effect:
          $ref: '#/components/schemas/Effect'
    ABTestConfiguration:
      title: configuration
      type: object
      description: A/B test configuration.
      properties:
        outliers:
          $ref: '#/components/schemas/Outliers'
        emptySearch:
          $ref: '#/components/schemas/EmptySearch'
        minimumDetectableEffect:
          $ref: '#/components/schemas/MinimumDetectableEffect'
      required:
        - outliers
    ABTest:
      type: object
      additionalProperties: false
      properties:
        abTestID:
          $ref: '#/components/schemas/abTestID'
        clickSignificance:
          description: >
            A/B test significance calculated from click events.


            Values of 0.95 or higher can be considered significant,

            that is, the difference between A and B variants is _not_ due to
            random variations.

            Lower values have a.
          oneOf:
            - type: number
              format: double
              example: 1
            - type: 'null'
        conversionSignificance:
          description: >
            A/B test significance calculated from conversion events.


            Values of 0.95 or higher can be considered significant,

            that is, the difference between A and B variants is _not_ due to
            random variations.
          oneOf:
            - type: number
              format: double
              example: 1
            - type: 'null'
        addToCartSignificance:
          description: >
            A/B test significance calculated from add-to-cart events.


            Values of 0.95 or higher can be considered significant,

            that is, the difference between A and B variants is _not_ due to
            random variations.
          oneOf:
            - type: number
              format: double
              example: 1
            - type: 'null'
        purchaseSignificance:
          description: >
            A/B test significance calculated from purchase events.


            Values of 0.95 or higher can be considered significant,

            that is, the difference between A and B variants is _not_ due to
            random variations.
          oneOf:
            - type: number
              format: double
              example: 1
            - type: 'null'
        revenueSignificance:
          description: >
            A/B test significance calculated from revenue data.


            Values of 0.95 or higher can be considered significant,

            that is, the difference between A and B variants is _not_ due to
            random variations.
          oneOf:
            - type: object
              additionalProperties:
                type: number
                format: double
                x-additionalPropertiesName: currency code
              example:
                USD: 1
                EUR: 0.87
            - type: 'null'
        updatedAt:
          $ref: '#/components/schemas/updatedAt'
        createdAt:
          $ref: '#/components/schemas/createdAt'
        endAt:
          $ref: '#/components/schemas/endAt'
        name:
          $ref: '#/components/schemas/name'
        status:
          $ref: '#/components/schemas/Status'
        variants:
          $ref: '#/components/schemas/variants'
        configuration:
          $ref: '#/components/schemas/ABTestConfiguration'
      required:
        - status
        - name
        - createdAt
        - endAt
        - updatedAt
        - conversionSignificance
        - clickSignificance
        - purchaseSignificance
        - addToCartSignificance
        - revenueSignificance
        - abTestID
        - variants
    ABTests:
      oneOf:
        - type: array
          description: A/B tests.
          items:
            $ref: '#/components/schemas/ABTest'
        - type: 'null'
          description: No A/B tests are configured for this application.
    abTestsVariant:
      type: object
      additionalProperties: false
      properties:
        index:
          $ref: '#/components/schemas/index'
        trafficPercentage:
          $ref: '#/components/schemas/trafficPercentage'
        description:
          $ref: '#/components/schemas/description'
      required:
        - index
        - trafficPercentage
    customSearchParams:
      type: object
      description: |
        Search parameters to add to the test variant.
        Only use this parameter if the two variants use the same index.
      example:
        typoTolerance: false
        synonyms: false
      additionalProperties: false
      properties:
        customSearchParameters:
          type: object
      required:
        - customSearchParameters
    abTestsVariantSearchParams:
      allOf:
        - $ref: '#/components/schemas/abTestsVariant'
        - $ref: '#/components/schemas/customSearchParams'
    AddABTestsVariant:
      oneOf:
        - $ref: '#/components/schemas/abTestsVariant'
        - $ref: '#/components/schemas/abTestsVariantSearchParams'
    taskID:
      type: integer
      format: int64
      example: 1514562690001
      description: >
        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](#tag/Indices/operation/getTask) and this `taskID`.
    ABTestResponse:
      type: object
      additionalProperties: false
      properties:
        index:
          $ref: '#/components/schemas/index'
        abTestID:
          $ref: '#/components/schemas/abTestID'
        taskID:
          $ref: '#/components/schemas/taskID'
      required:
        - abTestID
        - index
        - taskID
  responses:
    BadRequest:
      description: Bad request or request arguments.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBase'
    FeatureNotEnabled:
      description: This feature is not enabled on your Algolia account.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBase'
    MethodNotAllowed:
      description: Method not allowed with this API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBase'
    IndexNotFound:
      description: Index not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBase'
  headers:
    x-ratelimit-limit:
      description: Number of allowed requests per one minute.
      example: 100
      schema:
        type: integer
    x-ratelimit-remaining:
      description: Number of remaining requests in the current period.
      example: 99
      schema:
        type: integer
    x-ratelimit-reset:
      description: >-
        Timstamp when the rate limit will reset, measured in seconds since the
        Unix epoch.
      example: 1710682486
      schema:
        type: integer
x-tagGroups:
  - name: General
    tags:
      - abtest
