Skip to content

AWMC Gateway Public API (Billing)

For end users: how to call open endpoints and when Tokens are charged. This page does not cover upstream wire encoding.

Platform

Platform: https://api.wmc.pub

Docs: https://wiki.awmc.team/en/dev/awmc-api

Sign in with an AWMC passport (forum account), then create a gw_ token or use the login JWT.

Auth

Send:

Authorization: Bearer <token>

  • Session JWT after browser login, or a long-lived gw_ token from the console (keep secret).

Buy Tokens

Top up with card codes from the Afdian shop.
Redeem in the console or via POST /redeem.

keychip

keychip is injected by the gateway. Callers must not send it. Provide business fields only (e.g. qrcode).

High-risk operations (read first)

These actions may cause irreversible, severe damage to an account. Do not call them casually:

  1. Gate edits: POST /v1/kaleidx-scope/upsert (Kaleidx Scope Gate state).
  2. Unverified collectibles: writing itemKind 4 / 8 via POST /v1/item/upsert or POST /v1/user/upsert-all.

The gateway does not block these requests; you accept the risk by calling them.

1. Base URL & path compatibility

All business paths are under /v1 on the gateway.

  • Upstream is AWMC API v2; public paths stay as close as possible to the old ones (e.g. still /v1/user/data).
  • POST with plain JSON (Content-Type: application/json). zlib/Base64 is handled by the gateway.
  • Responses include:
    • Upstream: returnCode, returnMessage (and businessData when applicable)
    • Compatibility: code === 0 on business success; msg often JSON-parseable

Success (billing)

EndpointUpstream success
GET /v1/healthreturnCode === 0 (ping)
Other businessreturnCode === 1

Prefer returnCode in new clients; legacy clients may use code === 0.

2. Token pricing

Charged on HTTP 2xx and upstream business success. Suggest 180s client timeout.

2.1 Legacy-compatible paths

MethodPathCostNotes
GET/v1/health0Connectivity (ping)
POST/v1/user/data2User data
POST/v1/user/region2Region records
POST/v1/user/music4All scores
POST/v1/user/charge2Owned Charges (read-only)
GET/v1/charge/queue0Stub: no real queue; empty tasks
POST/v1/charge10 / 15 / 25Buy one Charge (chargeId/charge = 2 / 3 / 510 / 15 / 25 Tokens)
POST/v1/update-lx5LXNS sync (key+qrcode; ignore legacy type)
POST/v1/update-fish5Diving-Fish sync

2.2 New paths

MethodPathCostNotes
POST/v1/user/preview1Preview
POST/v1/user/item-list2Items
POST/v1/user/kaleidx-scope2Read Gate state
POST/v1/music/upsert15Upsert 1–4 scores
POST/v1/music/delete10Delete 1–4 scores
POST/v1/item/upsert20Item write (high risk)
POST/v1/ticket/clear5Clear Charges
POST/v1/kaleidx-scope/upsert30Gate edit (high risk)
POST/v1/user/upsert-all25Combined write (high risk)

Charge / queue behavior change

  1. POST /v1/charge buys a Charge directly (not enqueue); 10 / 15 / 25 Tokens for chargeId 2 / 3 / 5.
  2. GET /v1/charge/queue remains but has no real tasks.
  3. Use POST /v1/user/charge to list owned tickets.

3. Interactive demos

3.1 Health

GETHealth
/v1/health

3.2 User reads

POSTUser data
/v1/user/data

3.3 Buy Charge & queue stub

POSTBuy Charge
/v1/charge

3.4 Score writes (upload charts) — details

Do not confuse with POST /v1/user/music (read all scores).
Write/overwritePOST /v1/music/upsert; deletePOST /v1/music/delete.

What one request does

  • Body: qrcode + musicList (array length 1–4).
  • Each item is uniquely identified by (musicId, level).
  • Costs 15 Tokens; success when upstream returnCode === 1.

level

ValueDifficulty
0BASIC
1ADVANCED
2EXPERT
3MASTER
4Re:MASTER
10UTAGE

Exact vs fuzzy (fuzzy) — easy to get wrong

ModefuzzyachievementMeaning of dxScore
ExactfalseTarget rate, e.g. 100.9444Actual DX score (e.g. 2947)
FuzzytrueMinimum desired rateDX star 0–5 (not the raw DX score!)

Fuzzy stars: 0 none · 1 ≥85% · 2 ≥90% · 3 ≥93% · 4 ≥95% · 5 ≥97% of chart max DX.

Minimal exact example

json
{
  "qrcode": "SGWCMAID...",
  "musicList": [
    {
      "musicId": 11479,
      "level": 3,
      "achievement": 100.5,
      "dxScore": 2100,
      "comboStatus": "ap",
      "syncStatus": "fsd",
      "fuzzy": false
    }
  ]
}

More detail: API Reference / SwaggerScore → /v1/music/upsert.

POSTUpsert scores (exact)
/v1/music/upsert

3.5 High-risk writes

POSTGate edit (high risk)
/v1/kaleidx-scope/upsert

3.6 Third-party sync

POSTUpload to LXNS
/v1/update-lx

4. Public JSON catalog

http
GET https://api.wmc.pub/api/docs

5. Usage & failure rate

MethodPathAuthScope
GET/me/usageBearerPersonal log
GET/me/usage/statsBearerDaily stats
GET/usage/failure-rateNoneSite-wide, 7d / 30m buckets
GET/me/usage/failure-rateBearerPersonal failure rate

codeZero counts business success (returnCode 0 for ping, 1 otherwise).

6. Common errors

HTTP / returnCodeMeaning
401Missing/invalid token
403Insufficient balance
4001 etc.Upstream business errors (see returnMessage)
500 / 502Forwarding or decode failure

Tips

Start with /v1/health. Buy tickets with /v1/charge; do not rely on /v1/charge/queue. Never log QR codes or third-party tokens.

Released under the MIT License.