GAGA Game API — Excalibur (GM tool) (0.2.0-draft)

Download OpenAPI specification:

The excalibur game-side API that the GAGA Web Shop calls.

Language: ไทย · English

The game-side API the GAGA Web Shop (gaga-portal-be) calls to list servers and characters, deliver what players buy into the game, and redeem gift codes.

Scope: excalibur only, for now · every other game that connects to the GAGA Web Shop should implement this spec as the standard (same paths · fields · md5str · status), differing only in its host and secret

Status: drafted from the endpoint list the customer sent · anything marked ⚠️ TBD still needs the game team to confirm — see Open questions below

Glossary

Term Meaning On the GAGA side
xluserid The player's account on the GAGA platform GAGA ID (users.gagaId), e.g. THGG327120152161
aid The player's account id inside the game game_accounts.accountUid (not stored yet)
cid One character inside the game game_accounts.characterUid · Funtap role_id
sid A game server Funtap server_id = excalibur_s<sid>
orderid One Web Shop order orders.externalOrderId, e.g. EXC-…

Which flow calls which endpoint

GAGA flow Calls
Web Shop (paid through ChillPay): pick a server + character when buying a DIRECT package · bind a character · Funtap: Get servers and checking server_id on every call Get server list
Funtap Find role · binding a character on the Web Shop Query character
Delivering a DIRECT package (paid through ChillPay or Funtap) Fulfil an order
Rewards that are not purchases (events · compensation) Send mail with items
Redeem codes (not built yet) Redeem a gift code

Conventions

  • Every response carries status · "1" = success · other values ⚠️ TBD
  • Endpoints that write are signed with md5str and carry time (unix seconds, ±300 s) — formula and secret ⚠️ TBD
  • Writes are idempotent: orders on orderid, sendmail on refid (proposed) · a repeat must answer success without delivering again
  • The HTTP methods below are our assumption (read = GET · write = POST) ⚠️ TBD

Open questions

  1. Base URLs (test / production) and authentication — IP allow-list or a key?
  2. The md5str formula: which fields · in which order · with which secret
  3. Every status value and what it means · the response body of endpoints 2–5
  4. role/query: which type values it accepts · how many characters it returns · can it take a GAGA ID and return a list (the proposed type=gagaid)?
  5. role/orders: what a repeated orderid returns — it must answer success without delivering again, not an error · what productid maps to on your side · what price / currency / payment are used for · can it take a quantity · can it accept the proposed promotionid / originalprice / discount (GAGA already sends them, inside md5str)?
  6. role/sendmail: the allowed <Type> values in items · how many items per call · can it de-duplicate on the proposed refid (same rule as orderid)?
  7. role/giftcode: can it take the optional productid / items for codes GAGA created · can it return what it granted · which status tells "no such code" / "already used" / "expired" apart?
  8. Timeouts and rate limits
  9. Can the game check time and refuse a request more than 300 s old? Which status for that?
  10. Authentication for the read endpoints (server/list, role/query): role/query returns a player's accounts and characters, so it should not be open. We propose an IP allow-list at minimum (GAGA sends its egress IPs per environment), and ideally the same md5str + time as the write endpoints. Which can you support?

Servers

Which game servers exist

Get server list

Every server of the game, with the name players see.

Used by GAGA:

Where What for
Web Shop (paid through ChillPay) — GraphQL gameServers The server picker when a player binds a character, and when buying a DIRECT package after pre-registration closes (no DIRECT is sold during pre-registration)
Web Shop — binding a character (bindGameCharacter) Checks that the sid the player picked exists
Funtap Get servers (after pre-registration closes) Lists every sid to Funtap as excalibur_s<sid>, with the game's own name
Funtap Find role · List item · Check item Checks that the sid in Funtap's server_id is still listed, or refuses it

Responses

Response Schema: application/json
status
required
string (GameStatus)

"1" = success · other values ⚠️ TBD

required
Array of objects (Server)

Response samples

Content type
application/json
{
  • "status": "1",
  • "servers": [
    • {
      },
    • {
      }
    ]
}

Characters

Who a player is inside the game — the account and its characters on each server

Query character

Looks a player up by an in-game id and returns the owner's GAGA account (xluserid).

Used by GAGA: to confirm whose character a cid is before delivering to it · when a player binds a character, GAGA sends type=cid and compares xluserid with the binder's GAGA ID; only a match is saved to game_accounts

Proposal: search by GAGA ID

We ask the game team to also accept type=gagaid and return every character of that account across servers, so the Web Shop and Funtap can offer a character picker without the player typing a cid:

GET /gmtool/role/query?type=gagaid&data=THGG327120152161
→ { "status": "1", "characters": [ { "xluserid", "aid", "cid", "sid", "name" }, … ] }

GAGA checks the GAGA ID pattern (country · kind · Damm check digit) before choosing type.

query Parameters
type
required
string
Enum: "aid" "cid" "gagaid"
Example: type=cid

Which id data holds · aid = in-game account id · cid = character id · gagaid = GAGA ID (proposed) · the full list ⚠️ TBD

data
required
string
Example: data=10023

The id to look up

Responses

Response Schema: application/json
status
required
string (GameStatus)

"1" = success · other values ⚠️ TBD

xluserid
string (XlUserId)

The player's GAGA ID (users.gagaId), stored form without dashes

sid
string (Sid)

The game server id, as the server list returns it

name
string

The character's name · without it GAGA uses the cid as the name

Array of objects (Character)

Proposed — every character found (one for aid / cid · all of them for gagaid)

Response samples

Content type
application/json
Example
{
  • "status": "1",
  • "xluserid": "THGG327120152161",
  • "sid": "1",
  • "name": "Arthur"
}

Purchases

Deliver what a player bought on the Web Shop · idempotent on orderid, so a retry never delivers twice

Fulfil an order

Delivers what a player bought on the Web Shop (items or G Coin) to one character. The most important endpoint for Web Shop purchases.

Used by GAGA: delivery of every DIRECT package, whether paid through ChillPay (our site) or Funtap · one call per order

Idempotent on orderid: we send orders.externalOrderId and may call again for the same order after a timeout, or from the retry pass (every 10 minutes, for up to 24 hours) · a repeated orderid must answer success without delivering again

Request Body schema: application/x-www-form-urlencoded
required
xluserid
required
string (XlUserId)

The player's GAGA ID (users.gagaId), stored form without dashes

sid
required
string (Sid)

The game server id, as the server list returns it

cid
required
string (Cid)

The character id inside the game

orderid
required
string

Our order number — the game's de-duplication key

productid
required
string

What was bought — the package SKU (orders.packageSku), one call per order · the game maps it to what it delivers

price
required
string

What was paid for the whole order, in major units with the currency's decimals — 100000 (VND) · 398.00 (THB) · what it is used for ⚠️ TBD

currency
required
string

ISO 4217 currency code

payment
required
string

Who collected the money — chillpay (GAGA Web Shop) or funtap_s2s (Funtap · Vietnam)

promotionid
string

(Proposed) The promotion the package was sold through (orders.promotion.id) — tells the game which campaign the sale came from, for reporting and audits

originalprice
string

(Proposed) The whole order's full price before the discount, in major units like price

discount
string

(Proposed) The whole order's discount in major units = originalprice − price · 0 when none

time
required
string (Time) ^\d{10}$

(Proposed) Unix timestamp in seconds when GAGA sent the request · part of md5str · the game should refuse a request more than 300 s from its own clock (status ⚠️ TBD) · both sides keep their clocks in sync with NTP

md5str
required
string (Md5Str)

