# Batch deactivate promotions

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

## 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/promotion/batch-deactivate:
    post:
      tags:
        - Promotions
      summary: Batch deactivate promotions
      description: |
        A Profile can change the status of a number of activated promotions back to `assigned`.

        ---

        **API consumers:** <a href="/api-reference/authorization?tag=Authorization&amp;operationId=authenticateUsingPOST_v3" target="_blank" rel="noopener">Profile (Client)</a>, <a href="/api-reference/authorization?tag=Authorization&amp;operationId=LogInAnonymouslyV3" target="_blank" rel="noopener">Anonymous Profile</a>
      operationId: BatchDeactivate
      requestBody:
        description: ""
        content:
          application/json:
            schema:
              type: array
              minItems: 1
              maxItems: 200
              items:
                required:
                  - key
                  - value
                type: object
                properties:
                  key:
                    type: string
                    description: Type of promotion identifier
                    enum:
                      - uuid
                      - code
                  value:
                    type: string
                    description: Value of the selected identifier
                  pointsToUse:
                    nullable: true
                    type: integer
                    minimum: 0
                    description: How many points should be converted to digital money and stored as ready to redeem in transactions in digital cashback promotions.
                example:
                  key: code
                  value: 7893467834GG
                  pointsToUse: 100
        required: true
      responses:
        "200":
          description: Promotions deactivated
          content:
            application/json:
              schema:
                type: object
        "400":
          description: Request body invalid/malformed/missing elements
          content:
            application/json:
              schema:
                anyOf:
                  - type: object
                    title: JSON content issue
                    properties:
                      message:
                        type: string
                        description: Summary of the error
                      error:
                        description: Details of the error
                        anyOf:
                          - type: array
                            description: An array of objects with error details
                            items:
                              type: object
                              description: Details of an error
                              properties:
                                message:
                                  type: string
                                  description: Short description of the error
                                  example: Internal Error
                                additionalProperties:
                                  description: Additional information, if applicable
                          - type: string
                            description: Description of the error
                  - type: object
                    title: JSON structure issue
                    properties:
                      message:
                        type: string
                        description: Summary of the error
                      code:
                        type: string
                        description: String-type code of the error
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    description: HTTP code of the problem
                  error:
                    type: string
                    description: Summary of the error
                  message:
                    type: string
                    description: Error details
                  timestamp:
                    type: string
                    description: Time when the error occurred
        "403":
          description: Forbidden
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    description: HTTP code of the problem
                  error:
                    type: string
                    description: Summary of the error
                  message:
                    type: string
                    description: Error details
                  timestamp:
                    type: string
                    description: Time when the error occurred
        "404":
          description: Not Found
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Short summary of the response
              example:
                message: Promotions for profile not found
        "429":
          description: Waiting for profile lock release
          content:
            application/json:
              schema:
                type: object
                title: JSON content issue
                properties:
                  message:
                    type: string
                    description: Summary of the error
                  error:
                    description: Details of the error
                    anyOf:
                      - type: array
                        description: An array of objects with error details
                        items:
                          type: object
                          description: Details of an error
                          properties:
                            message:
                              type: string
                              description: Short description of the error
                              example: Internal Error
                            additionalProperties:
                              description: Additional information, if applicable
                      - type: string
                        description: Description of the error
      deprecated: false
      security:
        - JWT: []
      x-snr-doc-urls:
        - /api-reference/loyalty-and-engagement#tag/Promotions/operation/BatchDeactivate
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |-
            curl --request POST \
              --url https://api.synerise.com/v4/promotions/promotion/batch-deactivate \
              --header 'Authorization: Bearer REPLACE_BEARER_TOKEN' \
              --header 'content-type: application/json' \
              --data '[{"key":"code","value":"7893467834GG","pointsToUse":100}]'
        - lang: Python
          label: Python
          source: |-
            import http.client

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

            payload = "[{\"key\":\"code\",\"value\":\"7893467834GG\",\"pointsToUse\":100}]"

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

            conn.request("POST", "/v4/promotions/promotion/batch-deactivate", payload, headers)

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

            print(data.decode("utf-8"))
        - lang: JavaScript
          label: JavaScript
          source: |-
            const data = JSON.stringify([
              {
                "key": "code",
                "value": "7893467834GG",
                "pointsToUse": 100
              }
            ]);

            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/promotion/batch-deactivate");
            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/promotion/batch-deactivate",
              "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([{key: 'code', value: '7893467834GG', pointsToUse: 100}]));
            req.end();
        - lang: PHP
          label: PHP
          source: |-
            <?php

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

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

            $request->setBody('[{"key":"code","value":"7893467834GG","pointsToUse":100}]');

            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/promotion/batch-deactivate")
              .header("Authorization", "Bearer REPLACE_BEARER_TOKEN")
              .header("content-type", "application/json")
              .body("[{\"key\":\"code\",\"value\":\"7893467834GG\",\"pointsToUse\":100}]")
              .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.
```
