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

# Complete a redemption

> Consumes the redemption code: verifies ownership, pending status,
expiry, reward cooldowns/eligibility, and the customer's balance;
deducts the points; and marks the redemption completed. This is the
same engine Rigaly PTS terminals use. Supports `Idempotency-Key`.




## OpenAPI

````yaml /openapi/v1.yaml post /api/v1/redemptions/{code}/complete
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/redemptions/{code}/complete:
    post:
      tags:
        - Redemptions
      summary: Complete a redemption
      description: |
        Consumes the redemption code: verifies ownership, pending status,
        expiry, reward cooldowns/eligibility, and the customer's balance;
        deducts the points; and marks the redemption completed. This is the
        same engine Rigaly PTS terminals use. Supports `Idempotency-Key`.
      operationId: completeRedemption
      parameters:
        - $ref: '#/components/parameters/RedemptionCode'
        - $ref: '#/components/parameters/IdempotencyKey'
      responses:
        '200':
          description: Redemption completed
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/SuccessEnvelope'
                  - type: object
                    properties:
                      data:
                        type: object
                        properties:
                          redemption:
                            type: object
                            properties:
                              code:
                                type: string
                                example: AB12CD34
                              status:
                                type: string
                                example: completed
                              reward_name:
                                type: string
                                example: Free Coffee
                              points_cost:
                                type: integer
                                example: 500
                              type:
                                type: string
                                example: standard
                              cashback_cents:
                                type: integer
                                nullable: true
                          transaction:
                            type: object
                            properties:
                              id:
                                type: string
                                format: uuid
                              type:
                                type: string
                                example: redeem
                              points:
                                type: integer
                                example: 500
                              created_at:
                                type: string
                                format: date-time
        '400':
          $ref: '#/components/responses/BadRequest'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  parameters:
    RedemptionCode:
      name: code
      in: path
      required: true
      schema:
        type: string
        example: AB12CD34
      description: The short redemption code the customer shows (from the Rigaly app).
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: false
      schema:
        type: string
        maxLength: 255
      description: >-
        Optional. Retries with the same key within 24h replay the original
        response instead of repeating the operation.
  schemas:
    SuccessEnvelope:
      type: object
      properties:
        success:
          type: boolean
          example: true
        message:
          type: string
        data:
          type: object
    ErrorEnvelope:
      type: object
      properties:
        success:
          type: boolean
          example: false
        error:
          type: object
          properties:
            message:
              type: string
  responses:
    BadRequest:
      description: Validation or business-rule error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          example:
            success: false
            error:
              message: Provide exactly one of "user_id" or "identifier"
    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_...`'

````