PUT
Edit a discount campaign
Company space For: Manager · Permission: discount_campaigns.update Conditions
  • Archived campaigns are read-only.
  • activation_mode, discount_type, application_scope and access_mode cannot be changed after creation.
  • The code can only be changed while the campaign is draft, and only on a campaign whose activation mode is code; it cannot be emptied.
  • tier_basis and combination_policy can only be changed while the campaign is draft or paused.
  • The resulting end date must be after the start date.
  • The code must stay unique among the company’s campaigns.
Part of Run discount campaigns.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

campaign
string
required

Identifier of the discount campaign (27-character KSUID string).

Query Parameters

response
enum<string>
default:none

Response mode. Default none; none answers 204 No Content.

Available options:
none,
resource
fields
string

Comma-separated JSON keys of the root resource (id is always rendered). Available: id, name, description, activation_mode, code, status, discount_type, tier_basis, currency_code, currency_exponent, application_scope, access_mode, combination_policy, usage_limit, usage_pool_limit, usage_limit_per_customer, starts_at, ends_at, metadata, created_at, updated_at, stockable_units.

include
string

Comma-separated include paths, each optionally followed by its fields in parentheses: units(id,sku),units.uomUnit(id,name). Max depth 6, max 40 paths. Available: conditions, tiers.

Body

application/json
name
string

New name, up to 255 characters. When sent it cannot be empty.

Maximum string length: 255
description
string | null

New description; null clears it.

metadata
string[] | null

New free-form object; null clears it.

activation_mode
string

Not accepted: the activation mode is fixed when the campaign is created.

discount_type
string

Not accepted: the discount type is fixed when the campaign is created.

application_scope
string

Not accepted: the application scope is fixed when the campaign is created.

access_mode
string

Not accepted: the access mode is fixed when the campaign is created.

code
string | null

New code, up to 64 characters, stored in capitals and unique within the company. Accepted only while the campaign is draft and its activation mode is code; it cannot be empty.

Maximum string length: 64
usage_limit
integer | null

Maximum number of orders in total, at least 1; null removes the limit.

Required range: x >= 1
usage_pool_limit
integer | null

Maximum number of orders without a customer, at least 1; null removes the limit.

Required range: x >= 1
usage_limit_per_customer
integer | null

Maximum number of orders per customer, at least 1; null removes the limit.

Required range: x >= 1
starts_at
string<date-time>

New start of eligibility, as a date and time; a value without an offset is read in the company time zone. When sent it cannot be empty.

ends_at
string<date-time> | null

New end of eligibility, as a date and time; null removes the end date. The resulting end must be after the start.

tier_basis
enum<string> | null

New tier basis (order or eligible_stockables). Accepted only while the campaign is draft or paused.

Available options:
order,
eligible_stockables
combination_policy
enum<string> | null

New combination policy (exclusive or stackable). Accepted only while the campaign is draft or paused.

Available options:
exclusive,
stackable

Response

Resource (only with response=resource).

id

Identifier of the campaign (27-character KSUID string).

name

Name of the campaign.

description

Free-text description, or null when none was given.

activation_mode

How the campaign starts to apply: automatic (to every eligible order) or code (only when the customer gives the campaign code). Cannot be changed after creation.

code

Code the customer gives, stored in capitals. Null for an automatic campaign.

status

Lifecycle status: draft (being set up, not applied), active (applied to orders), paused (temporarily not applied) or archived (retired, read-only). Changed only by the activate, pause, archive and draft actions.

discount_type

How the discount is computed: percentage (tiers give a percentage) or fixed (tiers give a fixed amount). Cannot be changed after creation.

tier_basis

Amount compared with the tier minimums: order (the whole order) or eligible_stockables (only the lines targeted by the campaign).

currency_code

Currency of the campaign amounts, copied from the company when the campaign was created.

currency_exponent
integer

Number of decimal places of the currency (0 for XOF). An amount in minor units divided by 10 to this power gives the amount in the currency.

application_scope

What the discount applies to: order (the whole order) or stockables (only the product units chosen for the campaign). Cannot be changed after creation.

access_mode

Who may use the campaign: public (everyone) or restricted (only customers given access). Cannot be changed after creation.

combination_policy

Whether the campaign can be combined with other campaigns: exclusive or stackable.

usage_limit
integer | null

Maximum number of orders that can use the campaign in total. Null means no limit.

usage_pool_limit
integer | null

Maximum number of orders without a customer that can use the campaign. Null means no limit.

usage_limit_per_customer
integer | null

Maximum number of orders each customer can use the campaign on. Null means no limit.

starts_at

Moment the campaign starts to be eligible, in ISO 8601 (UTC).

ends_at

Moment the campaign stops being eligible, in ISO 8601 (UTC). Null means no end date.

metadata
object | null

Free-form data stored with the campaign by the client, or null.

conditions
array

Conditions an order must meet for the campaign to apply. Returned only when selected with ?include=conditions.

tiers
array

Discount levels of the campaign, ordered by minimum amount. Returned only when selected with ?include=tiers.

stockable_units
any[]

Identifiers of the product units targeted by the campaign (27-character KSUID strings). Empty when application_scope is order, since targets can only be set on a stockables campaign.

created_at

Date and time the record was created (ISO 8601, UTC).

updated_at

Date and time the record was last changed (ISO 8601, UTC).