> ## 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 billing usage

> Returns the billing usage of a project




## OpenAPI

````yaml https://spec.speakeasy.com/latitude/latitude/latitude-sh-api-with-code-samples get /billing/usage
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:
  /billing/usage:
    get:
      tags:
        - Billing
      summary: Retrieve billing usage
      description: |
        Returns the billing usage of a project
      operationId: get-billing-usage
      parameters:
        - name: filter[products][]
          in: query
          schema:
            type: array
            items:
              type: string
          required: false
          description: >
            Allows to filter the billing usage for specific products. It accepts
            an array of product ids.
          examples:
            Success:
              value:
                - si_aslft06m
                - si_on0fybnq
        - name: filter[plan]
          in: query
          required: false
          description: |
            Accepts a plan name and allows to filter the usage for that plan.
          schema:
            type: string
          examples:
            Success:
              value: plan.name
        - name: filter[project]
          in: query
          required: true
          examples:
            Success:
              value: proj_r0MK4O4kDa95w
          schema:
            type: string
      responses:
        '200':
          description: Success
          content:
            application/vnd.api+json:
              examples:
                Success:
                  value:
                    data:
                      id: ''
                      type: billing_usage
                      attributes:
                        project:
                          id: proj_r0MK4O4kDa95w
                          slug: fantastic-iron-clock
                          name: Fantastic Iron Clock
                        period:
                          start: '2025-12-24T15:56:32+00:00'
                          end: '2026-01-24T15:56:32+00:00'
                        available_credit_balance: 123
                        amount: 0
                        price: 0
                        products: []
                        threshold: 10000
                    meta: {}
              schema:
                $ref: '#/components/schemas/billing_usage'
      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.billing.list_usage(filter_project="proj_r0MK4O4kDa95w", filter_products=[
                    "si_aslft06m",
                    "si_on0fybnq",
                ], filter_plan="plan.name")

                # 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.Billing.ListUsage(ctx, \"proj_r0MK4O4kDa95w\", []string{\n        \"si_aslft06m\",\n        \"si_on0fybnq\",\n    }, latitudeshgosdk.Pointer(\"plan.name\"))\n    if err != nil {\n        log.Fatal(err)\n    }\n    if res.BillingUsage != 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.billing.listUsage({
                filterProducts: [
                  "si_aslft06m",
                  "si_on0fybnq",
                ],
                filterPlan: "plan.name",
                filterProject: "proj_r0MK4O4kDa95w",
              });

              console.log(result);
            }

            run();
components:
  schemas:
    billing_usage:
      type: object
      properties:
        data:
          type: object
          properties:
            id:
              type: string
            attributes:
              type: object
              properties:
                project:
                  type: object
                  description: The project in which the returned usage belongs to
                  properties:
                    id:
                      type: string
                    slug:
                      type: string
                    name:
                      type: string
                period:
                  type: object
                  description: The period from the returned billing cycle
                  properties:
                    start:
                      type: string
                      format: date-time
                    end:
                      type: string
                      format: date-time
                available_credit_balance:
                  type: integer
                  description: The available credit balance in cents
                price:
                  type: number
                  description: The total usage price in cents
                threshold:
                  type: number
                  description: The threshold which we use to charge your usage, in cents
                  nullable: true
                products:
                  type: array
                  items:
                    type: object
                    properties:
                      id:
                        type: string
                      resource:
                        type: string
                      name:
                        type: string
                      proration:
                        type: boolean
                      discounts:
                        type: array
                        items:
                          type: object
                          required:
                            - description
                            - type
                            - value
                          properties:
                            description:
                              type: string
                              example: Monthly Discount - Accelerate
                              description: Description of the discount
                            type:
                              type: string
                              enum:
                                - percent
                                - amount
                              description: Type of discount (percentage or fixed amount)
                            value:
                              type: number
                              format: float
                              example: 5
                              description: Value of the discount (percentage or amount)
                      discountable:
                        type: boolean
                      description:
                        type: string
                      amount_without_discount:
                        type: integer
                      start:
                        type: string
                        format: date-time
                      end:
                        type: string
                        format: date-time
                        nullable: true
                      unit:
                        type: string
                        enum:
                          - quantity
                          - hour
                          - minute
                      unit_price:
                        type: number
                        description: The unit price of the product in cents
                      usage_type:
                        type: string
                        enum:
                          - licensed
                          - metered
                      quantity:
                        type: number
                      price:
                        type: number
                        description: The total usage price of the product in cents
                      metadata:
                        type: object
                        properties:
                          id:
                            type: string
                            nullable: true
                          hostname:
                            type: string
                            nullable: true
                          plan:
                            type: string
                            nullable: true
                          tags:
                            type: array
                            items:
                              type: string
  securitySchemes:
    Bearer:
      type: apiKey
      name: Authorization
      in: header

````