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

# Retrieve traffic



## OpenAPI

````yaml https://spec.speakeasy.com/latitude/latitude/latitude-sh-api-with-code-samples get /traffic
openapi: 3.0.1
info:
  title: Latitude.sh API
  version: '2023-06-01'
  description: >-
    The Latitude.sh API is a RESTful API to manage your Latitude.sh account. It
    allows you to perform the same actions as the Latitude.sh dashboard.
servers:
  - url: https://api.latitude.sh
    variables:
      latitude_api_key:
        default: <insert your api key here>
  - url: http://api.latitude.sh
    variables:
      latitude_api_key:
        default: <insert your api key here>
security: []
tags:
  - name: API keys
  - name: Billing
  - name: Elastic Ips
  - name: Events
  - name: Firewalls
  - name: IP Addresses
  - name: Kubernetes Clusters
  - name: Operating Systems
  - name: Plans
  - name: Private Networks
  - name: Projects
  - name: Regions
  - name: Roles
  - name: SSH Keys
  - name: Servers
  - name: Storage
  - name: Tags
  - name: Teams
  - name: Team members
  - name: Traffic
  - name: User data
  - name: User profile
  - name: VPN Sessions
  - name: Virtual machines
paths:
  /traffic:
    get:
      tags:
        - Traffic
      summary: Retrieve traffic
      operationId: get-traffic-consumption
      parameters:
        - name: filter[server]
          in: query
          required: false
          description: The server id to filter by
          examples:
            Success:
              value: sv_A05EdQ50dvKYQ
          schema:
            type: string
        - name: filter[project]
          in: query
          required: false
          description: The project id to filter by
          schema:
            type: string
        - name: filter[date][gte]
          in: query
          required: true
          description: >-
            The start timestamp to retrieve the traffic. You must provide in
            ISO8601 format. Example: filter[date][gte]=2024-04-01T00:00:00Z
          examples:
            Success:
              value: '2025-12-14T15:57:10Z'
          schema:
            type: string
        - name: filter[date][lte]
          in: query
          required: true
          description: >-
            The end timestamp to retrieve the traffic. You must provide in
            ISO8601 format. Example: filter[date][gte]=2024-04-31T23:59:59Z
          examples:
            Success:
              value: '2026-01-14T15:57:10Z'
          schema:
            type: string
      responses:
        '200':
          description: Success
          content:
            application/vnd.api+json:
              examples:
                Success:
                  value:
                    data:
                      id: ''
                      type: traffic
                      attributes:
                        from_date: 1765727830
                        to_date: 1768406230
                        total_inbound_gb: 102
                        total_outbound_gb: 241
                        total_inbound_95th_percentile_mbps: 1832.91
                        total_outbound_95th_percentile_mbps: 1819.99
                        regions:
                          - region_slug: brazil
                            total_inbound_gb: 102
                            total_outbound_gb: 241
                            total_inbound_95th_percentile_mbps: 1832.91
                            total_outbound_95th_percentile_mbps: 1819.99
                            data:
                              - date: '2021-07-01T00:00:00.000+00:00'
                                inbound_gb: 10
                                outbound_gb: 102
                                avg_outbound_speed_mbps: 1.19
                                avg_inbound_speed_mbps: 0.13
                              - date: '2021-07-02T00:00:00.000+00:00'
                                inbound_gb: 2
                                outbound_gb: 6
                                avg_outbound_speed_mbps: 0.08
                                avg_inbound_speed_mbps: 0.02
                              - date: '2021-07-03T00:00:00.000+00:00'
                                inbound_gb: 5
                                outbound_gb: 15
                                avg_outbound_speed_mbps: 0.18
                                avg_inbound_speed_mbps: 0.06
                              - date: '2021-07-04T00:00:00.000+00:00'
                                inbound_gb: 57
                                outbound_gb: 32
                                avg_outbound_speed_mbps: 0.38
                                avg_inbound_speed_mbps: 0.66
                              - date: '2021-07-05T00:00:00.000+00:00'
                                inbound_gb: 11
                                outbound_gb: 59
                                avg_outbound_speed_mbps: 0.69
                                avg_inbound_speed_mbps: 0.13
                              - date: '2021-07-06T00:00:00.000+00:00'
                                inbound_gb: 17
                                outbound_gb: 27
                                avg_outbound_speed_mbps: 0.32
                                avg_inbound_speed_mbps: 0.2
                    meta: {}
              schema:
                $ref: '#/components/schemas/traffic'
      security:
        - Bearer: []
      x-codeSamples:
        - lang: python
          label: Python (SDK)
          source: |-
            from latitudesh_python_sdk import Latitudesh
            import os


            with Latitudesh(
                bearer=os.getenv("LATITUDESH_BEARER", ""),
            ) as latitudesh:

                res = latitudesh.traffic.get(filter_date_gte="2025-12-14T15:57:10Z", filter_date_lte="2026-01-14T15:57:10Z", filter_server="sv_A05EdQ50dvKYQ", filter_project="proj_AW6Q2D9lqKLpr")

                # Handle response
                print(res)
        - lang: go
          label: Go (SDK)
          source: "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tlatitudeshgosdk \"github.com/latitudesh/latitudesh-go-sdk\"\n\t\"log\"\n)\n\nfunc main() {\n    ctx := context.Background()\n\n    s := latitudeshgosdk.New(\n        latitudeshgosdk.WithSecurity(os.Getenv(\"LATITUDESH_BEARER\")),\n    )\n\n    res, err := s.Traffic.Get(ctx, \"2025-12-14T15:57:10Z\", \"2026-01-14T15:57:10Z\", latitudeshgosdk.Pointer(\"sv_A05EdQ50dvKYQ\"), latitudeshgosdk.Pointer(\"proj_AW6Q2D9lqKLpr\"))\n    if err != nil {\n        log.Fatal(err)\n    }\n    if res.Traffic != nil {\n        // handle response\n    }\n}"
        - lang: typescript
          label: Typescript (SDK)
          source: |-
            import { Latitudesh } from "latitudesh-typescript-sdk";

            const latitudesh = new Latitudesh({
              bearer: process.env["LATITUDESH_BEARER"] ?? "",
            });

            async function run() {
              const result = await latitudesh.traffic.get({
                filterServer: "sv_A05EdQ50dvKYQ",
                filterDateGte: "2025-12-14T15:57:10Z",
                filterDateLte: "2026-01-14T15:57:10Z",
              });

              console.log(result);
            }

            run();
