Docs home

Update Promo Code

Replaces the settings and mappings of an existing promo code or unique code. Use it to change the discount, dates or the courses a code applies to.

POST/promocode/{promocodeId}
Update Promo Code
curl --request POST \
  --url 'https://<your-api-host>/nuSource/api/v1/promocode/{promocodeId}' \
  --header 'APIKEY: <your-api-key>' \
  --header 'ORGID: <your-org-id>' \
  --form 'JSONString={"promo_code_type":"promo_code_discount","promo_code_text":"PARTH321","discount":"50.00","max_discount_amount":"250.00","promo_code_description":"ds","mapping_details":[{"organization_ids":[212],"package_id":18753,"promo_code_used":0}],"promo_code_creation_time":1730099385,"promo_code_start_time":"10 Jul 2024","promo_code_end_time":"31 Oct 2024","max_usd_discount_amount":"0.00","usd_discount":"50.00"}'

Access: Institute admins, plus custom roles that can manage promo codes.

Path parameters
promo_code_idintegerrequired
ID of the promo code, e.g. promocode/19378.

Request body: form-data with one field, JSONString, containing this JSON (same fields as "Create Promo Code"):

BodyJSONString
promo_code_typestringrequired
promo_code_discount (a normal promo code), promo_code_cashback (cashback code) or unique_code (a batch of single-use codes).
promo_code_textstringrequired
The code learners type, letters and digits only. For unique_code it is the prefix of the generated codes.
discountintegerrequired
Discount in percent, 0 to 100.
max_discount_amountintegerrequired
Maximum discount amount, in the organization's base currency.
Description shown with the code.
promo_code_start_timestringrequired
First valid day, as DD Mon YYYY (e.g. 16 Dec 2022), in your account's time zone. Valid from the start of that day.
promo_code_end_timestringrequired
Last valid day, same format. Valid until the end of that day.
mapping_detailsarrayOne of the two mappings
Courses and organizations the code applies to (fields below).
subscription_mapping_detailsarrayOne of the two mappings
Membership plans the code applies to (fields below).
Discount per currency for international selling: objects with currency_id, discount and max_discount_amount.
Discount in percent for USD prices. Default 0.
Maximum USD discount. Default 0.
Total number of times the code can be used. 0 means no limit.
user_usageinteger
Times one learner can use it. 0 means no limit. Must not be more than system_usage.
1 shows the code on the website checkout.
1 shows the code in the app checkout.
1 (default) shows the expiry date to learners.

Fields in each mapping_details object:

Name Required Type Description
package_id Yes integer Course ID (bundle_id). Get it from "Institution Course Bundles".
organization_ids Yes array of integers Organizations where the code works for this course.

Fields in each subscription_mapping_details object:

Name Required Type Description
subscription_plan_id Yes integer Membership plan ID.
organization_ids No array of integers Organizations where the code works. Defaults to every organization that offers the plan.

Response: promo_codes echoes the settings you sent with promo_code_id and the new promo_code_creation_time.

Notes:

  • This is a full replace. The course, membership and currency mappings are deleted and recreated from what you send, and every setting you leave out goes back to its default.
  • Leaving out website_visibility or app_visibility sets them to 0 (hidden at checkout), so always send them.
  • promo_code_creation_time is reset to the time of the update.
  • Rate limit: 30 requests per minute; going over locks you out for 30 minutes.

Updated yesterday

Ask AI