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

# List products with their session stats for a period

> One row per product the caller may read: sessions received, evaluated and with a critical failure in the period and in the period of the same length just before it, the latest evaluation, and the estimated cost per session. A product without `analytics.read` keeps its row with null stats. Pinned products come first, then the products that received a session in the period or have stats the caller may not read, then the others; the `X-Active-Total` header counts the first two groups. Inside a group, a product without `analytics.read` sorts last on every stats field.



## OpenAPI

````yaml https://api.galtea.ai/openapi.json get /analytics/products
openapi: 3.0.0
info:
  version: 1.0.0
  title: Product Management Service API
  description: API documentation for Product Management Service
  contact:
    name: Galtea AI
servers:
  - url: https://api.galtea.ai
security:
  - bearerAuth: []
tags: []
externalDocs:
  description: Galtea Platform Documentation
  url: https://docs.galtea.ai
paths:
  /analytics/products:
    get:
      tags:
        - analytics
      summary: List products with their session stats for a period
      description: >-
        One row per product the caller may read: sessions received, evaluated
        and with a critical failure in the period and in the period of the same
        length just before it, the latest evaluation, and the estimated cost per
        session. A product without `analytics.read` keeps its row with null
        stats. Pinned products come first, then the products that received a
        session in the period or have stats the caller may not read, then the
        others; the `X-Active-Total` header counts the first two groups. Inside
        a group, a product without `analytics.read` sorts last on every stats
        field.
      operationId: listProductSessionStats
      parameters:
        - schema:
            type: string
            format: date-time
            description: Start of the period, inclusive (ISO 8601)
          required: true
          description: Start of the period, inclusive (ISO 8601)
          name: from
          in: query
        - schema:
            type: string
            format: date-time
            description: >-
              End of the period, exclusive (ISO 8601). A period that does not
              end after `from`, or is longer than 1830 days (5 years), is
              rejected with 400.
          required: true
          description: >-
            End of the period, exclusive (ISO 8601). A period that does not end
            after `from`, or is longer than 1830 days (5 years), is rejected
            with 400.
          name: to
          in: query
        - schema:
            type: boolean
            description: >-
              Count production sessions when true, development sessions when
              false.
          required: true
          description: >-
            Count production sessions when true, development sessions when
            false.
          name: isProduction
          in: query
        - schema:
            type: string
            description: >-
              The organization whose products to read. Defaults to the caller's
              own organization. Another organization reads products only for a
              caller that may read across organizations.
          required: false
          description: >-
            The organization whose products to read. Defaults to the caller's
            own organization. Another organization reads products only for a
            caller that may read across organizations.
          name: organizationId
          in: query
        - schema:
            type: string
            description: Keep the products whose name contains this (case-insensitive)
          required: false
          description: Keep the products whose name contains this (case-insensitive)
          name: name
          in: query
        - schema:
            type: array
            items:
              type: string
            description: Keep the products that carry any of these tags
          required: false
          description: Keep the products that carry any of these tags
          style: form
          explode: true
          name: tags
          in: query
        - schema:
            type: array
            items:
              type: string
            description: >-
              Keep only these products. A product outside the caller's grant is
              refused with 403; a product of another organization, or a deleted
              one, matches nothing. At most 25.
            maxItems: 25
          required: false
          description: >-
            Keep only these products. A product outside the caller's grant is
            refused with 403; a product of another organization, or a deleted
            one, matches nothing. At most 25.
          style: form
          explode: true
          name: productIds
          in: query
        - schema:
            type: array
            items:
              type: string
            description: >-
              Products listed first, each part in the requested sort. A product
              the caller may not read is ignored. At most 25, counted together
              with `productIds`.
            maxItems: 25
          required: false
          description: >-
            Products listed first, each part in the requested sort. A product
            the caller may not read is ignored. At most 25, counted together
            with `productIds`.
          style: form
          explode: true
          name: pinnedProductIds
          in: query
        - schema:
            type: array
            items:
              type: string
            description: >-
              Sort instructions (field and direction pairs). Fields: name,
              receivedCount, evaluatedCount, lastEvaluatedAt,
              criticalFailureRate, costPerSession. A product without
              `analytics.read` sorts last inside its group on every field but
              name, in both directions. costPerSession answers 400 unless the
              caller holds `evaluation.readInference` on every product whose
              analytics the caller may read. Default: criticalFailureRate desc.
          required: false
          description: >-
            Sort instructions (field and direction pairs). Fields: name,
            receivedCount, evaluatedCount, lastEvaluatedAt, criticalFailureRate,
            costPerSession. A product without `analytics.read` sorts last inside
            its group on every field but name, in both directions.
            costPerSession answers 400 unless the caller holds
            `evaluation.readInference` on every product whose analytics the
            caller may read. Default: criticalFailureRate desc.
          style: form
          explode: true
          name: sort
          in: query
        - schema:
            type: integer
            minimum: 0
            maximum: 100
            default: 20
            description: Maximum number of results
          required: false
          description: Maximum number of results
          name: limit
          in: query
        - schema:
            type: integer
            minimum: 0
            default: 0
            description: Number of results to skip
          required: false
          description: Number of results to skip
          name: offset
          in: query
      responses:
        '200':
          description: Products with their session stats
          headers:
            Content-Range:
              schema:
                type: string
                description: Pagination range as `products <offset>-<upperBound>/<total>`.
              required: true
              description: Pagination range as `products <offset>-<upperBound>/<total>`.
            X-Active-Total:
              schema:
                type: string
                description: >-
                  Products the filters keep that are pinned, received a session
                  in the period, or have stats the caller may not read. They
                  come first, so the rows from this position on received none.
              required: true
              description: >-
                Products the filters keep that are pinned, received a session in
                the period, or have stats the caller may not read. They come
                first, so the rows from this position on received none.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ProductSessionStats'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearerAuth: []
