项目作者: jvergerolle

项目描述 :
Description of the Genshin impact wish history API
高级语言:
项目地址: git://github.com/jvergerolle/Genshin-Impact-Wish-history-API.git


Genshin Impact Wish History Web API (Global version)


Get wish history (JSON)

  1. https://hk4e-api-os.hoyoverse.com/event/gacha_info/api/getGachaLog?authkey_ver=1&sign_type=2&auth_appid=webview_gacha&init_type=301&lang=en&authkey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&gacha_type=301&page=1&size=6&end_id=0

Base URL : https://hk4e-api-os.hoyoverse.com/event/gacha_info/api/getGachaLog
(the base URL may differ on chinese version of the game)

Params

  • authkey_ver=1 mandatory
  • sign_type=2 mandatory
  • auth_appid=webview_gatcha
  • init_type=gatcha code number mandatory
    • 100 = begginer banner
    • 200 = permanent banner
    • 301 = character event banner
    • 302 = weapon event banner
  • lang=country code mandatory (Same lang code as the game)
    • en = English
    • fr = French
  • authkey=urlencoded key mandatory (vary with time can be obtained from the game or external pages fetch by the game)
  • gatcha_type=gatcha code number mandatory
    • 100 = begginer banner
    • 200 = permanent banner
    • 301 = event banner
    • 302 = weapon banner
  • page=page number mandatory
  • size=array size (between 1 and 20 / default 6)
  • end_id = last wish id in the previous page (can be 0 to get first page)

Returned JSON example

  1. {
  2. "retcode": 0,
  3. "message": "OK",
  4. "data":
  5. {
  6. "page": "1",
  7. "size": "6",
  8. "total": "0",
  9. "list":
  10. [
  11. {
  12. "uid": "700000000",
  13. "gacha_type": "301",
  14. "item_id": "",
  15. "count": "1",
  16. "time": "2021-11-24 22:18:45",
  17. "name": "Albedo",
  18. "lang": "en-us",
  19. "item_type": "Character",
  20. "rank_type": "5",
  21. "id": "1637787960000243756"
  22. },
  23. {
  24. "uid": "700000000",
  25. "gacha_type": "301",
  26. "item_id": "",
  27. "count": "1",
  28. "time": "2021-11-24 22:18:45",
  29. "name": "Rosaria",
  30. "lang": "en-us",
  31. "item_type": "Character",
  32. "rank_type": "4",
  33. "id": "1637787960000243656"
  34. },
  35. {
  36. "uid": "700000000",
  37. "gacha_type": "301",
  38. "item_id": "",
  39. "count": "1",
  40. "time": "2021-11-24 22:18:45",
  41. "name": "Magic Guide",
  42. "lang": "en-us",
  43. "item_type": "Weapon",
  44. "rank_type": "3",
  45. "id": "1637787960000243556"
  46. },
  47. {
  48. "uid": "700000000",
  49. "gacha_type": "301",
  50. "item_id": "",
  51. "count": "1",
  52. "time": "2021-11-24 22:18:45",
  53. "name": "Ferrous Shadow",
  54. "lang": "en-us",
  55. "item_type": "Weapon",
  56. "rank_type": "3",
  57. "id": "1637787960000243456"
  58. },
  59. {
  60. "uid": "700000000",
  61. "gacha_type": "301",
  62. "item_id": "",
  63. "count": "1",
  64. "time": "2021-11-24 22:18:45",
  65. "name": "Magic Guide",
  66. "lang": "en-us",
  67. "item_type": "Weapon",
  68. "rank_type": "3",
  69. "id": "1637787960000243356"
  70. },
  71. {
  72. "uid": "700000000",
  73. "gacha_type": "400",
  74. "item_id": "",
  75. "count": "1",
  76. "time": "2021-11-24 22:18:28",
  77. "name": "Sharpshooter's Oath",
  78. "lang": "en-us",
  79. "item_type": "Weapon",
  80. "rank_type": "3",
  81. "id": "1637787960000237756"
  82. }
  83. ],
  84. "region": "os_euro"
  85. }
  86. }

Updates

Update February 2021

item_id is no longer filled in response

Update 1.4 (March 2021)

Mihoyo has changed the pagination mechanic. They added an id for each wish and a parameter end_id in the url. To get the wishes in a page you need to provide the last wish id from the previous page in the end_id parameter. If you do not provide a valid end_id or end_id is missing the API will return the first page.

Update 2.3 (November 2021)

  • Mihoyo has changed the authentication method to request the API. The authkey to get wish data must be from the webview_gatcha app (wish history page) in order to get the wish history.
  • The value of key gacha_type can now be 301 or 400. (301 will be for wishes made on “Character event wish” banners and 400 will be for “Character event wish - 2”.)

Update 2.5 (January 2022)

API domain changed from hk4e-api-os.mihoyo.com to hk4e-api-os.hoyoverse.com