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.
POST
https://example.thoughtindustries.com/incoming/v2/redemptionCodesExample 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
| Name | Type | Required | Location | Description |
|---|---|---|---|---|
label | string | Yes | body | Group label. |
codeLength | integer | Yes | body | Length of each generated code. |
totalCodesCount | integer | Yes | body | Number of codes to generate (max 10,000). |
client | uuid | No | body | Client UUID. |
expirationDate | ISO 8601 date | No | body | When codes expire. |
accessDays | integer | No | body | Days of access after redemption. Mutually exclusive with accessExpirationDate. |
accessExpirationDate | ISO 8601 date | No | body | Absolute access expiry. Mutually exclusive with accessDays. |
courses | string[] | No | body | Course UUIDs. |
bundles | string[] | No | body | Bundle UUIDs. |
licenses | string[] | No | body | License UUIDs. |
learningPaths | string[] | No | body | Learning path UUIDs. |
:::note Constraints:
- At least one of
courses,bundles,licenses, orlearningPathsmust be provided. accessDaysandaccessExpirationDateare mutually exclusive — setting both is rejected.totalCodesCountcannot 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
| Field | Type | Description |
|---|---|---|
id | uuid | Created group ID. |
label | string | Group label. |
redeemedCodesCount | integer | Always 0 for new groups. |
totalCodesCount | integer | Number of codes generated. |
expirationDate | ISO 8601 date | When codes expire. |
accessDays | integer | Days of access after redemption. |
accessExpirationDate | ISO 8601 date | Absolute access expiry. |
client | object | { id, name } or null. |
courses | object[] | Array of { id, title }. |
learningPaths | object[] | Array of { id, name }. |
bundles | object[] | Array of { id, name }. |
licenses | object[] | Array of { id, name }. |