# Batch redeem vouchers for profiles

- Operation ID: `BatchRedeemVouchersForProfile`
- HTTP method: `POST`
- Path: `/v4/promotions/voucher/batch-redeem-for-profile`
- [Human-readable API reference](https://hub.synerise.com/api-reference/loyalty-and-engagement#tag/Promotions/operation/BatchRedeemVouchersForProfile)

## Self-contained OpenAPI method

The fenced document below contains this method's documentation and all of its local references. It is self-contained; no category or master specification fetch is required.

```yaml
openapi: 3.0.0
info:
  title: Synerise Public API
  version: 1.9.1
paths:
  /v4/promotions/voucher/batch-redeem-for-profile:
    post:
      tags:
        - Promotions
      summary: Batch redeem vouchers for profiles
      description: |
        You can redeem up to 100 vouchers.

        ---

        **API consumers:** <a href="/api-reference/authorization?tag=Authorization&amp;operationId=profileLogin" target="_blank" rel="noopener">Workspace (Business Profile)</a>, <a href="/api-reference/authorization?tag=Authorization&amp;operationId=userLogin" target="_blank" rel="noopener">Synerise User</a>

        **API key permission required:** `PROMOTIONS_BATCH_REDEEM_VOUCHERS_PROMOTIONS_CREATE`

        **User role permission required:** `campaigns_promotions: create`
      operationId: BatchRedeemVouchersForProfile
      requestBody:
        content:
          application/json:
            schema:
              type: array
              description: Vouchers to redeem
              minItems: 1
              maxItems: 100
              items:
                type: object
                required:
                  - profileKey
                  - profileValue
                  - voucherKey
                  - voucherValue
                properties:
                  profileKey:
                    type: string
                    example: clientId
                    description: Type of profile identifier
                    enum:
                      - externalId
                      - clientId
                      - email
                      - phone
                      - uuid
                  profileValue:
                    description: Value of the selected identifier
                    type: string
                    example: "434428563"
                  voucherKey:
                    type: string
                    example: code
                    description: Type of voucher identifier
                    enum:
                      - code
                  voucherValue:
                    description: Value of the selected identifier
                    type: string
                    example: "434428563"
                  options:
                    type: object
                    description: Additional options of the operation
                    properties:
                      quantity:
                        description: Quantity of redeemed items
                        type: integer
                        example: 2
                        default: 1
                      sourceId:
                        description: "The source of redemption. It should be unique to ensure that redemptions are successfully deduplicated when retried. Example: a concatenation of receipt ID and index of the discounted transaction line on the receipt."
                        type: string
                        example: 3f0a1670-eb63-43f1-a6b8-895a74621964-3
                      orderId:
                        description: Receipt ID for which the voucher was redeemed.
                        type: string
                        example: 3f0a1670-eb63-43f1-a6b8-895a74621964
        required: true
      responses:
        "200":
          description: Vouchers redeemed
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Status of the operation
                  data:
                    type: array
                    description: Vouchers redeemed successfully
                    items:
                      type: object
                      required:
                        - code
                        - status
                        - autoGenerated
                        - lastingAt
                        - redeemedAt
                        - assignedAt
                      properties:
                        code:
                          type: string
                          description: Voucher code
                          example: 6f54671d-157f-4c4e-a577-11fac3111293
                        status:
                          type: string
                          description: Status of the voucher
                          example: ASSIGNED
                          enum:
                            - ASSIGNED
                            - REDEEMED
                            - CANCELED
                        autoGenerated:
                          type: boolean
                          example: false
                          description: "`true` if the voucher was generated by an algorithm"
                        lastingAt:
                          type: string
                          nullable: true
                          example: 2026-01-01
                          format: date-time
                          description: Time when the voucher expires.
                        redeemedAt:
                          type: string
                          nullable: true
                          example: null
                          format: date-time
                          description: Time when the voucher was redeemed.
                        assignedAt:
                          type: string
                          nullable: true
                          example: 2025-01-01
                          format: date-time
                          description: Time when the voucher was assigned.
        "207":
          description: Some vouchers couldn't be redeemed
          content:
            application/json:
              schema:
                type: object
                description: List of errors
                properties:
                  httpStatus:
                    allOf:
                      - type: number
                        description: HTTP status of the error
                        example: 500
                      - default: 207
                        example: 207
                  traceId:
                    type: string
                    description: Trace ID for troubleshooting
                    example: c72d530fd1b813ae
                  timestamp:
                    type: string
                    format: date-timed
                    description: Time when the error occurred
                    example: 2021-12-28T08:27:54.549Z
                  errorCode:
                    allOf:
                      - type: string
                        description: Error code which helps identify the issue. See [API error reference](https://hub.synerise.com/api-reference/errors.html).
                        example: ERR-001
                      - default: ERR-003
                  message:
                    allOf:
                      - type: string
                        description: Short description of the error
                        example: Internal Error
                      - default: Batch operation failed
                  errors:
                    type: array
                    description: A list of redemption errors
                    items:
                      type: object
                      description: Error that occurred and data source index
                      properties:
                        source:
                          type: object
                          description: Identifier of the item which caused the error
                          properties:
                            index:
                              type: integer
                              example: 1
                              description: Index of an item which failed
                        errorCode:
                          allOf:
                            - type: string
                              description: Error code which helps identify the issue. See [API error reference](https://hub.synerise.com/api-reference/errors.html).
                              example: ERR-001
                            - example: ERR-002
                        message:
                          allOf:
                            - type: string
                              description: Short description of the error
                              example: Internal Error
                            - example: Invalid data
                        httpStatus:
                          allOf:
                            - type: number
                              description: HTTP status of the error
                              example: 500
                            - example: 404
                        help:
                          type: string
                          nullable: true
                          description: Currently unused
                        details:
                          type: object
                          nullable: true
                          description: Additional error context, for example the identifier of the entity that caused the failure
                        errors:
                          type: array
                          description: Error details
                          items:
                            type: object
                            description: Error details
                            properties:
                              errorCode:
                                allOf:
                                  - type: string
                                    description: Error code which helps identify the issue. See [API error reference](https://hub.synerise.com/api-reference/errors.html).
                                    example: ERR-001
                                  - example: VLD-080
                              message:
                                allOf:
                                  - type: string
                                    description: Short description of the error
                                    example: Internal Error
                                  - example: String fails to match the required pattern
                              source:
                                type: object
                                description: The entity which caused a problem
                                properties:
                                  pointer:
                                    type: string
                                    description: Pointer to the wrong element
                  data:
                    type: array
                    description: Vouchers redeemed successfully
                    items:
                      type: object
                      required:
                        - code
                        - status
                        - autoGenerated
                        - lastingAt
                        - redeemedAt
                        - assignedAt
                      properties:
                        code:
                          type: string
                          description: Voucher code
                          example: 6f54671d-157f-4c4e-a577-11fac3111293
                        status:
                          type: string
                          description: Status of the voucher
                          example: ASSIGNED
                          enum:
                            - ASSIGNED
                            - REDEEMED
                            - CANCELED
                        autoGenerated:
                          type: boolean
                          example: false
                          description: "`true` if the voucher was generated by an algorithm"
                        lastingAt:
                          type: string
                          nullable: true
                          example: 2026-01-01
                          format: date-time
                          description: Time when the voucher expires.
                        redeemedAt:
                          type: string
                          nullable: true
                          example: null
                          format: date-time
                          description: Time when the voucher was redeemed.
                        assignedAt:
                          type: string
                          nullable: true
                          example: 2025-01-01
                          format: date-time
                          description: Time when the voucher was assigned.
      deprecated: false
      security:
        - JWT: []
      x-snr-doc-urls:
        - /api-reference/loyalty-and-engagement#tag/Promotions/operation/BatchRedeemVouchersForProfile
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |-
            curl --request POST \
              --url https://api.synerise.com/v4/promotions/voucher/batch-redeem-for-profile \
              --header 'Authorization: Bearer REPLACE_BEARER_TOKEN' \
              --header 'content-type: application/json' \
              --data '[{"profileKey":"clientId","profileValue":"434428563","voucherKey":"code","voucherValue":"434428563","options":{"quantity":2,"sourceId":"3f0a1670-eb63-43f1-a6b8-895a74621964-3","orderId":"3f0a1670-eb63-43f1-a6b8-895a74621964"}}]'
        - lang: Python
          label: Python
          source: |-
            import http.client

            conn = http.client.HTTPSConnection("api.synerise.com")

            payload = "[{\"profileKey\":\"clientId\",\"profileValue\":\"434428563\",\"voucherKey\":\"code\",\"voucherValue\":\"434428563\",\"options\":{\"quantity\":2,\"sourceId\":\"3f0a1670-eb63-43f1-a6b8-895a74621964-3\",\"orderId\":\"3f0a1670-eb63-43f1-a6b8-895a74621964\"}}]"

            headers = {
                'Authorization': "Bearer REPLACE_BEARER_TOKEN",
                'content-type': "application/json"
                }

            conn.request("POST", "/v4/promotions/voucher/batch-redeem-for-profile", payload, headers)

            res = conn.getresponse()
            data = res.read()

            print(data.decode("utf-8"))
        - lang: JavaScript
          label: JavaScript
          source: |-
            const data = JSON.stringify([
              {
                "profileKey": "clientId",
                "profileValue": "434428563",
                "voucherKey": "code",
                "voucherValue": "434428563",
                "options": {
                  "quantity": 2,
                  "sourceId": "3f0a1670-eb63-43f1-a6b8-895a74621964-3",
                  "orderId": "3f0a1670-eb63-43f1-a6b8-895a74621964"
                }
              }
            ]);

            const xhr = new XMLHttpRequest();
            xhr.withCredentials = true;

            xhr.addEventListener("readystatechange", function () {
              if (this.readyState === this.DONE) {
                console.log(this.responseText);
              }
            });

            xhr.open("POST", "https://api.synerise.com/v4/promotions/voucher/batch-redeem-for-profile");
            xhr.setRequestHeader("Authorization", "Bearer REPLACE_BEARER_TOKEN");
            xhr.setRequestHeader("content-type", "application/json");

            xhr.send(data);
        - lang: Node.js
          label: Node.js
          source: |-
            const http = require("https");

            const options = {
              "method": "POST",
              "hostname": "api.synerise.com",
              "port": null,
              "path": "/v4/promotions/voucher/batch-redeem-for-profile",
              "headers": {
                "Authorization": "Bearer REPLACE_BEARER_TOKEN",
                "content-type": "application/json"
              }
            };

            const req = http.request(options, function (res) {
              const chunks = [];

              res.on("data", function (chunk) {
                chunks.push(chunk);
              });

              res.on("end", function () {
                const body = Buffer.concat(chunks);
                console.log(body.toString());
              });
            });

            req.write(JSON.stringify([
              {
                profileKey: 'clientId',
                profileValue: '434428563',
                voucherKey: 'code',
                voucherValue: '434428563',
                options: {
                  quantity: 2,
                  sourceId: '3f0a1670-eb63-43f1-a6b8-895a74621964-3',
                  orderId: '3f0a1670-eb63-43f1-a6b8-895a74621964'
                }
              }
            ]));
            req.end();
        - lang: PHP
          label: PHP
          source: |-
            <?php

            $request = new HttpRequest();
            $request->setUrl('https://api.synerise.com/v4/promotions/voucher/batch-redeem-for-profile');
            $request->setMethod(HTTP_METH_POST);

            $request->setHeaders([
              'Authorization' => 'Bearer REPLACE_BEARER_TOKEN',
              'content-type' => 'application/json'
            ]);

            $request->setBody('[{"profileKey":"clientId","profileValue":"434428563","voucherKey":"code","voucherValue":"434428563","options":{"quantity":2,"sourceId":"3f0a1670-eb63-43f1-a6b8-895a74621964-3","orderId":"3f0a1670-eb63-43f1-a6b8-895a74621964"}}]');

            try {
              $response = $request->send();

              echo $response->getBody();
            } catch (HttpException $ex) {
              echo $ex;
            }
        - lang: Java
          label: Java
          source: |-
            HttpResponse<String> response = Unirest.post("https://api.synerise.com/v4/promotions/voucher/batch-redeem-for-profile")
              .header("Authorization", "Bearer REPLACE_BEARER_TOKEN")
              .header("content-type", "application/json")
              .body("[{\"profileKey\":\"clientId\",\"profileValue\":\"434428563\",\"voucherKey\":\"code\",\"voucherValue\":\"434428563\",\"options\":{\"quantity\":2,\"sourceId\":\"3f0a1670-eb63-43f1-a6b8-895a74621964-3\",\"orderId\":\"3f0a1670-eb63-43f1-a6b8-895a74621964\"}}]")
              .asString();
servers:
  - description: Microsoft Azure EU
    url: https://api.synerise.com
  - description: Microsoft Azure USA
    url: https://api.azu.synerise.com
  - description: Google Cloud Platform
    url: https://api.geb.synerise.com
tags:
  - name: Promotions
components:
  securitySchemes:
    JWT:
      type: http
      scheme: bearer
      description: |-
        JWT Bearer token. The header looks like this: `Bearer {JWT}`

        Remember to include the space between 'Bearer' and the token.

        Generate a token via the **Authorization** endpoints.
```
