> ## 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 all codes

> Streams every code in the batch (regenerated deterministically). CSV columns are `code,serial,deep_link`. Hand the file to your manufacturer/printer and have each `deep_link` printed as a QR code — scanning it opens the Rigaly app with the code ready to claim.



## OpenAPI

````yaml /openapi/v1.yaml get /api/v1/code-batches/{id}/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/code-batches/{id}/export:
    get:
      tags:
        - Code batches
      summary: Export all codes
      description: >-
        Streams every code in the batch (regenerated deterministically). CSV
        columns are `code,serial,deep_link`. Hand the file to your
        manufacturer/printer and have each `deep_link` printed as a QR code —
        scanning it opens the Rigaly app with the code ready to claim.
      operationId: exportCodeBatch
      parameters:
        - $ref: '#/components/parameters/ResourceId'
        - name: format
          in: query
          schema:
            type: string
            enum:
              - csv
              - json
            default: csv
      responses:
        '200':
          description: Code file (streamed download)
          content:
            text/csv:
              schema:
                type: string
                example: >
                  code,serial,deep_link

                  SUMMER-595Y-000-JT5-A5Q,0,HTTPS://LINK.RIGALY.COM/CODE/595Y000JT5A5Q
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    code:
                      type: string
                    serial:
                      type: integer
                    deep_link:
                      type: string
        '404':
          $ref: '#/components/responses/NotFound'
components:
  parameters:
    ResourceId:
      name: id
      in: path
      required: true
      schema:
        type: string
        format: uuid
  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
  schemas:
    ErrorEnvelope:
      type: object
      properties:
        success:
          type: boolean
          example: false
        error:
          type: object
          properties:
            message:
              type: string
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: 'API key from the Rigaly dashboard: `Authorization: Bearer rgly_sk_...`'

````