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

# Get the current balance

> Retrieve the current API balance shared by the API key's workspace.



## OpenAPI

````yaml /openapi.yaml get /v2/billing/balance
openapi: 3.1.0
info:
  title: getimg.ai API
  version: 2.0.0
  description: |
    The getimg.ai API for image and video generation.

    Authenticate with a bearer token in the format `sk_<secret>`.
servers:
  - url: https://api.getimg.ai
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Images
    description: Endpoints for image generation.
  - name: Models
    description: Endpoints for listing available developer models.
  - name: Videos
    description: Endpoints for video generation.
  - name: Billing
    description: Developer API balance and usage costs.
paths:
  /v2/billing/balance:
    get:
      tags:
        - Billing
      summary: Get the current balance
      description: Retrieve the current API balance shared by the API key's workspace.
      operationId: getBalance
      responses:
        '200':
          description: >
            The workspace balance in USD, as a decimal string with four
            fractional digits. A workspace with no billing set up returns a zero
            balance. Responses are sent with `Cache-Control: no-store`.
          content:
            application/json:
              schema:
                type: object
                required:
                  - currency
                  - balance
                properties:
                  currency:
                    type: string
                    enum:
                      - USD
                  balance:
                    type: string
                    description: Current balance in USD.
                    example: '12.3456'
              examples:
                balance:
                  summary: Current balance
                  value:
                    currency: USD
                    balance: '12.3456'
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '429':
          $ref: '#/components/responses/RateLimitError'
        '500':
          $ref: '#/components/responses/ServerError'
      x-codeSamples:
        - lang: javascript
          label: Node.js
          source: >
            import GetimgAI from "getimg-ai";


            const client = new GetimgAI();


            const { balance, currency } = await
            client.billing.retrieveBalance();
        - lang: python
          label: Python
          source: |
            from getimg import GetimgAI

            client = GetimgAI()

            result = client.billing.retrieve_balance()
components:
  responses:
    UnauthorizedError:
      description: Authentication failed due to a missing or invalid API key.
      headers:
        X-RateLimit-Limit:
          $ref: '#/components/headers/X-RateLimit-Limit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/X-RateLimit-Remaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/X-RateLimit-Reset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/PublicApiError'
          examples:
            invalid_api_key:
              value:
                error:
                  message: >-
                    Incorrect API key provided. You can manage your API keys at
                    https://getimg.ai/app/developer/api-keys
                  type: invalid_request_error
                  param: null
                  code: invalid_api_key
                  doc_url: https://docs.getimg.ai/guides/authentication
    RateLimitError:
      description: A rate or concurrency limit was exceeded.
      headers:
        X-RateLimit-Limit:
          $ref: '#/components/headers/X-RateLimit-Limit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/X-RateLimit-Remaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/X-RateLimit-Reset'
        Retry-After:
          $ref: '#/components/headers/Retry-After'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/PublicApiError'
          examples:
            rate_limited:
              value:
                error:
                  message: Too many requests hit the API too quickly.
                  type: invalid_request_error
                  param: null
                  code: rate_limit
    ServerError:
      description: An unexpected server error occurred.
      headers:
        X-RateLimit-Limit:
          $ref: '#/components/headers/X-RateLimit-Limit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/X-RateLimit-Remaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/X-RateLimit-Reset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/PublicApiError'
          examples:
            server_error:
              value:
                error:
                  message: Something went wrong on our end.
                  type: invalid_request_error
                  param: null
                  code: server_error
  headers:
    X-RateLimit-Limit:
      description: Maximum requests allowed in the current rate-limit window.
      schema:
        type: string
        pattern: ^[0-9]+$
      example: '60'
    X-RateLimit-Remaining:
      description: Remaining requests in the current rate-limit window.
      schema:
        type: string
        pattern: ^[0-9]+$
      example: '59'
    X-RateLimit-Reset:
      description: Unix timestamp (seconds) when the current rate-limit window resets.
      schema:
        type: string
        pattern: ^[0-9]+$
      example: '1760000042'
    Retry-After:
      description: Number of seconds to wait before retrying.
      schema:
        type: string
        pattern: ^[0-9]+$
      example: '42'
  schemas:
    PublicApiError:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - message
            - type
            - param
            - code
          properties:
            message:
              type: string
            type:
              type: string
              const: invalid_request_error
            param:
              anyOf:
                - type: string
                - type: 'null'
            code:
              type: string
              enum:
                - invalid_api_key
                - parameter_missing
                - invalid_parameter
                - quota_exceeded
                - rate_limit
                - content_policy_violation
                - not_found
                - server_error
            doc_url:
              type: string
              format: uri
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: |
        Send your API key as a bearer token:
        `Authorization: Bearer sk_<secret>`.

````