components:
  schemas:
    ProductSessionStats:
      type: object
      properties:
        productId:
          type: string
        name:
          type: string
        tags:
          type: array
          items:
            type: string
        current:
          type: object
          nullable: true
          properties:
            receivedCount:
              type: integer
              description: Sessions created in the period. Seed sessions never count.
            evaluatedCount:
              type: integer
              description: Received sessions with at least one scored evaluation
            criticalFailureCount:
              type: integer
              description: >-
                Evaluated sessions with a failed evaluation on a metric of a
                critical specification of the product
          required:
            - receivedCount
            - evaluatedCount
            - criticalFailureCount
          description: >-
            Counts of the requested period. Null without `analytics.read` on the
            product.
        previous:
          type: object
          nullable: true
          properties:
            receivedCount:
              type: integer
              description: Sessions created in the period. Seed sessions never count.
            evaluatedCount:
              type: integer
              description: Received sessions with at least one scored evaluation
            criticalFailureCount:
              type: integer
              description: >-
                Evaluated sessions with a failed evaluation on a metric of a
                critical specification of the product
          required:
            - receivedCount
            - evaluatedCount
            - criticalFailureCount
          description: >-
            Counts of the period of the same length just before it. Null without
            `analytics.read` on the product.
        receivedBuckets:
          type: array
          nullable: true
          items:
            type: integer
          description: >-
            Received sessions of the requested period per slice: the period cut
            into 5 equal slices, oldest first. They sum to
            `current.receivedCount`. Null without `analytics.read` on the
            product.
        lastEvaluatedAt:
          type: string
          nullable: true
          format: date-time
          description: >-
            When the latest scored evaluation of a session of the period, or of
            the period before it, was created. Null without `analytics.read` on
            the product.
        costPerSession:
          type: number
          nullable: true
          description: >-
            Average estimated cost of the sessions of the period that carry one.
            Null without `analytics.read` and `evaluation.readInference` on the
            product, or when no session carries a cost.
        totalCost:
          type: number
          nullable: true
          description: >-
            Estimated cost of the sessions of the period. Null as
            `costPerSession` is.
        sessionsWithoutCostCount:
          type: integer
          nullable: true
          description: >-
            Sessions of the period that carry no cost, left out of
            `costPerSession`. Null without `analytics.read` and
            `evaluation.readInference` on the product.
      required:
        - productId
        - name
        - tags
        - current
        - previous
        - receivedBuckets
        - lastEvaluatedAt
        - costPerSession
        - totalCost
        - sessionsWithoutCostCount
    Error:
      type: object
      properties:
        error:
          type: string
          example: Error type
        message:
          type: string
          example: Error message description
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        API key authorization. Pass your API key in the Authorization header as
        a Bearer token. Both new (`gsk_*`) and legacy (`gsk-`) API keys are
        accepted, e.g. `Authorization: Bearer gsk_...` or `Authorization: Bearer
        gsk-...`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.