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

# Get pooled AI usage

> Gets pooled billable AI usage for the billing account's current billing period, broken down by attached organization. Requires admin access to the account's owner organization.



## OpenAPI

````yaml https://charts.basedash.com/api/public/openapi get /api/public/billing-accounts/{billingAccountId}/ai-usage
openapi: 3.1.0
info:
  title: Basedash Public API
  version: 0.0.0
  description: >-
    API for programmatic access to Basedash features. Use API keys for
    authentication.
  contact:
    name: Basedash Support
    url: https://basedash.com
    email: support@basedash.com
servers:
  - url: https://charts.basedash.com
    description: Production
security: []
tags:
  - name: Organizations
    description: Manage organizations
  - name: Groups
    description: Manage organization groups and memberships
  - name: Data Sources
    description: Manage database connections and data sources
  - name: MCP servers
    description: Manage MCP server data sources
  - name: Insights
    description: Manage generated insights
  - name: Automations
    description: Manage automations and automation runs
  - name: Skills
    description: Manage organization skills
  - name: Definitions
    description: Manage reusable SQL definitions
  - name: Dashboards
    description: Manage dashboards and their tabs
  - name: Charts
    description: Manage charts and their SQL queries
  - name: Chats
    description: >-
      Chat with the Basedash AI agent about your data. Start a chat by sending a
      message, then continue the conversation with follow-up messages. The
      assistant responds asynchronously: pass the `wait` query parameter to
      receive the finished response in the same request, or poll the assistant
      message (or stream its events) after an HTTP 202. Chats created through
      the API are not shown in the Basedash app.
paths:
  /api/public/billing-accounts/{billingAccountId}/ai-usage:
    get:
      tags:
        - Billing accounts
      summary: Get pooled AI usage
      description: >-
        Gets pooled billable AI usage for the billing account's current billing
        period, broken down by attached organization. Requires admin access to
        the account's owner organization.
      parameters:
        - schema:
            type: string
            description: Billing account ID
          required: true
          description: Billing account ID
          name: billingAccountId
          in: path
      responses:
        '200':
          description: AI usage retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicBillingAccountAiUsageResponse'
        '401':
          description: Unauthorized - Missing or invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: >-
            Not found - Billing account not found, no admin access, or billing
            period unavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Rate limit exceeded - Too many requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RateLimitErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    PublicBillingAccountAiUsageResponse:
      type: object
      properties:
        totalUsage:
          type: number
          description: >-
            Total billable AI usage pooled across all attached organizations for
            the billing period, in USD dollars
        includedCredits:
          type: number
          description: Included AI usage credits for the account in USD dollars
        billingPeriodStart:
          type: string
          format: date-time
          description: Billing period start timestamp
        billingPeriodEnd:
          type: string
          format: date-time
          description: Billing period end timestamp
        organizationUsage:
          type: array
          items:
            $ref: '#/components/schemas/PublicBillingAccountOrganizationUsage'
          description: Billable AI usage grouped by attached organization
      required:
        - totalUsage
        - includedCredits
        - billingPeriodStart
        - billingPeriodEnd
        - organizationUsage
    ErrorResponse:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/ApiError'
      required:
        - error
    RateLimitErrorResponse:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/RateLimitError'
      required:
        - error
    PublicBillingAccountOrganizationUsage:
      type: object
      properties:
        organizationId:
          type: string
          description: Organization ID
        name:
          type: string
          description: Name of the organization
        slug:
          type: string
          description: URL-friendly slug
        usage:
          type: number
          description: Billable AI usage for this organization in USD dollars
      required:
        - organizationId
        - name
        - slug
        - usage
    ApiError:
      type: object
      properties:
        title:
          type: string
          description: Error type identifier
        detail:
          type: string
          description: Human-readable error description
      required:
        - title
        - detail
    RateLimitError:
      allOf:
        - $ref: '#/components/schemas/ApiError'
        - type: object
          properties:
            title:
              type: string
              enum:
                - RateLimitExceeded
            retryAfterMs:
              type: number
              description: Milliseconds until the rate limit window resets
          required:
            - retryAfterMs
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        API key authentication using Bearer token format: `Bearer
        <basedash_api_key>`

````