> ## Documentation Index
> Fetch the complete documentation index at: https://test-8862363a-tembo-docs-codex-usage-reset.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Retrieve billing

> Retrieve billing and credit information for the organization.



## OpenAPI

````yaml https://api.tembo.io/public-api/openapi/public get /v1/billing
openapi: 3.1.0
info:
  title: Tembo Public API
  description: >-
    Manage agents, sessions, repositories, and organization resources with the
    Tembo API.
  version: 1.0.0
servers:
  - url: https://api.tembo.io
    description: Tembo API
  - url: https://{deployment-origin}/api/public-api
    description: Self-hosted Tembo
    variables:
      deployment-origin:
        default: tembo.example.com
        description: Hostname of your self-hosted Tembo deployment
security: []
paths:
  /v1/billing:
    get:
      tags:
        - Billing
      summary: Retrieve billing
      description: Retrieve billing and credit information for the organization.
      operationId: retrieveBilling
      responses:
        '200':
          description: Retrieve billing
          content:
            application/json:
              schema:
                type: object
                properties:
                  billingEnabled:
                    type: boolean
                  balance:
                    type: object
                    properties:
                      calculatedBalance:
                        type: number
                      availableBalance:
                        type: number
                      availableOnDemandUsage:
                        type: number
                      lastTransaction:
                        type:
                          - object
                          - 'null'
                        properties:
                          amount:
                            type: integer
                          createdAt:
                            type: string
                            format: date-time
                        required:
                          - amount
                          - createdAt
                        additionalProperties: false
                      unlimitedCredits:
                        type: boolean
                    required:
                      - calculatedBalance
                      - availableBalance
                      - availableOnDemandUsage
                      - lastTransaction
                      - unlimitedCredits
                    additionalProperties: false
                  onDemand:
                    type: object
                    properties:
                      enabled:
                        type: boolean
                      currentUsage:
                        type: number
                      maxCreditUsage:
                        type: number
                        minimum: 0
                    required:
                      - enabled
                      - currentUsage
                      - maxCreditUsage
                    additionalProperties: false
                  subscription:
                    oneOf:
                      - type: object
                        properties:
                          type:
                            type: string
                            const: free
                          status:
                            type: 'null'
                          canceledAt:
                            type: 'null'
                          periodEnd:
                            type: 'null'
                          plan:
                            type: 'null'
                          currentTier:
                            type: number
                            const: 0
                          upgradablePlans:
                            type: array
                            items:
                              type: object
                              properties:
                                id:
                                  type: string
                                  minLength: 1
                                  maxLength: 255
                                title:
                                  type: string
                                  maxLength: 255
                                tier:
                                  type: integer
                                  minimum: 0
                                description:
                                  type: string
                                  maxLength: 2000
                                includedCredits:
                                  type: number
                                  minimum: 0
                                monthlyPrice:
                                  type: number
                                  minimum: 0
                                yearlyPrice:
                                  type:
                                    - number
                                    - 'null'
                                  minimum: 0
                              required:
                                - id
                                - title
                                - tier
                                - description
                                - includedCredits
                                - monthlyPrice
                                - yearlyPrice
                              additionalProperties: false
                            maxItems: 20
                        required:
                          - type
                          - status
                          - canceledAt
                          - periodEnd
                          - plan
                          - currentTier
                          - upgradablePlans
                        additionalProperties: false
                      - type: object
                        properties:
                          status:
                            type: string
                            enum:
                              - Active
                              - PastDue
                              - Unpaid
                              - Canceled
                              - Trialing
                              - Incomplete
                              - IncompleteExpired
                          canceledAt:
                            type:
                              - string
                              - 'null'
                            format: date-time
                          periodEnd:
                            type:
                              - string
                              - 'null'
                            format: date-time
                          type:
                            type: string
                            const: paid
                          plan:
                            type:
                              - object
                              - 'null'
                            properties:
                              id:
                                type: string
                                minLength: 1
                                maxLength: 255
                              title:
                                type: string
                                maxLength: 255
                              tier:
                                type: integer
                                minimum: 0
                              description:
                                type: string
                                maxLength: 2000
                              includedCredits:
                                type: number
                                minimum: 0
                              monthlyPrice:
                                type: number
                                minimum: 0
                              yearlyPrice:
                                type:
                                  - number
                                  - 'null'
                                minimum: 0
                            required:
                              - id
                              - title
                              - tier
                              - description
                              - includedCredits
                              - monthlyPrice
                              - yearlyPrice
                            additionalProperties: false
                          currentTier:
                            type: integer
                            minimum: 0
                          upgradablePlans:
                            type: array
                            items:
                              type: object
                              properties:
                                id:
                                  type: string
                                  minLength: 1
                                  maxLength: 255
                                title:
                                  type: string
                                  maxLength: 255
                                tier:
                                  type: integer
                                  minimum: 0
                                description:
                                  type: string
                                  maxLength: 2000
                                includedCredits:
                                  type: number
                                  minimum: 0
                                monthlyPrice:
                                  type: number
                                  minimum: 0
                                yearlyPrice:
                                  type:
                                    - number
                                    - 'null'
                                  minimum: 0
                              required:
                                - id
                                - title
                                - tier
                                - description
                                - includedCredits
                                - monthlyPrice
                                - yearlyPrice
                              additionalProperties: false
                            maxItems: 20
                        required:
                          - status
                          - canceledAt
                          - periodEnd
                          - type
                          - plan
                          - currentTier
                          - upgradablePlans
                        additionalProperties: false
                required:
                  - billingEnabled
                  - balance
                  - onDemand
                  - subscription
                additionalProperties: false
        '400':
          description: Invalid request or missing organization billing information.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
                additionalProperties: false
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
                additionalProperties: false
        '404':
          description: Billing resource not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
                additionalProperties: false
        '409':
          description: Billing operation conflicts with its current state
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
                additionalProperties: false
        '502':
          description: Billing provider operation failed
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
                additionalProperties: false
      security:
        - apiKey: []
      x-codeSamples:
        - lang: typescript
          label: TypeScript SDK
          source: |
            import Tembo from '@tembo-io/sdk';

            const client = new Tembo();

            const billing = await client.billing.retrieve();
components:
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer

````