You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

api.md 20 kB

4 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
3 years ago
2 years ago
2 years ago
2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  1. # Enka.Network - API
  2. ## Table of Content
  3. - [Getting Started](#getting-started)
  4. - [Data Structure Info](#data-structure-info)
  5. - [Definitions](#definitions)
  6. - [Icons and Images](#icons-and-images)
  7. - [Localizations](#localizations)
  8. ## Getting Started
  9. You can utilize some wrappers made by other people, or use the API directly. It's very simple, so it is not hard at all to hand-roll your own data logic based on the responses. The biggest challenge is navigating the datamined game data and attaching it to the data returned in the right way.
  10. See [Wrappers](#wrappers) for the language of your choice.
  11. ## Before You Request
  12. A couple of rules on using the API:
  13. 1. Please don't try to enumerate UIDs or try to do massive query jobs in an effort to fill a database. There are hundreds of millions of UIDs and you simply won't be able to do this through this API. I may provide batch data at a later point.
  14. 2. Please set a custom `User-Agent` header with your requests so I can track them better and help you if needed.
  15. 3. There are dynamic ratelimits on UID endpoints - if you're requesting too fast, you'll run into slower response times and eventually a 429 return code. This mean you either need to slow down or contact me to see if it's possible to increase the ratelimits for you. In most cases it's not needed and is a result of unoptimized code.
  16. 4. On this note, all UID requests return a `ttl` field - this field is "seconds until the next Showcase request will be made for this UID". Until it runs out, the endpoint will return cached data, but you will still consume your ratelimit if you repeatedly hit it. Try to either cache the data with a timeout of `ttl` upon request, or prevent requests to the UID until its `ttl` runs out. I recommend Redis for this.
  17. If you have difficulties working with the data, hop on the [Discord server](https://discord.gg/PcSZr5sbn3) for help.
  18. ## List of APIs
  19. ### UID endpoints
  20. #### Get Showcase data with full player info
  21. > https://enka.network/api/uid/618285856/
  22. The response will contain `playerInfo` and `avatarInfoList`. `playerInfo` is the basic data about the game account. If `avatarInfoList` is missing, that means the Showcase of this account is either closed or not populated with characters.
  23. #### Get only player info
  24. > https://enka.network/api/uid/618285856/?info
  25. By attaching `?info` to the request, you are requesting only `playerInfo`. The main request always tries to get `avatarInfoList` as well; if you only need `playerInfo`, please use this endpoint - it will be much faster than getting the full data.
  26. In addition, both responses will contain an `owner` object if:
  27. 1. The user has an account on the site
  28. 2. The user added their UID to the profile
  29. 3. The user verified it
  30. 4. The user set its visibility to "public"
  31. More info on user accounts below.
  32. #### HTTP response codes
  33. Please make sure to handle these in your app appropriately.
  34. ```
  35. 400 = Wrong UID format
  36. 404 = Player does not exist (MHY server said that)
  37. 424 = Game maintenance / everything is broken after the game update
  38. 429 = Rate-limited (either by my server or by MHY server)
  39. 500 = General server error
  40. 503 = I screwed up massively
  41. ```
  42. ### Profile endpoints
  43. It is possible to create an account (profile) on the website and attach several game accounts to it. The users are then required to verify that the account belongs to them via a verification code placed in their signature - this way we can ensure the account belongs to them.
  44. Users can "snapshot" builds under custom names, referred as "saved builds".
  45. > https://enka.network/api/profile/Algoinde/
  46. Gets the user info.
  47. > https://enka.network/api/profile/Algoinde/hoyos/
  48. Gets a list of "hoyos" - Genshin accounts and their metadata. This only returns accounts that are `verified` and `public` (users can hide accounts; unverified accounts are hidden by default). Each key in the response is a unique identifier of a hoyo which you need to use for the subsequent requests to actually get the characters/builds information.
  49. > https://enka.network/api/profile/Algoinde/hoyos/4Wjv2e/
  50. Returns metadata for a single hoyo.
  51. > https://enka.network/api/profile/Algoinde/hoyos/4Wjv2e/builds/
  52. Returns saved builds for a given hoyo. This is an object of arrays, where the key is `avatarId` of the character, and objects in arrays are different builds for a given character, in no particular order (but they do have an `order` field you need to order by for display).
  53. If a build has a `live: true` field, that means it's not a "saved" build, but simply what was fetched from their showcase when they clicked "refresh". When refreshed, all old `live` builds are gone and new ones are created. Only the user decides when to perform this refresh - this data will NOT be up-to-date.
  54. As outlined in [UID endpoints](#uid-endpoints), when you make a UID request, you could get an `owner` object. You can construct the URL using these fields in the object:
  55. `https://enka.network/api/profile/{owner.username}/hoyos/{owner.hash}/builds/`
  56. ## Data Structure Info
  57. | Name | Description |
  58. | :--- | :---------- |
  59. | [playerInfo](#playerinfo) | Profile Info |
  60. | [avatarInfoList](#avatarinfolist) | List of detailed information for every character from showcase |
  61. ### playerInfo
  62. For basic data of characters by ID, go to [store/characters.json](https://github.com/EnkaNetwork/API-docs/blob/master/store/characters.json). <br />
  63. For any additional info, check the [Characters Data](https://gitlab.com/Dimbreath/AnimeGameData/-/blob/main/ExcelBinOutput/AvatarExcelConfigData.json).
  64. | Name | Description |
  65. | :--- | :--------- |
  66. | nickname | Player Nickname |
  67. | signature | Profile Signature |
  68. | worldLevel | Player World Level |
  69. | namecardId | Profile Namecard ID |
  70. | finishAchievementNum | Number of Completed Achievements |
  71. | towerFloorIndex | Abyss Floor |
  72. | towerLevelIndex | Abyss Floor's Chamber |
  73. | [showAvatarInfoList](#showavatarinfolist) | List of Character IDs and Levels |
  74. | showNameCardIdList | List of Namecard IDs |
  75. | profilePicture.avatarId | Character ID of Profile Picture |
  76. #### showAvatarInfoList
  77. | Name | Description |
  78. | :--- | :--------- |
  79. | avatarId | Character ID |
  80. | level | Character Level |
  81. | costumeId | ID of character's skin. Check `"Costumes"` in [store/characters.json](https://github.com/EnkaNetwork/API-docs/blob/master/store/characters.json) |
  82. ### avatarInfoList
  83. For basic data of characters by ID, go to [store/characters.json](https://github.com/EnkaNetwork/API-docs/blob/master/store/characters.json). <br />
  84. For any additional info, check the [Characters Data](https://gitlab.com/Dimbreath/AnimeGameData/-/blob/main/ExcelBinOutput/AvatarExcelConfigData.json).
  85. | Name | Description |
  86. | :--- |:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
  87. | avatarID | Character ID |
  88. | talentIdList | List of Constellation IDs <br /> There is no data if 0 Constellation |
  89. | [propMap](#propmap) | Character Info Properties List |
  90. | fightPropMap -> `{id: value}` | Map of Character's Combat Properties. <br />Check the [Definitions for IDs](#fightprop) |
  91. | skillDepotId | Character Skill Set ID <br />[Skills Data](https://gitlab.com/Dimbreath/AnimeGameData/-/blob/main/ExcelBinOutput/AvatarSkillDepotExcelConfigData.json) -> `"id"` |
  92. | inherentProudSkillList | List of Unlocked Skill Ids <br />[Skills Data](https://gitlab.com/Dimbreath/AnimeGameData/-/blob/main/ExcelBinOutput/AvatarSkillDepotExcelConfigData.json) -> `"inherentProudSkillOpens"` |
  93. | skillLevelMap -> `{skill_id: level}`| Map of Skill Levels <br /> [Skills Data](https://gitlab.com/Dimbreath/AnimeGameData/-/blob/main/ExcelBinOutput/AvatarSkillDepotExcelConfigData.json) -> `"inherentProudSkillOpens"` |
  94. | [equipList](#equiplist) | List of Equipments: Weapon, Ariftacts |
  95. | fetterInfo.expLevel | Character Friendship Level |
  96. #### propMap
  97. | Name | Description |
  98. | :--- | :--------- |
  99. | type | ID of Property Type, Check the [Definitions for IDs](#prop) |
  100. | ival | Ignore it |
  101. | val | Value of Property |
  102. #### equipList
  103. | Name | Description |
  104. | :--- | :--------- |
  105. | itemId | Equipment ID <br /> [Artifacts Data](https://gitlab.com/Dimbreath/AnimeGameData/-/blob/main/ExcelBinOutput/ReliquaryExcelConfigData.json) -> `"id"` <br /> [Weapons Data](https://gitlab.com/Dimbreath/AnimeGameData/-/blob/main/ExcelBinOutput/WeaponExcelConfigData.json) -> `"id"` |
  106. | [weapon](#weapon) `[Weapon Only]` | Weapon Base Info |
  107. | [reliquary](#reliquary) `[Artifact Only]` | Artifact Base Info |
  108. | [flat](#flat) | Detailed Info of Equipment |
  109. #### weapon
  110. For any additional info about weapons, check the [Weapons Data](https://gitlab.com/Dimbreath/AnimeGameData/-/blob/main/ExcelBinOutput/WeaponExcelConfigData.json)
  111. | Name | Description |
  112. | :--- | :---------- |
  113. | level | Weapon Level |
  114. | promoteLevel | Weapon Ascension Level |
  115. | affixMap | Weapon Refinement Level `[0-4]` |
  116. #### reliquary
  117. For any additional info about artifacts, check the [Artifacts Data](https://gitlab.com/Dimbreath/AnimeGameData/-/blob/main/ExcelBinOutput/ReliquaryExcelConfigData.json)
  118. | Name | Description |
  119. | :--- | :---------- |
  120. | level | Artifact Level `[1-21]` |
  121. | mainPropId | Artifact Main Stat ID <br /> [MainProps Data](https://gitlab.com/Dimbreath/AnimeGameData/-/blob/main/ExcelBinOutput/ReliquaryMainPropExcelConfigData.json) |
  122. | appendPropIdList | List of IDs of the artifact substats <br /> [AppendProp Data](https://gitlab.com/Dimbreath/AnimeGameData/-/blob/main/ExcelBinOutput/ReliquaryAffixExcelConfigData.json) |
  123. #### flat
  124. | Name | Description |
  125. | :--- | :---------- |
  126. | nameTextHashMap | Hash for Equipment Name <br /> Check [Localizations](#localizations) |
  127. | setNameTextHashMap `[Artifact Only]`| Hash for Artifact Set Name <br /> Check [Localizations](#localizations)|
  128. | rankLevel | Rarity Level of Equipment |
  129. | [reliquaryMainstat](#reliquarymainstat-reliquarysubstats-weaponstats) `[Artifact Only]` | Artifact Main Stat |
  130. | [reliquarySubstats](#reliquarymainstat-reliquarysubstats-weaponstats) `[Artifact Only]` | List of Artifact Substats |
  131. | [weaponStats](#reliquarymainstat-reliquarysubstats-weaponstats) `[Weapon Only]`| List of Weapon Stat: Base ATK, Substat |
  132. | [itemType](#itemtype) | Equipment Type: Weapon or Artifact |
  133. | icon | Equipment Icon Name <br /> [Icon name usage](#icons-and-images)|
  134. | [equipType](#equiptype) `[Artifact Only]` | Artifact Type |
  135. #### reliquaryMainstat, reliquarySubstats, weaponStats
  136. | Name | Description |
  137. | :--- | :---------- |
  138. | mainPropId / appendPropID | Equipment Append Property Name. Check the [Definitions for Names](#appendprop)|
  139. | propValue | Property Value |
  140. ## Definitions
  141. ### Prop
  142. | Type | Description |
  143. | :--: | :---------- |
  144. | 1001 | XP |
  145. | 1002 | Ascension |
  146. | 4001 | Level |
  147. ### FightProp
  148. | Type | Description |
  149. | :--: |:--------------------------------------------------|
  150. | 1 | Base HP |
  151. | 2 | HP |
  152. | 3 | HP% |
  153. | 4 | Base ATK |
  154. | 5 | ATK |
  155. | 6 | ATK% |
  156. | 7 | Base DEF |
  157. | 8 | DEF |
  158. | 9 | DEF% |
  159. | 10 | Base SPD |
  160. | 11 | SPD% |
  161. | 20 | CRIT Rate |
  162. | 22 | CRIT DMG |
  163. | 23 | Energy Recharge |
  164. | 26 | Healing Bonus |
  165. | 27 | Incoming Healing Bonus |
  166. | 28 | Elemental Mastery |
  167. | 29 | Physical RES |
  168. | 30 | Physical DMG Bonus |
  169. | 40 | Pyro DMG Bonus |
  170. | 41 | Electro DMG Bonus |
  171. | 42 | Hydro DMG Bonus |
  172. | 43 | Dendro DMG Bonus |
  173. | 44 | Anemo DMG Bonus |
  174. | 45 | Geo DMG Bonus |
  175. | 46 | Cryo DMG Bonus |
  176. | 50 | Pyro RES |
  177. | 51 | Electro RES |
  178. | 52 | Hydro RES |
  179. | 53 | Dendro RES |
  180. | 54 | Anemo RES |
  181. | 55 | Geo RES |
  182. | 56 | Cryo RES |
  183. | 70 | Pyro Enegry Cost |
  184. | 71 | Electro Energy Cost |
  185. | 72 | Hydro Energy Cost |
  186. | 73 | Dendro Energy Cost |
  187. | 74 | Anemo Energy Cost |
  188. | 75 | Cryo Energy Cost |
  189. | 76 | Geo Energy Cost |
  190. | 80 | Cooldown reduction |
  191. | 81 | Shield Strength |
  192. | 1000 | Current Pyro Energy |
  193. | 1001 | Current Electro Energy |
  194. | 1002 | Current Hydro Energy |
  195. | 1003 | Current Dendro Energy |
  196. | 1004 | Current Anemo Energy |
  197. | 1005 | Current Cryo Energy |
  198. | 1006 | Current Geo Energy |
  199. | 1010 | Current HP |
  200. | 2000 | Max HP |
  201. | 2001 | ATK |
  202. | 2002 | DEF |
  203. | 2003 | SPD |
  204. | 3025 | Elemental reaction CRIT Rate |
  205. | 3026 | Elemental reaction CRIT DMG |
  206. | 3027 | Elemental reaction (Overloaded) CRIT Rate |
  207. | 3028 | Elemental reaction (Overloaded) CRIT DMG |
  208. | 3029 | Elemental reaction (Swirl) CRIT Rate |
  209. | 3030 | Elemental reaction (Swirl) CRIT DMG |
  210. | 3031 | Elemental reaction (Electro-Charged) CRIT Rate |
  211. | 3032 | Elemental reaction (Electro-Charged) CRIT DMG |
  212. | 3033 | Elemental reaction (Superconduct) CRIT Rate |
  213. | 3034 | Elemental reaction (Superconduct) CRIT DMG |
  214. | 3035 | Elemental reaction (Burn) CRIT Rate |
  215. | 3036 | Elemental reaction (Burn) CRIT DMG |
  216. | 3037 | Elemental reaction (Frozen (Shattered)) CRIT Rate |
  217. | 3038 | Elemental reaction (Frozen (Shattered)) CRIT DMG |
  218. | 3039 | Elemental reaction (Bloom) CRIT Rate |
  219. | 3040 | Elemental reaction (Bloom) CRIT DMG |
  220. | 3041 | Elemental reaction (Burgeon) CRIT Rate |
  221. | 3042 | Elemental reaction (Burgeon) CRIT DMG |
  222. | 3043 | Elemental reaction (Hyperbloom) CRIT Rate |
  223. | 3044 | Elemental reaction (Hyperbloom) CRIT DMG |
  224. | 3045 | Base Elemental reaction CRIT Rate |
  225. | 3046 | Base Elemental reaction CRIT DMG |
  226. ### ItemType
  227. | Name | Description |
  228. | :--- | :---------- |
  229. | ITEM_WEAPON | Weapon |
  230. | ITEM_RELIQUARY | Artifact |
  231. ### EquipType
  232. | Name | Description |
  233. | :--- | :---------- |
  234. | EQUIP_BRACER | Flower |
  235. | EQUIP_NECKLACE | Feather |
  236. | EQUIP_SHOES | Sands |
  237. | EQUIP_RING | Goblet |
  238. | EQUIP_DRESS | Circlet |
  239. ### AppendProp
  240. | Name | Description |
  241. | :--- |:-------------------|
  242. | FIGHT_PROP_BASE_ATTACK `[Weapon]` | Base ATK |
  243. | FIGHT_PROP_HP | Flat HP |
  244. | FIGHT_PROP_ATTACK | Flat ATK |
  245. | FIGHT_PROP_DEFENSE | Flat DEF |
  246. | FIGHT_PROP_HP_PERCENT | HP% |
  247. | FIGHT_PROP_ATTACK_PERCENT | ATK% |
  248. | FIGHT_PROP_DEFENSE_PERCENT | DEF% |
  249. | FIGHT_PROP_CRITICAL | Crit RATE |
  250. | FIGHT_PROP_CRITICAL_HURT | Crit DMG |
  251. | FIGHT_PROP_CHARGE_EFFICIENCY | Energy Recharge |
  252. | FIGHT_PROP_HEAL_ADD | Healing Bonus |
  253. | FIGHT_PROP_ELEMENT_MASTERY | Elemental Mastery |
  254. | FIGHT_PROP_PHYSICAL_ADD_HURT | Physical DMG Bonus |
  255. | FIGHT_PROP_FIRE_ADD_HURT | Pyro DMG Bonus |
  256. | FIGHT_PROP_ELEC_ADD_HURT | Electro DMG Bonus |
  257. | FIGHT_PROP_WATER_ADD_HURT | Hydro DMG Bonus |
  258. | FIGHT_PROP_WIND_ADD_HURT | Anemo DMG Bonus |
  259. | FIGHT_PROP_ICE_ADD_HURT | Cryo DMG Bonus |
  260. | FIGHT_PROP_ROCK_ADD_HURT | Geo DMG Bonus |
  261. | FIGHT_PROP_GRASS_ADD_HURT | Dendro DMG Bonus |
  262. ## Icons and Images
  263. You can get icons of characters, weapons and artifacts via Enka, by URL `https://enka.network/ui/[icon_name].png`.
  264. Usually icon name starts with `"UI_"` or `"Skill_"` for [characters talents](#characters-talents-and-consts).
  265. For example https://enka.network/ui/UI_AvatarIcon_Side_Ambor.png.
  266. ### Weapons and Artifacts
  267. Go to [flat](#flat) and look for `icon`.
  268. ### Characters, Talents and Consts
  269. Go to [store/characters.json](https://github.com/EnkaNetwork/API-docs/blob/master/store/characters.json) and look for anything related to "UI_XXXXXX" or "Skill_XXXXXX" by character ID.
  270. ## Localizations
  271. You may notice `"NameTextMapHash"` in [store/characters.json](https://github.com/EnkaNetwork/API-docs/blob/master/store/characters.json), `"nameTextHashMap"` and `"setNameTextHashMap"` at [flat](#flat) that could be used as a key to get basic localization data of characters, weapons and artifacts from [store/loc.json](https://github.com/EnkaNetwork/API-docs/blob/master/store/loc.json).
  272. Also you can get localization data of [AppendProp](#appendprop) by using property name as a key - `"FIGHT_PROP_HP"`, `"FIGHT_PROP_HEAL_ADD"` etc.
  273. For any additional info about names, descriptions and etc, check the [TextMap Data](https://gitlab.com/Dimbreath/AnimeGameData/-/tree/main/TextMap), only includes languages supported by game.
  274. ## Wrappers
  275. TS/JS - https://www.npmjs.com/package/enkanetwork.js - [Jelosus1](https://github.com/Jelosus2)
  276. TS/JS - https://github.com/yuko1101/enka-network-api - [yuko1101](https://github.com/yuko1101)
  277. Rust - https://github.com/eratou/enkanetwork-rs - [eratou](https://github.com/eratou)
  278. Python - https://github.com/mrwan200/enkanetwork.py - [mrwan200](https://github.com/mrwan200)
  279. Python - https://github.com/seriaati/enka-py - [seriaati](https://github.com/seriaati)
  280. Java - https://github.com/kazuryyx/EnkaNetworkAPI - [kazury](https://github.com/kazuryyx)