Skip to main content
PUT
Update CoworkerDiscountCode
Updates an existing CoworkerDiscountCode record. You must include the Id of the record to update along with all required fields.

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-Edit role.

Request Body

Required Fields

integer
required
The Id of the CoworkerDiscountCode record to update.
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 update.
object
Contains the Id of the updated record.
boolean
true if the coworkerdiscountcode was updated 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