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

# List all subscription grants

> Returns the subscription's grants, newest first, with each line's used and remaining units.



## OpenAPI

````yaml https://api.salesbricks.com/api/v2/openapi.yaml get /subscriptions/{subscription_id}/grants
openapi: 3.0.3
info:
  title: Salesbricks REST API
  version: 2.0.0
  description: API reference for external integrations
servers:
  - url: https://api.salesbricks.com/api/v2
    description: Production
security:
  - ApiKeyAuth: []
tags:
  - name: Subscriptions
    description: >-
      Operations related to subscription management, including creation,
      updates, and retrieving subscription details. Subscriptions can be
      upgraded to add / remove add-ons by using the POST
      /subscriptions/{subscription_id}/upgrade endpoint and can be recasted for
      replacing the current agreement using the POST
      /subscriptions/{subscription_id}/recast endpoint
  - name: Subscription Milestones
    description: >-
      Operations for listing and completing milestone bricks — bricks billed
      when the work they cover is delivered rather than on the subscription's
      schedule. Completing one either raises a standalone invoice immediately or
      bills on the subscription's next scheduled invoice.
  - name: Customers
    description: >-
      Operations related to customer management, including creation, updates,
      and managing customer person objects.
  - name: Invoices
    description: Operations related to subscription's invoicing details.
  - name: Plans
    description: >-
      Operations related to listing and getting plan details including bricks in
      the plan.
  - name: Payment Methods
    description: Operations related to subscription's payment method.
paths:
  /subscriptions/{subscription_id}/grants:
    get:
      tags:
        - Subscription Grants
      summary: List all subscription grants
      description: >-
        Returns the subscription's grants, newest first, with each line's used
        and remaining units.
      operationId: listSubscriptionGrants
      parameters:
        - in: query
          name: brick_id
          schema:
            type: string
          description: Only grants with a line for this brick.
        - in: query
          name: grant_type
          schema:
            type: string
            enum:
              - ROLLOVER
              - TOP_UP
          description: 'Only grants of this type: `TOP_UP` or `ROLLOVER`.'
        - in: query
          name: status
          schema:
            type: string
            enum:
              - ACTIVE
              - EXPIRED
              - PENDING
              - VOIDED
          description: >-
            Only grants with this status. `EXPIRED` returns only grants that
            became active; one never activated stays `PENDING`.
        - in: path
          name: subscription_id
          schema:
            type: string
            pattern: ^([a-zA-Z\d\-]+)$
          required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GrantListOutput'
          description: ''
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: ''
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                NotFoundResponse:
                  value:
                    error:
                      code: ERR_NOT_FOUND
                      message: >-
                        Subscription not found — no subscription matches the
                        given `subscription_id`.
                  summary: Not Found Response
          description: ''
