Offers
Automatic discounts: buy X get Y, quantity discounts and amount discounts, applied without a code.
Reach them through admin.offers. Reading needs the marketing:read scope, changing them marketing:write.
List offers
admin.offers.list(query?: ListQuery): Promise<CursorPage<AdminOffer>>
One page of the shop's offers, newest first, or oldest change first with updatedSince. Read the next page with meta.nextCursor as cursor. Scope: marketing:read.
Parameters
| Parameter |
Type |
|
query |
object |
The query fields below, by name. |
Query fields
| Parameter | Type | Description |
|---|
limit | integer | At least 1. At most 100. Default 50. |
cursor | string | meta.nextCursor (or the cursor in links.next) of the previous page. At most 1000 characters. |
updatedSince | string (date-time) | Records changed at or after this time (ISO 8601, any offset or Z), oldest change first, for incremental sync. |
Returns
A CursorPage<AdminOffer>:
| Field | Type | Description |
|---|
links | object | |
links.first | null | |
links.last | null | |
links.prev | string (uri) or null | |
links.next | string (uri) or null | |
meta | object | |
meta.path | string (uri) | |
meta.perPage | integer | |
meta.nextCursor | string or null | |
meta.prevCursor | string or null | |
data | array of AdminOffer | |
data[].id | integer | |
data[].name | string | |
data[].type | string | One of buy_x_get_y, quantity_discount, amount_discount. |
data[].config | OfferConfig | buy_x_get_y takes buy and reward; quantity_discount and amount_discount take tiers. |
data[].config.buy | object | |
data[].config.buy.qty | integer | At least 1. At most 1000. |
data[].config.buy.scope | OfferScope or null | Narrows the products the offer counts; null is the whole catalog. |
data[].config.buy.scope.taxonomyFilters | object (map) or null | |
data[].config.buy.scope.taxonomyLabels | object (map) or null | |
data[].config.buy.scope.productIds | array of integer or null | At most 200 items. |
data[].config.buy.scope.productLabels | object (map) or null | |
data[].config.buy.scope.excludeProductIds | array of integer or null | At most 200 items. |
data[].config.buy.scope.excludeProductLabels | object (map) or null | |
data[].config.reward | object | |
data[].config.reward.kind | string | One of items, discount. |
data[].config.reward.qty | integer or null | Required for items. At least 1. At most 1000. |
data[].config.reward.getScope | OfferScope or null | Narrows the products the offer counts; null is the whole catalog. |
data[].config.reward.getScope.taxonomyFilters | object (map) or null | |
data[].config.reward.getScope.taxonomyLabels | object (map) or null | |
data[].config.reward.getScope.productIds | array of integer or null | At most 200 items. |
data[].config.reward.getScope.productLabels | object (map) or null | |
data[].config.reward.getScope.excludeProductIds | array of integer or null | At most 200 items. |
data[].config.reward.getScope.excludeProductLabels | object (map) or null | |
data[].config.reward.valueType | string | One of percentage, fixed. |
data[].config.reward.value | number | At most 100 for a percentage. |
data[].config.reward.appliesTo | string or null | Required for discount. One of buy_items, order. |
data[].config.maxApplications | integer or null | At least 1. |
data[].config.tiers | array of object | minQty for quantity_discount, minSubtotal for amount_discount; thresholds must differ. At most 10 items. |
data[].config.tiers[].minQty | integer | At least 1. |
data[].config.tiers[].minSubtotal | number | At least 0. |
data[].config.tiers[].valueType | string | One of percentage, fixed. |
data[].config.tiers[].value | number | |
data[].config.maxDiscountAmount | number or null | amount_discount only. At least 0. |
data[].config.scope | OfferScope or null | Narrows the products the offer counts; null is the whole catalog. |
data[].config.scope.taxonomyFilters | object (map) or null | |
data[].config.scope.taxonomyLabels | object (map) or null | |
data[].config.scope.productIds | array of integer or null | At most 200 items. |
data[].config.scope.productLabels | object (map) or null | |
data[].config.scope.excludeProductIds | array of integer or null | At most 200 items. |
data[].config.scope.excludeProductLabels | object (map) or null | |
data[].status | boolean | |
data[].combinableWithCoupons | boolean | |
data[].priority | integer or null | |
data[].usageLimit | integer or null | |
data[].usedCount | integer or null | |
data[].startsAt | string (date-time) or null | |
data[].endsAt | string (date-time) or null | |
data[].createdAt | string (date-time) or null | |
data[].updatedAt | string (date-time) or null | |
Errors
| Status | When |
|---|
401 | invalid_api_key: no active Admin key in Authorization: Bearer. |
403 | admin_key_in_browser (an Origin header was sent), ip_not_allowed, plan_required(the shop's plan lacks the Integration API, or the feature the endpoint needs), orinsufficient_scope. |
422 | Validation errors ({ message, errors }), or an idempotency refusal(idempotency_key_reused, idempotency_key_invalid). |
429 | Rate limited. |
Example
const { data, meta } = await admin.offers.list({ limit: 50 });
const cursor = meta.nextCursor;
Iterate over every offer
admin.offers.all(query?: ListQuery): AsyncGenerator<AdminOffer, void, undefined>
Every offer matching the query, one at a time, fetching the next page as you read. It takes the same query as list, without cursor. Scope: marketing:read.
Returns
An async iterable of AdminOffer, each:
| Field | Type | Description |
|---|
[].id | integer | |
[].name | string | |
[].type | string | One of buy_x_get_y, quantity_discount, amount_discount. |
[].config | OfferConfig | buy_x_get_y takes buy and reward; quantity_discount and amount_discount take tiers. |
[].config.buy | object | |
[].config.buy.qty | integer | At least 1. At most 1000. |
[].config.buy.scope | OfferScope or null | Narrows the products the offer counts; null is the whole catalog. |
[].config.buy.scope.taxonomyFilters | object (map) or null | |
[].config.buy.scope.taxonomyLabels | object (map) or null | |
[].config.buy.scope.productIds | array of integer or null | At most 200 items. |
[].config.buy.scope.productLabels | object (map) or null | |
[].config.buy.scope.excludeProductIds | array of integer or null | At most 200 items. |
[].config.buy.scope.excludeProductLabels | object (map) or null | |
[].config.reward | object | |
[].config.reward.kind | string | One of items, discount. |
[].config.reward.qty | integer or null | Required for items. At least 1. At most 1000. |
[].config.reward.getScope | OfferScope or null | Narrows the products the offer counts; null is the whole catalog. |
[].config.reward.getScope.taxonomyFilters | object (map) or null | |
[].config.reward.getScope.taxonomyLabels | object (map) or null | |
[].config.reward.getScope.productIds | array of integer or null | At most 200 items. |
[].config.reward.getScope.productLabels | object (map) or null | |
[].config.reward.getScope.excludeProductIds | array of integer or null | At most 200 items. |
[].config.reward.getScope.excludeProductLabels | object (map) or null | |
[].config.reward.valueType | string | One of percentage, fixed. |
[].config.reward.value | number | At most 100 for a percentage. |
[].config.reward.appliesTo | string or null | Required for discount. One of buy_items, order. |
[].config.maxApplications | integer or null | At least 1. |
[].config.tiers | array of object | minQty for quantity_discount, minSubtotal for amount_discount; thresholds must differ. At most 10 items. |
[].config.tiers[].minQty | integer | At least 1. |
[].config.tiers[].minSubtotal | number | At least 0. |
[].config.tiers[].valueType | string | One of percentage, fixed. |
[].config.tiers[].value | number | |
[].config.maxDiscountAmount | number or null | amount_discount only. At least 0. |
[].config.scope | OfferScope or null | Narrows the products the offer counts; null is the whole catalog. |
[].config.scope.taxonomyFilters | object (map) or null | |
[].config.scope.taxonomyLabels | object (map) or null | |
[].config.scope.productIds | array of integer or null | At most 200 items. |
[].config.scope.productLabels | object (map) or null | |
[].config.scope.excludeProductIds | array of integer or null | At most 200 items. |
[].config.scope.excludeProductLabels | object (map) or null | |
[].status | boolean | |
[].combinableWithCoupons | boolean | |
[].priority | integer or null | |
[].usageLimit | integer or null | |
[].usedCount | integer or null | |
[].startsAt | string (date-time) or null | |
[].endsAt | string (date-time) or null | |
[].createdAt | string (date-time) or null | |
[].updatedAt | string (date-time) or null | |
Example
for await (const offer of admin.offers.all({ updatedSince: lastSyncedAt })) {
await erp.saveOffer(offer);
}
Get an offer
admin.offers.get(id: number): Promise<AdminOffer>
One offer by its id. Scope: marketing:read.
Parameters
| Parameter |
Type |
|
id |
number |
The offer's id. |
Returns
An AdminOffer:
| Field | Type | Description |
|---|
id | integer | |
name | string | |
type | string | One of buy_x_get_y, quantity_discount, amount_discount. |
config | OfferConfig | buy_x_get_y takes buy and reward; quantity_discount and amount_discount take tiers. |
config.buy | object | |
config.buy.qty | integer | At least 1. At most 1000. |
config.buy.scope | OfferScope or null | Narrows the products the offer counts; null is the whole catalog. |
config.buy.scope.taxonomyFilters | object (map) or null | |
config.buy.scope.taxonomyLabels | object (map) or null | |
config.buy.scope.productIds | array of integer or null | At most 200 items. |
config.buy.scope.productLabels | object (map) or null | |
config.buy.scope.excludeProductIds | array of integer or null | At most 200 items. |
config.buy.scope.excludeProductLabels | object (map) or null | |
config.reward | object | |
config.reward.kind | string | One of items, discount. |
config.reward.qty | integer or null | Required for items. At least 1. At most 1000. |
config.reward.getScope | OfferScope or null | Narrows the products the offer counts; null is the whole catalog. |
config.reward.getScope.taxonomyFilters | object (map) or null | |
config.reward.getScope.taxonomyLabels | object (map) or null | |
config.reward.getScope.productIds | array of integer or null | At most 200 items. |
config.reward.getScope.productLabels | object (map) or null | |
config.reward.getScope.excludeProductIds | array of integer or null | At most 200 items. |
config.reward.getScope.excludeProductLabels | object (map) or null | |
config.reward.valueType | string | One of percentage, fixed. |
config.reward.value | number | At most 100 for a percentage. |
config.reward.appliesTo | string or null | Required for discount. One of buy_items, order. |
config.maxApplications | integer or null | At least 1. |
config.tiers | array of object | minQty for quantity_discount, minSubtotal for amount_discount; thresholds must differ. At most 10 items. |
config.tiers[].minQty | integer | At least 1. |
config.tiers[].minSubtotal | number | At least 0. |
config.tiers[].valueType | string | One of percentage, fixed. |
config.tiers[].value | number | |
config.maxDiscountAmount | number or null | amount_discount only. At least 0. |
config.scope | OfferScope or null | Narrows the products the offer counts; null is the whole catalog. |
config.scope.taxonomyFilters | object (map) or null | |
config.scope.taxonomyLabels | object (map) or null | |
config.scope.productIds | array of integer or null | At most 200 items. |
config.scope.productLabels | object (map) or null | |
config.scope.excludeProductIds | array of integer or null | At most 200 items. |
config.scope.excludeProductLabels | object (map) or null | |
status | boolean | |
combinableWithCoupons | boolean | |
priority | integer or null | |
usageLimit | integer or null | |
usedCount | integer or null | |
startsAt | string (date-time) or null | |
endsAt | string (date-time) or null | |
createdAt | string (date-time) or null | |
updatedAt | string (date-time) or null | |
Errors
| Status | When |
|---|
401 | invalid_api_key: no active Admin key in Authorization: Bearer. |
403 | admin_key_in_browser (an Origin header was sent), ip_not_allowed, plan_required(the shop's plan lacks the Integration API, or the feature the endpoint needs), orinsufficient_scope. |
404 | not_found: the shop has no such record. |
429 | Rate limited. |
Create an offer
admin.offers.create(input: AdminOfferInput, options?: RequestOptions): Promise<AdminOffer>
A new offer. name, type and config are required. type is buy_x_get_y, which takes buy and reward in its config, or quantity_discount or amount_discount, which take tiers. Scope: marketing:write.
Parameters
| Parameter |
Type |
|
input |
object |
The offer's fields, below. |
options |
RequestOptions |
idempotencyKey, signal and headers (see retries). |
Request fields
| Field | Type | Description |
|---|
name required | string | At most 255 characters. |
type required | string | One of buy_x_get_y, quantity_discount, amount_discount. |
config required | OfferConfig | buy_x_get_y takes buy and reward; quantity_discount and amount_discount take tiers. |
config.buy required | object | |
config.buy.qty required | integer | At least 1. At most 1000. |
config.buy.scope | OfferScope or null | Narrows the products the offer counts; null is the whole catalog. |
config.buy.scope.taxonomyFilters | object (map) or null | |
config.buy.scope.taxonomyLabels | object (map) or null | |
config.buy.scope.productIds | array of integer or null | At most 200 items. |
config.buy.scope.productLabels | object (map) or null | |
config.buy.scope.excludeProductIds | array of integer or null | At most 200 items. |
config.buy.scope.excludeProductLabels | object (map) or null | |
config.reward required | object | |
config.reward.kind required | string | One of items, discount. |
config.reward.qty | integer or null | Required for items. At least 1. At most 1000. |
config.reward.getScope | OfferScope or null | Narrows the products the offer counts; null is the whole catalog. |
config.reward.getScope.taxonomyFilters | object (map) or null | |
config.reward.getScope.taxonomyLabels | object (map) or null | |
config.reward.getScope.productIds | array of integer or null | At most 200 items. |
config.reward.getScope.productLabels | object (map) or null | |
config.reward.getScope.excludeProductIds | array of integer or null | At most 200 items. |
config.reward.getScope.excludeProductLabels | object (map) or null | |
config.reward.valueType required | string | One of percentage, fixed. |
config.reward.value required | number | At most 100 for a percentage. |
config.reward.appliesTo | string or null | Required for discount. One of buy_items, order. |
config.maxApplications | integer or null | At least 1. |
config.tiers required | array of object | minQty for quantity_discount, minSubtotal for amount_discount; thresholds must differ. At most 10 items. |
config.tiers[].minQty | integer | At least 1. |
config.tiers[].minSubtotal | number | At least 0. |
config.tiers[].valueType required | string | One of percentage, fixed. |
config.tiers[].value required | number | |
config.maxDiscountAmount | number or null | amount_discount only. At least 0. |
config.scope | OfferScope or null | Narrows the products the offer counts; null is the whole catalog. |
config.scope.taxonomyFilters | object (map) or null | |
config.scope.taxonomyLabels | object (map) or null | |
config.scope.productIds | array of integer or null | At most 200 items. |
config.scope.productLabels | object (map) or null | |
config.scope.excludeProductIds | array of integer or null | At most 200 items. |
config.scope.excludeProductLabels | object (map) or null | |
combinableWithCoupons | boolean or null | |
priority | integer or null | At least 0. At most 1000. |
usageLimit | integer or null | At least 1. |
startsAt | string (date-time) or null | |
endsAt | string (date-time) or null | |
status | boolean or null | |
Returns
The new AdminOffer:
| Field | Type | Description |
|---|
id | integer | |
name | string | |
type | string | One of buy_x_get_y, quantity_discount, amount_discount. |
config | OfferConfig | buy_x_get_y takes buy and reward; quantity_discount and amount_discount take tiers. |
config.buy | object | |
config.buy.qty | integer | At least 1. At most 1000. |
config.buy.scope | OfferScope or null | Narrows the products the offer counts; null is the whole catalog. |
config.buy.scope.taxonomyFilters | object (map) or null | |
config.buy.scope.taxonomyLabels | object (map) or null | |
config.buy.scope.productIds | array of integer or null | At most 200 items. |
config.buy.scope.productLabels | object (map) or null | |
config.buy.scope.excludeProductIds | array of integer or null | At most 200 items. |
config.buy.scope.excludeProductLabels | object (map) or null | |
config.reward | object | |
config.reward.kind | string | One of items, discount. |
config.reward.qty | integer or null | Required for items. At least 1. At most 1000. |
config.reward.getScope | OfferScope or null | Narrows the products the offer counts; null is the whole catalog. |
config.reward.getScope.taxonomyFilters | object (map) or null | |
config.reward.getScope.taxonomyLabels | object (map) or null | |
config.reward.getScope.productIds | array of integer or null | At most 200 items. |
config.reward.getScope.productLabels | object (map) or null | |
config.reward.getScope.excludeProductIds | array of integer or null | At most 200 items. |
config.reward.getScope.excludeProductLabels | object (map) or null | |
config.reward.valueType | string | One of percentage, fixed. |
config.reward.value | number | At most 100 for a percentage. |
config.reward.appliesTo | string or null | Required for discount. One of buy_items, order. |
config.maxApplications | integer or null | At least 1. |
config.tiers | array of object | minQty for quantity_discount, minSubtotal for amount_discount; thresholds must differ. At most 10 items. |
config.tiers[].minQty | integer | At least 1. |
config.tiers[].minSubtotal | number | At least 0. |
config.tiers[].valueType | string | One of percentage, fixed. |
config.tiers[].value | number | |
config.maxDiscountAmount | number or null | amount_discount only. At least 0. |
config.scope | OfferScope or null | Narrows the products the offer counts; null is the whole catalog. |
config.scope.taxonomyFilters | object (map) or null | |
config.scope.taxonomyLabels | object (map) or null | |
config.scope.productIds | array of integer or null | At most 200 items. |
config.scope.productLabels | object (map) or null | |
config.scope.excludeProductIds | array of integer or null | At most 200 items. |
config.scope.excludeProductLabels | object (map) or null | |
status | boolean | |
combinableWithCoupons | boolean | |
priority | integer or null | |
usageLimit | integer or null | |
usedCount | integer or null | |
startsAt | string (date-time) or null | |
endsAt | string (date-time) or null | |
createdAt | string (date-time) or null | |
updatedAt | string (date-time) or null | |
Errors
| Status | When |
|---|
401 | invalid_api_key: no active Admin key in Authorization: Bearer. |
403 | admin_key_in_browser (an Origin header was sent), ip_not_allowed, plan_required(the shop's plan lacks the Integration API, or the feature the endpoint needs), orinsufficient_scope. |
409 | idempotency_in_progress: a request with this Idempotency-Key is still running. Retry with the same key after Retry-After seconds; the first answer is then replayed. |
422 | Validation errors ({ message, errors }), or an idempotency refusal(idempotency_key_reused, idempotency_key_invalid). |
429 | Rate limited. |
Example
const offer = await admin.offers.create({
name: 'Buy more, save more',
type: 'quantity_discount',
config: {
tiers: [
{ minQty: 3, valueType: 'percentage', value: 10 },
{ minQty: 5, valueType: 'percentage', value: 15 },
],
},
endsAt: '2026-12-31T23:59:59Z',
});
Update an offer
admin.offers.update(id: number, changes: Partial<AdminOfferInput>, options?: UpdateOptions): Promise<AdminOffer>
Changes only the fields sent. A config sent replaces the whole config, and setting status to false pauses the offer. Scope: marketing:write.
Parameters
| Parameter |
Type |
|
id |
number |
The offer's id. |
changes |
object |
The fields to change, below. |
options |
UpdateOptions |
unmodifiedSince (the updatedAt you read; a newer offer is refused with 409 edit_conflict) and idempotencyKey. |
Request fields
| Field | Type | Description |
|---|
name | string | At most 255 characters. |
type | string | One of buy_x_get_y, quantity_discount, amount_discount. |
config | OfferConfig | buy_x_get_y takes buy and reward; quantity_discount and amount_discount take tiers. |
config.buy required | object | |
config.buy.qty required | integer | At least 1. At most 1000. |
config.buy.scope | OfferScope or null | Narrows the products the offer counts; null is the whole catalog. |
config.buy.scope.taxonomyFilters | object (map) or null | |
config.buy.scope.taxonomyLabels | object (map) or null | |
config.buy.scope.productIds | array of integer or null | At most 200 items. |
config.buy.scope.productLabels | object (map) or null | |
config.buy.scope.excludeProductIds | array of integer or null | At most 200 items. |
config.buy.scope.excludeProductLabels | object (map) or null | |
config.reward required | object | |
config.reward.kind required | string | One of items, discount. |
config.reward.qty | integer or null | Required for items. At least 1. At most 1000. |
config.reward.getScope | OfferScope or null | Narrows the products the offer counts; null is the whole catalog. |
config.reward.getScope.taxonomyFilters | object (map) or null | |
config.reward.getScope.taxonomyLabels | object (map) or null | |
config.reward.getScope.productIds | array of integer or null | At most 200 items. |
config.reward.getScope.productLabels | object (map) or null | |
config.reward.getScope.excludeProductIds | array of integer or null | At most 200 items. |
config.reward.getScope.excludeProductLabels | object (map) or null | |
config.reward.valueType required | string | One of percentage, fixed. |
config.reward.value required | number | At most 100 for a percentage. |
config.reward.appliesTo | string or null | Required for discount. One of buy_items, order. |
config.maxApplications | integer or null | At least 1. |
config.tiers required | array of object | minQty for quantity_discount, minSubtotal for amount_discount; thresholds must differ. At most 10 items. |
config.tiers[].minQty | integer | At least 1. |
config.tiers[].minSubtotal | number | At least 0. |
config.tiers[].valueType required | string | One of percentage, fixed. |
config.tiers[].value required | number | |
config.maxDiscountAmount | number or null | amount_discount only. At least 0. |
config.scope | OfferScope or null | Narrows the products the offer counts; null is the whole catalog. |
config.scope.taxonomyFilters | object (map) or null | |
config.scope.taxonomyLabels | object (map) or null | |
config.scope.productIds | array of integer or null | At most 200 items. |
config.scope.productLabels | object (map) or null | |
config.scope.excludeProductIds | array of integer or null | At most 200 items. |
config.scope.excludeProductLabels | object (map) or null | |
combinableWithCoupons | boolean or null | |
priority | integer or null | At least 0. At most 1000. |
usageLimit | integer or null | At least 1. |
startsAt | string (date-time) or null | |
endsAt | string (date-time) or null | |
status | boolean or null | |
updatedAt | string (date-time) or null | The record's updatedAt as you read it; a newer record gets 409 edit_conflict. |
Returns
The changed AdminOffer:
| Field | Type | Description |
|---|
id | integer | |
name | string | |
type | string | One of buy_x_get_y, quantity_discount, amount_discount. |
config | OfferConfig | buy_x_get_y takes buy and reward; quantity_discount and amount_discount take tiers. |
config.buy | object | |
config.buy.qty | integer | At least 1. At most 1000. |
config.buy.scope | OfferScope or null | Narrows the products the offer counts; null is the whole catalog. |
config.buy.scope.taxonomyFilters | object (map) or null | |
config.buy.scope.taxonomyLabels | object (map) or null | |
config.buy.scope.productIds | array of integer or null | At most 200 items. |
config.buy.scope.productLabels | object (map) or null | |
config.buy.scope.excludeProductIds | array of integer or null | At most 200 items. |
config.buy.scope.excludeProductLabels | object (map) or null | |
config.reward | object | |
config.reward.kind | string | One of items, discount. |
config.reward.qty | integer or null | Required for items. At least 1. At most 1000. |
config.reward.getScope | OfferScope or null | Narrows the products the offer counts; null is the whole catalog. |
config.reward.getScope.taxonomyFilters | object (map) or null | |
config.reward.getScope.taxonomyLabels | object (map) or null | |
config.reward.getScope.productIds | array of integer or null | At most 200 items. |
config.reward.getScope.productLabels | object (map) or null | |
config.reward.getScope.excludeProductIds | array of integer or null | At most 200 items. |
config.reward.getScope.excludeProductLabels | object (map) or null | |
config.reward.valueType | string | One of percentage, fixed. |
config.reward.value | number | At most 100 for a percentage. |
config.reward.appliesTo | string or null | Required for discount. One of buy_items, order. |
config.maxApplications | integer or null | At least 1. |
config.tiers | array of object | minQty for quantity_discount, minSubtotal for amount_discount; thresholds must differ. At most 10 items. |
config.tiers[].minQty | integer | At least 1. |
config.tiers[].minSubtotal | number | At least 0. |
config.tiers[].valueType | string | One of percentage, fixed. |
config.tiers[].value | number | |
config.maxDiscountAmount | number or null | amount_discount only. At least 0. |
config.scope | OfferScope or null | Narrows the products the offer counts; null is the whole catalog. |
config.scope.taxonomyFilters | object (map) or null | |
config.scope.taxonomyLabels | object (map) or null | |
config.scope.productIds | array of integer or null | At most 200 items. |
config.scope.productLabels | object (map) or null | |
config.scope.excludeProductIds | array of integer or null | At most 200 items. |
config.scope.excludeProductLabels | object (map) or null | |
status | boolean | |
combinableWithCoupons | boolean | |
priority | integer or null | |
usageLimit | integer or null | |
usedCount | integer or null | |
startsAt | string (date-time) or null | |
endsAt | string (date-time) or null | |
createdAt | string (date-time) or null | |
updatedAt | string (date-time) or null | |
Errors
| Status | When |
|---|
401 | invalid_api_key: no active Admin key in Authorization: Bearer. |
403 | admin_key_in_browser (an Origin header was sent), ip_not_allowed, plan_required(the shop's plan lacks the Integration API, or the feature the endpoint needs), orinsufficient_scope. |
404 | not_found: the shop has no such record. |
409 | edit_conflict (the record changed after If-Unmodified-Since or updatedAt), or idempotency_in_progress. |
422 | Validation errors ({ message, errors }), or an idempotency refusal(idempotency_key_reused, idempotency_key_invalid). |
429 | Rate limited. |
Example
const offer = await admin.offers.get(3);
await admin.offers.update(
3,
{ status: false },
{ unmodifiedSince: offer.updatedAt ?? undefined },
);
Delete an offer
admin.offers.delete(id: number): Promise<void>
Deletes an offer. Scope: marketing:write.
Parameters
| Parameter |
Type |
|
id |
number |
The offer's id. |
Returns
Nothing.
Errors
| Status | When |
|---|
401 | invalid_api_key: no active Admin key in Authorization: Bearer. |
403 | admin_key_in_browser (an Origin header was sent), ip_not_allowed, plan_required(the shop's plan lacks the Integration API, or the feature the endpoint needs), orinsufficient_scope. |
404 | not_found: the shop has no such record. |
409 | idempotency_in_progress: a request with this Idempotency-Key is still running. Retry with the same key after Retry-After seconds; the first answer is then replayed. |
422 | Validation errors ({ message, errors }), or an idempotency refusal(idempotency_key_reused, idempotency_key_invalid). |
429 | Rate limited. |