> ## Documentation Index
> Fetch the complete documentation index at: https://algolia.com/llms.txt
> Use this file to discover all available pages before exploring further.

# List all A/B tests

> Lists all A/B tests you configured for this application.

**Required ACL:** `analytics`


## OpenAPI

````yaml specs/abtesting.yml get /2/abtests
openapi: 3.1.0
info:
  title: A/B Testing API
  summary: >-
    The Algolia A/B Testing API lets you manage your Algolia A/B tests to
    optimize your search experience
  description: >
    ## Base URLs


    Base URLs for the A/B testing API:


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

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

    - `https://analytics.algolia.com` (alias of `analytics.us.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).


    Add these headers to authenticate requests:


    - `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/api-keys).


    ## 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 `2xx` statuses. Client errors return `4xx`
    statuses. Server errors return `5xx` statuses.

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


    ## Version


    The current version of the A/B Testing API is version 2, indicated by the
    `/2/` in each endpoint's URL.
  version: 2.0.0
servers:
  - url: https://analytics.{region}.algolia.com
    variables:
      region:
        description: The region where your Algolia application is hosted.
        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 one or more 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: A/B testing.
paths:
  /2/abtests:
    get:
      tags:
        - abtest
      summary: List all A/B tests
      description: Lists all A/B tests you configured for this application.
      operationId: listABTests
      parameters:
        - 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
        - name: limit
          in: query
          description: Number of items to return.
          required: false
          schema:
            type: integer
            default: 10
        - name: offset
          in: query
          description: Position of the first item to return.
          required: false
          schema:
            type: integer
            default: 0
            minimum: 0
      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("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION")
            );

            // Call the API
            var response = await client.ListABTestsAsync();

            // print the response
            Console.WriteLine(response);
        - lang: go
          label: Go
          source: >-
            // Initialize the client with your application region, eg.
            abtesting.ALGOLIA_APPLICATION_REGION

            client, err := abtesting.NewClient("ALGOLIA_APPLICATION_ID",
            "ALGOLIA_API_KEY", abtesting.US)

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


            // Call the API

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

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



            // print the response

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

            AbtestingClient client = new
            AbtestingClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY",
            "ALGOLIA_APPLICATION_REGION");


            // Call the API

            ListABTestsResponse response = client.listABTests();


            // print the response

            System.out.println(response);
        - lang: javascript
          label: JavaScript
          source: >-
            // Initialize the client

            // Replace 'us' with your Algolia Application Region

            const client = algoliasearch('ALGOLIA_APPLICATION_ID',
            'ALGOLIA_API_KEY').initAbtesting({ region: 'us' });


            // Call the API

            const response = await client.listABTests();



            // print the response

            console.log(response);
        - lang: kotlin
          label: Kotlin
          source: |-
            // Initialize the client
            val client =
              AbtestingClient(
                appId = "ALGOLIA_APPLICATION_ID",
                apiKey = "ALGOLIA_API_KEY",
                region = "ALGOLIA_APPLICATION_REGION",
              )

            // Call the API
            var response = client.listABTests()


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

            $client = AbtestingClient::create('ALGOLIA_APPLICATION_ID',
            'ALGOLIA_API_KEY', 'ALGOLIA_APPLICATION_REGION');


            // Call the API

            $response = $client->listABTests();



            // print the response

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

            # In an asynchronous context, you can use AbtestingClient instead,
            which exposes the exact same methods.

            client = AbtestingClientSync(
                "ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION"
            )


            # Call the API

            response = client.list_ab_tests()



            # print the response

            print(response)
        - lang: ruby
          label: Ruby
          source: >-
            # Initialize the client

            client = Algolia::AbtestingClient.create("ALGOLIA_APPLICATION_ID",
            "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION")


            # Call the API

            response = client.list_ab_tests



            # print the response

            puts(response)
        - lang: scala
          label: Scala
          source: |-
            // Initialize the client
            val client = AbtestingClient(
              appId = "ALGOLIA_APPLICATION_ID",
              apiKey = "ALGOLIA_API_KEY",
              region = Option("ALGOLIA_APPLICATION_REGION")
            )

            // Call the API
            val response = Await.result(
              client.listABTests(
              ),
              Duration(100, "sec")
            )

            // print the response
            println(response)
        - lang: swift
          label: Swift
          source: >-
            // Initialize the client

            let client = try AbtestingClient(appID: "ALGOLIA_APPLICATION_ID",
            apiKey: "ALGOLIA_API_KEY", region: .us)


            // Call the API

            let response = try await client.listABTests()


            // print the response

            print(response)
        - lang: cURL
          label: curl
          source: |-
            curl --request GET \
              --url 'https://analytics.us.algolia.com/2/abtests?offset=0&limit=10&indexPrefix=dev_&indexSuffix=_development' \
              --header 'accept: application/json' \
              --header 'x-algolia-api-key: ALGOLIA_API_KEY' \
              --header 'x-algolia-application-id: ALGOLIA_APPLICATION_ID'