components:
  schemas:
    traffic:
      type: object
      properties:
        data:
          type: object
          properties:
            id:
              type: string
            type:
              type: string
              enum:
                - traffic
            attributes:
              type: object
              properties:
                from_date:
                  type: integer
                  description: The start timestamp. Must be a unix timestamp
                to_date:
                  type: integer
                  description: The end timestamp. Must be a unix timestamp
                regions:
                  type: array
                  items:
                    type: object
                    properties:
                      region_slug:
                        type: string
                      total_inbound_gb:
                        type: integer
                        description: Value in GB
                      total_outbound_gb:
                        type: integer
                        description: Value in GB
                      total_inbound_95th_percentile_mbps:
                        type: number
                        description: >-
                          The 95th percentile of inbound bandwidth for this
                          region, calculated from 30-minute intervals. Value in
                          Mbps
                      total_outbound_95th_percentile_mbps:
                        type: number
                        description: >-
                          The 95th percentile of outbound bandwidth for this
                          region, calculated from 30-minute intervals. Value in
                          Mbps
                      data:
                        type: array
                        items:
                          type: object
                          properties:
                            date:
                              type: string
                              description: The datetime of the day
                            inbound_gb:
                              type: integer
                              description: Value in GB
                            outbound_gb:
                              type: integer
                              description: Value in GB
                            avg_outbound_speed_mbps:
                              type: number
                              description: Value in Mbps
                            avg_inbound_speed_mbps:
                              type: number
                              description: Value in Mbps
                total_inbound_gb:
                  type: integer
                  description: Value in GB
                total_outbound_gb:
                  type: integer
                  description: Value in GB
                total_inbound_95th_percentile_mbps:
                  type: number
                  description: >-
                    The 95th percentile of inbound bandwidth across all regions,
                    calculated from all 30-minute intervals combined. This is a
                    global percentile, not a sum of regional percentiles. Value
                    in Mbps
                total_outbound_95th_percentile_mbps:
                  type: number
                  description: >-
                    The 95th percentile of outbound bandwidth across all
                    regions, calculated from all 30-minute intervals combined.
                    This is a global percentile, not a sum of regional
                    percentiles. Value in Mbps
  securitySchemes:
    Bearer:
      type: apiKey
      name: Authorization
      in: header

````