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

# Get analytics namespace

> Queries a single analytics namespace (e.g. sessions, messages, credits)
over a date range and set of filters, returning the response shape
specific to that namespace.



## OpenAPI

````yaml /api/services-api.yaml post /v1/tenants/{tenantID}/analytics/{namespace}
openapi: 3.0.3
info:
  description: >-
    Talqui is an omnichannel customer service platform that unifies
    conversations from WhatsApp, Instagram, Telegram, and many other channels
    into a single attendant panel, alongside a broader ecosystem of plugins and
    integrations. This API gives developers programmatic access to Talqui's
    services layer, exposing the operations needed to read and manage tenants,
    conversations, plugins, and related resources that power that platform.


    Authentication is available on behalf of an Operator (the default for this
    API), a Plugin Connection, or a Plugin — see the [Talqui authentication
    guide](https://docs.talqui.chat/guides/introduction/authentication/) for how
    each token is obtained and when to use it.


    Need help or have questions not covered here? Reach out to
    support@talqui.com.
  license:
    name: ISC
    url: https://opensource.org/license/isc-license-txt
  title: Talqui - Services API
  version: 0.65.0
servers:
  - description: Production
    url: https://services-api.talqui.chat
security: []
tags:
  - name: Tenants
  - name: Settings
  - name: Analytics
  - name: Campaigns
  - name: Campaigns models
  - name: Contacts
  - name: Handoff links
  - name: Inboxes
  - name: Messages
  - name: Notifications
  - name: Sessions
  - name: Operators
  - name: Plugins
  - name: Setup
  - name: Uploads
paths:
  /v1/tenants/{tenantID}/analytics/{namespace}:
    post:
      tags:
        - Analytics
      summary: Get analytics namespace
      description: |-
        Queries a single analytics namespace (e.g. sessions, messages, credits)
        over a date range and set of filters, returning the response shape
        specific to that namespace.
      operationId: GetAnalyticsNamespaceController
      parameters:
        - in: path
          name: tenantID
          required: true
          schema:
            type: string
        - in: path
          name: namespace
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              properties:
                namespace:
                  description: >-
                    The analytics namespace being queried (also present in the
                    URL).
                  enum:
                    - messages_outbound
                    - sessions_initialized
                    - sessions_created
                    - sessions_responsiveness
                    - contacts_created
                    - operators_leaderboard
                    - operator_sessions
                    - session_motives
                    - session_bypluginconnection
                    - sessions_intensity
                    - campaignmodels_usage
                    - evaluation_automation_overview
                    - evaluation_quality_distribution
                    - evaluation_quality_reasons
                    - evaluation_weekly_average_score
                    - evaluation_quality_tiers
                    - evaluation_top_procedures
                    - credits_daily_balance
                    - credits_consumption
                    - credits_projection
                    - credits_by_operation
                    - credits_ledger
                    - credits_ledger_grouped
                  type: string
                query:
                  description: >-
                    Query parameters for this namespace: date range, granularity
                    and filters.
                  properties:
                    filterBag:
                      default: []
                      description: >-
                        Structured filter criteria applied in addition to
                        filters.
                      items:
                        properties:
                          criterion:
                            description: Field name on the target entity to filter by.
                            type: string
                          operator:
                            default: eq
                            description: >-
                              Comparison operator (equals, greater/less than,
                              has/not-has, starts/ends with, contains).
                            enum:
                              - eq
                              - gt
                              - lt
                              - ha
                              - nh
                              - sw
                              - ew
                              - ct
                            type: string
                          query:
                            default: []
                            description: Value(s) to compare the criterion against.
                            items:
                              anyOf:
                                - type: string
                                - type: number
                                - type: boolean
                            type: array
                          schema:
                            description: Which entity this filter criterion applies to.
                            enum:
                              - session
                              - contact
                              - procedure
                            type: string
                        required:
                          - schema
                          - criterion
                        type: object
                      type: array
                    filters:
                      default: []
                      description: Free-form filter tokens specific to this namespace.
                      items:
                        type: string
                      type: array
                    from:
                      description: >-
                        First day of the range, inclusive, as YYYY-MM-DD
                        (defaults to 29 days before `to`).
                      format: date-time
                      type: string
                    granularity:
                      description: Time bucket size for series data (defaults to day).
                      enum:
                        - hour
                        - day
                        - week
                        - month
                        - year
                      type: string
                    timezone:
                      description: >-
                        IANA timezone used to bucket/format dates (defaults to
                        UTC).
                      type: string
                    to:
                      description: >-
                        Last day of the range, inclusive, as YYYY-MM-DD
                        (defaults to today). `from` = `to` is one day.
                      format: date-time
                      type: string
                  type: object
              required:
                - namespace
                - query
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                additionalProperties: false
                properties:
                  data:
                    additionalProperties: false
                    properties:
                      analyticsData:
                        description: >-
                          The query result — shape depends on which namespace
                          was queried.
                    required:
                      - analyticsData
                    type: object
                required:
                  - data
                type: object
          description: Response for status 200.
        '400':
          content:
            application/json:
              schema:
                properties:
                  errors:
                    items:
                      oneOf:
                        - $ref: '#/components/schemas/MissingTenantIDError'
                        - $ref: '#/components/schemas/RequestValidationError'
                        - $ref: '#/components/schemas/InvalidNamespaceError'
                    maxItems: 1
                    minItems: 1
                    type: array
                required:
                  - errors
                type: object
          description: >-
            MissingTenantIDError (error_code 1001): tenantID absent from the
            URL. | RequestValidationError (error_code 1002): request body fails
            schema validation. | InvalidNamespaceError (error_code 1202):
            namespace param does not match a known analytics namespace.
        '401':
          content:
            application/json:
              schema:
                properties:
                  errors:
                    items:
                      $ref: '#/components/schemas/UnauthorizedError'
                    maxItems: 1
                    minItems: 1
                    type: array
                required:
                  - errors
                type: object
          description: 'UnauthorizedError (error_code 1003): missing/invalid operator token.'
        '403':
          content:
            application/json:
              schema:
                properties:
                  errors:
                    items:
                      $ref: '#/components/schemas/ForbiddenError'
                    maxItems: 1
                    minItems: 1
                    type: array
                required:
                  - errors
                type: object
          description: 'ForbiddenError (error_code 1004): operator token rejected upstream.'
        '500':
          content:
            application/json:
              schema:
                properties:
                  errors:
                    items:
                      $ref: '#/components/schemas/UnknownError'
                    maxItems: 1
                    minItems: 1
                    type: array
                required:
                  - errors
                type: object
          description: >-
            UnknownError (error_code 5999): Unexpected internal error not
            otherwise documented for this endpoint.
      security:
        - operatorAuth: []
components:
  schemas:
    MissingTenantIDError:
      additionalProperties: false
      properties:
        error:
          enum:
            - MissingTenantIDError
          type: string
        error_code:
          enum:
            - 1001
          type: number
        message:
          example: tenantID is required.
          type: string
        statusCode:
          enum:
            - 400
          type: number
      required:
        - statusCode
        - error
        - error_code
        - message
      type: object
    RequestValidationError:
      additionalProperties: false
      properties:
        error:
          enum:
            - RequestValidationError
          type: string
        error_code:
          enum:
            - 1002
          type: number
        fields:
          items:
            additionalProperties: false
            properties:
              allowed:
                type: string
              field:
                type: string
              received:
                type: string
            required:
              - field
              - received
              - allowed
            type: object
          type: array
        message:
          example: Invalid request data.
          type: string
        statusCode:
          enum:
            - 400
          type: number
      required:
        - statusCode
        - error
        - error_code
        - message
        - fields
      type: object
    InvalidNamespaceError:
      additionalProperties: false
      properties:
        error:
          enum:
            - InvalidNamespaceError
          type: string
        error_code:
          enum:
            - 1202
          type: number
        message:
          example: Invalid namespace.
          type: string
        statusCode:
          enum:
            - 400
          type: number
      required:
        - statusCode
        - error
        - error_code
        - message
      type: object
    UnauthorizedError:
      additionalProperties: false
      properties:
        error:
          enum:
            - UnauthorizedError
          type: string
        error_code:
          enum:
            - 1003
          type: number
        message:
          example: You are not authorized to perform this request.
          type: string
        statusCode:
          enum:
            - 401
          type: number
      required:
        - statusCode
        - error
        - error_code
        - message
      type: object
    ForbiddenError:
      additionalProperties: false
      properties:
        error:
          enum:
            - ForbiddenError
          type: string
        error_code:
          enum:
            - 1004
          type: number
        message:
          example: You do not have access to this resource.
          type: string
        statusCode:
          enum:
            - 403
          type: number
      required:
        - statusCode
        - error
        - error_code
        - message
      type: object
    UnknownError:
      additionalProperties: false
      properties:
        error:
          enum:
            - UnknownError
          type: string
        error_code:
          enum:
            - 5999
          type: number
        message:
          example: For some unknown reason your request has not succeeded.
          type: string
        statusCode:
          enum:
            - 500
          type: number
      required:
        - statusCode
        - error
        - error_code
        - message
      type: object
  securitySchemes:
    operatorAuth:
      bearerFormat: JWT
      description: >-
        Behalf of an Operator (default). A JWT issued by Talqui Core when an
        operator signs in, scoped to every tenant that operator belongs to. Send
        as `Authorization: Bearer <jwt-token>`.
      scheme: bearer
      type: http

````

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