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

# List usage grants

> List the organization's usage grants, newest first, with what settled cycles used and what is left.



## OpenAPI

````yaml /openapi.json get /billing/usage-grants
openapi: 3.1.1
info:
  title: Sazabi Public API
  version: 1.0.0
  description: >
    Public REST API for Sazabi. Authenticate using a secret API key in the
    Authorization header.


    ## Pagination


    This API uses two pagination strategies depending on the endpoint type:


    ### Cursor-Based Pagination (List Endpoints)


    List endpoints (threads, messages, keys) use cursor-based pagination for
    efficient, consistent results:


    - **Parameters**: `limit` (items per page, default 50, max 100), `cursor`
    (opaque pagination token)

    - **Response**: Includes `nextCursor` field - pass this as `cursor` in the
    next request

    - **End of results**: When `nextCursor` is `null`, there are no more results

    - **Example**: `GET
    /v1/threads?limit=20&cursor=01234567-89ab-cdef-0123-456789abcdef`


    ### Page-Based Pagination (Search Endpoints)


    Search endpoints use page-based pagination due to the underlying search
    engine:


    - **Parameters**: `limit` (items per page, default 20, max 100), `page`
    (1-indexed page number)

    - **Response**: Includes `pagination` object with `page`, `limit`,
    `totalResults`, `totalPages`

    - **Example**: `GET /v1/search/threads?q=error&limit=10&page=2`
servers:
  - url: https://api.sazabi.com/v1
    description: Production
security: []
paths:
  /billing/usage-grants:
    get:
      tags:
        - Billing
      summary: List usage grants
      description: >-
        List the organization's usage grants, newest first, with what settled
        cycles used and what is left.
      operationId: billing.listUsageGrants
      parameters:
        - name: organizationId
          in: query
          schema:
            type: string
            minLength: 1
            description: >-
              Organization to list usage grants for. Auto-filled from CLI and
              SDK context when omitted.
          allowEmptyValue: true
          allowReserved: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  items:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        program:
                          type: string
                          description: >-
                            Program the grant came from, such as yc-batch or
                            yc-alum.
                        programDisplayName:
                          type: string
                        productKey:
                          enum:
                            - logs_ingested_bytes
                            - logs_accepted_bytes
                            - logs_query_bytes_scanned
                            - log_questions_answered
                            - log_queries_executed
                            - input_tokens
                            - output_tokens
                            - ai_tokens
                            - issues_created
                            - automation_runs_completed
                            - pull_requests_created
                            - pull_request_reviews_completed
                          type: string
                          description: >-
                            Product the grant covers, keyed by the usage
                            dimension vocabulary.
                        displayName:
                          type: string
                          description: Display name of the covered product.
                        grantedQuantity:
                          type: string
                          description: >-
                            Units granted, in the product's metered unit (bytes
                            for logs).
                        usedQuantity:
                          type: string
                          description: >-
                            Units settled usage invoices drew from the grant.
                            Open-cycle usage is drawn when the cycle settles.
                        remainingQuantity:
                          type: string
                        effectiveAt:
                          type: string
                          format: date-time
                        endsAt:
                          type: string
                          format: date-time
                          description: >-
                            When the grant stops covering usage: its expiry or
                            revocation.
                        status:
                          enum:
                            - scheduled
                            - active
                            - exhausted
                            - expired
                            - revoked
                          type: string
                          description: >-
                            scheduled before it starts; active while it covers
                            usage; exhausted once fully used; expired after its
                            end date; revoked when ended early.
                      required:
                        - id
                        - program
                        - programDisplayName
                        - productKey
                        - displayName
                        - grantedQuantity
                        - usedQuantity
                        - remainingQuantity
                        - effectiveAt
                        - endsAt
                        - status
                required:
                  - items

````

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