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

# Export the code pool

> Streams every value in the pool, consumed and unconsumed, oldest first —
your reconciliation file for "which code went to which redemption".

CSV columns are `value,status,consumed_at,redemption_id`, where `status`
is `available` or `consumed` and the last two columns are empty for
values nobody has claimed yet.




## OpenAPI

````yaml /openapi/v1.yaml get /api/v1/rewards/{id}/pool/export
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/export:
    get:
      tags:
        - Rewards
      summary: Export the code pool
      description: |
        Streams every value in the pool, consumed and unconsumed, oldest first —
        your reconciliation file for "which code went to which redemption".

        CSV columns are `value,status,consumed_at,redemption_id`, where `status`
        is `available` or `consumed` and the last two columns are empty for
        values nobody has claimed yet.
      operationId: exportRewardPool
      parameters:
        - $ref: '#/components/parameters/ResourceId'
        - name: format
          in: query
          schema:
            type: string
            enum:
              - csv
              - json
            default: csv
      responses:
        '200':
          description: Pool file (streamed download)
          content:
            text/csv:
              schema:
                type: string
                example: >
                  value,status,consumed_at,redemption_id

                  "NFLX-A1B2C3","consumed","2026-08-01T14:22:31.004Z","9f1c3a2e-5b7d-4e21-9a0c-1f2d3e4b5a67"

                  "NFLX-D4E5F6","available","",""
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    value:
                      type: string
                    status:
                      type: string
                      enum:
                        - available
                        - consumed
                    consumed_at:
                      type: string
                      format: date-time
                      nullable: true
                    redemption_id:
                      type: string
                      format: uuid
                      nullable: true
        '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:
    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_...`'

````