Skip to content

Create a code or automatic discount

POST/admin/v1/stores/{store_id}/discounts
  • discounts:write
  • Idempotency-Key supported

Create a code or automatic discount.

Path parameters

  • store_idstringrequired

    The store's ID, like store_01k8qs5s…. Apps get it with the install, in the OAuth redirect and the token response.

Headers

  • Idempotency-Keystring

    Send the same key to retry safely: the first answer is replayed for 24 hours.

  • shop-api-versionYYYY-MM

    The version to answer in. Without it, your app’s pinned version, else the newest.

Body

  • titlestringrequired
  • methodenumrequired
    • code
    • automatic
    • unique_codes
  • effectobject | object | object | object | object | objectrequired

    What a discount does.

  • title_translationsobject

    The name shoppers see in the store's other languages, by locale ({"ar": "…"}).

  • codestring · or null

    Required for code discounts: 1–64 letters, digits, - or _.

  • requirementobject | object | object · or null

    Defaults to none.

  • eligibilityobject | object | object | object · or null

    Defaults to everyone.

  • combines_withobject · or null

    Defaults to combining with nothing.

Returns

201 Discount created.

Errors

  • 403forbiddenMissing permission.
  • 409Code taken or automatic discount limit reached.
  • 422validation_failedValidation failed.