HoYoAPI Backend

Ce serveur expose les routes API pour l'extension CHghosts.

Routes disponibles

POST/api/account/login

Connexion — génère un token

Body :
{
  "username": "string",
  "password": "string"
}
Exemple curl
curl -X POST http://localhost:3000/api/account/login \
  -H "Content-Type: application/json" \
  -d '{"username":"monuser","password":"monpass"}'
POST/api/account/veriflogin

Vérifie si un token est valide (token dans body ou header Authorization)

Body :
{
  "token": "string (optionnel si envoyé en header)"
}
Exemple curl
curl -X POST http://localhost:3000/api/account/veriflogin \
  -H "Content-Type: application/json" \
  -d '{"token":"VOTRE_TOKEN"}'
POST/api/game/genshin/characters

Personnages Genshin Impact (avec constellations, skills, artefacts)

Body :
{
  "server": "os_euro (défaut)",
  "role_id": "string (UID ou account_id)",
  "hoyolab_cookies": "string (requis pour HoYoLab)",
  "device_fp": "string (optionnel)",
  "device_id": "string (optionnel)",
  "force_refresh": "boolean (optionnel)"
}
Exemple curl
curl -X POST http://localhost:3000/api/game/genshin/characters \
  -H "Content-Type: application/json" \
  -d '{"server":"os_euro","role_id":"706809753","hoyolab_cookies":"cookie1=val1;..."}'
POST/api/game/hkrpg/characters

Personnages Honkai: Star Rail

Body :
{
  "server": "prod_official_eur (défaut)",
  "role_id": "string",
  "hoyolab_cookies": "string (requis pour HoYoLab)",
  "device_fp": "string (optionnel)",
  "device_id": "string (optionnel)",
  "force_refresh": "boolean (optionnel)"
}
Exemple curl
curl -X POST http://localhost:3000/api/game/hkrpg/characters \
  -H "Content-Type: application/json" \
  -d '{"server":"prod_official_eur","role_id":"VOTRE_ROLE_ID","hoyolab_cookies":"..."}'
POST/api/game/zzz/characters

Personnages Zenless Zone Zero

Body :
{
  "server": "prod_official_eur (défaut)",
  "role_id": "string",
  "hoyolab_cookies": "string (requis pour HoYoLab)",
  "device_fp": "string (optionnel)",
  "device_id": "string (optionnel)",
  "force_refresh": "boolean (optionnel)"
}
Exemple curl
curl -X POST http://localhost:3000/api/game/zzz/characters \
  -H "Content-Type: application/json" \
  -d '{"server":"prod_official_eur","role_id":"VOTRE_ROLE_ID","hoyolab_cookies":"..."}'
GET/api/game/record-card

Game Record Card (UID du compte)

Query : ?uid=xxx&force_refresh=true (optionnel)
Exemple curl
curl -X GET "http://localhost:3000/api/game/record-card?uid=706809753"
POST/api/game/record-card

Game Record Card (version POST)

Body :
{
  "uid": "string (requis)",
  "hoyolab_cookies": "string (optionnel)",
  "force_refresh": "boolean (optionnel)"
}
Exemple curl
curl -X POST http://localhost:3000/api/game/record-card \
  -H "Content-Type: application/json" \
  -d '{"uid":"706809753"}'
GET/api/cache

Statistiques du cache

Exemple curl
curl -X GET http://localhost:3000/api/cache
DELETE/api/cache

Vider le cache (tout ou une clé)

Query : ?key=xxx (optionnel — supprime une clé ; sans key = vide tout)
Exemple curl
curl -X DELETE "http://localhost:3000/api/cache?key=genshin_characters_detail:os_euro:706809753"

Note : Les routes sont ouvertes — aucune clé d'authentification requise. Envoyez les données nécessaires (hoyolab_cookies, role_id, uid, etc.) selon la route.