Gift inventory
The gift inventory has the premium gift codes the current account bought.
A new code sets has_unread_gift_inventory on the user object and adds one to unread_gift_inventory_count. To clear both, send has_unread_gift_inventory: false to Modify current user. Listing gifts doesn’t clear them.
Gift inventory object
Заголовок раздела «Gift inventory object»One gift code the current account bought. A held gift has no link, and only its owner can redeem it. Other people claim a shared gift through its link.
Structure
Заголовок раздела «Structure»| Field | Type | Description |
|---|---|---|
| code | string | The gift’s own code, used in the routes on this page |
| duration_type | string | The duration unit of duration_quantity |
| duration_quantity | integer | The number of duration_type units the code grants |
| created_at | ISO8601 timestamp | When the code was created |
| created_by | partial user object | The account that bought the code |
| redeemed_at? | ?ISO8601 timestamp | When the code was redeemed, or null if it is unredeemed |
| redeemed_by? | ?partial user object | The account that redeemed the code, or null if it is unredeemed |
| state | string | The gift share state |
| share_code1 | ?string | The code to put in the gift URL, or null when the gift has no working link |
| link_expires_at | ?ISO8601 timestamp | When the current link stops working, or null when it never does |
| rules | gift claim rules object | Who can claim the gift |
1 Build gift URLs from share_code only. For a held gift code works for nobody but its owner
Gift share states
Заголовок раздела «Gift share states»| Value | Description |
|---|---|
| held | The gift has no link and nobody else can claim it |
| shared | The gift has a working link, or it is an older gift whose own code anyone can redeem |
| expired | The link has expired. The gift is held again and keeps its claim rules |
| redeemed | Someone redeemed the gift |
List current user gifts
Заголовок раздела «List current user gifts»/v1/users/@me/giftsReturns the gift codes the current account bought, newest first, with no pagination. The list leaves out revoked codes and codes redeemed more than seven days ago.
Headers
Заголовок раздела «Headers»| Header | Description |
|---|---|
| X-Fluxer-Capabilities? | Comma-separated client capabilities. Include gift_links to get each gift as it is |
A client made before gift links builds gift URLs from code. So that such a client never shares a code that works only for its owner, a request without gift_links changes the list:
- Each unredeemed gift that is
heldorexpiredgets a new link that never expires, and keeps its claim rules. The owner’s other clients see it asshared. codeholds the gift’sshare_codefor every unredeemed gift that has one. The owner can still redeem a gift through its link, and the claim rules don’t apply to them.
Response
Заголовок раздела «Response»| Status | Body | Condition |
|---|---|---|
| 200 | array[gift inventory object] | The gift codes were returned |
| 404 | error response | NOT_FOUND when a self-hosted instance’s premium mode isn’t mirror |
The rate limit is 40 requests per 10 seconds, on the gifts:list bucket.
Modify gift claim rules
Заголовок раздела «Modify gift claim rules»/v1/users/@me/gifts/{code}Sets who can claim a gift the current account owns and returns the updated gift inventory object. A field you leave out keeps its value, and null clears it. The link stays the same.
JSON body
Заголовок раздела «JSON body»| Field | Type | Description |
|---|---|---|
| recipient_user_id? | ?snowflake | The only account that can claim the gift |
| guild_id? | ?snowflake | The community whose members can claim the gift. You must be a member |
| non_premium_only? | ?boolean | Whether accounts that already have premium are refused |
Setting both recipient_user_id and guild_id fails validation. The recipient can’t be a bot, a deleted account or you.
Response
Заголовок раздела «Response»| Status | Body | Condition |
|---|---|---|
| 200 | gift inventory object | The rules were saved |
| 400 | error response | INVALID_FORM_BODY for a recipient and a community together, an unknown recipient or a community you aren’t in |
| 400 | error response | GIFT_CODE_ALREADY_REDEEMED when the gift was redeemed |
| 400 | error response | STRIPE_GIFT_REDEMPTION_IN_PROGRESS when someone is redeeming the gift at the same time |
| 404 | error response | UNKNOWN_GIFT_CODE when the gift does not exist, was revoked or belongs to another account |
The rate limit is 20 requests per 10 seconds, on the gifts:manage bucket.
Create gift link
Заголовок раздела «Create gift link»/v1/users/@me/gifts/{code}/linkMakes a new link for a gift the current account owns and returns the updated gift inventory object. The old link stops working at once. The gift’s own code never changes, and after this call it works only for you.
JSON body
Заголовок раздела «JSON body»| Field | Type | Description |
|---|---|---|
| expires_in? | ?integer | Seconds until the link stops working, one of 3600, 86400, 604800 and 2592000, or null for never (default null) |
A link code has the same length and characters as a gift code, and gift URLs and gift embeds work with either. When a link expires, the gift is held again. The gift itself never expires.
Response
Заголовок раздела «Response»| Status | Body | Condition |
|---|---|---|
| 200 | gift inventory object | The link was made |
| 400 | error response | GIFT_CODE_ALREADY_REDEEMED when the gift was redeemed |
| 400 | error response | STRIPE_GIFT_REDEMPTION_IN_PROGRESS when someone is redeeming the gift at the same time |
| 404 | error response | UNKNOWN_GIFT_CODE when the gift does not exist, was revoked or belongs to another account |
The rate limit is 20 requests per 10 seconds, on the gifts:manage bucket.
Delete gift link
Заголовок раздела «Delete gift link»/v1/users/@me/gifts/{code}/linkStops the link of a gift the current account owns and returns the updated gift inventory object. The gift is held again and keeps its claim rules.
Response
Заголовок раздела «Response»| Status | Body | Condition |
|---|---|---|
| 200 | gift inventory object | The link was stopped |
| 400 | error response | GIFT_CODE_ALREADY_REDEEMED when the gift was redeemed |
| 400 | error response | STRIPE_GIFT_REDEMPTION_IN_PROGRESS when someone is redeeming the gift at the same time |
| 404 | error response | UNKNOWN_GIFT_CODE when the gift does not exist, was revoked or belongs to another account |
The rate limit is 20 requests per 10 seconds, on the gifts:manage bucket.