# Create coupon promotion

Creates a coupon promotion.

Endpoint: POST /v3/project/{project_id}/admin/coupon
Version: 2.0.0
Security: basicAuth

## Path parameters:

  - `project_id` (integer, required)
    Project ID. You can find this parameter in your Publisher Account next to the project name and in the browser address bar when working with a project. The URL has the following format: https://publisher.xsolla.com//projects/.
    Example: 44056

## Request fields (application/json):

  - `external_id` (string, required)
    Unique promotion ID. The external_id may contain only lowercase and uppercase Latin alphanumeric characters, periods, dashes, and underscores.

  - `promotion_periods` (array)
    Promotion validity periods. If multiple periods are specified, both date_from and date_until are required.

  - `promotion_periods.date_from` (string, required)
    Start date for the specified promotion.
    Example: "2020-08-11T10:00:00+03:00"

  - `promotion_periods.date_until` (string,null)
    End date for the specified promotion. If set to null, the promotion is indefinite. Can be null only if a single validity period is specified.
    Example: "2020-08-11T20:00:00+03:00"

  - `name` (object, required)
    Name of promotion. Should contain key/value pairs
where key is a locale with "^[a-z]{2}-[A-Z]{2}$" format, value is string.

  - `bonus` (array,null)

  - `bonus.sku` (string)
    Item SKU.

  - `bonus.quantity` (number)
    Item quantity.

  - `redeem_total_limit` (integer,null)
    Limits total numbers of coupons.

  - `redeem_user_limit` (integer,null)
    Limits total numbers of coupons redeemed by single user.

  - `redeem_code_limit` (integer,null)
    Number of redemptions per code.

  - `attribute_conditions` (array)
    Conditions for validating user attributes.
Determine promotion availability based on whether user attributes match all specified conditions.

## Response 201 fields (application/json):

  - `external_id` (string)
    Unique promotion ID. The external_id may contain only lowercase and uppercase Latin alphanumeric characters, periods, dashes, and underscores.

## Response 401 fields (application/json):

  - `statusCode` (integer)
    Example: 401

  - `errorCode` (integer)
    Example: 1020

  - `errorMessage` (string)
    Example: "[0401-1020]: Error in Authentication method occurred"

## Response 422 fields (application/json):

  - `statusCode` (integer)
    Example: 422

  - `errorCode` (integer)
    Example: 1102

  - `errorMessage` (string)
    Example: "[0401-1102]: Unprocessable Entity. The property `external_id` is required"


