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

# Get Traffic

> Get API traffic data for an app. Grouped by hour or by day. With pagination. Traffic to endpoints that have been excluded in the dashboard is excluded here as well.



## OpenAPI

````yaml https://api.apitally.io/openapi.json get /v1/apps/{app_id}/traffic
openapi: 3.1.0
info:
  title: Apitally API
  version: 1.0.0
servers:
  - url: https://api.apitally.io
security: []
paths:
  /v1/apps/{app_id}/traffic:
    get:
      tags:
        - Metrics
      summary: Get Traffic
      description: >-
        Get API traffic data for an app. Grouped by hour or by day. With
        pagination. Traffic to endpoints that have been excluded in the
        dashboard is excluded here as well.
      operationId: get_traffic_v1_apps__app_id__traffic_get
      parameters:
        - name: app_id
          in: path
          required: true
          schema:
            type: integer
            minimum: 1
            description: App ID
            title: App Id
          description: App ID
        - name: app_env_id
          in: query
          required: false
          schema:
            anyOf:
              - type: integer
                minimum: 1
              - type: 'null'
            description: Filter to environment ID, if provided.
            title: App Env Id
          description: Filter to environment ID, if provided.
        - name: consumer_id
          in: query
          required: false
          schema:
            anyOf:
              - type: integer
                minimum: 1
              - type: 'null'
            description: Filter to consumer ID, if provided.
            title: Consumer Id
          description: Filter to consumer ID, if provided.
        - name: start
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date-time
              - type: 'null'
            description: >-
              Start date and time in ISO 8601 format. Defaults to 24 hours ago
              if `interval` is "hour", or 30 days ago if `interval` is "day".
              Will be rounded down to the beginning of the interval (hour or
              day).
            examples:
              - '2025-05-14T00:00:00Z'
            title: Start
          description: >-
            Start date and time in ISO 8601 format. Defaults to 24 hours ago if
            `interval` is "hour", or 30 days ago if `interval` is "day". Will be
            rounded down to the beginning of the interval (hour or day).
        - name: end
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date-time
              - type: 'null'
            description: End date and time in ISO 8601 format. Defaults to now.
            examples:
              - '2025-05-15T00:00:00Z'
            title: End
          description: End date and time in ISO 8601 format. Defaults to now.
        - name: interval
          in: query
          required: false
          schema:
            anyOf:
              - enum:
                  - hour
                  - day
                type: string
              - type: 'null'
            description: Whether to group by day or by hour.
            default: hour
            title: Interval
          description: Whether to group by day or by hour.
        - name: timezone
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              Timezone to use for intervals and to interpret `start` and `end`
              if given without offset. Defaults to UTC.
            examples:
              - America/New_York
            title: Timezone
          description: >-
            Timezone to use for intervals and to interpret `start` and `end` if
            given without offset. Defaults to UTC.
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            maximum: 1000
            minimum: 1
            description: Maximum number of records to return per page
            default: 100
            title: Limit
          description: Maximum number of records to return per page
        - name: next_token
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                maxLength: 1024
              - type: 'null'
            description: >-
              Token to fetch the next page of records, as returned by a previous
              request.
            title: Next Token
          description: >-
            Token to fetch the next page of records, as returned by a previous
            request.
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetTrafficResponse'
        '404':
          description: App Not Found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    GetTrafficResponse:
      properties:
        data:
          items:
            $ref: '#/components/schemas/TrafficItem'
          type: array
          title: Data
          description: List of traffic data.
        has_more:
          type: boolean
          title: Has More
          description: Whether there are more records to fetch.
        next_token:
          anyOf:
            - type: string
            - type: 'null'
          title: Next Token
          description: Token to fetch the next page of records, if there are more.
      type: object
      required:
        - data
        - has_more
        - next_token
      title: GetTrafficResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    TrafficItem:
      properties:
        period_start:
          type: string
          format: date-time
          title: Period Start
          description: Start of the period in ISO 8601 format with timezone offset.
        period_end:
          type: string
          format: date-time
          title: Period End
          description: End of the period in ISO 8601 format with timezone offset.
        requests:
          type: integer
          title: Requests
          description: Number of requests.
          examples:
            - 123
        bytes_received:
          type: integer
          title: Bytes Received
          description: Number of bytes received.
        bytes_sent:
          type: integer
          title: Bytes Sent
          description: Number of bytes sent.
      type: object
      required:
        - period_start
        - period_end
        - requests
        - bytes_received
        - bytes_sent
      title: TrafficItem
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: Api-Key

````