components:
  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: >-
        Timestamp when the rate limit will reset, measured in seconds since the
        Unix epoch.
      example: 1710682486
      schema:
        type: integer
  schemas:
    ABTests:
      oneOf:
        - type: array
          description: >-
            The list of A/B tests, null if no A/B tests are configured for this
            application.
          items:
            $ref: '#/components/schemas/ABTest'
        - type: 'null'
    ABTest:
      type: object
      additionalProperties: false
      properties:
        abTestID:
          $ref: '#/components/schemas/abTestID'
        createdAt:
          $ref: '#/components/schemas/createdAt'
        endAt:
          $ref: '#/components/schemas/endAt'
        name:
          $ref: '#/components/schemas/name'
        status:
          $ref: '#/components/schemas/Status'
        updatedAt:
          $ref: '#/components/schemas/updatedAt'
        variants:
          $ref: '#/components/schemas/variants'
        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'
        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'
        configuration:
          $ref: '#/components/schemas/ABTestConfiguration'
        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'
        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'
        stoppedAt:
          $ref: '#/components/schemas/stoppedAt'
      required:
        - status
        - name
        - createdAt
        - endAt
        - updatedAt
        - abTestID
        - variants
    ErrorBase:
      description: Error.
      type: object
      x-keep-model: true
      additionalProperties: true
      properties:
        message:
          type: string
          example: Invalid Application-Id or API-Key
    abTestID:
      type: integer
      description: Unique A/B test identifier.
      example: 224
    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
    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'
    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'
    ABTestConfiguration:
      title: configuration
      type: object
      description: A/B test configuration.
      properties:
        emptySearch:
          $ref: '#/components/schemas/EmptySearch'
        featureFilters:
          $ref: '#/components/schemas/FeatureFilters'
        minimumDetectableEffect:
          $ref: '#/components/schemas/MinimumDetectableEffect'
        outliers:
          $ref: '#/components/schemas/Outliers'
    stoppedAt:
      type: string
      description: Date and time when the A/B test was stopped, in RFC 3339 format.
      example: '2023-06-15T15:06:44.400601Z'
      nullable: true
    variant:
      type: object
      additionalProperties: false
      properties:
        addToCartCount:
          type: integer
          description: Number of add-to-cart events for this variant.
          example: 0
        clickCount:
          type: integer
          description: Number of click events for this variant.
          example: 65131
        conversionCount:
          type: integer
          description: Number of click events for this variant.
          example: 4785
        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
        searchCount:
          oneOf:
            - type: integer
              description: Number of searches for this variant.
              example: 86269
            - type: 'null'
        trackedUserCount:
          oneOf:
            - type: integer
              description: Number of users that made tracked searches to this variant.
              example: 55501
            - type: 'null'
        trafficPercentage:
          $ref: '#/components/schemas/trafficPercentage'
        userCount:
          oneOf:
            - type: integer
              description: Number of users that made searches to this variant.
              example: 55501
            - type: 'null'
        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: number
              format: double
              description: >
                [Average click
                position](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-position)
                for this variant.
              example: 29.12342
            - type: 'null'
        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'
        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'
        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'
        trackedSearchCount:
          $ref: '#/components/schemas/trackedSearchCount'
      required:
        - userCount
        - trackedUserCount
        - trafficPercentage
        - searchCount
        - noResultCount
        - index
        - conversionCount
        - clickCount
        - addToCartCount
        - purchaseCount
    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.
    FeatureFilters:
      type: object
      description: >-
        Configuration of feature-based filters applied to the A/B test
        population.
      properties:
        aiPerso:
          type: boolean
          description: Whether to apply AI Personalization feature filters.
        dynamicReRanking:
          type: boolean
          description: Whether to apply Dynamic Re-Ranking feature filters.
        multiSignalRanking:
          type: boolean
          description: Whether to apply Multi-Signal Re-Ranking feature filters.
    MinimumDetectableEffect:
      type: object
      description: >-
        Configuration for the smallest difference between test variants you want
        to detect.
      properties:
        metric:
          $ref: '#/components/schemas/EffectMetric'
        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.
      required:
        - size
        - metric
    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
    index:
      type: string
      description: Index name of the A/B test variant (case-sensitive).
      example: delcourt_production
    trafficPercentage:
      type: integer
      description: Percentage of search requests each variant receives.
      minimum: 0
      maximum: 100
      example: 60
    currencies:
      type: object
      description: A/B test currencies.
      example:
        USD:
          currency: USD
          revenue: 120
          mean: 53.7
          standardDeviation: 12.3
          winsorizedAmount: 23
        EUR:
          currency: EUR
          revenue: 100
          mean: 43.7
          standardDeviation: 10.3
          winsorizedAmount: 10
      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:
        emptySearch:
          title: emptySearchFilter
          type: object
          description: >-
            Empty searches removed from the A/B test as a result of
            configuration settings.
          example:
            usersCount: 1
            trackedSearchesCount: 237
          properties:
            trackedSearchesCount:
              type: integer
              description: Number of tracked searches removed from the A/B test.
              example: 237
            usersCount:
              type: integer
              description: Number of users removed from the A/B test.
              example: 1
        outliers:
          title: outliersFilter
          type: object
          description: >-
            Outliers removed from the A/B test as a result of configuration
            settings.
          example:
            usersCount: 1
            trackedSearchesCount: 237
          properties:
            trackedSearchesCount:
              type: integer
              description: Number of tracked searches removed from the A/B test.
              example: 237
            usersCount:
              type: integer
              description: Number of users removed from the A/B test.
              example: 1
    trackedSearchCount:
      type: integer
      example: 2
      default: 0
      description: >-
        Number of tracked searches. Tracked searches are search requests where
        the `clickAnalytics` parameter is true.
    EffectMetric:
      type: string
      description: Metric for which you want to detect the smallest relative difference.
      enum:
        - addToCartRate
        - clickThroughRate
        - conversionRate
        - purchaseRate
    currency:
      type: object
      properties:
        currency:
          type: string
          description: Currency code.
          example: USD
        mean:
          type: number
          format: double
          description: Mean for this currency.
          example: 53.7
        revenue:
          type: number
          format: double
          description: Revenue for this currency.
          example: 120
        standardDeviation:
          type: number
          format: double
          description: Standard deviation for this currency.
          example: 12.3
        winsorizedAmount:
          type: number
          format: double
          description: >-
            The amount of revenue for this currency that was removed after
            capping purchase amounts to the 95th percentile.
          example: 23
  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'
  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.

````