Skip to content

Instantly share code, notes, and snippets.

@theabhishek2511
Last active May 30, 2023 07:24
Show Gist options
  • Star 22 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save theabhishek2511/dfd54989013254324cc4d67f1dbc9f7f to your computer and use it in GitHub Desktop.
Save theabhishek2511/dfd54989013254324cc4d67f1dbc9f7f to your computer and use it in GitHub Desktop.

Shadowverse Card API

Basic

Every response to all the endpoints is encapsulated in a root JSON object with two keys, a data_headers and a data. The data value is a JSON object. For every endpoint, there exist different keys which contain the actual queried data. In case of any errors, data will contain an empty JSON array.

Card information

GET https://shadowverse-portal.com/api/v1/cards

Known Params:

Parameter Possible Values Comments
format json required
lang two letter language code Only supports languages that Shadowverse supports. Applies on description and lore.
clan 0 through 7 Filter by craft.
0 = Neutral
1 through 7 = Forest through Haven, in order.

Response:

data key: cards

Key Type Comments
card_id int The card ID.
Link pages on shadowverse-portal (https://shadowverse-portal.com/card/{card_id})
Image link, base (https://shadowverse-portal.com/image/card/en/C_{card_id}.png)
Image link, evolved (https://shadowverse-portal.com/image/card/en/E_{card_id}.png)
foil_card_id int Unused/unknown usage
card_set_id int The pack the card belongs to.
10000 = Basic
10001 = Standard
10002 = Darkness Evolved
10003 = Rise of Bahamut
10004 = Tempest of the Gods
90000 = Only obtained during a match (e.g. Thorn Burst, which is only obtainable from Rose Queen's ability)
card_name string The card name.
is_foil int, always 0 Unused/unknown usage
char_type int Type of the card.
1 = Follower
2 = Amulet
3 = Countdown Amulet
4 = Spell
clan int Craft the card belongs to.
0 = Neutral
1 through 7 = Forest through Haven, in order.
tribe_name string Trait of the card. For Swordcraft it can be either "Commander" or "Officer", for all other classes it returns "-"
skill_disc string Skill description in plaintext.
evo_skill_disc string Evolved skill description in plaintext.
cost int PP cost of the card.
atk int Attack power of the card.
life int Health of the card.
evo_atk int Attack power of the card after evolution.
evo_life int Health of the card after evolution.
rarity int Rarity. Values are 1 through 4 for Bronze upto Legendary.
get_red_ether int Vials gained upon liquefying.
use_red_ether int Vials required for crafting.
description string Lore of the card.
evo_description string Evolved lore of the card.
cv string card's voice actor.
The string has values only when lang is set to ja; for everything else the value is "".
base_card_id int ID of the original card in case of alternate art version.
e.g. Ancient Elf original and alt art have different card_id, but same base_card_id.
tokens always null Unused/unknown usage?
normal_card_id int, same value as card_id Unused/unknown usage?

Deck Code

GET https://shadowverse-portal.com/api/v1/deck/import

Known Params:

Parameter Possible Values Comments
format json required
deck_code 4 letter deck code The deck code.

Response:

data is the root object

Key Type Comments
text string Value is always "デッキのインポートに成功しました。" regardless of whether deck code was valid or not.
clan string Craft of the deck.
"0" = Neutral
"1" through "7" = Forest through Haven, in order.
null = error
hash string Hash of the deck. Can be used to
- form a deck url: https://shadowverse-portal.com/deck/{hash}
- form a deck image url: https://shadowverse-portal.com/image/{hash}
- used to fetch the deck contents using the Fetching Deck from Deck Code endpoint below.
This usually does not expire.
Key does not exist in case of error.
errors array contains only one json object, with an error key and the error message.
Array is empty if no errors occurred.

Fetching Deck from Deck Code

GET https://shadowverse-portal.com/api/v1/deck

Known Params:

Parameter Possible Values Comments
format json required
lang two letter language code Only supports languages that Shadowverse supports. Applies on description and lore.
hash hash value from the Deck Code endpoint Hash of the deck.

Response:

data key: deck

Key Type Comments
deck_format int Unused/unknown usage?
clan int Craft of the deck.
1 through 7 = Forest through Haven, in order.
cards array Array of the cards used.
See response of Card Information endpoint.
@Mirror-Cocoa
Copy link

After running this API, 500 is returned.
Does this API also support Nemesis?(8?)

@theabhishek2511
Copy link
Author

@Mirror-Cocoa

i have not been maintaining this for 2+ years now but the core fundamentals should still be the same. Please look at tyronesama's discord bot for a more up-to-date implementation.

@Mirror-Cocoa
Copy link

@theabhishek2511

Thank you very much.
I was able to confirm the URL of the portal site of shadowverse at the transition destination of the URL.
I want to make it based on this.

@Manokii
Copy link

Manokii commented May 12, 2021

Hi does anyone know how to parse the card hash to card id?

@Zhen-Bo
Copy link

Zhen-Bo commented Oct 18, 2021

https://shadowverse-portal.com/image/{hash}
{hash} = 1.2.7DjKQ....(get from https://shadowverse-portal.com/api/v1/deck/import?format=json&deck_code=fx3p ->data[hash])
will get an error
Error
An unexpected error occurred.
Please try again later from the Home page.

I get the deck image using
https://shadowverse-portal.com/image/1?lang=zh-tw
header_Referer=https://shadowverse-portal.com/deck/{hash}?lang=zh-tw

@Zhen-Bo
Copy link

Zhen-Bo commented Oct 27, 2021

BTW:deck_code api(deck link to 4 letter deck code)
https://shadowverse-portal.com/api/v1/deck_code/publish

requests method:POST

Known Params:

Parameter Possible Values Comments
format json required
lang two letter language code Only supports languages that Shadowverse supports. Applies on description and lore.

Known requests body(form data):

Parameter Possible Values Comments
hash hash value from the Deck Code endpoint required

and the 4 letter deck code will in the response json
result_code = 1=success
result_code = 205=error

{
  "data_headers": {
    "udid": false,
    "viewer_id": 0,
    "sid": "",
    "servertime": "{servertime}",
    "result_code": 1
  },
  "data": {
    "text": "デッキコードの取得に成功しました。",
    "deck_code": "{4 letter deck code}",
    "error_result": "0",
    "errors": []
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment