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

# List users or API tokens with their AI spending caps and spend

> List one page of the Organization's users or API tokens, whether or not they have an override. Each entry includes the override, the Astro AI spend this billing period, and whether the limit is reached. If some usage isn't priced yet, spend is estimated and `isUsageEstimated` is `true`. If Astro can't read spend data, the limits are still listed and `usageCents` is left out. Amounts are in USD cents.



## OpenAPI

````yaml /astro/api/v-1-labs/openapi.yaml get /organizations/{organizationId}/billing/ai-spending-caps
openapi: 3.0.3
info:
  contact: {}
  description: >-
    Astro Labs API - Experimental endpoints for preview features, plus
    everything served under /v1.
  title: Astro Labs API
  version: v1.1
servers:
  - url: /labs/v1.1
security:
  - JWT: []
tags:
  - description: >-
      Canned-data placeholder used to exercise the labs epoch versioning
      surface. Real labs endpoints register their own tags.
    name: Example
  - description: >-
      The `organization` object contains the metadata and configurations of an
      Astro Organization. It does not include objects within the Organization,
      such as users and clusters. Make requests to `organization` endpoints to
      view and update high level settings for your Organization, including
      settings related to authentication and billing. To manage resources within
      an Organization, make requests to the endpoints related to those
      resources, such as `users`. See
      [Billing](https://astronomer.io/docs/astro/manage-billing), [Set up single
      sign-on](https://astronomer.io/docs/astro/configure-idp), and [Manage
      domains](https://astronomer.io/docs/astro/manage-domains).
    name: Organization
  - description: >-
      The `deployment` object represents an Astro Deployment, which is a hosted
      Airflow environment that is powered by all core Airflow components,
      including schedulers and workers. Make requests to the `deployment` object
      to create, update, or delete a Deployment or its computational resources.
      See [Deployment
      settings](https://astronomer.io/docs/astro/deployment-settings).
    name: Deployment
  - description: >-
      A `cluster` object represents an Astro cluster, which is a Kubernetes
      cluster that hosts the infrastructure required to run Deployments. Make
      requests to `cluster` endpoints to manage your standard and dedicated
      clusters. See [Create a dedicated
      cluster](https://astronomer.io/docs/astro/create-dedicated-cluster).
    name: Cluster
  - description: >-
      The `workspace` object represents an Astro Workspace, which is a
      collection of Deployments that can be accessed by a specific group of
      users. It contains metadata about a Workspace, but does not contain
      objects within the Workspace such as users and Deployments. Make requests
      to `workspace` endpoints to manage high level details about your
      Workspace. To manage resources within a Workspace, make requests to the
      endpoints related to those resources, such as `users`, and use the
      `workspaceIds` parameter to filter results by Workspace. See [Configure
      Workspaces](https://astronomer.io/docs/astro/manage-workspaces).
    name: Workspace
  - description: >-
      The `user` object represents a user account in your Astro Organization.
      Astro creates a new `user` object whenever you invite a user by email or
      add a user to Astro through an identity provider. The object contains all
      information about a user, including their personal information, roles, and
      login attempts. It doesn't include attributes for actions that the user
      completes after they log in, such as updating a Deployment. Make requests
      to `user` endpoints to manage permissions for existing users both at the
      Organization and Workspace level. To create new users, make requests to
      `invite` endpoints instead.
    name: User
  - description: >-
      The `team` object represents an Astro Team, which is a group of users that
      share the same permissions across your Organization and Workspaces. Make
      requests to `team` endpoints to create, update, and delete Teams across an
      Organization. See [Configure Teams on
      Astro](https://astronomer.io/docs/astro/manage-teams).
    name: Team
  - description: >-
      The `apitoken` object represents a single API token within your
      Organization. API tokens are used to authenticate automated tools and
      processes to your Organization. They have varying levels of access to your
      resources based on their Organization, Workspace, and Deployment roles.
      See [Workspace API tokens](workspace-api-tokens.md) and [Organization API
      tokens](organization-api-tokens.md).
    name: api-token
    x-group: API Token
  - name: allowed-ip-address-range
    x-group: Allowed IP Address Range
  - name: agent-token
    x-group: Agent Token
  - name: notification-channels
    x-group: Notification Channels
  - name: ai-spending-caps
    x-group: Ai Spending Caps
paths:
  /organizations/{organizationId}/billing/ai-spending-caps:
    get:
      tags:
        - ai-spending-caps
      summary: List users or API tokens with their AI spending caps and spend
      description: >-
        List one page of the Organization's users or API tokens, whether or not
        they have an override. Each entry includes the override, the Astro AI
        spend this billing period, and whether the limit is reached. If some
        usage isn't priced yet, spend is estimated and `isUsageEstimated` is
        `true`. If Astro can't read spend data, the limits are still listed and
        `usageCents` is left out. Amounts are in USD cents.
      operationId: LabsListAiSpendingCaps
      parameters:
        - description: The ID of the Organization.
          in: path
          name: organizationId
          required: true
          schema:
            type: string
        - description: List users or API tokens.
          in: query
          name: subjectType
          required: true
          schema:
            enum:
              - USER
              - SERVICEKEY
            type: string
        - description: A user's name or email, or an API token's name.
          in: query
          name: search
          schema:
            type: string
        - description: Sort order, name:asc by default.
          in: query
          name: sorts
          schema:
            enum:
              - name:asc
              - name:desc
              - usage:asc
              - usage:desc
            type: string
        - description: >-
            true lists only subjects with an override, false only those without
            one.
          in: query
          name: hasOverride
          schema:
            type: boolean
        - description: Offset of the page.
          in: query
          name: offset
          schema:
            minimum: 0
            type: integer
        - description: Page size, 20 by default and at most 100.
          in: query
          name: limit
          schema:
            maximum: 100
            minimum: 1
            type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AiSpendingCapsPaginated'
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Bad Request
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Unauthorized
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Forbidden
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Not Found
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Internal Server Error
      security:
        - JWT: []
components:
  schemas:
    AiSpendingCapsPaginated:
      properties:
        aiSpendingCaps:
          description: The users or API tokens on this page.
          items:
            $ref: '#/components/schemas/AiSpendingCap'
          type: array
        isUsageAvailable:
          description: >-
            False when Astro can't read spend data. `usageCents` is then absent,
            and the limits and `isCapReached` still hold.
          type: boolean
        isUsageEstimated:
          description: >-
            True when some usage isn't priced yet, so `usageCents` is an
            estimate that can differ from your invoice.
          type: boolean
        limit:
          description: The page size.
          type: integer
        offset:
          description: The offset of this page.
          type: integer
        periodEndAt:
          description: The end of that period, exclusive.
          format: date-time
          type: string
        periodStartAt:
          description: >-
            The start of the billing period that `usageCents` covers. A limit
            that was reached resets at the start of the calendar month (UTC),
            which can differ from the start of the billing period.
          format: date-time
          type: string
        totalCount:
          description: The number of users or API tokens that match.
          type: integer
      required:
        - aiSpendingCaps
        - isUsageAvailable
        - isUsageEstimated
        - limit
        - offset
        - periodEndAt
        - periodStartAt
        - totalCount
      type: object
    Error:
      properties:
        fieldErrors:
          description: >-
            FieldErrors carries one entry per failed request-validation
            constraint. Only present on 400 responses caused by request
            binding/validation.
          items:
            $ref: '#/components/schemas/FieldValidationError'
          type: array
        message:
          type: string
        requestId:
          type: string
        statusCode:
          maximum: 600
          minimum: 400
          type: integer
      required:
        - message
        - requestId
        - statusCode
      type: object
    AiSpendingCap:
      properties:
        avatarUrl:
          description: A user's avatar. Absent for API tokens.
          type: string
        effectiveSpendingCap:
          description: >-
            The lowest cap that applies to the subject in USD cents: its
            override, else its type's default, and the organization's AI
            spending cap on all spend, which no subject can pass. Absent when
            none is set.
          type: integer
        email:
          description: A user's email. Absent for API tokens.
          type: string
        isCapReached:
          description: >-
            Whether the subject's AI is blocked now by a spending limit: its
            override, else its type's default, or the organization's AI spending
            cap on all spend.
          type: boolean
        name:
          description: A user's full name or an API token's name.
          type: string
        spendingCap:
          description: >-
            The subject's override in USD cents. Absent when it has none and
            follows its type's default.
          type: integer
        subjectId:
          description: The ID of the user or API token.
          type: string
        subjectType:
          description: USER or SERVICEKEY.
          enum:
            - USER
            - SERVICEKEY
          type: string
        usageCents:
          description: >-
            The subject's AI spend this period in USD cents. Absent when spend
            is unavailable.
          type: integer
      required:
        - isCapReached
        - name
        - subjectId
        - subjectType
      type: object
    FieldValidationError:
      properties:
        code:
          type: string
        field:
          type: string
        message:
          type: string
      required:
        - code
        - field
        - message
      type: object
  securitySchemes:
    JWT:
      scheme: bearer
      type: http

````