Skip to main content
PUT
/
api
/
billing
/
discountcodes
{
  "Status": 123,
  "Message": "<string>",
  "Value": "<any>",
  "WasSuccessful": true,
  "Errors": [
    {
      "AttemptedValue": "<any>",
      "Message": "<string>",
      "PropertyName": "<string>"
    }
  ]
}
Updates an existing DiscountCode 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 DiscountCode-Edit role.

Enums

ValueName
1Day
2Week
3Month
4Year

Request Body

Required Fields

Id
integer
required
The Id of the DiscountCode record to update.
BusinessId
integer
required
Business Id.
Code
string
required
The unique alphanumeric code customers enter to apply the discount.
Description
string
required
Human-readable description of what this discount code is for.

Optional Fields

Active
boolean
Whether this discount code is currently active and can be redeemed.
PublishFrom
string
Date from which this discount code is visible/published to customers.
PublishTo
string
Date until which this discount code is visible/published to customers.
DiscountPercentage
number
Percentage discount to apply (e.g. 10 for 10% off). Mutually exclusive with DiscountAmount.
DiscountAmount
number
Fixed monetary amount to discount. Mutually exclusive with DiscountPercentage.
ReferralDiscount
boolean
Whether this discount code is used as part of the referral program.
DiscountPricePlans
boolean
Whether this discount can be applied to price plans (tariffs). When true, use Tariffs to restrict to specific plans.
Tariffs
integer[]
Tariffs.
AddedTariffs
integer[]
Added Tariffs.
RemovedTariffs
integer[]
Removed Tariffs.
DiscountBookings
boolean
Whether this discount can be applied to resource bookings. When true, use ResourceTypes to restrict to specific resource types.
ResourceTypes
integer[]
Resource Types.
AddedResourceTypes
integer[]
Added Resource Types.
RemovedResourceTypes
integer[]
Removed Resource Types.
DiscountProducts
boolean
Whether this discount can be applied to products. When true, use Products to restrict to specific products.
Products
integer[]
Products.
AddedProducts
integer[]
Added Products.
RemovedProducts
integer[]
Removed Products.
DiscountEvents
boolean
Whether this discount can be applied to events. When true, use EventCategories to restrict to specific event categories.
EventCategories
integer[]
Event Categories.
AddedEventCategories
integer[]
Added Event Categories.
RemovedEventCategories
integer[]
Removed Event Categories.
MaxUsesPerUser
integer
Maximum number of times a single customer can redeem this discount code.
MaxUses
integer
Maximum total number of times this discount code can be redeemed across all customers.
OnlyForContacts
boolean
When true, only contacts (non-member customers) can use this discount code.
OnlyForMembers
boolean
When true, only members (customers with an active plan) can use this discount code.
ValidFrom
string
Start date from which this discount code can be redeemed.
ValidTo
string
End date after which this discount code can no longer be redeemed.
ExpirationType
integer
Unit of the expiration period (Day, Week, Month, Year). Used with ExpiresIn to determine when the discount expires after being assigned to a customer. See eDiscountExpirePeriod? enum above.
ExpiresIn
integer
Number of ExpirationType periods after assignment until the discount expires for a customer.

Code Examples

curl -X PUT \
  "https://spaces.nexudus.com/api/billing/discountcodes" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "BusinessId": 0,
    "Code": "",
    "Description": "",
    "Id": 87654321
}'

Response

200

Status
integer
HTTP status code. 200 on success.
Message
string
A human-readable message confirming the update.
Value
object
Contains the Id of the updated record.
WasSuccessful
boolean
true if the discountcode was updated successfully.
Errors
array
null on success.
Example Response
{
  "Status": 200,
  "Message": "DiscountCode was successfully updated.",
  "Value": {
    "Id": 87654321
  },
  "OpenInDialog": false,
  "OpenInWindow": false,
  "RedirectURL": null,
  "JavaScript": null,
  "UpdatedOn": "2025-01-15T10:30:00Z",
  "UpdatedBy": "admin@example.com",
  "Errors": null,
  "WasSuccessful": true
}

400

Message
string
A summary of the validation error(s), in the format PropertyName: error message.
Value
any
null on validation failure.
Errors
object[]
Array of validation errors.
WasSuccessful
boolean
false when the request fails validation.
Example Response
{
  "Message": "Code: is a required field",
  "Value": null,
  "Errors": [
    {
      "AttemptedValue": null,
      "Message": "is a required field",
      "PropertyName": "Code"
    }
  ],
  "WasSuccessful": false
}