Commerce

Create a discount

Creates a code discount (buyers enter a code) or an automatic one (applied at checkout), as a percentage, a fixed amount or free shipping. It applies to every product unless productIds or collectionIds narrow it, and to every buyer.

Billing: Request; paid actions are priced in credits (see GET /v1/messaging/prices) · Rate limit: 60/min

post/v1/messaging/commerce/discounts

Request

  • Base URL: https://apihub.co.il
  • URL: https://apihub.co.il/v1/messaging/commerce/discounts
  • Auth: HTTP bearer

Headers

Idempotency-Keystring

Replay-safe: the same execution is returned instead of charging twice

X-Tagstring

Group calls into one job (e.g. one video) — see GET /v1/usage?tag=…

Request body

codestring

Required for method code.

type'percentage' | 'fixed_amount' | 'free_shipping' required
titlestring required
amountstring

For type fixed_amount, a decimal in the store currency.

endsAtstring date-time nullable
method'code' | 'automatic' required
startsAtstring date-time

Defaults to now.

accountIdstring required
percentagenumber

For type percentage, e.g. 15 for 15%.

productIdsstring[]
usageLimitinteger nullable

Code discounts only: total uses allowed.

collectionIdsstring[]
minimumQuantityinteger nullable
minimumSubtotalstring nullable

Minimum order subtotal, a decimal in the store currency.

oncePerCustomerboolean

Code discounts only.

appliesOnEachItemboolean

fixed_amount only: take the amount off each item instead of once per order.

Response

Completed

idstring

Execution id — stable across internal retries; use it with GET /v1/executions/{id}

status'pending' | 'processing' | 'completed' | 'partial' | 'failed' | 'cancelled' | 'timeout'
operationstring
tagstring nullable

Your X-Tag, if sent

created_atstring date-time
completed_atstring date-time nullable
errorstring nullable

Changes

No recorded changes to this operation across all 2 revisions of this API.