Redeem diamonds for credit

Live
POST/api/v1/diamond/redeem

Redeem one shop item.

The redeemed credit is recorded as a DIAMOND_REDEEM entry in the transaction history and carries turnover per the agent's shop_wagering_x.

idempotent = true means a replay — do not count it as a new redeem; just refresh the screen with the returned diamond_balance/balance.

Headers

FieldTypeRequiredDescription
AuthorizationstringYesUsed — send Bearer <member access_token>
X-Api-KeystringYesAgent API key (ak_…) from the bo screen
X-TimestampstringYesSigning time in unix milliseconds (±300s skew allowed)
X-NoncestringYesUnique per-request value (UUIDv4) for replay protection
X-SignaturestringYeshex(HMAC-SHA256(secret, canonical)) — see the Authentication page
X-Player-IPstring—The player's real IP (IPv4/IPv6) — recommended (used in login history)
X-Player-UAstring—The player's User-Agent (optional — recorded in login history)
X-Request-Idstring—Your correlation id — echoed back as request_uuid (recommended)
x-langstring—th (default) or en — the language of message

Request bodyapplication/json

FieldTypeRequiredDescription
item_idstringYesShop item id to redeem, taken from items in /diamond/shop (UUID).
idempotency_keystring—Your idempotency key, max 64 chars — send the same value on retry so it never redeems twice. If omitted the server generates a uuid (so a retry must carry your own key to be deduplicated).
Request example
{
  "item_id": "3f1c9a2e-7b41-4d6c-9a8e-2f5b1c0d7e10",
  "idempotency_key": "redeem-2026-07-12-9f8a1c"
}

Response

Fields in data

FieldTypeRequiredDescription
idempotentboolean—true = this was a replay of a prior idempotency_key (no double deduct/credit), balances returned as-is · false = a fresh redeem happened.
diamond_balancenumber—Diamond balance after the item cost is deducted (integer)
balancestring—Wallet balance after the credit is applied (THB, string)
credit_amountstring—Credit granted by this redeem (THB, string)
item_idstring—The redeemed item id (echoed back to tie to a toast/history)
Response example
{
  "success": true,
  "code": 0,
  "message": "Redeemed successfully",
  "data": {
    "idempotent": false,
    "diamond_balance": 220,
    "balance": "170.00",
    "credit_amount": "50",
    "item_id": "3f1c9a2e-7b41-4d6c-9a8e-2f5b1c0d7e10"
  },
  "request_uuid": "c4a8f2d6-1b39-4e75-90cd-5e7a3f8b1d64"
}

Possible error codes

codeNameHTTPMessage
6222DIAMOND_INSUFFICIENT400Not enough diamonds to redeemNot enough diamonds for this item (diamond_balance < cost_diamonds) — earn more first
6223DIAMOND_ITEM_UNAVAILABLE400Diamond shop item is inactive or not foundThe item is unavailable — no such id or it was deactivated (refetch /diamond/shop)
6221DIAMOND_NOT_ENABLED400Diamond program is not enabled or member not eligibleThe diamond program or shop is off (enabled/shop_enabled = false), or the account does not qualify (not a TRANSFER wallet)
9002SERVICE_UNAVAILABLE503Service unavailableThe agent's credit issuance is temporarily unavailable — diamonds are not deducted, retry later (the real cause is masked from the member)
4001VALIDATION_ERROR400Validation erroritem_id is not a UUID, or idempotency_key exceeds 64 characters
1001UNAUTHORIZED401Unauthorized
1007TOKEN_INVALID401Token invalid