openapi: 3.0.2
info:
  title: Analytics API
  description: API powering the Analytics feature of Algolia.
  version: 0.1.0
components:
  securitySchemes:
    appId:
      type: apiKey
      in: header
      name: X-Algolia-Application-Id
    apiKey:
      type: apiKey
      in: header
      name: X-Algolia-API-Key
  parameters:
    PathInPath:
      name: path
      in: path
      description: >-
        The path of the API endpoint to target, anything after the /1 needs to
        be specified.
      required: true
      schema:
        type: string
        example: /keys
    Parameters:
      name: parameters
      in: query
      description: Query parameters to be applied to the current query.
      schema:
        type: object
        additionalProperties: true
    Index:
      in: query
      name: index
      description: The index name to target.
      required: true
      schema:
        type: string
    ClickAnalytics:
      in: query
      name: clickAnalytics
      description: Whether to include the click-through and conversion rates for a search.
      schema:
        type: boolean
        default: false
    StartDate:
      in: query
      name: startDate
      description: >-
        The lower bound timestamp (a date, a string like "2006-01-02") of the
        period to analyze.
      schema:
        type: string
        example: '1999-09-19'
        pattern: ^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$
    EndDate:
      in: query
      name: endDate
      description: >-
        The upper bound timestamp (a date, a string like "2006-01-02") of the
        period to analyze.
      schema:
        type: string
        example: '2000-01-21'
        pattern: ^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$
    OrderBy:
      in: query
      name: orderBy
      description: Reorder the results.
      schema:
        $ref: '#/components/schemas/orderBy'
    Direction:
      in: query
      name: direction
      description: The sorting of the result.
      schema:
        $ref: '#/components/schemas/direction'
    Limit:
      in: query
      name: limit
      description: Number of records to return. Limit is the size of the page.
      schema:
        type: integer
        default: 10
    Offset:
      in: query
      name: offset
      description: Position of the starting record. Used for paging. 0 is the first record.
      schema:
        type: integer
        default: 0
    Tags:
      name: tags
      in: query
      description: >-
        Filter metrics on the provided tags. Each tag must correspond to an
        analyticsTags set at search time. Multiple tags can be combined with the
        operators OR and AND. If a tag contains characters like spaces or
        parentheses, it should be URL encoded.
      schema:
        type: string
    Search:
      in: query
      name: search
      description: The query term to search for. Must match the exact user input.
      schema:
        type: string
    Attribute:
      in: path
      name: attribute
      description: The exact name of the attribute.
      required: true
      schema:
        type: string
  schemas:
    ErrorBase:
      description: Error.
      type: object
      additionalProperties: true
      properties:
        message:
          type: string
          example: Invalid Application-Id or API-Key
    orderBy:
      type: string
      enum:
        - searchCount
        - clickThroughRate
        - conversionRate
        - averageClickPosition
      default: searchCount
    direction:
      type: string
      enum:
        - asc
        - desc
      default: asc
    search:
      description: The search query.
      type: string
    count:
      description: The number of occurrences.
      type: integer
    nbHits:
      type: integer
      description: Number of hits that the search query matched.
      example: 20
    topSearchesResponse:
      type: object
      additionalProperties: false
      required:
        - searches
      properties:
        searches:
          type: array
          description: A list of top searches with their count.
          items:
            type: object
            additionalProperties: false
            required:
              - search
              - count
              - nbHits
            properties:
              search:
                $ref: '#/components/schemas/search'
              count:
                $ref: '#/components/schemas/count'
              nbHits:
                $ref: '#/components/schemas/nbHits'
    rate:
      type: number
      format: double
      description: The click-through rate.
    averageClickPosition:
      type: integer
      description: The average position of all the click count event.
    conversionRate:
      type: number
      format: double
      description: The conversion rate.
    trackedSearchCount:
      type: integer
      description: The number of tracked search click.
    clickCount:
      type: integer
      description: The number of click event.
    conversionCount:
      type: integer
      description: The number of converted clicks.
    topSearchesResponseWithAnalytics:
      type: object
      additionalProperties: false
      required:
        - searches
      properties:
        searches:
          type: array
          description: A list of top searches with their count and analytics.
          items:
            type: object
            additionalProperties: false
            required:
              - search
              - count
              - nbHits
              - clickThroughRate
              - averageClickPosition
              - conversionRate
              - trackedSearchCount
              - clickCount
              - conversionCount
            properties:
              search:
                $ref: '#/components/schemas/search'
              count:
                $ref: '#/components/schemas/count'
              clickThroughRate:
                $ref: '#/components/schemas/rate'
              averageClickPosition:
                $ref: '#/components/schemas/averageClickPosition'
              conversionRate:
                $ref: '#/components/schemas/conversionRate'
              trackedSearchCount:
                $ref: '#/components/schemas/trackedSearchCount'
              clickCount:
                $ref: '#/components/schemas/clickCount'
              conversionCount:
                $ref: '#/components/schemas/conversionCount'
              nbHits:
                $ref: '#/components/schemas/nbHits'
    getTopSearchesResponse:
      oneOf:
        - $ref: '#/components/schemas/topSearchesResponse'
        - $ref: '#/components/schemas/topSearchesResponseWithAnalytics'
    date:
      type: string
      description: Date of the event.
    hit:
      description: The hit.
      type: string
    topHitsResponse:
      type: object
      additionalProperties: false
      required:
        - hits
      properties:
        hits:
          type: array
          description: A list of top hits with their count.
          items:
            type: object
            additionalProperties: false
            required:
              - hit
              - count
            properties:
              hit:
                $ref: '#/components/schemas/hit'
              count:
                $ref: '#/components/schemas/count'
    topHitsResponseWithAnalytics:
      type: object
      additionalProperties: false
      required:
        - hits
      properties:
        hits:
          type: array
          description: A list of top hits with their count and analytics.
          items:
            type: object
            additionalProperties: false
            required:
              - hit
              - count
              - clickThroughRate
              - conversionRate
              - trackedSearchCount
              - clickCount
              - conversionCount
            properties:
              hit:
                $ref: '#/components/schemas/hit'
              count:
                $ref: '#/components/schemas/count'
              clickThroughRate:
                $ref: '#/components/schemas/rate'
              conversionRate:
                $ref: '#/components/schemas/conversionRate'
              trackedSearchCount:
                $ref: '#/components/schemas/trackedSearchCount'
              clickCount:
                $ref: '#/components/schemas/clickCount'
              conversionCount:
                $ref: '#/components/schemas/conversionCount'
    getTopHitsResponse:
      oneOf:
        - $ref: '#/components/schemas/topHitsResponse'
        - $ref: '#/components/schemas/topHitsResponseWithAnalytics'
    attribute:
      description: The attribute.
      type: string
    getTopFilterAttribute:
      type: object
      additionalProperties: false
      required:
        - attribute
        - count
      properties:
        attribute:
          $ref: '#/components/schemas/attribute'
        count:
          $ref: '#/components/schemas/count'
    getTopFilterAttributesResponse:
      type: object
      additionalProperties: false
      required:
        - attributes
      properties:
        attributes:
          type: array
          description: A list of attributes with their count.
          items:
            $ref: '#/components/schemas/getTopFilterAttribute'
    operator:
      description: The operator.
      type: string
    value:
      description: The value of the attribute.
      type: string
    getTopFilterForAttribute:
      type: object
      additionalProperties: false
      required:
        - operator
        - attribute
        - value
        - count
      properties:
        attribute:
          $ref: '#/components/schemas/attribute'
        operator:
          $ref: '#/components/schemas/operator'
        value:
          $ref: '#/components/schemas/value'
        count:
          $ref: '#/components/schemas/count'
    getTopFilterForAttributeResponse:
      type: object
      additionalProperties: false
      required:
        - values
      properties:
        values:
          type: array
          description: A list of filters for the given attributes.
          items:
            $ref: '#/components/schemas/getTopFilterForAttribute'
    getTopFiltersNoResultsValue:
      type: object
      additionalProperties: false
      required:
        - attribute
        - operator
        - value
      properties:
        attribute:
          $ref: '#/components/schemas/attribute'
        operator:
          $ref: '#/components/schemas/operator'
        value:
          $ref: '#/components/schemas/value'
    getTopFiltersNoResultsValues:
      type: object
      additionalProperties: false
      required:
        - values
        - count
      properties:
        count:
          $ref: '#/components/schemas/count'
        values:
          type: array
          description: A list of filters without results.
          items:
            $ref: '#/components/schemas/getTopFiltersNoResultsValue'
    getTopFiltersNoResultsResponse:
      type: object
      additionalProperties: false
      required:
        - values
      properties:
        values:
          type: array
          description: A list of filters without results.
          items:
            $ref: '#/components/schemas/getTopFiltersNoResultsValues'
    average:
      type: number
      format: double
      description: The average of all the click count event.
    updatedAt:
      type: string
      description: Date of last update (ISO-8601 format).
  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'
