Skip to main content
https://.thoughtindustries.com

Create Redemption Code Group

Creates a redemption code group and generates its codes. At least one of `courses`, `bundles`, `licenses`, or `learningPaths` must be provided. `accessDays` and `accessExpirationDate` are mutually exclusive

Create a redemption code group and generate its codes.

POSThttps://example.thoughtindustries.com/incoming/v2/redemptionCodes

Example request

curl -X POST "https://example.thoughtindustries.com/incoming/v2/redemptionCodes" \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "label": "Spring Promo",
    "codeLength": 8,
    "totalCodesCount": 100,
    "courses": ["<course-uuid>"]
  }'

Parameters

NameTypeRequiredLocationDescription
labelstringYesbodyGroup label.
codeLengthintegerYesbodyLength of each generated code.
totalCodesCountintegerYesbodyNumber of codes to generate (max 10,000).
clientuuidNobodyClient UUID.
expirationDateISO 8601 dateNobodyWhen codes expire.
accessDaysintegerNobodyDays of access after redemption. Mutually exclusive with accessExpirationDate.
accessExpirationDateISO 8601 dateNobodyAbsolute access expiry. Mutually exclusive with accessDays.
coursesstring[]NobodyCourse UUIDs.
bundlesstring[]NobodyBundle UUIDs.
licensesstring[]NobodyLicense UUIDs.
learningPathsstring[]NobodyLearning path UUIDs.

:::note Constraints:

  • At least one of courses, bundles, licenses, or learningPaths must be provided.
  • accessDays and accessExpirationDate are mutually exclusive — setting both is rejected.
  • totalCodesCount cannot exceed 10,000. :::

Example response

{
  "id": "rc100000-1111-2222-3333-444455556666",
  "label": "Spring Promo",
  "redeemedCodesCount": 0,
  "totalCodesCount": 100,
  "expirationDate": null,
  "accessDays": null,
  "accessExpirationDate": null,
  "client": null,
  "courses": [
    {
      "id": "8f2a1c34-5b6d-4e7f-9a01-2b3c4d5e6f70",
      "title": "Onboarding Essentials"
    }
  ],
  "learningPaths": [],
  "bundles": [],
  "licenses": []
}

Validation errors

Validation failures return { "errors": [message] }:

{
  "errors": [
    "Please choose at least one item to give access to, or select a license."
  ]
}

Other validation messages include:

  • "Generated Redemption Code Groups must have a value for code length and total codes."

Response fields

FieldTypeDescription
iduuidCreated group ID.
labelstringGroup label.
redeemedCodesCountintegerAlways 0 for new groups.
totalCodesCountintegerNumber of codes generated.
expirationDateISO 8601 dateWhen codes expire.
accessDaysintegerDays of access after redemption.
accessExpirationDateISO 8601 dateAbsolute access expiry.
clientobject{ id, name } or null.
coursesobject[]Array of { id, title }.
learningPathsobject[]Array of { id, name }.
bundlesobject[]Array of { id, name }.
licensesobject[]Array of { id, name }.