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

# Generate reward codes



## OpenAPI

````yaml post /v1/rewards/{id}/codes/generate
openapi: 3.1.0
info:
  title: One of None API
  version: 1.0.0
  description: >-
    The One of None API manages product collections, registrations, short URLs,
    team operations, and rewards used by storefront integrations including
    Shopify discounts and redemption flows.
servers:
  - url: https://api.oneofnone.io
security:
  - ApiKeyAuth: []
paths:
  /v1/rewards/{id}/codes/generate:
    post:
      summary: Generate reward codes
      parameters:
        - schema:
            type: string
            format: uuid
          required: true
          name: id
          in: path
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GenerateRewardCodesBody'
      responses:
        '201':
          description: Generated codes
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenerateRewardCodesResponse'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenericErrorResponse'
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenericErrorResponse'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    GenerateRewardCodesBody:
      type: object
      properties:
        count:
          type: integer
          minimum: 1
          maximum: 500
        prefix:
          type: string
          minLength: 1
          maxLength: 32
      required:
        - count
      additionalProperties: false
    GenerateRewardCodesResponse:
      type: object
      properties:
        codes:
          type: array
          items:
            $ref: '#/components/schemas/RewardCode'
      required:
        - codes
      additionalProperties: false
    GenericErrorResponse:
      type: object
      properties:
        message:
          type: string
        code:
          type: string
        details:
          type: object
          additionalProperties: {}
      required:
        - message
        - code
      additionalProperties: {}
    RewardCode:
      type:
        - object
        - 'null'
      properties:
        id:
          type: string
          format: uuid
        rewardId:
          type: string
          format: uuid
        code:
          type: string
        status:
          type: string
          enum:
            - available
            - reserved
            - redeemed
            - expired
            - revoked
        reservedFor:
          type:
            - string
            - 'null'
        redeemedBy:
          type:
            - string
            - 'null'
        redeemedAt:
          type:
            - string
            - 'null'
        orderId:
          type:
            - string
            - 'null'
        externalOrderId:
          type:
            - string
            - 'null'
        createdAt:
          type: string
        expiresAt:
          type:
            - string
            - 'null'
        updatedAt:
          type:
            - string
            - 'null'
        externalIds:
          type: object
          properties:
            shopify:
              $ref: '#/components/schemas/RewardCodeExternalIdEntry'
            stripe:
              $ref: '#/components/schemas/RewardCodeExternalIdEntry'
          additionalProperties: {}
      required:
        - id
        - rewardId
        - code
        - status
        - reservedFor
        - redeemedBy
        - redeemedAt
        - orderId
        - externalOrderId
        - createdAt
        - expiresAt
        - updatedAt
        - externalIds
      additionalProperties: false
    RewardCodeExternalIdEntry:
      type: object
      properties:
        discountId:
          type: string
        codeId:
          type:
            - string
            - 'null'
        syncedAt:
          type: string
        syncStatus:
          type: string
          enum:
            - synced
            - pending
            - error
        error:
          type:
            - string
            - 'null'
      required:
        - discountId
        - codeId
        - syncedAt
        - syncStatus
        - error
      additionalProperties: false
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````