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

id

string

Abra ID of the discount. Use it in {id} paths, including for unique codes.

title

string

Name of the discount. For a code discount created through the API, it's also a code.

discountClass

string

PRODUCT, ORDER or SHIPPING.

typeName

string

DiscountCodeApp or DiscountAutomaticApp for Abra discounts; the Shopify type, such as DiscountCodeBasic, for attached native discounts.

hasBulkCodes

boolean

true when the discount has unique codes.

discountValueType

string or null

Same as discountValue.type.

discountValue

object or null

The discount's settings; see Abra API: Discount types. One of 13 shapes, chosen by type.

status

string

ACTIVE, SCHEDULED (starts later) or EXPIRED.

summary

string

Short text summary. Empty for discounts created through the API.

entitled

object or null

Which products the discount covers. List results only include markets. Fields listed under entitled below.

prerequisite

object or null

Conditions such as a minimum purchase and which customers qualify. Fields listed under prerequisite below.

startsAt

string or null

Start time (ISO 8601), or null.

endsAt

string or null

End time (ISO 8601), or null for no end date.

appliesOncePerCustomer

boolean

Whether each customer can use it only once.

appliesOnOneTimePurchase

boolean

Whether it applies to one-time purchases.

appliesOnSubscription

boolean

Whether it applies to subscription purchases.

usageLimit

number or null

Total uses allowed, or null for no limit.

recurringCycleLimit

number or null

Billing cycles it applies to for subscriptions, or null.

combinesWith

object

Which other kinds of discounts it combines with. Fields listed under combinesWith below.

tags

array of strings

Tags on the Shopify discount.

productDiscountsWithTagsOnSameCartLine

array of strings

Tags of other product discounts that can apply to the same cart line.

shopifyDiscountId

string or null

Shopify ID (GID) of the discount. Use it in a promotion's discounts.

managedBy

string

ABRA for discounts on Abra's functions, SHOPIFY for attached native discounts.

entitled

Name

Description

type

string

AllDiscountItems (all products), DiscountCollections (products in collections) or DiscountProducts (the listed products or variants). The other values are set by Abra for specific discount kinds.

One of:

  • AllDiscountItems

  • DiscountCollections

  • DiscountProducts

  • FreeShipping

  • BxgyDiscount

  • BXGY

all

boolean

true with AllDiscountItems.

collections

array of strings or objects

Shopify collection IDs, or objects with id and handle.

products

array of strings or objects

Shopify product IDs, or objects with id, handle and variants.

variants

array of strings

Shopify product variant IDs.

selectionMethod

string

product to pick products directly, or metafield to pick variants by metafield value in metafieldSelections.

metafieldSelections

array of objects

Metafield values that pick the covered variants. Each item is a Metafield selection object.

markets

array of strings

Older market filter, cleared when the discount is updated. To limit a discount to markets, use prerequisite.customerSelection with type MARKETS.

shopifyMarketIds

array of strings

Older market filter, cleared when the discount is updated. Use prerequisite.customerSelection instead.

currency

string

Currency code, for example USD.

prerequisite

Name

Description

minimumRequirement

object

Minimum the cart must reach: an item quantity or a subtotal. Fields listed under prerequisite.minimumRequirement below.

customerSelection

object

Which customers can use the discount. Defaults to all customers. Fields listed under prerequisite.customerSelection below.

tapCartExclusive

boolean

true makes the discount exclusive to Tapcart. Defaults to false.

posExclusive

boolean

true makes the discount exclusive to Shopify POS, at the locations in posLocationIds, or at all POS locations when that list is empty. Defaults to false.

posLocationIds

array of strings

With posExclusive, the Shopify POS locations the discount is limited to. Empty means all POS locations.

prerequisite.minimumRequirement

Name

Description

greaterThanOrEqualToQuantity

number

Minimum number of items.

greaterThanOrEqualToSubtotal

object

Minimum subtotal. A Money object.

prerequisite.customerSelection

Name

Description

type

string

ALL, SEGMENTS (Shopify customer segments), CUSTOMERS (specific customers) or MARKETS (Shopify markets).

ids

array of strings

Shopify IDs of the segments, customers or markets. Required unless type is ALL.

