POST
Give a customer campaign access
Company space For: Manager · Permission: discount_campaign_accesses.create Conditions
  • The campaign must not be archived.
  • The campaign access mode must be restricted.
  • The customer must be one of the company’s customers and not be deleted.
  • A customer that already has an access to the campaign that was not removed cannot be given another one.
  • ends_at must be after starts_at.
What else happens
  • A manual access is created for the customer (status 201).
  • If the customer had an access to this campaign that was removed earlier, it is restored with the fields sent (status 200) instead of creating a new one.
Part of Choose who gets a campaign.

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, discount_campaign_id, customer_id, source_type, source_reference, starts_at, ends_at, usage_limit, metadata, created_at, updated_at.

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: .

Body

application/json
customer_id
integer
required

Customer to give access to (27-character KSUID string). Required; must be an existing customer of the company.

source_reference
string | null

Free-text reference to the origin of the access, up to 255 characters. Optional.

Maximum string length: 255
starts_at
string<date-time> | null

Moment the access begins, as a date and time; a value without an offset is read in the company time zone. Optional; omitted means valid at once.

ends_at
string<date-time> | null

Moment the access ends, after starts_at. Optional; omitted means it does not expire.

usage_limit
integer | null

Maximum number of orders the customer can use this access on, at least 1. Optional; omitted means no limit.

Required range: x >= 1
metadata
string[] | null

Free-form object stored with the access. Optional.

Response

Resource (only with response=resource).

id

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

discount_campaign_id

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

customer_id

Identifier of the customer who may use the campaign (27-character KSUID string).

source_type

How the access was given: manual (through this API), loyalty or system. Accesses created by this API are manual.

source_reference

Free-text reference to the origin of the access, for example a loyalty programme name. Null when none was given.

starts_at

Moment the access begins, in ISO 8601 (UTC). Null means it is valid from the start.

ends_at

Moment the access ends, in ISO 8601 (UTC). Null means it does not expire.

usage_limit
integer | null

Maximum number of orders this access can be used on. Null means no limit.

metadata
object | null

Free-form data stored with the access, or null.

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).