Refresh tokens

Live
POST/api/v1/auth/refresh

Request a new access token using your refresh token

The refresh token is single-use (rotation) — a successful request returns a new key and the old one stops working immediately; replaying the old key returns 1007 and requires a fresh login.

The refresh_token cookie is httpOnly, SameSite=Strict, scoped to path /api/v1/auth — it is only sent on refresh/logout calls.

Headers

FieldTypeRequiredDescription
Authorizationstring—Not used — this endpoint is public; no member token required
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
refresh_tokenstring—The refresh token used to request a new access token

Response

Fields in data

FieldTypeRequiredDescription
access_tokenstring—New access token, valid 15 minutes
expires_innumber—Access-token lifetime in seconds (900 = 15 minutes)
refresh_tokenstring—For requesting a new access token; valid 7 days
userobject—Member summary (latest values)
└ idstring—Member id (uuid)
└ usernamestring—Username (agent prefix + phone)
└ rolestring—RoleMEMBER
└ statusstring—Account status, e.g. ACTIVE
└ member_tierstring | null—Member tier (e.g. BRONZE)
└ full_namestring | null—Full name
└ selected_promotion_idstring | null—Deposit bonus the member selected (null = no bonus)
Response example
{
  "success": true,
  "code": 0,
  "message": "สำเร็จ",
  "data": {
    "access_token": "eyJhbGciOiJIUzI1NiIs…",
    "expires_in": 900,
    "user": {
      "id": "0f1e2d3c-4b5a-6978-8796-a5b4c3d2e1f0",
      "username": "abc0812345678",
      "role": "MEMBER",
      "status": "ACTIVE",
      "member_tier": "BRONZE",
      "full_name": "สมชาย ใจดี",
      "selected_promotion_id": null
    }
  },
  "request_uuid": "5d8e1a37-2c94-4f60-b8e5-7a3d0c6f9e42"
}

Possible error codes

codeNameHTTPMessage
1007TOKEN_INVALID401Token invalidMissing / invalid / expired, an already-rotated token, or the session was revoked (logout / new login elsewhere)
9003TOO_MANY_REQUESTS429Too many requests. Please slow downAuth-group rate limit exceeded (10 req/min/IP)