combinesWith

Name

Description

orderDiscounts

boolean

Combines with order discounts.

productDiscounts

boolean

Combines with product discounts.

shippingDiscounts

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

page

integer

The page to return. The first page is 1. Defaults to 1.

limit

integer

The number of discounts per page. Between 1 and 100. Defaults to 25.

status

string

Returns only discounts with this status. One of ACTIVE, EXPIRED or SCHEDULED.

discountClass

string

Returns only discounts of this class. One of PRODUCT, ORDER or SHIPPING.

typeName

string

Comma-separated list of typeNames. Matches discounts whose typeName is in the set. Each value is one of DiscountAutomaticApp or DiscountCodeApp.

discountValueType

string

Comma-separated list of discountValueTypes. Matches discounts whose discountValueType is in the set.

promotionId

string

Comma-separated list of promotion Abra IDs. Returns discounts attached to any of them.

search

string

Returns only discounts whose title contains this text. The match is not case-sensitive.

sort

string

The sort order, as field:direction. field is createdAt, updatedAt, title, status, method (sorts by typeName) or type (sorts by discountValueType). direction is asc or desc, and is desc when you leave it out. Defaults to createdAt:desc.

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

page

number

Current page number.

limit

number

Number of items per page.

total

number

Total number of items.

totalPages

number

Total number of pages.

hasNextPage

boolean

Whether there is a next page.

hasPreviousPage

boolean

Whether there is a previous page.

Errors

Status

Code

Description

400

VALIDATION_FAILED

A query value is invalid, for example limit above 100 or a promotionId that isn't a UUID. See issues.

400

SORT_FIELD_INVALID

sort uses a field that can't be sorted on.

400

SORT_DIRECTION_INVALID

The sort direction isn't asc or desc.

401

UNAUTHORIZED

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

title

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 TAG- or be a reserved word such as PUBLIC.

discountClass

string, required

What the discount reduces: PRODUCT, ORDER or SHIPPING. The Abra types use PRODUCT, except CollectionOrderDiscount, which is always saved as ORDER.

typeName

string

DiscountCodeApp (the default) for a discount customers apply with a code, or DiscountAutomaticApp for one that applies by itself. When you attach a native Shopify discount with discountId, send its Shopify type, such as DiscountCodeBasic.

One of:

  • DiscountCodeApp

  • DiscountAutomaticApp

  • DiscountCodeBasic

  • DiscountAutomaticBasic

  • DiscountCodeBxgy

  • DiscountAutomaticBxgy

  • DiscountCodeFreeShipping

  • DiscountAutomaticFreeShipping

discountValue

object, required

What the discount gives. One shape per type; see Abra API: Discount types. One of 13 shapes, chosen by type.

entitled

object

Which products the discount covers. Defaults to all products. Fields listed under entitled below.

prerequisite

object

Conditions such as a minimum purchase and which customers qualify. Defaults to all customers and no minimum. Fields listed under prerequisite below.

combinesWith

object

Which other kinds of discounts this one combines with at checkout. Each flag defaults to false. Fields listed under combinesWith below.

tags

array of strings

Up to 5 tags, saved on the Shopify discount.

productDiscountsWithTagsOnSameCartLine

array of strings

Up to 10 tags of other product discounts that can apply to the same cart line. Product discounts only.

startsAt

string

Start time (ISO 8601). Defaults to now.

endsAt

string

End time (ISO 8601), after startsAt. Leave it out for no end date.

appliesOncePerCustomer

boolean

Code discounts only: each customer can use it once. Defaults to false.

appliesOnOneTimePurchase

boolean

Applies to one-time purchases. Defaults to true.

appliesOnSubscription

boolean

Applies to subscription purchases. Defaults to false. If both purchase flags are false, one-time purchases stay on.

usageLimit

number

Code discounts only: how many times the discount can be used in total. Leave it out for no limit.

recurringCycleLimit

number

For subscriptions: how many billing cycles the discount applies to.

promotionId

string

Abra ID of a promotion to attach the discount to. The promotion's dates are then set from this discount.

discountId

string

