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

# List code batches



## OpenAPI

````yaml /openapi/v1.yaml get /api/v1/code-batches
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:
    get:
      tags:
        - Code batches
      summary: List code batches
      operationId: listCodeBatches
      parameters:
        - $ref: '#/components/parameters/Limit'
        - $ref: '#/components/parameters/Offset'
      responses:
        '200':
          description: Batches
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/SuccessEnvelope'
                  - type: object
                    properties:
                      data:
                        type: object
                        properties:
                          batches:
                            type: array
                            items:
                              $ref: '#/components/schemas/CodeBatch'
                          pagination:
                            $ref: '#/components/schemas/Pagination'
components:
  parameters:
    Limit:
      name: limit
      in: query
      schema:
        type: integer
        minimum: 1
        maximum: 100
        default: 25
    Offset:
      name: offset
      in: query
      schema:
        type: integer
        minimum: 0
        default: 0
  schemas:
    SuccessEnvelope:
      type: object
      properties:
        success:
          type: boolean
          example: true
        message:
          type: string
        data:
          type: object
    CodeBatch:
      type: object
      properties:
        id:
          type: string
          format: uuid
        business_id:
          type: string
          format: uuid
        batch_ref:
          type: string
          example: 595Y
        name:
          type: string
          example: Summer 2027 bottles
        prefix:
          type: string
          nullable: true
          example: SUMMER
        points:
          type: integer
          example: 250
        quantity:
          type: integer
          example: 30000
        expires_at:
          type: string
          format: date-time
        active:
          type: boolean
        created_via:
          type: string
          example: api
        created_at:
          type: string
          format: date-time
        failed_attempts:
          type: integer
          example: 0
          description: >-
            Claim attempts that failed signature verification — a
            counterfeiting-attempt signal. Deactivate the batch if it spikes
            unexpectedly.
    Pagination:
      type: object
      properties:
        limit:
          type: integer
          example: 25
        offset:
          type: integer
          example: 0
        returned:
          type: integer
          example: 25
        total_count:
          type: integer
          example: 112
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: 'API key from the Rigaly dashboard: `Authorization: Bearer rgly_sk_...`'

````