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

# Redeem Voucher

> Redeems a voucher, transferring all or part of its value to a specified target account.

This operation allows for full or partial redemption of a voucher. If the redeemed value
is less than the total voucher value, the voucher remains active with the remaining balance.
Once fully redeemed, a voucher cannot be used again.



## OpenAPI

````yaml service-openapi POST /v1/service/voucher/{voucherId}/redeem
openapi: 3.0.0
info:
  title: Service API
  version: 0.0.0
servers:
  - url: https://api.nxos.io
    description: single server endpoint
    variables: {}
security: []
tags: []
paths:
  /v1/service/voucher/{voucherId}/redeem:
    post:
      summary: Redeem a voucher (full or partial)
      description: >-
        Redeems a voucher, transferring all or part of its value to a specified
        target account.


        This operation allows for full or partial redemption of a voucher. If
        the redeemed value

        is less than the total voucher value, the voucher remains active with
        the remaining balance.

        Once fully redeemed, a voucher cannot be used again.
      operationId: Vouchers_redeemVoucher
      parameters:
        - name: voucherId
          in: path
          required: true
          description: The unique identifier of the voucher to redeem.
          schema:
            type: string
      requestBody:
        description: >-
          The details required for redeeming the voucher, including the target
          account and redemption value.
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RedeemVoucherRequest'
      responses:
        '200':
          description: >-
            The updated Voucher object after redemption, including the new
            status and redemption details.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RedeemedVoucher'
components:
  schemas:
    RedeemVoucherRequest:
      type: object
      required:
        - target_account_id
      properties:
        target_account_id:
          type: string
          description: >-
            The ID of the account that will receive the redeemed value of the
            voucher.
        redemption_value:
          allOf:
            - $ref: '#/components/schemas/PaymentValue'
          description: >-
            The value to be redeemed from the voucher.

            If not specified, the entire remaining value of the voucher will be
            redeemed.

            For partial redemption, specify a value less than the voucher's
            current value.
        metadata:
          type: object
          additionalProperties:
            type: string
          description: Optional metadata to be associated with the redemption transaction.
    RedeemedVoucher:
      type: object
      required:
        - voucher_id
        - value
        - expires_at
        - provider_name
        - funding_source_account
        - status
        - redeemed_at
        - redeemed_to_account_id
        - redemption_transaction_id
        - redeemed_value
        - remaining_value
      properties:
        voucher_id:
          type: string
          description: Unique identifier for the voucher.
        value:
          allOf:
            - $ref: '#/components/schemas/PaymentValue'
          description: The value of the voucher.
        expires_at:
          type: string
          description: The expiration date of the voucher in ISO 8601 format.
        provider_name:
          type: string
          description: The name of the voucher provider or issuing system.
        funding_source_account:
          type: string
          description: The account ID from which funds were sourced to back the voucher.
        status:
          allOf:
            - $ref: '#/components/schemas/VoucherStatus'
          description: The current status of the voucher.
        redeemed_at:
          type: string
          description: >-
            The timestamp when the voucher was last redeemed, in ISO 8601
            format.
        redeemed_to_account_id:
          type: string
          description: The ID of the account that received the redeemed voucher value.
        redemption_transaction_id:
          type: string
          description: The ID of the transaction created for this redemption.
        redeemed_value:
          allOf:
            - $ref: '#/components/schemas/PaymentValue'
          description: The value that was redeemed in this transaction.
        remaining_value:
          allOf:
            - $ref: '#/components/schemas/PaymentValue'
          description: The remaining value on the voucher after this redemption.
    PaymentValue:
      type: object
      required:
        - amount
        - asset_code
      properties:
        amount:
          type: string
          description: >-
            The amount of the payment, in string representation. All amounts
            should be passed in full subunits, e.g. 1000 for 10.00
        asset_code:
          type: string
          description: >-
            The asset_code of the payment. The asset must've been created in the
            system before it can be used in payments
    VoucherStatus:
      type: string
      enum:
        - ACTIVE
        - PARTIALLY_REDEEMED
        - FULLY_REDEEMED
        - EXPIRED
        - CANCELLED

````