Create a promotion
https://api.cartirra.com/v1/promotionsCreate a draft.
- Authentication
- Secret key (
Authorization: Bearer sk_…). How keys work - Permission
promotions:manage- Idempotency
Idempotency-Keyheader recommended: a retry with the same key returns the first response. Details
Headers
Idempotency-KeystringUnique per request; replays return the first response
Request body required
JSON (Content-Type: application/json).
namestringrequiredtypestringrequiredpercentnumbernullablePercent off (percentage, and first purchase / cart threshold when percent)
amountMoneyDtoAmount off, or the delivery price for fixed shipping
max_discountMoneyDtonullableactivationstringrequiredcodestringnullablemin_order_valueMoneyDtonullablemax_order_valueMoneyDtonullablecustomer_restrictionstringstore_idsarray of stringEmpty = every store
customer_idsarray of stringWith customer_restriction "specific": the customers it is for (at most 500)
total_limitnumbernullableper_customer_limitnumbernullablestackablebooleanAutomatic only: may combine with a code and other stackable promotions
starts_atstring (date-time)nullableends_atstring (date-time)nullable
Responses
idstringrequirednamestringrequiredtypestringrequiredpercentnumbernullablerequiredPercentage promotions
amountMoneyResponsenullablerequiredFixed-amount promotions
max_discountMoneyResponsenullablerequiredactivationstringrequiredcodestringnullablerequiredmin_order_valueMoneyResponsenullablerequiredmax_order_valueMoneyResponsenullablerequiredcustomer_restrictionstringrequiredstore_idsarray of stringrequiredEmpty = every store
customersarray of PromotionCustomerRefResponserequiredWith customer_restriction "specific": the customers it is for
total_limitnumbernullablerequiredper_customer_limitnumbernullablerequiredstackablebooleanrequiredstarts_atstring (date-time)nullablerequiredends_atstring (date-time)nullablerequiredstatusstringrequiredredemption_countintegerrequiredConfirmed redemptions in this mode (shown against total_limit, e.g. "12/100")
created_byPersonRefResponsenullablerequiredThe member who created it; null when an API key or Cartirra did
created_atstringrequired
Errors
Every error has the same body: { "error": { "code", "message", "details"?, "request_id" } }. See Errors for every code.
- 400The request is malformed or a field is invalid (`VALIDATION_FAILED`).
- 401Missing, malformed, revoked or expired API key (`UNAUTHENTICATED`), or a key this route does not accept, such as a public key (`CREDENTIAL_NOT_ACCEPTED`).
- 403The key may not do this (`PERMISSION_DENIED`, `LIVE_MODE_NOT_ENABLED`, `PLAN_LIMIT_REACHED`, …).
- 409The resource is in a state that does not allow this (for example `ORDER_NOT_CANCELLABLE`, `REFUND_NOT_ALLOWED`).
- 422The request is valid but breaks a business rule.
- 429Too many requests for this key (`RATE_LIMITED`); wait for `Retry-After` seconds.
- 500Something went wrong on our side (`INTERNAL`). Safe to retry with the same `Idempotency-Key`.