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

# Retrieve account usage

> Retrieve priced usage for an account within a specified time range.



## OpenAPI

````yaml GET /accounts/{account_id}/usage
openapi: 3.1.1
info:
  title: Surge
  version: '1.0'
servers:
  - url: https://api.surge.app
security:
  - authorization: []
paths:
  /accounts/{account_id}/usage:
    get:
      tags:
        - Accounts
      summary: Retrieve account usage
      description: >
        Returns priced usage for an account between `start_time` (inclusive) and
        `end_time` (exclusive).


        Both times must be whole UTC minutes and must fall within the last year.

        The window may span at most 90 days. Prices use the project's current
        plan rates.

        Phone number, campaign, and recording storage charges are included when
        their

        billing time falls in the window.
      operationId: RetrieveAccountUsage
      parameters:
        - in: path
          name: account_id
          required: true
          schema:
            description: ID of the account.
            example: acct_01j9a43avnfqzbjfch6pygv1td
            type: string
        - in: query
          name: start_time
          required: true
          schema:
            description: Inclusive start of the window. Must be a whole UTC minute.
            example: '2026-04-09T15:03:00Z'
            format: date-time
            type: string
        - in: query
          name: end_time
          required: true
          schema:
            description: Exclusive end of the window. Must be a whole UTC minute.
            example: '2026-04-09T16:03:00Z'
            format: date-time
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountUsage'
          description: Priced usage for the window
        default:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Error
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Surge from '@surgeapi/node';


            const client = new Surge({
              apiKey: process.env['SURGE_API_KEY'], // This is the default and can be omitted
            });


            const accountUsage = await
            client.accounts.retrieveUsage('acct_01j9a43avnfqzbjfch6pygv1td', {
              end_time: '2026-04-09T16:03:00Z',
              start_time: '2026-04-09T15:03:00Z',
            });


            console.log(accountUsage.end_time);
        - lang: Python
          source: |-
            import os
            from datetime import datetime
            from surge import Surge

            client = Surge(
                api_key=os.environ.get("SURGE_API_KEY"),  # This is the default and can be omitted
            )
            account_usage = client.accounts.retrieve_usage(
                account_id="acct_01j9a43avnfqzbjfch6pygv1td",
                end_time=datetime.fromisoformat("2026-04-09T16:03:00"),
                start_time=datetime.fromisoformat("2026-04-09T15:03:00"),
            )
            print(account_usage.end_time)
        - lang: Ruby
          source: |-
            require "surge_api"

            surge = SurgeAPI::Client.new(api_key: "My API Key")

            account_usage = surge.accounts.retrieve_usage(
              "acct_01j9a43avnfqzbjfch6pygv1td",
              end_time: "2026-04-09T16:03:00Z",
              start_time: "2026-04-09T15:03:00Z"
            )

            puts(account_usage)
components:
  schemas:
    AccountUsage:
      title: AccountUsage
      description: Priced usage for an account over a requested window.
      example:
        end_time: '2026-04-09T16:03:00Z'
        line_items:
          - category: sms
            count: 2
            item: Inbound SMS Segments
            total_price: $2.00
            unit: segment
            unit_price: $1.00
        start_time: '2026-04-09T15:03:00Z'
        total: $2.00
      properties:
        end_time:
          description: Exclusive end of the window, in UTC.
          format: date-time
          type: string
        line_items:
          items:
            properties:
              category:
                description: Billing category for the line.
                enum:
                  - sms
                  - mms
                  - secure_messages
                  - voice
                  - phone_numbers
                  - number_lookups
                  - recording
                  - campaigns
                  - registrations
                  - verifications
                type: string
              count:
                description: Number of units in the window.
                type: integer
              item:
                description: Description of the line.
                type: string
              total_price:
                description: Formatted USD total for the line, such as "$1.25".
                type: string
              unit:
                description: Unit represented by count.
                enum:
                  - segment
                  - message
                  - minute
                  - phone_number
                  - lookup
                  - campaign
                  - brand
                  - verification
                  - fee
                type: string
              unit_price:
                description: Formatted USD price for one unit, such as "$0.0079".
                type: string
            required:
              - category
              - item
              - count
              - unit
              - unit_price
              - total_price
            type: object
          type: array
        start_time:
          description: Inclusive start of the window, in UTC.
          format: date-time
          type: string
        total:
          description: Formatted USD total, such as "$1.25".
          type: string
      required:
        - start_time
        - end_time
        - total
        - line_items
      type: object
    ErrorResponse:
      title: ErrorResponse
      description: An error response
      example:
        error:
          message: The requested resource could not be found.
          type: not_found
      properties:
        error:
          $ref: '#/components/schemas/Error'
      required:
        - error
      type: object
    Error:
      title: Error
      description: An error response
      example:
        message: The requested resource was not found.
        type: not_found
      properties:
        detail:
          additionalProperties: true
          description: Additional details about the error.
          type: object
        message:
          description: A human-readable error message.
          example: The requested resource was not found.
          type: string
        type:
          description: A unique error code.
          example: not_found
          type: string
      required:
        - type
        - message
      type: object
  securitySchemes:
    authorization:
      bearerFormat: Surge API token
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.