Refresh tokens
LivePOST
/api/v1/auth/refreshRequest 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
| Field | Type | Required | Description |
|---|---|---|---|
| Authorization | string | — | Not used — this endpoint is public; no member token required |
| X-Api-Key | string | Yes | Agent API key (ak_…) from the bo screen |
| X-Timestamp | string | Yes | Signing time in unix milliseconds (±300s skew allowed) |
| X-Nonce | string | Yes | Unique per-request value (UUIDv4) for replay protection |
| X-Signature | string | Yes | hex(HMAC-SHA256(secret, canonical)) — see the Authentication page |
| X-Player-IP | string | — | The player's real IP (IPv4/IPv6) — recommended (used in login history) |
| X-Player-UA | string | — | The player's User-Agent (optional — recorded in login history) |
| X-Request-Id | string | — | Your correlation id — echoed back as request_uuid (recommended) |
| x-lang | string | — | th (default) or en — the language of message |
Request bodyapplication/json
| Field | Type | Required | Description |
|---|---|---|---|
| refresh_token | string | — | The refresh token used to request a new access token |
Response
Fields in data
| Field | Type | Required | Description |
|---|---|---|---|
| access_token | string | — | New access token, valid 15 minutes |
| expires_in | number | — | Access-token lifetime in seconds (900 = 15 minutes) |
| refresh_token | string | — | For requesting a new access token; valid 7 days |
| user | object | — | Member summary (latest values) |
| └ id | string | — | Member id (uuid) |
| └ username | string | — | Username (agent prefix + phone) |
| └ role | string | — | RoleMEMBER |
| └ status | string | — | Account status, e.g. ACTIVE |
| └ member_tier | string | null | — | Member tier (e.g. BRONZE) |
| └ full_name | string | null | — | Full name |
| └ selected_promotion_id | string | 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
| code | Name | HTTP | Message |
|---|---|---|---|
| 1007 | TOKEN_INVALID | 401 | Token invalidMissing / invalid / expired, an already-rotated token, or the session was revoked (logout / new login elsewhere) |
| 9003 | TOO_MANY_REQUESTS | 429 | Too many requests. Please slow downAuth-group rate limit exceeded (10 req/min/IP) |