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

# Read service analytics

> Read service analytics through the Towbar REST API.

Required permissions: scout.read. Personal keys are capped by their owner’s current team role.

See [request conventions](/docs/api/overview) and [automation workflows](/docs/api/workflows). MCP clients use the task-oriented [tool catalogue](/docs/api/mcp-tools).


## OpenAPI

````yaml api-reference/openapi.json GET /apps/{appId}/analytics
openapi: 3.1.0
info:
  title: Towbar API
  version: 2.0.0
  description: >-
    Manage your Towbar control plane with a bearer API key. Keys inherit current
    workspace permissions.
servers:
  - url: https://towbar.example.com/v1/api
security: []
paths:
  /apps/{appId}/analytics:
    get:
      tags:
        - Services / Scout Agent
      summary: Read service analytics
      description: >-
        Required permissions: scout.read. Personal keys are capped by the
        current member role; team keys use explicit grants.
      operationId: get_apps_by_id_analytics
      parameters:
        - name: appId
          in: path
          required: true
          schema:
            $schema: https://json-schema.org/draft/2020-12/schema
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
        - name: days
          in: query
          required: false
          schema:
            default: 7
            type: integer
            minimum: 1
            maximum: 90
        - name: kind
          in: query
          required: false
          schema:
            default: request
            type: string
            enum:
              - request
              - pageview
        - name: filters
          in: query
          required: false
          schema:
            default: '[]'
            type: string
            maxLength: 8192
            description: >-
              JSON array of AND conditions, for example
              [{"field":"path","operator":"startsWith","value":"/docs"}].
              Supports path with equals or startsWith; at most 8 conditions.
      responses:
        '200':
          description: >-
            Request or pageview trends, dimensions, latency histogram, and
            optional browser identity estimates within retention.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/AnalyticsReport_1'
                  - type: object
                    properties:
                      localization:
                        $schema: https://json-schema.org/draft/2020-12/schema
                        type: object
                        properties:
                          dateFormat:
                            type: string
                            enum:
                              - day-short-month-year
                              - short-month-day-year
                              - year-month-day
                              - day-month-year
                              - month-day-year
                          timeFormat:
                            type: string
                            enum:
                              - 24-hour
                              - 12-hour
                              - 24-hour-seconds
                              - 12-hour-seconds
                          timeZone:
                            type: string
                          timestamps:
                            type: object
                            propertyNames:
                              type: string
                            additionalProperties:
                              type: object
                              properties:
                                date:
                                  type: string
                                time:
                                  type:
                                    - string
                                    - 'null'
                                dateTime:
                                  type:
                                    - string
                                    - 'null'
                                timeZone:
                                  type: string
                                zoneLabel:
                                  type: string
                                epochMilliseconds:
                                  type: number
                                inputDateTime:
                                  type:
                                    - string
                                    - 'null'
                              required:
                                - date
                                - time
                                - dateTime
                                - timeZone
                                - zoneLabel
                                - epochMilliseconds
                                - inputDateTime
                              additionalProperties: false
                        required:
                          - dateFormat
                          - timeFormat
                          - timeZone
                          - timestamps
                        additionalProperties: false
                    required:
                      - localization
        '400':
          $ref: '#/components/responses/ApiError'
        '401':
          $ref: '#/components/responses/ApiError'
        '403':
          $ref: '#/components/responses/ApiError'
        '404':
          $ref: '#/components/responses/ApiError'
        '409':
          $ref: '#/components/responses/ApiError'
        '413':
          $ref: '#/components/responses/ApiError'
        '422':
          $ref: '#/components/responses/ApiError'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/ApiError'
      security:
        - bearerAuth: []
