Abra API: Discounts
Last updated: September 29, 2026
A discount is the pricing rule behind a promotion. Abra creates it in Shopify and keeps the two in step. Discounts that run on Abra's discount functions, such as tiered, volume and gift with purchase discounts, can be created and edited here. Native Shopify discounts can only be attached. Abra API: Discount types describes each discountValue.
Beta. The Abra API is in beta, so its behavior may change. If something doesn't work as described, contact us at help@abrapromotions.com.
Unique codes
A code discount can have many unique codes. Generate unique codes (below) creates up to 500,000 random codes per job, with an optional prefix and suffix of up to 20 characters each. The job runs in the background: poll List code generation jobs until its status is DONE or FAILED. The codes are added to the discount in Shopify. Get them from the Shopify admin or the Shopify Admin API. If Klaviyo is connected in the Abra app, the codes are also added to Klaviyo.
The discount object
Discount endpoints return discounts in this shape, in the data field of the response.
Name | Description |
|---|---|
string | Abra ID of the discount. Use it in |
string | Name of the discount. For a code discount created through the API, it's also a code. |
string |
|
string |
|
boolean |
|
string or null | Same as |
object or null | The discount's settings; see Abra API: Discount types. One of 13 shapes, chosen by |
string |
|
string | Short text summary. Empty for discounts created through the API. |
object or null | Which products the discount covers. List results only include |
object or null | Conditions such as a minimum purchase and which customers qualify. Fields listed under |
string or null | Start time (ISO 8601), or |
string or null | End time (ISO 8601), or |
boolean | Whether each customer can use it only once. |
boolean | Whether it applies to one-time purchases. |
boolean | Whether it applies to subscription purchases. |
number or null | Total uses allowed, or |
number or null | Billing cycles it applies to for subscriptions, or |
object | Which other kinds of discounts it combines with. Fields listed under |
array of strings | Tags on the Shopify discount. |
array of strings | Tags of other product discounts that can apply to the same cart line. |
string or null | Shopify ID (GID) of the discount. Use it in a promotion's |
string |
|
entitled
Name | Description |
|---|---|
string |
One of:
|
boolean |
|
array of strings or objects | Shopify collection IDs, or objects with |
array of strings or objects | Shopify product IDs, or objects with |
array of strings | Shopify product variant IDs. |
string |
|
array of objects | Metafield values that pick the covered variants. Each item is a Metafield selection object. |
array of strings | Older market filter, cleared when the discount is updated. To limit a discount to markets, use |
array of strings | Older market filter, cleared when the discount is updated. Use |
string | Currency code, for example |
prerequisite
Name | Description |
|---|---|
object | Minimum the cart must reach: an item quantity or a subtotal. Fields listed under |
object | Which customers can use the discount. Defaults to all customers. Fields listed under |
boolean |
|
boolean |
|
array of strings | With |
prerequisite.minimumRequirement
Name | Description |
|---|---|
number | Minimum number of items. |
object | Minimum subtotal. A Money object. |
prerequisite.customerSelection
Name | Description |
|---|---|
string |
|
array of strings | Shopify IDs of the segments, customers or markets. Required unless |
combinesWith
Name | Description |
|---|---|
boolean | Combines with order discounts. |
boolean | Combines with product discounts. |
boolean | Combines with shipping discounts. |
List discounts
GET /v1/partner/discounts
Returns the store's discounts that run on Abra's discount functions, newest first, one page at a time (see Pagination). Native Shopify discounts attached to Abra aren't listed; get them by ID.
Filter with status, discountClass, typeName, discountValueType, promotionId and search (part of the title, not case-sensitive). typeName, discountValueType and promotionId take comma-separated lists. Sort with sort=field:direction: the fields are createdAt (the default), updatedAt, title, status, method (typeName) and type (discountValueType), and the direction is asc or desc (the default).
In list results, entitled only holds its markets, or is null. Get the discount by ID for the full object.
Query parameters
Name | Description |
|---|---|
integer | The page to return. The first page is 1. Defaults to |
integer | The number of discounts per page. Between 1 and 100. Defaults to |
string | Returns only discounts with this status. One of |
string | Returns only discounts of this class. One of |
string | Comma-separated list of typeNames. Matches discounts whose typeName is in the set. Each value is one of |
string | Comma-separated list of discountValueTypes. Matches discounts whose discountValueType is in the set. |
string | Comma-separated list of promotion Abra IDs. Returns discounts attached to any of them. |
string | Returns only discounts whose title contains this text. The match is not case-sensitive. |
string | The sort order, as |
Example request
curl "$ABRA_API_BASE/v1/partner/discounts" \
-H "Authorization: Bearer $ABRA_API_TOKEN"Response
200 OK. data is an array of discounts. Their fields are listed in The discount object. pagination describes the page:
Name | Description |
|---|---|
number | Current page number. |
number | Number of items per page. |
number | Total number of items. |
number | Total number of pages. |
boolean | Whether there is a next page. |
boolean | Whether there is a previous page. |
Errors
Status | Code | Description |
|---|---|---|
|
| A query value is invalid, for example |
|
|
|
|
| The |
|
| The token is missing, expired or revoked. |
Create a discount
POST /v1/partner/discounts
Creates a discount in Shopify and in Abra. discountValue.type picks the kind of discount (see Abra API: Discount types), and typeName picks DiscountCodeApp (a code, the default) or DiscountAutomaticApp (applies by itself). For a code discount, the title is also the code customers enter. startsAt defaults to now.
The native Shopify types (DiscountPercentage, DiscountAmount, DiscountOnQuantity, DiscountCodeFreeShipping and BXGY) can't be created here. To attach an existing Shopify discount instead, send its Shopify ID in discountId with its Shopify typeName. If it's already in Abra, you get the existing discount back.
Set promotionId to attach the discount to a promotion. The promotion's dates are then set from this discount.
Each discount type has its own rules, for example tier thresholds must increase. A broken rule returns 400 with a code for that rule, and error.description says what to fix.
Request body
Name | Description |
|---|---|
string, required | Name of the discount, 3 to 64 characters, unique among the store's discounts in Abra and Shopify. For a code discount it's also the code customers enter. It can't start with |
string, required | What the discount reduces: |
string |
One of:
|
object, required | What the discount gives. One shape per |
object | Which products the discount covers. Defaults to all products. Fields listed under |
object | Conditions such as a minimum purchase and which customers qualify. Defaults to all customers and no minimum. Fields listed under |
object | Which other kinds of discounts this one combines with at checkout. Each flag defaults to |
array of strings | Up to 5 tags, saved on the Shopify discount. |
array of strings | Up to 10 tags of other product discounts that can apply to the same cart line. Product discounts only. |
string | Start time (ISO 8601). Defaults to now. |
string | End time (ISO 8601), after |
boolean | Code discounts only: each customer can use it once. Defaults to |
boolean | Applies to one-time purchases. Defaults to |
boolean | Applies to subscription purchases. Defaults to |
number | Code discounts only: how many times the discount can be used in total. Leave it out for no limit. |
number | For subscriptions: how many billing cycles the discount applies to. |
string | Abra ID of a promotion to attach the discount to. The promotion's dates are then set from this discount. |
string | Shopify ID (GID) of an existing native Shopify discount to attach instead of creating one, for example |
entitled
Name | Description |
|---|---|
string, required |
One of:
|
boolean |
|
array of strings or objects | Shopify collection IDs, or objects with |
array of strings or objects | Shopify product IDs, or objects with |
array of strings | Shopify product variant IDs. |
string |
|
array of objects | Metafield values that pick the covered variants. Each item is a Metafield selection object. |
array of strings | Older market filter, cleared when the discount is updated. To limit a discount to markets, use |
array of strings | Older market filter, cleared when the discount is updated. Use |
string | Currency code, for example |
prerequisite
Name | Description |
|---|---|
object | Minimum the cart must reach: an item quantity or a subtotal. Fields listed under |
object | Which customers can use the discount. Defaults to all customers. Fields listed under |
boolean |
|
boolean |
|
array of strings | With |
prerequisite.minimumRequirement
Name | Description |
|---|---|
number | Minimum number of items. |
object | Minimum subtotal. A Money object. |
prerequisite.customerSelection
Name | Description |
|---|---|
string, required |
|
array of strings | Shopify IDs of the segments, customers or markets. Required unless |
combinesWith
Name | Description |
|---|---|
boolean | Combines with order discounts. |
boolean | Combines with product discounts. |
boolean | Combines with shipping discounts. |
Example request
curl -X POST "$ABRA_API_BASE/v1/partner/discounts" \
-H "Authorization: Bearer $ABRA_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"title": "Free gift with purchase",
"discountClass": "PRODUCT",
"typeName": "DiscountAutomaticApp",
"discountValue": {
"type": "Gift",
"quantity": 1,
"products": [
{
"id": "gid://shopify/Product/123",
"handle": "free-gift-product",
"title": "Free Gift Product",
"variants": [
{
"id": "gid://shopify/ProductVariant/456",
"displayName": "Default Title"
}
]
}
],
"compound": false,
"countsTowardEligibility": false
},
"prerequisite": {
"minimumRequirement": {
"greaterThanOrEqualToSubtotal": {
"amount": "50.00",
"currencyCode": "USD"
}
}
}
}'Response
201 Created. Returns the discount in data. Its fields are listed in The discount object.
Errors
Status | Code | Description |
|---|---|---|
|
| A field is invalid. See |
|
|
|
|
| A |
|
| The token is missing, expired or revoked. |
|
|
|
|
| Another discount in Abra or Shopify already has this title. |
|
| A native Shopify type was sent without |
|
| The discount is assigned to a B2B market, and Shopify hasn't enabled B2B discounts for this store. |
|
| Shopify rejected the discount. |
|
| The call to Shopify failed. Nothing is saved; try again. |
Get a discount
GET /v1/partner/discounts/{id}
Returns one discount, including native Shopify discounts attached to Abra. {id} is the discount's Abra ID (its id field).
Path parameters
Name | Description |
|---|---|
string, required | The discount ID ( |
Example request
curl "$ABRA_API_BASE/v1/partner/discounts/$DISCOUNT_ID" \
-H "Authorization: Bearer $ABRA_API_TOKEN"Response
200 OK. Returns the discount in data. Its fields are listed in The discount object.
Errors
Status | Code | Description |
|---|---|---|
|
| The token is missing, expired or revoked. |
|
| No discount with this ID in the store. |
Update a discount
PUT /v1/partner/discounts/{id}
Changes the fields you send and leaves the rest as they are. discountValue, entitled and prerequisite are replaced as a whole when you send them; in combinesWith, only the flags you send change. typeName, discountClass and the promotion link can't be changed.
The change is saved to Shopify in the same request. If Shopify rejects it, nothing changes and you get 422. If the discount belongs to a promotion, the promotion's dates are set from this discount.
Path parameters
Name | Description |
|---|---|
string, required | The discount ID ( |
Request body
Name | Description |
|---|---|
string | New name, 3 to 64 characters, unique among the store's discounts in Abra and Shopify. For a code discount without unique codes, it's also the code customers enter. |
object | Replaces the whole value. See Abra API: Discount types. One of 13 shapes, chosen by |
object | Replaces which products the discount covers. Same fields as |
object | Replaces the conditions. Send it along with a |
object | Only the flags you send change. Same fields as |
array of strings | Replaces the tags. Up to 5. |
array of strings | Replaces the list. Up to 10 tags; product discounts only. |
string | New start time (ISO 8601). The status is worked out again from the dates. |
string | New end time (ISO 8601), after |
boolean | Code discounts only: each customer can use it once. |
boolean | Applies to one-time purchases. |
boolean | Applies to subscription purchases. |
number | Code discounts only: how many times the discount can be used in total. |
number | For subscriptions: how many billing cycles the discount applies to. |
string | Ignored on update. |
Response
200 OK. Returns the discount in data. Its fields are listed in The discount object.
Errors
Status | Code | Description |
|---|---|---|
|
| A field is invalid. See |
|
|
|
|
| A |
|
| The token is missing, expired or revoked. |
|
| Native Shopify discounts can't be edited through the API. Edit them in the Shopify admin. |
|
| No discount with this ID in the store. |
|
| Another discount in Abra or Shopify already has this title. |
|
| Another request is changing this discount's promotion. Try again. |
|
| The discount is assigned to a B2B market, and Shopify hasn't enabled B2B discounts for this store. |
|
| Shopify rejected the change. |
|
| The call to Shopify failed. The discount is left as it was; try again. |
Delete a discount
DELETE /v1/partner/discounts/{id}
Deletes the discount in Shopify and in Abra. Returns 204 with no body.
If it was the last discount of a promotion that takes its dates from its discounts (useDiscountDates), that promotion is expired and made PRIVATE.
Deleting a native Shopify code discount through the API also deletes it in Shopify, including one you attached with discountId.
Path parameters
Name | Description |
|---|---|
string, required | The discount ID ( |
Example request
curl -X DELETE "$ABRA_API_BASE/v1/partner/discounts/$DISCOUNT_ID" \
-H "Authorization: Bearer $ABRA_API_TOKEN"Response
204 No Content. The response has no body.
Errors
Status | Code | Description |
|---|---|---|
|
| The token is missing, expired or revoked. |
|
| No discount with this ID in the store. |
|
| Another request is changing this discount's promotion. Try again. |
The code generation job object
Unique codes are generated by a background job. The code generation endpoints return jobs in this shape, in the data field of the response.
Name | Description |
|---|---|
string | Job ID. |
string |
|
number | Number of codes asked for ( |
number | Codes added to the discount in Shopify so far. |
string or null | Prefix sent with the request, or |
string or null | Suffix sent with the request, or |
string or null | Last error, or |
string or null | Error from Klaviyo, or |
string | When the job was created (ISO 8601). |
string | When the job last changed (ISO 8601). |
Generate unique codes
POST /v1/partner/discounts/{id}/codes
Starts a background job that adds count random codes to a code discount. {id} is the discount's Abra ID. Only discounts with typeName DiscountCodeApp accept codes.
The call returns 202 Accepted with the job straight away. Follow the job with List code generation jobs until its status is DONE or FAILED. The codes are added to the discount in Shopify. Get them from the Shopify admin or the Shopify Admin API.
Path parameters
Name | Description |
|---|---|
string, required | The discount ID ( |
Request body
Name | Description |
|---|---|
integer, required | How many codes to create, from 1 to 500,000. |
string | Text before the random part of each code: up to 20 letters, numbers, |
string | Text after the random part of each code, with the same rules as |
Example request
curl -X POST "$ABRA_API_BASE/v1/partner/discounts/$DISCOUNT_ID/codes" \
-H "Authorization: Bearer $ABRA_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"count": 100}'Response
202 Accepted. Returns the code generation job in data. Its fields are listed in The code generation job object.
Errors
Status | Code | Description |
|---|---|---|
|
|
|
|
| The discount isn't a code discount ( |
|
| The token is missing, expired or revoked. |
|
| No discount with this ID in the store. |
|
| The discount isn't in Shopify yet. |
|
| The job couldn't be started and is marked |
List code generation jobs
GET /v1/partner/discounts/{id}/codes/jobs
Returns the discount's 5 most recent code generation jobs, newest first. Poll it every few seconds to follow a job: created goes up as codes are added in batches, and status ends at DONE or FAILED.
A discount ID with no jobs returns an empty list.
Path parameters
Name | Description |
|---|---|
string, required | The discount ID ( |
Example request
curl "$ABRA_API_BASE/v1/partner/discounts/$DISCOUNT_ID/codes/jobs" \
-H "Authorization: Bearer $ABRA_API_TOKEN"Response
200 OK. data is an array of code generation jobs. Their fields are listed in The code generation job object.
Errors
Status | Code | Description |
|---|---|---|
|
| The token is missing, expired or revoked. |
This page is generated from the Abra API specification (build bc96ccc) ยท ref 84a0e95a8983. Edits made in Pylon are overwritten.