Redeem key
POST
Atomically claims a key on behalf of a Discord user. If the key is in the project's unused pool, it moves to the user list and binds to the Discord ID. If the key is already claimed but has no Discord ID, the Discord ID is attached to that existing row.
One key per Discord ID per project is enforced. A Discord ID that already has a key returns 409 with code: "ALREADY_HAS_KEY".
Request
terminal
curl -X POST https://api.envyauth.my.id/api/v3/projects/<project_uuid>/users/redeem \ -H "Authorization: Bearer YOUR_API_TOKEN" \ -H "Content-Type: application/json" \ -d '{"discord_id":"1118453649727823974","key":"<32-char>"}'| Field | Type | Required | Meaning |
|---|---|---|---|
discord_id | string | yes | 17–20 digit Discord snowflake. |
key | string | yes | 32-character key to redeem. |
The Discord username and avatar are resolved server-side; you do not need to pass them.
Response
{ "success": true, "data": { "redeemed": true, "stage": "unclaimed_claim", "user_id": "uuid", "key": "<32-char>", "key_note": "Premium", "key_expire": 1761868800 }, "requestid": "uuid"}{ "success": true, "data": { "redeemed": true, "stage": "claimed_bind", "user_id": "uuid", "key": "<32-char>", "key_note": "Premium", "key_expire": 1761868800 }, "requestid": "uuid"}{ "success": false, "error": "This Discord user already has a key in this project", "code": "ALREADY_HAS_KEY", "requestid": "uuid"}{ "success": false, "error": "Key has expired", "code": "EXPIRED", "requestid": "uuid"}{ "success": false, "error": "Key not found in this project", "code": "NOT_FOUND", "requestid": "uuid"}{ "success": false, "error": "Invalid discord_id format", "code": "VALIDATION", "requestid": "uuid"}stage is one of:
| Stage | Meaning |
|---|---|
unclaimed_claim | The key was in the unused pool and is now a user row bound to the Discord ID. |
claimed_bind | The key was already a claimed row with no Discord ID. The Discord ID has now been attached. |