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

# Get code pool counts

> Counts for a reward whose `digital_asset_source` is `pool`. Poll it to
know when to refill: at `available: 0` the reward switches itself off
(`deactivated_by_pool: true`) and disappears from the customer app.

Any other reward returns `REWARD_NOT_POOL_SOURCED` (400). See the
[pool lifecycle](/guides/reward-delivery#pool-of-one-time-values).




## OpenAPI

````yaml /openapi/v1.yaml get /api/v1/rewards/{id}/pool
openapi: 3.1.0
info:
  title: Rigaly Business API
  version: '1.0'
  description: |
    Public API for businesses to manage their Rigaly loyalty programs: issue
    and redeem points, manage rewards, validate redemptions, and generate mass
    codes for physical products.

    All endpoints require an API key created in the Rigaly business dashboard
    (Tools → API Management), passed as `Authorization: Bearer rgly_sk_...`.
  contact:
    email: support@rigaly.com
servers:
  - url: https://api.rigaly.com
    description: Production
security:
  - apiKey: []
paths:
  /api/v1/rewards/{id}/pool:
    get:
      tags:
        - Rewards
      summary: Get code pool counts
      description: |
        Counts for a reward whose `digital_asset_source` is `pool`. Poll it to
        know when to refill: at `available: 0` the reward switches itself off
        (`deactivated_by_pool: true`) and disappears from the customer app.

        Any other reward returns `REWARD_NOT_POOL_SOURCED` (400). See the
        [pool lifecycle](/guides/reward-delivery#pool-of-one-time-values).
      operationId: getRewardPool
      parameters:
        - $ref: '#/components/parameters/ResourceId'
      responses:
        '200':
          description: Pool counts
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/SuccessEnvelope'
                  - type: object
                    properties:
                      data:
                        $ref: '#/components/schemas/RewardPoolStats'
              example:
                success: true
                message: Code pool retrieved successfully
                data:
                  reward_id: 3f2b1c9e-7d4a-4f1b-8c2e-9a0d1e2f3b4c
                  total: 5000
                  available: 4863
                  consumed: 137
                  capacity: 100000
        '400':
          description: The reward is not pool-sourced (`REWARD_NOT_POOL_SOURCED`)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
              example:
                success: false
                error:
                  message: REWARD_NOT_POOL_SOURCED
        '404':
          $ref: '#/components/responses/NotFound'
components:
  parameters:
    ResourceId:
      name: id
      in: path
      required: true
      schema:
        type: string
        format: uuid
  schemas:
    SuccessEnvelope:
      type: object
      properties:
        success:
          type: boolean
          example: true
        message:
          type: string
        data:
          type: object
    RewardPoolStats:
      type: object
      description: 'Counts for a `digital_asset_source: pool` reward.'
      properties:
        reward_id:
          type: string
          format: uuid
        total:
          type: integer
          example: 5000
          description: Every value currently stored — `available + consumed`.
        available:
          type: integer
          example: 4863
          description: >-
            Unconsumed values left. At 0 the reward switches itself off with
            `deactivated_by_pool: true`.
        consumed:
          type: integer
          example: 137
          description: >-
            Values already handed to a customer. Permanent — consumed values can
            never be deleted or edited.
        capacity:
          type: integer
          example: 100000
          description: Hard ceiling on `total` for one reward.
    ErrorEnvelope:
      type: object
      properties:
        success:
          type: boolean
          example: false
        error:
          type: object
          properties:
            message:
              type: string
  responses:
    NotFound:
      description: Resource not found (or belongs to another business)
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          example:
            success: false
            error:
              message: Reward not found
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: 'API key from the Rigaly dashboard: `Authorization: Bearer rgly_sk_...`'

````