Shopify ID (GID) of an existing native Shopify discount to attach instead of creating one, for example gid://shopify/DiscountCodeNode/123. Required for the native types.

entitled

Name

Description

type

string, required

AllDiscountItems (all products), DiscountCollections (products in collections) or DiscountProducts (the listed products or variants). The other values are set by Abra for specific discount kinds.

One of:

  • AllDiscountItems

  • DiscountCollections

  • DiscountProducts

  • FreeShipping

  • BxgyDiscount

  • BXGY

all

boolean

true with AllDiscountItems.

collections

array of strings or objects

Shopify collection IDs, or objects with id and handle.

products

array of strings or objects

Shopify product IDs, or objects with id, handle and variants.

variants

array of strings

Shopify product variant IDs.

selectionMethod

string

product to pick products directly, or metafield to pick variants by metafield value in metafieldSelections.

metafieldSelections

array of objects

Metafield values that pick the covered variants. Each item is a Metafield selection object.

markets

array of strings

Older market filter, cleared when the discount is updated. To limit a discount to markets, use prerequisite.customerSelection with type MARKETS.

shopifyMarketIds

array of strings

Older market filter, cleared when the discount is updated. Use prerequisite.customerSelection instead.

currency

string

Currency code, for example USD.

prerequisite

Name

Description

minimumRequirement

object

Minimum the cart must reach: an item quantity or a subtotal. Fields listed under prerequisite.minimumRequirement below.

customerSelection

object

Which customers can use the discount. Defaults to all customers. Fields listed under prerequisite.customerSelection below.

tapCartExclusive

boolean

true makes the discount exclusive to Tapcart. Defaults to false.

posExclusive

boolean

true makes the discount exclusive to Shopify POS, at the locations in posLocationIds, or at all POS locations when that list is empty. Defaults to false.

posLocationIds

array of strings

With posExclusive, the Shopify POS locations the discount is limited to. Empty means all POS locations.

prerequisite.minimumRequirement

Name

Description

greaterThanOrEqualToQuantity

number

Minimum number of items.

greaterThanOrEqualToSubtotal

object

Minimum subtotal. A Money object.

prerequisite.customerSelection

Name

Description

type

string, required

ALL, SEGMENTS (Shopify customer segments), CUSTOMERS (specific customers) or MARKETS (Shopify markets).

ids

array of strings

Shopify IDs of the segments, customers or markets. Required unless type is ALL.

combinesWith

Name

Description

orderDiscounts

boolean

Combines with order discounts.

productDiscounts

boolean

Combines with product discounts.

shippingDiscounts

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

400

VALIDATION_FAILED

A field is invalid. See issues.

400

UNKNOWN_DISCOUNT_VALUE_TYPE

discountValue.type isn't one of the supported types.

400

GIFT_MINIMUM_REQUIREMENT_REQUIRED

A Gift discount needs prerequisite.minimumRequirement with a subtotal or quantity above 0.

401

UNAUTHORIZED

The token is missing, expired or revoked.

404

NOT_FOUND

promotionId isn't a promotion in the store.

409

DISCOUNT_TITLE_CONFLICT

Another discount in Abra or Shopify already has this title.

422

NATIVE_DISCOUNT_REQUIRES_SHOPIFY_ID

A native Shopify type was sent without discountId.

422

DISCOUNT_MARKET_B2B_NOT_ENABLED

The discount is assigned to a B2B market, and Shopify hasn't enabled B2B discounts for this store.

422

SHOPIFY_USER_ERROR

Shopify rejected the discount. error.description has Shopify's message. Nothing is saved.

422

SHOPIFY_GRAPHQL_ERROR

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

id

string, required

The discount ID (id in the discount object).

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

401

UNAUTHORIZED

The token is missing, expired or revoked.

404

NOT_FOUND

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

id

string, required

The discount ID (id in the discount object).

Request body

Name

Description

title

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.

discountValue

object

Replaces the whole value. See Abra API: Discount types. One of 13 shapes, chosen by type.

entitled

object

Replaces which products the discount covers. Same fields as entitled in Create a discount.

prerequisite

object

Replaces the conditions. Send it along with a Gift discountValue. Same fields as prerequisite in Create a discount.

combinesWith