The request signature · formula and secret ⚠️ TBD by the game team · until then GAGA sends md5(<every other field's value, joined in the order listed> + secret) as lower-case hex · time is always included, so a captured request cannot be replayed after 300 s

Responses

Response Schema: application/json
status
required
string (GameStatus)

"1" = success · other values ⚠️ TBD

message
string

Why it failed, when it did

Request samples

Content type
application/x-www-form-urlencoded
xluserid=THGG327120152161&sid=1&cid=10023&orderid=EXC-20261008-7F3K2Q&productid=gcoin_500&price=100000&currency=VND&payment=funtap_s2s&promotionid=6aa00dda4ba751e268914a54&originalprice=120000&discount=20000&time=1791360000&md5str=%3CTBD%3E

Response samples

Content type
application/json
{
  • "status": "1"
}

Mail

Send items by in-game mail, for anything that is not a purchase

Send mail with items

Sends an in-game mail carrying items to one character — for rewards that are not purchases (events · compensation) · purchases go through Fulfil an order

Used by GAGA: not yet — no flow needs it

Request Body schema: application/x-www-form-urlencoded
required
uid
required
string (XlUserId)

The player's GAGA account — the same value as xluserid ⚠️ TBD

sid
required
string (Sid)

The game server id, as the server list returns it

cid
required
string (Cid)

The character id inside the game

title
required
string

The mail's subject

body
required
string

The mail's text

items
required
string (ItemList) ^\d+:\w+:\d+(,\d+:\w+:\d+)*$

Comma-separated <Type>:<ID>:<Amount> · the <Type> values and the per-call limit ⚠️ TBD

refid
required
string (RefId) <= 64 characters

(Proposed) GAGA's id for this mail — the game's de-duplication key, same rule as orderid: a repeated refid must answer success without sending the mail again · a repeated refid with different content should be refused (status ⚠️ TBD)

time
required
string (Time) ^\d{10}$

(Proposed) Unix timestamp in seconds when GAGA sent the request · part of md5str · the game should refuse a request more than 300 s from its own clock (status ⚠️ TBD) · both sides keep their clocks in sync with NTP

md5str
required
string (Md5Str)

The request signature · formula and secret ⚠️ TBD by the game team · until then GAGA sends md5(<every other field's value, joined in the order listed> + secret) as lower-case hex · time is always included, so a captured request cannot be replayed after 300 s

Responses

Response Schema: application/json
status
required
string (GameStatus)

"1" = success · other values ⚠️ TBD

message
string

Why it failed, when it did

Request samples

Content type
application/x-www-form-urlencoded
uid=THGG327120152161&sid=1&cid=10023&title=Event%20reward&body=Thank%20you%20for%20joining%20the%20launch%20event%21&items=1%3A1001%3A5%2C1%3A2002%3A1&refid=EVT-LAUNCH-2026-000123&time=1791360000&md5str=%3CTBD%3E

Response samples

Content type
application/json
{
  • "status": "1"
}

Gift codes

Validate and redeem promotional serial codes · not used yet

Redeem a gift code

Validates a promotional serial code and gives its in-game rewards to one character. Important for marketing events.

Used by GAGA: planned — the Web Shop does not redeem codes through the game yet

Who created the code

Case Send productid / items What the game does
The game created the code, or GAGA already exported it to the game No Validates the code and grants what it already knows
GAGA created the code and the game does not know what it grants One of the two Checks the code is unused, then grants what GAGA sent

If both are sent the game should refuse · GAGA validates the code on its side before every call — what it sends never comes from the player

Request Body schema: application/x-www-form-urlencoded
required
xluserid
required
string (XlUserId)

The player's GAGA ID (users.gagaId), stored form without dashes

sid
required
string (Sid)

The game server id, as the server list returns it

cid
required
string (Cid)

The character id inside the game

code
required
string

The serial code the player entered

productid
string

(Optional · proposed) For a code GAGA created that grants a whole package — the package SKU (packages.packageSku), the same as productid in Fulfil an order · leave it out for a code the game already knows

items
string (ItemList) ^\d+:\w+:\d+(,\d+:\w+:\d+)*$

(Optional · proposed) For a code GAGA created that grants individual items · leave it out for a code the game already knows

time
required
string (Time) ^\d{10}$

(Proposed) Unix timestamp in seconds when GAGA sent the request · part of md5str · the game should refuse a request more than 300 s from its own clock (status ⚠️ TBD) · both sides keep their clocks in sync with NTP

md5str
required
string (Md5Str)

The request signature · formula and secret ⚠️ TBD by the game team · until then GAGA sends md5(<every other field's value, joined in the order listed> + secret) as lower-case hex · time is always included, so a captured request cannot be replayed after 300 s

Responses

Response Schema: application/json
status
required
string (GameStatus)

"1" = success · other values ⚠️ TBD

message
string

Why it failed, when it did

items
string (ItemList) ^\d+:\w+:\d+(,\d+:\w+:\d+)*$

(Proposed) What was actually granted

Request samples

Content type
application/x-www-form-urlencoded
Example
xluserid=THGG327120152161&sid=1&cid=10023&code=EXCAL-LAUNCH-2026&time=1791360000&md5str=%3CTBD%3E

Response samples

Content type
application/json
{
  • "status": "1",
  • "items": "1:1001:5,1:2002:1"
}