CartirraAPI
Get API keys

Create a promotion

posthttps://api.cartirra.com/v1/promotions

Create a draft.

Authentication
Secret key (Authorization: Bearer sk_…). How keys work
Permission
promotions:manage
Idempotency
Idempotency-Key header recommended: a retry with the same key returns the first response. Details

Headers

  • Idempotency-Keystring

    Unique per request; replays return the first response

Request body required

JSON (Content-Type: application/json).

  • namestringrequired

    Example 10% off orders

  • typestringrequired

    One of percentage, fixed_amount, free_shipping, fixed_shipping, first_purchase, cart_threshold

  • percentnumbernullable

    Percent off (percentage, and first purchase / cart threshold when percent)

    Example 10

  • amountMoneyDto

    Amount off, or the delivery price for fixed shipping

  • max_discountMoneyDtonullable
  • activationstringrequired

    One of automatic, code

  • codestringnullable

    Example SAVE10

  • min_order_valueMoneyDtonullable
  • max_order_valueMoneyDtonullable
  • customer_restrictionstring

    One of all, new, returning, specific

  • store_idsarray of string

    Empty = every store

  • customer_idsarray of string

    With customer_restriction "specific": the customers it is for (at most 500)

  • total_limitnumbernullable
  • per_customer_limitnumbernullable
  • stackableboolean

    Automatic only: may combine with a code and other stackable promotions

  • starts_atstring (date-time)nullable
  • ends_atstring (date-time)nullable

Responses

201CreatedPromotionResponse
  • idstringrequired
  • namestringrequired
  • typestringrequired

    One of percentage, fixed_amount, free_shipping, fixed_shipping, first_purchase, cart_threshold

  • percentnumbernullablerequired

    Percentage promotions

  • amountMoneyResponsenullablerequired

    Fixed-amount promotions

  • max_discountMoneyResponsenullablerequired
  • activationstringrequired

    One of automatic, code

  • codestringnullablerequired
  • min_order_valueMoneyResponsenullablerequired
  • max_order_valueMoneyResponsenullablerequired
  • customer_restrictionstringrequired

    One of all, new, returning, specific

  • store_idsarray of stringrequired

    Empty = every store

  • customersarray of PromotionCustomerRefResponserequired

    With customer_restriction "specific": the customers it is for

  • total_limitnumbernullablerequired
  • per_customer_limitnumbernullablerequired
  • stackablebooleanrequired
  • starts_atstring (date-time)nullablerequired
  • ends_atstring (date-time)nullablerequired
  • statusstringrequired

    One of draft, scheduled, active, paused, ended, expired

  • redemption_countintegerrequired

    Confirmed redemptions in this mode (shown against total_limit, e.g. "12/100")

    ≥ 0.

  • created_byPersonRefResponsenullablerequired

    The 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`.