Publish a discount draft
Not yet enabled for merchant accounts. Returns 403 ERR_WRITE_NOT_ALLOWED until enabled for your account.
Creates the discount on Shopify from a draft made with POST /discounts, with the draft's effective settings. The request has no body. Only the API key that made the draft can publish it. The discount keeps the draft's id. A code pool's codes are uploaded to Shopify over the next minutes, until fillStatus is full.
Publishing again is safe: a published draft returns the discount with 200, and no second discount is created. When the response is lost or is a 5XX, call again with the same id.
It can be obtained in Recart account after contacting Support
ID of the draft
The draft was already published; the body is the discount, as with 201
The discount was created on Shopify
ERR_CODE_TAKEN — another discount took the code after the draft
was made.
ERR_BAD_REQUEST — Shopify rejected the draft's settings.
detail is Shopify's message.
After either error the draft cannot be published, and calling again returns the same error. Correct the settings and create a new draft.
ERR_UNAUTHORIZED — the API key is missing.
ERR_FORBIDDEN — the API key is unknown or has been revoked.
ERR_WRITE_NOT_ALLOWED — creating discounts is not enabled for
this account. Do not retry.
ERR_SHOPIFY_ACCESS_DENIED — Shopify denied access to the
store's discounts. Publishing cannot work until the store's
Shopify connection is fixed. Do not retry.
ERR_NOT_FOUND — this API key made no draft with this id, or
the draft expired. If an earlier publish of this id returned
409, 5XX, or no response, the discount may already exist on
Shopify. Check there before creating a new draft.
ERR_CONFLICT — a publish of this draft has started and not
finished. Call again in a few seconds with the same id; once the
publish finishes, the call returns the discount. If it keeps
returning 409, the publish stopped partway and cannot finish.
The discount may already exist on Shopify, so check there before
creating a new draft.
ERR_SHOPIFY_THROTTLED — Shopify throttled the request. Nothing
was created. Call again in a minute with the same id. After three
throttled publishes the draft cannot be published, and calling
again returns the same error. Create a new draft.
ERR_LIMIT_REACHED — the publish limit of the site is reached.
detail names the limit and when it resets. Call again after the
reset with the same id, or create a new draft if the draft
expires before then.
HTTP Error response
HTTP Error response
POST /app-integrations/2023-12/discounts/{id}/publish HTTP/1.1
Host: api.recart.com
X-Recart-API-Key: YOUR_API_KEY
Accept: */*
{
"data": {
"type": "discounts",
"attributes": {
"id": "66aa0f1c7e8c9d2b00123abc",
"name": "Welcome 10%",
"status": "active",
"customizationType": "unique",
"expiryType": "fixed",
"type": "basic",
"discountClasses": [
"product"
],
"amount": 10,
"valueType": "PERCENTAGE",
"summary": "10% off entire order",
"appTitle": "text",
"code": "WELCOME10",
"discountCodePattern": "WELCOME{RAND}",
"mode": "refilling",
"targetCount": 10000,
"availableCount": 8612,
"fillStatus": "needFilling",
"durationSeconds": 86400,
"template": {
"ANY_ADDITIONAL_PROPERTY": "anything"
},
"startsAt": "2026-01-01T00:00:00.000Z",
"endsAt": "2026-01-01T00:00:00.000Z",
"shopifyDiscountId": "1234567890123",
"createdAt": "2026-01-01T00:00:00.000Z",
"updatedAt": "2026-01-01T00:00:00.000Z",
"usage": {
"flows": [
{
"id": "6138d0ac2d79e00001210035",
"name": "Welcome flow"
}
],
"campaigns": [
{
"id": "6138d0ac2d79e00001210035",
"name": "Welcome flow"
}
],
"optinTools": [
{
"id": "6138d0ac2d79e00001210035",
"name": "Welcome flow"
}
]
},
"statistics": {
"sent": 1388,
"used": 212,
"sales": {
"USD": 9418.4
},
"codesCount": 10000
}
}
}
}Last updated
Was this helpful?