jvergerolle / Genshin-Impact-Wish-history-API

Description of the Genshin impact wish history API
31 stars 4 forks source link
authkey genshin genshin-impact history json

Genshin Impact Wish History Web API (Global version)


Get wish history (JSON)

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

Returned JSON example

{
    "retcode": 0,
    "message": "OK",
    "data":
    {
        "page": "1",
        "size": "6",
        "total": "0",
        "list":
        [
            {
                "uid": "700000000",
                "gacha_type": "301",
                "item_id": "",
                "count": "1",
                "time": "2021-11-24 22:18:45",
                "name": "Albedo",
                "lang": "en-us",
                "item_type": "Character",
                "rank_type": "5",
                "id": "1637787960000243756"
            },
            {
                "uid": "700000000",
                "gacha_type": "301",
                "item_id": "",
                "count": "1",
                "time": "2021-11-24 22:18:45",
                "name": "Rosaria",
                "lang": "en-us",
                "item_type": "Character",
                "rank_type": "4",
                "id": "1637787960000243656"
            },
            {
                "uid": "700000000",
                "gacha_type": "301",
                "item_id": "",
                "count": "1",
                "time": "2021-11-24 22:18:45",
                "name": "Magic Guide",
                "lang": "en-us",
                "item_type": "Weapon",
                "rank_type": "3",
                "id": "1637787960000243556"
            },
            {
                "uid": "700000000",
                "gacha_type": "301",
                "item_id": "",
                "count": "1",
                "time": "2021-11-24 22:18:45",
                "name": "Ferrous Shadow",
                "lang": "en-us",
                "item_type": "Weapon",
                "rank_type": "3",
                "id": "1637787960000243456"
            },
            {
                "uid": "700000000",
                "gacha_type": "301",
                "item_id": "",
                "count": "1",
                "time": "2021-11-24 22:18:45",
                "name": "Magic Guide",
                "lang": "en-us",
                "item_type": "Weapon",
                "rank_type": "3",
                "id": "1637787960000243356"
            },
            {
                "uid": "700000000",
                "gacha_type": "400",
                "item_id": "",
                "count": "1",
                "time": "2021-11-24 22:18:28",
                "name": "Sharpshooter's Oath",
                "lang": "en-us",
                "item_type": "Weapon",
                "rank_type": "3",
                "id": "1637787960000237756"
            }
        ],
        "region": "os_euro"
    }
}

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)

Update 2.5 (January 2022)

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