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

# Get user balance details



## OpenAPI

````yaml https://telnyx-openapi-ng.s3.us-east-1.amazonaws.com/account-billing/balance.yml get /balance
openapi: 3.1.0
info:
  title: Telnyx Balance API
  version: 2.0.0
  description: API for Balance.
  contact:
    email: support@telnyx.com
servers:
  - url: https://api.telnyx.com/v2
security:
  - bearerAuth: []
paths:
  /balance:
    get:
      tags:
        - Billing
      summary: Get user balance details
      operationId: GetUserBalance
      responses:
        '200':
          $ref: '#/components/responses/UserBalanceResponse'
        '403':
          $ref: '#/components/responses/billing_ForbiddenErrorResponse'
        '422':
          $ref: '#/components/responses/billing_UnprocessableEntityErrorResponse'
        '503':
          $ref: '#/components/responses/ServiceUnavailableErrorResponse'
        default:
          $ref: '#/components/responses/GenericErrorResponse'
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import Telnyx from 'telnyx';

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

            const balance = await client.balance.retrieve();

            console.log(balance.data);
        - lang: Python
          source: |-
            import os
            from telnyx import Telnyx

            client = Telnyx(
                api_key=os.environ.get("TELNYX_API_KEY"),  # This is the default and can be omitted
            )
            balance = client.balance.retrieve()
            print(balance.data)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/team-telnyx/telnyx-go\"\n\t\"github.com/team-telnyx/telnyx-go/option\"\n)\n\nfunc main() {\n\tclient := telnyx.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tbalance, err := client.Balance.Get(context.TODO())\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", balance.Data)\n}\n"
        - lang: Java
          source: |-
            package com.telnyx.sdk.example;

            import com.telnyx.sdk.client.TelnyxClient;
            import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
            import com.telnyx.sdk.models.balance.BalanceRetrieveParams;
            import com.telnyx.sdk.models.balance.BalanceRetrieveResponse;

            public final class Main {
                private Main() {}

                public static void main(String[] args) {
                    TelnyxClient client = TelnyxOkHttpClient.fromEnv();

                    BalanceRetrieveResponse balance = client.balance().retrieve();
                }
            }
        - lang: Ruby
          source: |-
            require "telnyx"

            telnyx = Telnyx::Client.new(api_key: "My API Key")

            balance = telnyx.balance.retrieve

            puts(balance)
        - lang: PHP
          source: >-
            <?php


            require_once dirname(__DIR__) . '/vendor/autoload.php';


            use Telnyx\Client;

            use Telnyx\Core\Exceptions\APIException;


            $client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API
            Key');


            try {
              $balance = $client->balance->retrieve();

              var_dump($balance);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
        - lang: CLI
          source: |-
            telnyx balance retrieve \
              --api-key 'My API Key'
components:
  responses:
    UserBalanceResponse:
      description: Get user balance details
      content:
        application/json:
          schema:
            type: object
            properties:
              data:
                $ref: '#/components/schemas/UserBalance'
    billing_ForbiddenErrorResponse:
      description: Insufficient permissions to access balance information
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/billing_Errors'
    billing_UnprocessableEntityErrorResponse:
      description: Invalid or missing account information
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/billing_Errors'
    ServiceUnavailableErrorResponse:
      description: Service temporarily unavailable
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/billing_Errors'
    GenericErrorResponse:
      description: Unexpected error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/billing_Errors'
  schemas:
    UserBalance:
      type: object
      properties:
        pending:
          type: string
          description: The account’s pending amount.
          example: '10.00'
        record_type:
          type: string
          example: balance
          enum:
            - balance
          description: Identifies the type of the resource.
        balance:
          type: string
          description: The account's current balance.
          example: '300.00'
        credit_limit:
          type: string
          description: The account's credit limit.
          example: '100.00'
        available_credit:
          type: string
          description: Available amount to spend (balance + credit limit)
          example: '400.00'
        currency:
          type: string
          description: The ISO 4217 currency identifier.
          example: USD
      example:
        record_type: balance
        pending: '10.00'
        balance: '300.00'
        credit_limit: '100.00'
        available_credit: '400.00'
        currency: USD
    billing_Errors:
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/billing_Error'
      type: object
    billing_Error:
      required:
        - code
        - title
      properties:
        code:
          type: string
        title:
          type: string
        detail:
          type: string
        source:
          type: object
          properties:
            pointer:
              description: JSON pointer (RFC6901) to the offending entity.
              type: string
            parameter:
              description: Indicates which query parameter caused the error.
              type: string
        meta:
          type: object
          additionalProperties: true
      type: object
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````