components:
  schemas:
    AnalyticsReport_1:
      type: object
      properties:
        filters:
          type: array
          items:
            $ref: '#/components/schemas/Response_2'
        enabled:
          type: boolean
        config:
          anyOf:
            - type: 'null'
            - $ref: '#/components/schemas/Response_3'
        agentStatus:
          type: string
        lastReceivedAt:
          anyOf:
            - type: 'null'
            - type: string
        droppedSamples:
          type: number
        droppedEvents:
          type: number
        geolocationBuiltAt:
          anyOf:
            - type: 'null'
            - type: string
        collectionReady:
          type: boolean
        collectionErrors:
          type: number
        start:
          type: string
        end:
          type: string
        kind:
          anyOf:
            - type: string
              const: request
            - type: string
              const: pageview
        total:
          type: number
        bytes:
          type: number
        errors:
          type: number
        meanMs:
          anyOf:
            - type: 'null'
            - type: number
        p50Ms:
          anyOf:
            - type: 'null'
            - type: number
        p95Ms:
          anyOf:
            - type: 'null'
            - type: number
        visitors:
          anyOf:
            - type: 'null'
            - type: number
        sessions:
          anyOf:
            - type: 'null'
            - type: number
        histogram:
          type: array
          items:
            type: number
        trend:
          type: array
          items:
            $ref: '#/components/schemas/Response_4'
        deployments:
          type: array
          items:
            $ref: '#/components/schemas/Response_5'
        comparison:
          anyOf:
            - type: 'null'
            - $ref: '#/components/schemas/Response_6'
        dimensions:
          $ref: '#/components/schemas/Record_8'
      required:
        - filters
        - enabled
        - config
        - agentStatus
        - lastReceivedAt
        - droppedSamples
        - droppedEvents
        - geolocationBuiltAt
        - collectionReady
        - collectionErrors
        - start
        - end
        - kind
        - total
        - bytes
        - errors
        - meanMs
        - p50Ms
        - p95Ms
        - visitors
        - sessions
        - histogram
        - trend
        - deployments
        - comparison
        - dimensions
    Response_2:
      type: object
      properties:
        field:
          type: string
          const: path
        operator:
          anyOf:
            - type: string
              const: startsWith
            - type: string
              const: equals
        value:
          type: string
      required:
        - field
        - operator
        - value
    Response_3:
      type: object
      properties:
        enabled:
          type: boolean
        pageviews:
          type: boolean
        visitorIdentity:
          type: boolean
        retentionDays:
          anyOf:
            - type: number
              const: 7
            - type: number
              const: 30
            - type: number
              const: 90
        excludePaths:
          type: array
          items:
            type: string
      required:
        - enabled
        - pageviews
        - visitorIdentity
        - retentionDays
        - excludePaths
    Response_4:
      type: object
      properties:
        at:
          type: string
        count:
          type: number
        errors:
          type: number
      required:
        - at
        - count
        - errors
    Response_5:
      type: object
      properties:
        id:
          type: string
        at:
          type: string
        state:
          type: string
        type:
          type: string
          const: deployment
      required:
        - id
        - at
        - state
        - type
    Response_6:
      type: object
      properties:
        start:
          type: string
        end:
          type: string
        total:
          type: number
        errors:
          type: number
        meanMs:
          anyOf:
            - type: 'null'
            - type: number
        visitors:
          anyOf:
            - type: 'null'
            - type: number
        sessions:
          anyOf:
            - type: 'null'
            - type: number
        trend:
          type: array
          items:
            $ref: '#/components/schemas/Response_7'
      required:
        - start
        - end
        - total
        - errors
        - meanMs
        - visitors
        - sessions
        - trend
    Record_8:
      type: object
      additionalProperties:
        type: array
        items:
          $ref: '#/components/schemas/Response_9'
    Response_7:
      type: object
      properties:
        at:
          type: string
        count:
          type: number
        errors:
          type: number
      required:
        - at
        - count
        - errors
    Response_9:
      type: object
      properties:
        value:
          type: string
        count:
          type: number
      required:
        - value
        - count
  responses:
    ApiError:
      description: Request failed. The error object contains code, message, and requestId.
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: object
                required:
                  - code
                  - message
                  - requestId
                properties:
                  code:
                    type: string
                  message:
                    type: string
                  requestId:
                    type: string
    RateLimited:
      description: Request failed. The error object contains code, message, and requestId.
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: object
                required:
                  - code
                  - message
                  - requestId
                properties:
                  code:
                    type: string
                  message:
                    type: string
                  requestId:
                    type: string
      headers:
        Retry-After:
          description: Seconds before retrying
          schema:
            type: integer
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: Towbar API key

````