object

Only the flags you send change. Same fields as combinesWith in Create a discount.

tags

array of strings

Replaces the tags. Up to 5.

productDiscountsWithTagsOnSameCartLine

array of strings

Replaces the list. Up to 10 tags; product discounts only.

startsAt

string

New start time (ISO 8601). The status is worked out again from the dates.

endsAt

string

New end time (ISO 8601), after startsAt. The status is worked out again from the dates.

appliesOncePerCustomer

boolean

Code discounts only: each customer can use it once.

appliesOnOneTimePurchase

boolean

Applies to one-time purchases.

appliesOnSubscription

boolean

Applies to subscription purchases.

usageLimit

number

Code discounts only: how many times the discount can be used in total.

recurringCycleLimit

number

For subscriptions: how many billing cycles the discount applies to.

discountId

string

Ignored on update.

Response

200 OK. Returns the discount in data. Its fields are listed in The discount object.

Errors

Status

Code

Description

400

VALIDATION_FAILED

A field is invalid. See issues.

400

UNKNOWN_DISCOUNT_VALUE_TYPE

discountValue.type isn't one of the supported types.

400

GIFT_MINIMUM_REQUIREMENT_REQUIRED

A Gift discountValue was sent without a prerequisite.minimumRequirement above 0 in the same request.

401

UNAUTHORIZED

The token is missing, expired or revoked.

403

CANNOT_EDIT_NATIVE_DISCOUNT

Native Shopify discounts can't be edited through the API. Edit them in the Shopify admin.

404

NOT_FOUND

No discount with this ID in the store.

409

DISCOUNT_TITLE_CONFLICT

Another discount in Abra or Shopify already has this title.

409

CONFLICT

Another request is changing this discount's promotion. Try again.

422

DISCOUNT_MARKET_B2B_NOT_ENABLED

The discount is assigned to a B2B market, and Shopify hasn't enabled B2B discounts for this store.

422

SHOPIFY_USER_ERROR

Shopify rejected the change. error.description has Shopify's message. The discount is left as it was.

422

SHOPIFY_GRAPHQL_ERROR

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

id

string, required

The discount ID (id in the discount object).

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

401

UNAUTHORIZED

The token is missing, expired or revoked.

404

NOT_FOUND

No discount with this ID in the store.

409

CONFLICT

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

id

string

Job ID.

status

string

PENDING (queued, or waiting for the next batch), RUNNING (adding a batch), DONE (all codes added) or FAILED (stopped; see error).

requested

number

Number of codes asked for (count).

created

number

Codes added to the discount in Shopify so far.

prefix

string or null

Prefix sent with the request, or null.

suffix

string or null

Suffix sent with the request, or null.

error

string or null

Last error, or null. While the job is PENDING or RUNNING it keeps going; with FAILED, this is why it stopped.

klaviyoError

string or null

Error from Klaviyo, or null.

createdAt

string

When the job was created (ISO 8601).

updatedAt

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

id

string, required

The discount ID (id in the discount object).

Request body

Name

Description

count

integer, required

How many codes to create, from 1 to 500,000.

prefix

string

Text before the random part of each code: up to 20 letters, numbers, - or _. Each code is the prefix, 8 random characters and the suffix, in upper case. Must match ^[A-Za-z0-9_-]*$.

suffix

string

Text after the random part of each code, with the same rules as prefix. Up to 20 characters. Must match ^[A-Za-z0-9_-]*$.

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

400

VALIDATION_FAILED

count isn't between 1 and 500,000, or prefix or suffix is over 20 characters or has characters other than letters, numbers, - and _. See issues.

400

BULK_CODES_REQUIRE_CODE_DISCOUNT

The discount isn't a code discount (typeName DiscountCodeApp).

401

UNAUTHORIZED

The token is missing, expired or revoked.

404

NOT_FOUND

No discount with this ID in the store.

422

DISCOUNT_NOT_SYNCED

The discount isn't in Shopify yet.

500

REDEEM_CODES_ENQUEUE_FAILED

The job couldn't be started and is marked FAILED. Try again.

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

id

string, required

The discount ID (id in the discount object).

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

401

UNAUTHORIZED

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.