servers:
  - url: https://analytics.{region}.algolia.com
    variables:
      region:
        enum:
          - us
          - de
        default: us
  - url: https://analytics.algolia.com
security:
  - appId: []
    apiKey: []
paths:
  /1{path}:
    get:
      operationId: get
      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'
    post:
      operationId: post
      requestBody:
        description: The 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'
    put:
      operationId: put
      requestBody:
        description: The 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'
    delete:
      operationId: del
      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'
  /2/searches:
    get:
      operationId: getTopSearches
      description: >-
        Returns top searches. Limited to the 1000 most frequent ones. For each
        search, also returns the average number of hits returned.
      summary: Returns top searches
      parameters:
        - $ref: '#/components/parameters/Index'
        - $ref: '#/components/parameters/ClickAnalytics'
        - $ref: '#/components/parameters/StartDate'
        - $ref: '#/components/parameters/EndDate'
        - $ref: '#/components/parameters/OrderBy'
        - $ref: '#/components/parameters/Direction'
        - $ref: '#/components/parameters/Limit'
        - $ref: '#/components/parameters/Offset'
        - $ref: '#/components/parameters/Tags'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/getTopSearchesResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/FeatureNotEnabled'
        '403':
          $ref: '#/components/responses/MethodNotAllowed'
        '404':
          $ref: '#/components/responses/IndexNotFound'
  /2/searches/count:
    get:
      operationId: getSearchesCount
      description: >-
        Returns the number of searches across the given time range. The endpoint
        returns a value for the complete given time range, as well as a value
        per day.
      summary: Returns the number of searches across the given time range
      parameters:
        - $ref: '#/components/parameters/Index'
        - $ref: '#/components/parameters/StartDate'
        - $ref: '#/components/parameters/EndDate'
        - $ref: '#/components/parameters/Tags'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                title: getSearchesCountResponse
                type: object
                additionalProperties: false
                required:
                  - dates
                  - count
                properties:
                  count:
                    $ref: '#/components/schemas/count'
                  dates:
                    type: array
                    description: A list of search events with their date and count.
                    items:
                      type: object
                      additionalProperties: false
                      required:
                        - date
                        - count
                      properties:
                        date:
                          $ref: '#/components/schemas/date'
                        count:
                          $ref: '#/components/schemas/count'
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/FeatureNotEnabled'
        '403':
          $ref: '#/components/responses/MethodNotAllowed'
        '404':
          $ref: '#/components/responses/IndexNotFound'
  /2/searches/noResults:
    get:
      operationId: getSearchesNoResults
      description: >-
        Returns top searches that didn't return any results. Limited to the 1000
        most frequent ones.
      summary: Returns top searches that didn't return any results
      parameters:
        - $ref: '#/components/parameters/Index'
        - $ref: '#/components/parameters/StartDate'
        - $ref: '#/components/parameters/EndDate'
        - $ref: '#/components/parameters/Limit'
        - $ref: '#/components/parameters/Offset'
        - $ref: '#/components/parameters/Tags'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                title: getSearchesNoResultsResponse
                type: object
                additionalProperties: false
                required:
                  - searches
                properties:
                  searches:
                    type: array
                    description: A list of searches with no results and their count.
                    items:
                      type: object
                      additionalProperties: false
                      required:
                        - search
                        - count
                        - nbHits
                      properties:
                        search:
                          $ref: '#/components/schemas/search'
                        count:
                          $ref: '#/components/schemas/count'
                        nbHits:
                          $ref: '#/components/schemas/nbHits'
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/FeatureNotEnabled'
        '403':
          $ref: '#/components/responses/MethodNotAllowed'
        '404':
          $ref: '#/components/responses/IndexNotFound'
  /2/searches/noClicks:
    get:
      operationId: getSearchesNoClicks
      description: >-
        Returns top searches that didn't lead to any clicks. Limited to the 1000
        most frequent ones. For each search, also returns the average number of
        found hits.
      summary: Returns top searches that didn't lead to any clicks
      parameters:
        - $ref: '#/components/parameters/Index'
        - $ref: '#/components/parameters/StartDate'
        - $ref: '#/components/parameters/EndDate'
        - $ref: '#/components/parameters/Limit'
        - $ref: '#/components/parameters/Offset'
        - $ref: '#/components/parameters/Tags'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                title: getSearchesNoClicksResponse
                type: object
                additionalProperties: false
                required:
                  - searches
                properties:
                  searches:
                    type: array
                    description: A list of searches with no clicks and their count.
                    items:
                      type: object
                      additionalProperties: false
                      required:
                        - search
                        - count
                        - withFilterCount
                      properties:
                        search:
                          $ref: '#/components/schemas/search'
                        count:
                          $ref: '#/components/schemas/count'
                        withFilterCount:
                          $ref: '#/components/schemas/count'
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/FeatureNotEnabled'
        '403':
          $ref: '#/components/responses/MethodNotAllowed'
        '404':
          $ref: '#/components/responses/IndexNotFound'
  /2/searches/noResultRate:
    get:
      operationId: getNoResultsRate
      description: >-
        Returns the rate at which searches didn't return any results. The
        endpoint returns a value for the complete given time range, as well as a
        value per day. It also returns the count of searches and searches
        without results used to compute the rates.
      summary: Returns the rate at which searches didn't return any results
      parameters:
        - $ref: '#/components/parameters/Index'
        - $ref: '#/components/parameters/StartDate'
        - $ref: '#/components/parameters/EndDate'
        - $ref: '#/components/parameters/Tags'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                title: getNoResultsRateResponse
                type: object
                additionalProperties: false
                required:
                  - rate
                  - count
                  - noResultCount
                  - dates
                properties:
                  rate:
                    $ref: '#/components/schemas/rate'
                  count:
                    $ref: '#/components/schemas/count'
                  noResultCount:
                    $ref: '#/components/schemas/count'
                  dates:
                    type: array
                    description: >-
                      A list of searches without results with their date, rate
                      and counts.
                    items:
                      type: object
                      additionalProperties: false
                      required:
                        - date
                        - noResultCount
                        - count
                        - rate
                      properties:
                        date:
                          $ref: '#/components/schemas/date'
                        noResultCount:
                          $ref: '#/components/schemas/count'
                        count:
                          $ref: '#/components/schemas/count'
                        rate:
                          $ref: '#/components/schemas/rate'
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/FeatureNotEnabled'
        '403':
          $ref: '#/components/responses/MethodNotAllowed'
        '404':
          $ref: '#/components/responses/IndexNotFound'
  /2/searches/noClickRate:
    get:
      operationId: getNoClickRate
      description: >-
        Returns the rate at which searches didn't lead to any clicks. The
        endpoint returns a value for the complete given time range, as well as a
        value per day. It also returns the count of searches and searches
        without clicks.
      summary: Returns the rate at which searches didn't lead to any clicks
      parameters:
        - $ref: '#/components/parameters/Index'
        - $ref: '#/components/parameters/StartDate'
        - $ref: '#/components/parameters/EndDate'
        - $ref: '#/components/parameters/Tags'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                title: getNoClickRateResponse
                type: object
                additionalProperties: false
                required:
                  - dates
                  - count
                  - noClickCount
                  - rate
                properties:
                  rate:
                    $ref: '#/components/schemas/rate'
                  count:
                    $ref: '#/components/schemas/clickCount'
                  noClickCount:
                    $ref: '#/components/schemas/clickCount'
                  dates:
                    type: array
                    description: >-
                      A list of searches without clicks with their date, rate
                      and counts.
                    items:
                      type: object
                      additionalProperties: false
                      required:
                        - rate
                        - count
                        - noClickCount
                        - date
                      properties:
                        rate:
                          $ref: '#/components/schemas/rate'
                        count:
                          $ref: '#/components/schemas/clickCount'
                        noClickCount:
                          $ref: '#/components/schemas/clickCount'
                        date:
                          $ref: '#/components/schemas/date'
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/FeatureNotEnabled'
        '403':
          $ref: '#/components/responses/MethodNotAllowed'
        '404':
          $ref: '#/components/responses/IndexNotFound'
  /2/hits:
    get:
      operationId: getTopHits
      description: Returns top hits. Limited to the 1000 most frequent ones.
      summary: Returns top hits
      parameters:
        - $ref: '#/components/parameters/Index'
        - $ref: '#/components/parameters/Search'
        - $ref: '#/components/parameters/ClickAnalytics'
        - $ref: '#/components/parameters/StartDate'
        - $ref: '#/components/parameters/EndDate'
        - $ref: '#/components/parameters/Limit'
        - $ref: '#/components/parameters/Offset'
        - $ref: '#/components/parameters/Tags'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/getTopHitsResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/FeatureNotEnabled'
        '403':
          $ref: '#/components/responses/MethodNotAllowed'
        '404':
          $ref: '#/components/responses/IndexNotFound'
  /2/users/count:
    get:
      operationId: getUsersCount
      description: >-
        Returns the distinct count of users across the given time range. The
        endpoint returns a value for the complete given time range, as well as a
        value per day.
      summary: Returns the distinct count of users across the given time range
      parameters:
        - $ref: '#/components/parameters/Index'
        - $ref: '#/components/parameters/StartDate'
        - $ref: '#/components/parameters/EndDate'
        - $ref: '#/components/parameters/Tags'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                title: getUsersCountResponse
                type: object
                additionalProperties: false
                required:
                  - dates
                  - count
                properties:
                  count:
                    $ref: '#/components/schemas/count'
                  dates:
                    type: array
                    description: A list of users count with their date.
                    items:
                      type: object
                      additionalProperties: false
                      required:
                        - date
                        - count
                      properties:
                        date:
                          $ref: '#/components/schemas/date'
                        count:
                          $ref: '#/components/schemas/count'
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/FeatureNotEnabled'
        '403':
          $ref: '#/components/responses/MethodNotAllowed'
        '404':
          $ref: '#/components/responses/IndexNotFound'
  /2/filters:
    get:
      operationId: getTopFilterAttributes
      description: Returns top filter attributes. Limited to the 1000 most used filters.
      summary: Returns top filter attributes
      parameters:
        - $ref: '#/components/parameters/Index'
        - $ref: '#/components/parameters/Search'
        - $ref: '#/components/parameters/StartDate'
        - $ref: '#/components/parameters/EndDate'
        - $ref: '#/components/parameters/Limit'
        - $ref: '#/components/parameters/Offset'
        - $ref: '#/components/parameters/Tags'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/getTopFilterAttributesResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/FeatureNotEnabled'
        '403':
          $ref: '#/components/responses/MethodNotAllowed'
        '404':
          $ref: '#/components/responses/IndexNotFound'
  /2/filters/{attribute}:
    get:
      operationId: getTopFilterForAttribute
      description: >-
        Returns top filters for the given attribute. Limited to the 1000 most
        used filters.
      summary: Returns top filters for the given attribute
      parameters:
        - $ref: '#/components/parameters/Attribute'
        - $ref: '#/components/parameters/Index'
        - $ref: '#/components/parameters/Search'
        - $ref: '#/components/parameters/StartDate'
        - $ref: '#/components/parameters/EndDate'
        - $ref: '#/components/parameters/Limit'
        - $ref: '#/components/parameters/Offset'
        - $ref: '#/components/parameters/Tags'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/getTopFilterForAttributeResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/FeatureNotEnabled'
        '403':
          $ref: '#/components/responses/MethodNotAllowed'
        '404':
          $ref: '#/components/responses/IndexNotFound'
  /2/filters/noResults:
    get:
      operationId: getTopFiltersNoResults
      description: >-
        Returns top filters with no results. Limited to the 1000 most used
        filters.
      summary: Returns top filters with no results
      parameters:
        - $ref: '#/components/parameters/Index'
        - $ref: '#/components/parameters/Search'
        - $ref: '#/components/parameters/StartDate'
        - $ref: '#/components/parameters/EndDate'
        - $ref: '#/components/parameters/Limit'
        - $ref: '#/components/parameters/Offset'
        - $ref: '#/components/parameters/Tags'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/getTopFiltersNoResultsResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/FeatureNotEnabled'
        '403':
          $ref: '#/components/responses/MethodNotAllowed'
        '404':
          $ref: '#/components/responses/IndexNotFound'
  /2/countries:
    get:
      operationId: getTopCountries
      description: Returns top countries. Limited to the 1000 most frequent ones.
      summary: Returns top countries
      parameters:
        - $ref: '#/components/parameters/Index'
        - $ref: '#/components/parameters/StartDate'
        - $ref: '#/components/parameters/EndDate'
        - $ref: '#/components/parameters/Limit'
        - $ref: '#/components/parameters/Offset'
        - $ref: '#/components/parameters/Tags'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                title: getTopCountriesResponse
                type: object
                additionalProperties: false
                required:
                  - countries
                properties:
                  countries:
                    type: array
                    description: A list of countries with their count.
                    items:
                      type: object
                      additionalProperties: false
                      required:
                        - country
                        - count
                      properties:
                        country:
                          description: The country.
                          type: string
                        count:
                          $ref: '#/components/schemas/count'
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/FeatureNotEnabled'
        '403':
          $ref: '#/components/responses/MethodNotAllowed'
        '404':
          $ref: '#/components/responses/IndexNotFound'
  /2/clicks/averageClickPosition:
    get:
      operationId: getAverageClickPosition
      description: >-
        Returns the average click position. The endpoint returns a value for the
        complete given time range, as well as a value per day.
      summary: Returns the average click position
      parameters:
        - $ref: '#/components/parameters/Index'
        - $ref: '#/components/parameters/StartDate'
        - $ref: '#/components/parameters/EndDate'
        - $ref: '#/components/parameters/Tags'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                title: getAverageClickPositionResponse
                type: object
                additionalProperties: false
                required:
                  - average
                  - clickCount
                  - dates
                properties:
                  average:
                    $ref: '#/components/schemas/average'
                  clickCount:
                    $ref: '#/components/schemas/clickCount'
                  dates:
                    type: array
                    description: A list of average click position with their date.
                    items:
                      type: object
                      additionalProperties: false
                      required:
                        - average
                        - clickCount
                        - date
                      properties:
                        average:
                          $ref: '#/components/schemas/average'
                        clickCount:
                          $ref: '#/components/schemas/clickCount'
                        date:
                          $ref: '#/components/schemas/date'
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/FeatureNotEnabled'
        '403':
          $ref: '#/components/responses/MethodNotAllowed'
        '404':
          $ref: '#/components/responses/IndexNotFound'
  /2/clicks/positions:
    get:
      operationId: getClickPositions
      description: Returns the distribution of clicks per range of positions.
      summary: Returns the distribution of clicks per range of positions
      parameters:
        - $ref: '#/components/parameters/Index'
        - $ref: '#/components/parameters/StartDate'
        - $ref: '#/components/parameters/EndDate'
        - $ref: '#/components/parameters/Tags'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                title: getClickPositionsResponse
                type: object
                additionalProperties: false
                required:
                  - positions
                properties:
                  positions:
                    type: array
                    description: A list of the click positions with their click count.
                    minItems: 2
                    maxItems: 2
                    items:
                      type: object
                      additionalProperties: false
                      required:
                        - position
                        - clickCount
                      properties:
                        position:
                          description: >
                            Range of positions with the following pattern:

                            Positions from 1 to 10 included are displayed in
                            separated groups. Positions from 11 to 20 included
                            are grouped together. Positions from 21 and up are
                            grouped together.
                          type: array
                          items:
                            type: integer
                        clickCount:
                          $ref: '#/components/schemas/clickCount'
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/FeatureNotEnabled'
        '403':
          $ref: '#/components/responses/MethodNotAllowed'
        '404':
          $ref: '#/components/responses/IndexNotFound'
  /2/clicks/clickThroughRate:
    get:
      operationId: getClickThroughRate
      description: >-
        Returns a click-through rate (CTR). The endpoint returns a value for the
        complete given time range, as well as a value per day. It also returns
        the count of clicks and searches used to compute the rates.
      summary: Returns a click-through rate (CTR)
      parameters:
        - $ref: '#/components/parameters/Index'
        - $ref: '#/components/parameters/StartDate'
        - $ref: '#/components/parameters/EndDate'
        - $ref: '#/components/parameters/Tags'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                title: getClickThroughRateResponse
                type: object
                additionalProperties: false
                required:
                  - dates
                  - clickCount
                  - trackedSearchCount
                  - rate
                properties:
                  rate:
                    $ref: '#/components/schemas/rate'
                  clickCount:
                    $ref: '#/components/schemas/clickCount'
                  trackedSearchCount:
                    $ref: '#/components/schemas/trackedSearchCount'
                  dates:
                    type: array
                    description: A list of click-through rate events with their date.
                    items:
                      type: object
                      additionalProperties: false
                      required:
                        - rate
                        - clickCount
                        - trackedSearchCount
                        - date
                      properties:
                        rate:
                          $ref: '#/components/schemas/rate'
                        clickCount:
                          $ref: '#/components/schemas/clickCount'
                        trackedSearchCount:
                          $ref: '#/components/schemas/trackedSearchCount'
                        date:
                          $ref: '#/components/schemas/date'
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/FeatureNotEnabled'
        '403':
          $ref: '#/components/responses/MethodNotAllowed'
        '404':
          $ref: '#/components/responses/IndexNotFound'
  /2/conversions/conversionRate:
    get:
      operationId: getConversationRate
      description: >-
        Returns a conversion rate (CR). The endpoint returns a value for the
        complete given time range, as well as a value per day. It also returns
        the count of conversion and searches used to compute the rates.
      summary: Returns a conversion rate (CR)
      parameters:
        - $ref: '#/components/parameters/Index'
        - $ref: '#/components/parameters/StartDate'
        - $ref: '#/components/parameters/EndDate'
        - $ref: '#/components/parameters/Tags'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                title: getConversationRateResponse
                type: object
                additionalProperties: false
                required:
                  - dates
                  - trackedSearchCount
                  - conversionCount
                  - rate
                properties:
                  rate:
                    $ref: '#/components/schemas/rate'
                  trackedSearchCount:
                    $ref: '#/components/schemas/trackedSearchCount'
                  conversionCount:
                    $ref: '#/components/schemas/conversionCount'
                  dates:
                    type: array
                    description: A list of conversion events with their date.
                    items:
                      type: object
                      additionalProperties: false
                      required:
                        - rate
                        - trackedSearchCount
                        - conversionCount
                        - date
                      properties:
                        rate:
                          $ref: '#/components/schemas/rate'
                        trackedSearchCount:
                          $ref: '#/components/schemas/trackedSearchCount'
                        conversionCount:
                          $ref: '#/components/schemas/conversionCount'
                        date:
                          $ref: '#/components/schemas/date'
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/FeatureNotEnabled'
        '403':
          $ref: '#/components/responses/MethodNotAllowed'
        '404':
          $ref: '#/components/responses/IndexNotFound'
  /2/status:
    get:
      operationId: getStatus
      description: >-
        Returns the latest update time of the analytics API for a given index.
        If the index has been recently created and/or no search has been
        performed yet the updated time will be null.
      summary: Get latest update time of the analytics API
      parameters:
        - $ref: '#/components/parameters/Index'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                title: getStatusResponse
                type: object
                additionalProperties: false
                required:
                  - updatedAt
                properties:
                  updatedAt:
                    $ref: '#/components/schemas/updatedAt'
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/FeatureNotEnabled'
        '403':
          $ref: '#/components/responses/MethodNotAllowed'
        '404':
          $ref: '#/components/responses/IndexNotFound'
