# Create Promotion

<Warning>
**Promotions is enabled per organization**

This endpoint works only after WHITELABEL enables Promotions for your organization. Ask your Technical Account Manager or Key Account Manager. See [Promotions](/docs/payment-features/promotions#enable-promotions-for-your-organization).
</Warning>

<Note>
**Promotions can't be edited**

There's no update endpoint. To change a discount, a date or a condition, [disable the promotion](/reference/promotions/disable-promotion) and create a new one. Payments already charged keep the promotion they were charged with.
</Note>

Creating a promotion doesn't discount any payment by itself. A payment gets the discount only when it carries a `quote_id` from [Create Promotion Quote](/reference/promotions/create-promotion-quote) or from the WHITELABEL checkout (on `additional_data.order.discounts`).

Each promotion belongs to **one** `account_id`. If you run the same campaign on several accounts, create it once per account.

When two or more promotions match the same payment, the one with the **biggest saving** applies, then the oldest, then the smallest `id`. One promotion per payment.

Set `redemption.mode` to `CODE` to require a promotion code, with `redemption.code` (3 to 32 characters). A code is unique per account among the promotions that can still apply; creating a second active promotion with a code already in use returns `409 CODE_ALREADY_EXISTS`. The code becomes reusable once the earlier promotion is disabled or its schedule ends.

Refer to the [HTTP Response Codes](/reference/getting-started/response-codes) section for details on possible error outcomes.

**POST** `/promotions`

Base URL: `https://api-sandbox.whitelabel.com/v1`

Creates a promotion for an account. Promotions must be enabled for your organization by WHITELABEL before you can use this endpoint. See [Promotions](/docs/payment-features/promotions#enable-promotions-for-your-organization).

## Authorization

- public-api-key (apiKey in header)
- private-secret-key (apiKey in header)

## Header parameters

- `X-Idempotency-Key` (string, required)
  A unique key (UUID) for the request. Sending the same key again within 24 hours returns the original response and stores nothing new.

## Body

Content type: `application/json`

- `account_id` (string, required)
  The account the promotion belongs to (UUID, found in your [WHITELABEL Dashboard](https://dashboard.whitelabel.com/developers)). One promotion applies to one account. If you run the same campaign on several accounts, create it once per account.
- `name` (string, required)
  The promotion name (MAX 255; MIN 3). The checkout uses it when it announces the discount.
- `description` (string)
  Shown with the name on the quote. Optional, up to 1000 characters.
- `schedule` (object, required)
  The window in which the promotion runs. UTC.
  - `starts_at` (string<date-time>, required)
    When the promotion starts (ISO 8601, UTC). Now or in the future.
  - `ends_at` (string,null<date-time>)
    When the promotion ends (ISO 8601, UTC). `null` means no end date.
- `redemption` (object, required)
  How the promotion is redeemed. `code` is required when `mode` is `CODE`.
  - `mode` ("AUTOMATIC" | "CODE", required)
    `AUTOMATIC` = applies by itself to every payment that meets the conditions. `CODE` = applies only when the payment's quote carries the promotion `code`. Not available yet: today every promotion is `AUTOMATIC`; codes are coming in a later release.
  - `code` (string,null)
    `CODE` only; required then, omit or send `null` otherwise. 3 to 32 characters: `A-Z`, `0-9`, `_` and `-`. Unique per account among the promotions that can still apply; reusable once the earlier promotion with that code is disabled or its schedule has ended.
- `discount` (object, required)
  What the customer saves. For `FIXED`, when the promotion also has an `amounts` condition, `discount.amounts` and `conditions.amounts.values` must list the same currencies or the request returns `400`.
  - `type` ("PERCENTAGE" | "FIXED", required)
  - `value` (number,null)
    `PERCENTAGE` only. Greater than 0 and up to 100, with up to two decimals (for example `10.5`). `null` for a fixed discount.
  - `amounts` (array,null)
    `FIXED` only. One entry per currency, each above zero. A fixed promotion applies only to payments in the currencies it lists, and the discount is capped at the payment amount. `null` for a percentage discount.
- `conditions` (object)
  Conditions a payment must meet. AND across keys, OR inside each key's values list. Omit a key or send `null` for no condition on that dimension; an empty `values` list returns `400`.
  - `bins` (object)
    Card BIN condition. A card matches when its BIN equals a prefix in `values` or falls in a `ranges` entry. At least one of `values` or `ranges` when `bins` is present.
    - `values` (string[])
      BIN prefixes (6 to 8 digits each).
    - `ranges` (object[])
      Inclusive BIN ranges (8-digit bounds).
      - `start` (string, required)
        First BIN of the range (8 digits).
      - `end` (string, required)
        Last BIN of the range (8 digits), inclusive.
  - `payment_methods` (object)
    - `values` (string[])
      Payment method types, for example `CARD`. See [Payment type list](/reference/payment-type-list).
  - `card_types` (object)
    - `values` ("CREDIT" | "DEBIT"[])
      Card types. A card whose type is unknown never meets this condition.
  - `countries` (object)
    - `values` (string[])
      Payment countries ([ISO 3166-1](/reference/country-reference)).
  - `amounts` (object)
    - `values` (object[])
      Amount bounds per currency (`min` and `max` inclusive).
      - `currency` (string, required)
        MAX 3; MIN 3; [ISO 4217](/reference/country-reference).
      - `min` (number,null<float>)
        Inclusive minimum in this currency. `null` with `max` also `null` filters by currency only.
      - `max` (number,null<float>)
        Inclusive maximum in this currency. `null` means no ceiling.

Example:

```json
{
  "account_id": "string",
  "name": "string",
  "description": "string",
  "schedule": {
    "starts_at": "1970-01-01T00:00:00.000Z",
    "ends_at": null
  },
  "redemption": {
    "mode": "AUTOMATIC",
    "code": null
  },
  "discount": {
    "type": "PERCENTAGE",
    "value": null,
    "amounts": null
  },
  "conditions": {
    "bins": {
      "values": [
        "string"
      ],
      "ranges": [
        {
          "start": "string",
          "end": "string"
        }
      ]
    },
    "payment_methods": {
      "values": [
        "string"
      ]
    },
    "card_types": {
      "values": [
        "CREDIT"
      ]
    },
    "countries": {
      "values": [
        "string"
      ]
    },
    "amounts": {
      "values": [
        {
          "currency": "string",
          "min": null,
          "max": null
        }
      ]
    }
  }
}
```

## Responses

### 201

201

- `id` (string)
  The unique identifier of the promotion (UUID).
- `account_id` (string)
  The account the promotion belongs to (UUID, found in your [WHITELABEL Dashboard](https://dashboard.whitelabel.com/developers)). One promotion applies to one account. If you run the same campaign on several accounts, create it once per account.
- `name` (string)
  The promotion name (MAX 255; MIN 3). The checkout uses it when it announces the discount.
- `description` (string)
  Shown with the name on the quote. Optional, up to 1000 characters.
- `schedule` (object)
  The window in which the promotion runs. UTC.
  - `starts_at` (string<date-time>, required)
    When the promotion starts (ISO 8601, UTC). Now or in the future.
  - `ends_at` (string,null<date-time>)
    When the promotion ends (ISO 8601, UTC). `null` means no end date.
- `redemption` (object)
  How the promotion is redeemed. `code` is required when `mode` is `CODE`.
  - `mode` ("AUTOMATIC" | "CODE", required)
    `AUTOMATIC` = applies by itself to every payment that meets the conditions. `CODE` = applies only when the payment's quote carries the promotion `code`. Not available yet: today every promotion is `AUTOMATIC`; codes are coming in a later release.
  - `code` (string,null)
    `CODE` only; `null` for an automatic promotion. 3 to 32 characters: `A-Z`, `0-9`, `_` and `-`. Unique per account among the promotions that can still apply; reusable once the earlier promotion with that code is disabled or its schedule has ended.
- `discount` (object)
  What the customer saves. For `FIXED`, when the promotion also has an `amounts` condition, `discount.amounts` and `conditions.amounts.values` must list the same currencies or the request returns `400`.
  - `type` ("PERCENTAGE" | "FIXED", required)
  - `value` (number,null)
    `PERCENTAGE` only. Greater than 0 and up to 100, with up to two decimals (for example `10.5`). `null` for a fixed discount.
  - `amounts` (array,null)
    `FIXED` only. One entry per currency, each above zero. A fixed promotion applies only to payments in the currencies it lists, and the discount is capped at the payment amount. `null` for a percentage discount.
- `conditions` (object)
  Conditions a payment must meet. AND across keys, OR inside each key's values list. Omit a key or send `null` for no condition on that dimension; an empty `values` list returns `400`.
  - `bins` (object)
    Card BIN condition. A card matches when its BIN equals a prefix in `values` or falls in a `ranges` entry. At least one of `values` or `ranges` when `bins` is present.
    - `values` (string[])
      BIN prefixes (6 to 8 digits each).
    - `ranges` (object[])
      Inclusive BIN ranges (8-digit bounds).
      - `start` (string, required)
        First BIN of the range (8 digits).
      - `end` (string, required)
        Last BIN of the range (8 digits), inclusive.
  - `payment_methods` (object)
    - `values` (string[])
      Payment method types, for example `CARD`. See [Payment type list](/reference/payment-type-list).
  - `card_types` (object)
    - `values` ("CREDIT" | "DEBIT"[])
      Card types. A card whose type is unknown never meets this condition.
  - `countries` (object)
    - `values` (string[])
      Payment countries ([ISO 3166-1](/reference/country-reference)).
  - `amounts` (object)
    - `values` (object[])
      Amount bounds per currency (`min` and `max` inclusive).
      - `currency` (string, required)
        MAX 3; MIN 3; [ISO 4217](/reference/country-reference).
      - `min` (number,null<float>)
        Inclusive minimum in this currency. `null` with `max` also `null` filters by currency only.
      - `max` (number,null<float>)
        Inclusive maximum in this currency. `null` means no ceiling.
- `status` ("SCHEDULED" | "ACTIVE" | "EXPIRED" | "DISABLED")
  Computed from `schedule` when you read the promotion. `DISABLED` is final.
- `created_at` (string<date-time>)
- `disabled_at` (string,null<date-time>)
  When you disabled the promotion (ISO 8601, UTC). `null` while not disabled.

Example:

```json
{
  "id": "string",
  "account_id": "string",
  "name": "string",
  "description": "string",
  "schedule": {
    "starts_at": "1970-01-01T00:00:00.000Z",
    "ends_at": null
  },
  "redemption": {
    "mode": "AUTOMATIC",
    "code": null
  },
  "discount": {
    "type": "PERCENTAGE",
    "value": null,
    "amounts": null
  },
  "conditions": {
    "bins": {
      "values": [
        "string"
      ],
      "ranges": [
        {
          "start": "string",
          "end": "string"
        }
      ]
    },
    "payment_methods": {
      "values": [
        "string"
      ]
    },
    "card_types": {
      "values": [
        "CREDIT"
      ]
    },
    "countries": {
      "values": [
        "string"
      ]
    },
    "amounts": {
      "values": [
        {
          "currency": "string",
          "min": null,
          "max": null
        }
      ]
    }
  },
  "status": "SCHEDULED",
  "created_at": "1970-01-01T00:00:00.000Z",
  "disabled_at": null
}
```

### 400

400

- `code` (string)
- `messages` (string[])

Example:

```json
{
  "code": "INVALID_REQUEST",
  "messages": [
    "string"
  ]
}
```

### 409

409

- `code` (string)
- `messages` (string[])

Example:

```json
{
  "code": "CODE_ALREADY_EXISTS",
  "messages": [
    "string"
  ]
}
```