Gift codes
Admin gift code generation issues premium codes in bulk, each one redeemable once and each granting a fixed span of entitlement. Gifts defines the public record of a code and its single redemption.
This resource has that one operation. No Admin operation lists, revokes, or redeems a code, or reports who redeemed one.
Gift duration units
Section titled “Gift duration units”The unit and the quantity together define the span a redeemed code grants. At redemption, FiveCord adds the span to the entitlement anchor, which is the latest of the current time, the end of the redeemer’s premium, and the end of any earlier gift extension. Lifetime gifts are not supported.
| Value | Description |
|---|---|
| days | The quantity counts days added to the entitlement anchor |
| weeks | The quantity counts weeks added to the entitlement anchor |
| months1 | The quantity counts calendar months added to the entitlement anchor |
| years1 | The quantity counts calendar years, applied as twelve calendar months each |
1 A calendar month is added in UTC and clamped to the last day of the target month, so an anchor of 31 January extended by one month lands on 28 or 29 February
Create gift codes
Section titled “Create gift codes”POST/v1/admin/gift-codesGenerates the requested number of unredeemed gift codes. Requires gift_codes:generate. Returns the complete redemption links on success.
JSON body
Section titled “JSON body”| Field | Type | Description |
|---|---|---|
| count | integer | The number of codes to generate (1-100) |
| duration_type | string | The gift duration unit the quantity is counted in |
| duration_quantity | integer | The quantity of the selected unit (1-3650) |
Response body
Section titled “Response body”| Field | Type | Description |
|---|---|---|
| codes1 | array[string] | The complete redemption links, one for each generated code, in generation order |
1 Each link uses the instance’s configured gift endpoint followed by / and the code
{ "codes": [ "https://example.com/gift/aB3dEfGhIjKlMnOpQrStUvWxYz012345", "https://example.com/gift/Zy9XwVuTsRqPoNmLkJiHgFeDcBa543210" ]}Response
Section titled “Response”| Status | Body | Condition |
|---|---|---|
| 200 | response body | The codes were generated |
| 4031 | error response | The account does not hold admin:authenticate, does not hold gift_codes:generate, or the instance is self-hosted |
1 Returned as MISSING_PERMISSIONS without admin:authenticate, as MISSING_ACL with that but without gift_codes:generate, and as FEATURE_NOT_AVAILABLE_SELF_HOSTED on a self-hosted instance
Side effects
Section titled “Side effects”Each code is 32 characters drawn from the uppercase letters, the lowercase letters, and the digits. FiveCord creates it unredeemed and records the system account with ID 0 as its creator, which is the creator the gift object reports to the redeemer.
A failed request can leave some codes redeemable without returning them. Retrying can therefore create additional codes.
The operation records one Admin audit entry with action generate_gift_codes, target type gift_code, target ID 0, and metadata keys count, duration_type, and duration_quantity. The codes are not recorded. It emits no Gateway Dispatch.
Rate limit
Section titled “Rate limit”30 requests per minute for each authenticated user, on the admin:code:generation bucket.