components:
  schemas:
    GrantListOutput:
      type: object
      description: Output serializer for the subscription grants list.
      properties:
        grants:
          type: array
          items:
            $ref: '#/components/schemas/Grant'
          description: The subscription's grants, newest first.
      required:
        - grants
    ErrorResponse:
      type: object
      description: >-
        Standardizes API error responses with a consistent structure containing
        error code and message.
      properties:
        error:
          allOf:
            - $ref: '#/components/schemas/Error'
          description: The error that caused the request to fail
      required:
        - error
    Grant:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: ID of the grant.
        grant_type:
          enum:
            - TOP_UP
            - ROLLOVER
          type: string
          x-spec-enum-id: e5380c0e8c5d3e7a
          description: >-
            What granted the units. `TOP_UP`: units sold on their own invoice.
            `ROLLOVER`: unused committed units rolled over when a commitment
            period ended, not charged for. More types will be added, so treat an
            unknown value as a grant you can read but not act on.


            * `TOP_UP` - Top-up

            * `ROLLOVER` - Rollover
        subscription_id:
          type: string
          format: uuid
          description: The subscription the grant is on.
        status:
          enum:
            - PENDING
            - ACTIVE
            - EXPIRED
            - VOIDED
          type: string
          x-spec-enum-id: c82743c7c6d79bf1
          description: >-
            `VOIDED` when it or its invoice is voided; else `EXPIRED` when it is
            active and every line has expired; else `ACTIVE` once its units
            cover usage; else `PENDING`.


            * `PENDING` - Pending

            * `ACTIVE` - Active

            * `EXPIRED` - Expired

            * `VOIDED` - Voided
        activates:
          enum:
            - ON_PAYMENT
            - ON_ISSUE
          type: string
          x-spec-enum-id: 039ee25b13d3a027
          nullable: true
          description: >-
            When the units start to cover overage. Null for a `ROLLOVER`, which
            covers overage as it is created.


            * `ON_PAYMENT` - On payment

            * `ON_ISSUE` - On issue
        effective_at:
          type: string
          format: date
          description: >-
            The first day the units cover usage. A date (YYYY-MM-DD) in the
            subscription's time zone.
        activated_at:
          type: string
          format: date-time
          nullable: true
          description: When the grant became active.
        voided_at:
          type: string
          format: date-time
          nullable: true
          description: When it or its invoice was voided. Null unless `status` is `VOIDED`.
        created_at:
          type: string
          format: date-time
          description: When the grant was created.
        invoice:
          allOf:
            - $ref: '#/components/schemas/GrantInvoice'
          nullable: true
          description: The invoice that bills the grant. Null for a `ROLLOVER`.
        lines:
          type: array
          items:
            $ref: '#/components/schemas/GrantLine'
          description: One line per brick.
      required:
        - activated_at
        - activates
        - created_at
        - effective_at
        - grant_type
        - id
        - invoice
        - lines
        - status
        - subscription_id
        - voided_at
    Error:
      type: object
      description: >-
        Represents individual error details with a standardized code and
        descriptive message.
      properties:
        code:
          enum:
            - ERR_NOT_FOUND
            - ERR_BAD_REQUEST
            - ERR_SERVER_ERROR
          type: string
          x-spec-enum-id: dc5a5d6feae1b697
          description: >-
            Error code indicating the type of error: NOT_FOUND for missing
            resources, BAD_REQUEST for invalid input, SERVER_ERROR for internal
            server issues


            * `ERR_NOT_FOUND` - ERR_NOT_FOUND

            * `ERR_BAD_REQUEST` - ERR_BAD_REQUEST

            * `ERR_SERVER_ERROR` - ERR_SERVER_ERROR
        message:
          type: string
          description: Human-readable explanation of the error
        error_id:
          type: string
          format: uuid
          description: >-
            Correlation handle for SERVER_ERROR responses — quote this when
            contacting support; it joins to the structured server log line for
            the failure. Not present on 4xx responses.
        details:
          description: >-
            Optional detail on what was wrong with the request; its shape
            depends on the endpoint. Validation errors send either a list of
            "field: message" strings or an object keyed by field name, nested
            under `fields` or at the top level.
      required:
        - code
        - message
    GrantInvoice:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: ID of the grant's invoice.
        number:
          type: string
          description: The invoice number.
        status:
          type: string
          description: The invoice status.
        grand_total:
          type: integer
          nullable: true
          description: Total due in cents. Null until the invoice is calculated.
        currency:
          type: string
          description: The invoice currency.
        payment_url:
          type: string
          format: uri
          nullable: true
          description: >-
            Link to the page where your customer pays this invoice online. Null
            when you have no Stripe account that can take payments connected, or
            the invoice has not been issued.
      required:
        - currency
        - grand_total
        - id
        - number
        - payment_url
        - status
    GrantLine:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: ID of the line.
        brick_id:
          type: string
          format: uuid
          description: The brick the units are for.
        brick_name:
          type: string
          description: Name of the brick.
        quantity:
          type: number
          format: double
          maximum: 100000000000000
          minimum: -100000000000000
          exclusiveMaximum: true
          exclusiveMinimum: true
          description: Units granted.
        unit_price:
          type: string
          format: decimal
          pattern: ^-?\d{0,14}(?:\.\d{0,6})?$
          description: >-
            Price per unit in cents, as a decimal string with 6 decimal places
            (e.g. "4.000000"), as usage tier prices are.
        expires_at:
          type: string
          format: date
          description: >-
            The last day the units cover usage. A date (YYYY-MM-DD) in the
            subscription's time zone.
        used:
          type: number
          format: double
          maximum: 100000000000000
          minimum: -100000000000000
          exclusiveMaximum: true
          exclusiveMinimum: true
          description: >-
            Units used on issued usage invoices. Overage covered in the open
            period, whose invoice is not issued yet, is not counted.
        remaining:
          type: number
          format: double
          maximum: 100000000000000
          minimum: -100000000000000
          exclusiveMaximum: true
          exclusiveMinimum: true
          description: quantity − used. 0 once the grant is voided.
      required:
        - brick_id
        - brick_name
        - expires_at
        - id
        - quantity
        - remaining
        - unit_price
        - used
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-SALESBRICKS-KEY
      description: API key for authentication

````

## Related topics

- [List all subscription invoices](https://docs.salesbricks.com/api-reference/invoices/list-all-subscription-invoices.md)
- [List all subscription bricks](https://docs.salesbricks.com/api-reference/subscription-state/list-all-subscription-bricks.md)
- [List all subscription orders](https://docs.salesbricks.com/api-reference/subscription-history/list-all-subscription-orders.md)


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