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

# Get public endpoint billing history

> Returns Runpod public endpoint billing history for the authenticated user, split into time buckets by startTime/endTime with bucketSize or by lastN recent buckets. Each record reports the endpoint total for one bucket, and metadata echoes the resolved query window, record count, and total endpoint amount across all returned records.




## OpenAPI

````yaml get /v2/billing/endpoints
openapi: 3.1.0
info:
  title: Runpod REST API
  version: 2.0.0
  description: Runpod public REST API — v2
servers:
  - url: https://api.runpod.io
    description: Runpod API v2 production server
security:
  - bearerAuth: []
tags:
  - name: Pods
    description: GPU and CPU pod lifecycle, configuration, actions, and log streaming.
  - name: Serverless
    description: >-
      Serverless endpoint lifecycle, worker visibility, releases, and worker log
      streaming.
  - name: Templates
    description: Reusable pod and endpoint configuration templates.
  - name: Network Volumes
    description: Persistent network storage volumes for workloads.
  - name: Registries
    description: Container registry credentials used to pull private images.
  - name: Catalog
    description: Available GPU, CPU, and data center catalog metadata.
  - name: Billing
    description: Billing history and usage cost records across resource types.
paths:
  /v2/billing/endpoints:
    get:
      tags:
        - Billing
      summary: Get public endpoint billing history
      description: >
        Returns Runpod public endpoint billing history for the authenticated
        user, split into time buckets by startTime/endTime with bucketSize or by
        lastN recent buckets. Each record reports the endpoint total for one
        bucket, and metadata echoes the resolved query window, record count, and
        total endpoint amount across all returned records.
      operationId: listEndpointBilling
      parameters:
        - $ref: '#/components/parameters/BillingStartTime'
        - $ref: '#/components/parameters/BillingEndTime'
        - $ref: '#/components/parameters/BillingBucketSize'
        - $ref: '#/components/parameters/BillingLastN'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListEndpointBillingResponse'
              examples:
                endpointBilling:
                  summary: Successful response
                  value:
                    records:
                      - startTime: '2026-06-01T00:00:00Z'
                        endTime: '2026-06-02T00:00:00Z'
                        totalAmount: 3.21
                    metadata:
                      query:
                        startTime: '2026-06-01T00:00:00Z'
                        endTime: '2026-06-02T00:00:00Z'
                        bucketSize: day
                      recordCount: 1
                      totals:
                        totalAmount: 3.21
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '403':
          $ref: '#/components/responses/ForbiddenError'
        '429':
          $ref: '#/components/responses/TooManyRequestsError'
        default:
          description: Error
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  parameters:
    BillingStartTime:
      name: startTime
      in: query
      required: false
      description: >
        Start of the billing period (RFC 3339). Defaults to 30 days ago. Snapped
        down to the start of its bucketSize bucket so the window aligns with the
        returned records; provide a boundary-aligned value (e.g. midnight for
        bucketSize=day) to avoid widening.
      schema:
        type: string
        format: date-time
      example: '2026-05-01T00:00:00Z'
    BillingEndTime:
      name: endTime
      in: query
      required: false
      description: >
        End of the billing period (RFC 3339), exclusive. Defaults to now.
        Snapped up to the end of the bucketSize bucket it lands in (unless
        already on a boundary) so the window aligns with the returned records.
      schema:
        type: string
        format: date-time
      example: '2026-06-01T00:00:00Z'
    BillingBucketSize:
      name: bucketSize
      in: query
      required: false
      description: Length of each billing time bucket. Defaults to day.
      schema:
        $ref: '#/components/schemas/BillingBucketSize'
    BillingLastN:
      name: lastN
      in: query
      required: false
      description: >
        Return the last N buckets of bucketSize, ending with the current
        (in-progress) bucket — e.g. lastN=100 with bucketSize=day is "last 100
        days". The resolved window is aligned to bucket boundaries: startTime is
        the start of the earliest bucket (e.g. midnight of the earliest day) and
        endTime is the end of the current bucket. Mutually exclusive with
        startTime/endTime; provide one or the other, not both.
      schema:
        type: integer
        minimum: 1
      example: 30
  schemas:
    ListEndpointBillingResponse:
      type: object
      description: >
        Time-bucketed Runpod public endpoint billing records plus metadata for
        the resolved query, record count, and total endpoint amount.
      required:
        - records
        - metadata
      properties:
        records:
          type: array
          items:
            $ref: '#/components/schemas/EndpointBillingRecord'
        metadata:
          $ref: '#/components/schemas/EndpointBillingMetadata'
    ErrorResponse:
      type: object
      required:
        - title
        - status
        - detail
      properties:
        title:
          type: string
          description: Short human-readable summary
          examples:
            - Not Found
        status:
          type: integer
          description: HTTP status code
          examples:
            - 404
        detail:
          type: string
          description: Human-readable explanation
          examples:
            - pod not found
        errors:
          type: array
          description: Individual request-validation failures.
          items:
            type: string
          examples:
            - - '$: additional properties ''bogus'' not allowed'
    BillingBucketSize:
      type: string
      enum:
        - hour
        - day
        - week
        - month
        - year
      x-enum-varnames:
        - BillingBucketSizeHour
        - BillingBucketSizeDay
        - BillingBucketSizeWeek
        - BillingBucketSizeMonth
        - BillingBucketSizeYear
      default: day
      description: Length of each billing time bucket.
      examples:
        - day
    EndpointBillingRecord:
      description: >
        A single time-bucketed Runpod public endpoint billing record. Returned
        by GET /v2/billing/endpoints.
      allOf:
        - $ref: '#/components/schemas/BillingTimeRange'
        - $ref: '#/components/schemas/EndpointBillingAmounts'
    EndpointBillingMetadata:
      type: object
      required:
        - query
        - recordCount
        - totals
      properties:
        query:
          $ref: '#/components/schemas/BillingQuery'
        recordCount:
          type: integer
        totals:
          $ref: '#/components/schemas/EndpointBillingAmounts'
    BillingTimeRange:
      type: object
      description: >
        Half-open time range [startTime, endTime) in RFC 3339. On a record it is
        the time bucket; on a query echo it is the resolved window.
      required:
        - startTime
        - endTime
      properties:
        startTime:
          type: string
          format: date-time
          description: Start of the range, inclusive (RFC 3339).
          examples:
            - '2026-06-01T00:00:00Z'
        endTime:
          type: string
          format: date-time
          description: End of the range, exclusive (RFC 3339).
          examples:
            - '2026-06-02T00:00:00Z'
    EndpointBillingAmounts:
      type: object
      description: >
        Runpod public endpoint cost. Backs a record's amounts and the metadata
        totals.
      required:
        - totalAmount
      properties:
        totalAmount:
          type: number
          format: double
          description: Total public endpoint cost in USD for the bucket.
          examples:
            - 3.21
    BillingQuery:
      description: Resolved query window and granularity (routes without a filter).
      allOf:
        - $ref: '#/components/schemas/BillingTimeRange'
        - type: object
          required:
            - bucketSize
          properties:
            bucketSize:
              $ref: '#/components/schemas/BillingBucketSize'
  responses:
    UnauthorizedError:
      description: >-
        Authentication failed because the bearer token is missing, malformed,
        expired, or invalid.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            missingBearerToken:
              summary: Missing bearer token
              value:
                title: Unauthorized
                status: 401
                detail: missing bearer token
    ForbiddenError:
      description: >-
        The bearer token is valid, but it does not grant access to the requested
        resource or action.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            insufficientAccess:
              summary: Insufficient access
              value:
                title: Forbidden
                status: 403
                detail: access denied
    TooManyRequestsError:
      description: >
        The caller exceeded its per-user rate limit. The response identifies the
        window that was exceeded and how long to wait. The `RateLimit` and
        `RateLimit-Policy` headers (per the IETF ratelimit-headers draft) also
        accompany successful responses, so clients can track quota before a 429.
      headers:
        Retry-After:
          description: Seconds to wait before retrying, per the exceeded window.
          schema:
            type: integer
          example: 12
        RateLimit:
          description: >
            Live per-window state as a structured-field list — one member per
            window (`minute`, `hour`, `day`) with remaining count `r` and
            seconds-until-reset `t`.
          schema:
            type: string
          example: '"minute";r=0;t=12, "hour";r=2800;t=1812, "day";r=49500;t=45012'
        RateLimit-Policy:
          description: >
            Static quota policy as a structured-field list — one member per
            window with quota `q` and window length `w` (seconds).
          schema:
            type: string
          example: '"minute";q=60;w=60, "hour";q=3000;w=3600, "day";q=50000;w=86400'
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            rateLimited:
              summary: Rate limit exceeded
              value:
                title: Too Many Requests
                status: 429
                detail: rate limit exceeded for the minute window
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: Runpod API Key
      description: >
        Runpod API key authentication. Generate an API key in the Runpod console
        and send it in the `Authorization` header as `Bearer <api_key>`. Keys
        are scoped to the permissions granted when created; requests may return
        `403` when a valid key lacks access to the requested resource or action.

````