Offers

You can use the Offers API to add discount codes to an existing offer.

Create an offer

  1. Navigate to the Offers page.
  2. Click + Create offer in the top-right corner.
  3. On the Choose an offer type window, select Unique discount codes
  4. Enter a unique name for your offer in the Discount name field.
  5. Choose the Distribution window.
    Note: If you include start and end dates in your API call, the distribution window automatically updates to Custom time period.
  6. Click Create.
  7. Click back into the offer and retrieve the numeric ID at the end of the URL string. This is the ID you will need for the POST

Add discount codes

Note: Once the offer(s) has been created, please reach out to an Attentive team member to enable this API feature for you

Make a call to this asynchronous endpoint to create new discount codes in an existing offer.

Request
Security:
OAuthFlow (offers:write)
path Parameters
coupon-pool-id
required
integer <int64>

The ID created under "Create an Offer"

Request Body schema: application/json
codes
required
Array of strings

List of the discount code values. Number of discount codes must be between 0 and 200,000.

distributionStart
string

Timestamp at which point the discount codes become valid for distribution within Attentive messages. Must be in valid UTC ISO format e.g. 2023-03-04T21:29:25Z. If null, the discount codes never expire.

distributionStop
string

Timestamp at which point the discount codes become invalid for distribution within Attentive messages. Must be in valid UTC ISO format.

Responses
202

Accepted. Check the Attentive Offers page to make sure that there are no errors and the remaining code count is accurate.

400

Invalid parameter in request query or body

403

Access Denied

404

Bad Request. Invalid parameter in request query or body. The following scenarios will cause a 400 response: A) Including distributionStart and distributionStop dates that overlap with the distributionStart and distributionStop dates from a previous call, B) Including distributionStart and distributionStop dates in an offer that has a distribution window of “Never expire” or “Time to live”, C) Excluding distributionStart and distributionStop dates in an offer that has a distribution window of “Custom time period”, D) Including a distributionStart value that is after the distributionStop value

500

Internal Server Error

post/coupons/coupon-pool/{coupon-pool-id}/create
Request samples
application/json
{
  • "codes": [
    ],
  • "distributionStart": "2023-02-14T21:29:25Z",
  • "distributionStop": "2023-02-15T21:29:25Z"
}
Response samples
application/json
{
  • "error": {
    }
}