> ## 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.

# Delete unconsumed pool values

> Removes values that have **not** been handed to a customer — the ones you
name in `values`, or every unconsumed value when you omit the body.

Consumed values are never deleted. They are what a customer already
received, so they stay on the pool as an audit trail (and keep counting
towards `total`); a value you asked to delete that had already been
consumed simply won't appear in `deleted`.




## OpenAPI

````yaml /openapi/v1.yaml delete /api/v1/rewards/{id}/pool/codes
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/codes:
    delete:
      tags:
        - Rewards
      summary: Delete unconsumed pool values
      description: >
        Removes values that have **not** been handed to a customer — the ones
        you

        name in `values`, or every unconsumed value when you omit the body.


        Consumed values are never deleted. They are what a customer already

        received, so they stay on the pool as an audit trail (and keep counting

        towards `total`); a value you asked to delete that had already been

        consumed simply won't appear in `deleted`.
      operationId: deleteRewardPoolCodes
      parameters:
        - $ref: '#/components/parameters/ResourceId'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PoolCodesDelete'
      responses:
        '200':
          description: Deletion result and the resulting pool counts
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/SuccessEnvelope'
                  - type: object
                    properties:
                      data:
                        $ref: '#/components/schemas/PoolDeleteResult'
              example:
                success: true
                message: Pool codes deleted successfully
                data:
                  reward_id: 3f2b1c9e-7d4a-4f1b-8c2e-9a0d1e2f3b4c
                  deleted: 12
                  total: 137
                  available: 0
                  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:
    PoolCodesDelete:
      type: object
      description: >-
        Which unconsumed values to remove. Omit the body entirely (or `values`)
        to delete every unconsumed value.
      properties:
        values:
          type: array
          minItems: 1
          maxItems: 5000
          items:
            type: string
            minLength: 1
            maxLength: 500
          example:
            - NFLX-A1B2C3
          description: >-
            The exact values to delete. Consumed values are silently skipped —
            they are what a customer already received.
    SuccessEnvelope:
      type: object
      properties:
        success:
          type: boolean
          example: true
        message:
          type: string
        data:
          type: object
    PoolDeleteResult:
      allOf:
        - $ref: '#/components/schemas/RewardPoolStats'
        - type: object
          properties:
            deleted:
              type: integer
              example: 12
              description: >-
                Unconsumed values removed. Consumed values are never touched, so
                a value you asked to delete may not be counted here.
    ErrorEnvelope:
      type: object
      properties:
        success:
          type: boolean
          example: false
        error:
          type: object
          properties:
            message:
              type: string
    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.
  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_...`'

````