> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tembo.io/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:
                  access:
                    type: object
                    properties:
                      state:
                        type: string
                        enum:
                          - blocked
                          - trial
                          - paid
                      canExecute:
                        type: boolean
                      blockedReason:
                        type:
                          - string
                          - 'null'
                        enum:
                          - awaiting_demo
                          - trial_expired
                          - trial_allowance_exhausted
                          - subscription_ended
                          - null
                        default: null
                    required:
                      - state
                      - canExecute
                      - blockedReason
                  trial:
                    type:
                      - object
                      - 'null'
                    properties:
                      status:
                        type: string
                        const: Trialing
                      startedAt:
                        type: string
                        format: date-time
                      endsAt:
                        type: string
                        format: date-time
                      allowance:
                        type: number
                      remainingAllowance:
                        type: number
                      purchasedCredits:
                        type: number
                      exhausted:
                        type: boolean
                    required:
                      - status
                      - startedAt
                      - endsAt
                      - allowance
                      - remainingAllowance
                      - purchasedCredits
                      - exhausted
                    default: null
                  billingEnabled:
                    type: boolean
                  availablePlans:
                    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
                  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:
                    type:
                      - object
                      - 'null'
                    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:
                  - access
                  - trial
                  - billingEnabled
                  - availablePlans
                  - 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();
        - lang: rust
          label: Rust SDK
          source: |
            use tembo_rs::*;

            let client = Tembo::from_env()?;

            let response = client.billing().retrieve().send().await?;
components:
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer

````

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