CoworkerDiscountCodes
Create CoworkerDiscountCode
Create a new CoworkerDiscountCode record.
POST
Create CoworkerDiscountCode
A customer discount code (internally CoworkerDiscountCode) is the link between one customer and one discount code offer. Nothing reduces a customer’s price until this link exists. It is created when the customer claims a code at sign-up, on the members portal or against a booking, and an operator can also create one directly to give a named customer a discount without sharing a code anyone else could use. The assignment carries its own ValidFrom and ExpiresOn window, which applies on top of the offer’s own validity window with the more restrictive of the two winning, and a read-only TimesUsed counter that the offer’s per-customer and overall usage caps are checked against. Every other rule stays on the offer itself, so change the discount amount, audience or which purchases it covers on the DiscountCode rather than here. On a referral assignment the holder is the customer who made the referral and RefererGuid identifies the person they referred. BookingUniqueId, when set, reserves the discount for one specific booking.
Authentication
This endpoint requires OAuth2 authentication. Include a valid bearer token in the
Authorization header.
The authenticated user must be a full unrestricted administrator or have the CoworkerDiscountCode-Create role.Request Body
Required Fields
integer
required
ID of the customer who holds this discount and receives the reduced price. On a referral assignment this is the customer who made the referral, not the person who was referred.
integer
required
ID of the location that issued this discount to the customer. When the customer claims a code themselves this is taken from the code’s own location, or from the booking’s location for a booking-specific claim.
integer
required
ID of the discount code offer granted to the customer. Every rule on that offer still applies on top of this assignment, including its active flag, validity window, usage caps, audience and which kinds of purchase it pays for.
Optional Fields
string
Free-text internal note about why the customer has this discount. Filled in automatically for a referral assignment to record who the customer referred.
string
UTC date and time from which this customer may use the discount, on top of the offer’s own validity window; the more restrictive of the two applies. Leave empty for no customer-specific start. The server rejects a value later than ExpiresOn.
string
UTC date and time after which this customer may no longer use the discount, on top of the offer’s own validity window; the more restrictive of the two applies. Calculated from the offer’s ExpirationType and ExpiresIn when the customer claims a code themselves, but not when an operator assigns one directly, so set it explicitly if the discount should lapse. Leave empty for no customer-specific end.
string
System-managed unique identifier of the customer who was referred, meaning the person who signed up with the code, while the holder of this assignment is the one being rewarded. Set by the referral sign-up flow; a referral discount stops applying once the referred customer is no longer active. Do not set this by hand to simulate a referral.
string
System-managed unique identifier of the booking this discount is reserved for. When empty the discount can be used for any eligible purchase; when set it only applies to that one booking. Populated by the booking flow when a customer enters a code against a booking.
Code Examples
Response
200
integer
HTTP status code.
200 on success.string
A human-readable message confirming the creation.
object
Contains the
Id of the newly created record.boolean
true if the coworkerdiscountcode was created successfully.array
null on success.Example Response
400
string
A summary of the validation error(s), in the format
PropertyName: error message.any
null on validation failure.object[]
Array of validation errors.
boolean
false when the request fails validation.Example Response