Skip to main content

Introducing the Riftcodex API!

· 4 min read
Univold
Univold
Open Source Enthusiast | Certified Nasus Main

Introduction

Hey everyone, thanks for stopping by!

I first decided to create an API for Riftbound a few months ago when I found that there was nothing else out there. Sure, there were a few places that you could scrape the data from, but when you just want to build something, doing all that extra legwork is no fun.

I have a bit of experience in working on projects in the TCG space. Earlier this year I created a retrieval-augmented generation (RAG) search engine for Magic: The Gathering, where I leveraged the brilliant Scryfall API. So I wanted to create something similar for Riftbound following their example.

Thus, the Riftcodex API was born. Currently, it consists of three main components.

  • Cards - Search and retrieve detailed information about individual Riftbound cards
  • Sets - Get information about different Riftbound card sets
  • Index - Get information about specific Riftbound categories (keywords, types, artists)

Getting started

The documentation linked above contains all the information you need to get started with using the API. You'll find details on the available endpoints, query parameters, and response formats.

But I'll just briefly run through a few examples here to get you started :)

https://api.riftcodex.com/cards?size=1
Response
{
"items":[
{
"id":"2b1b64ea-2c87-4837-8c90-d9b4b9885818",
"name":"Blind Monk",
"riftbound_id":"ogn-257-298",
"tcgplayer_id":"653055",
"public_code":"OGN-257/298",
"collector_number":257,
"attributes":{
"energy":null,
"might":null,
"power":null
},
"classification":{
"type":"Legend",
"supertype":null,
"rarity":"Rare",
"domain":[
"Calm",
"Body"
]
},
"text":{
"rich":"<p>:rb_energy_1:, :rb_exhaust:: Buff a friendly unit. <em>(If it doesn't have a buff, it gets a +1 :rb_might: buff.)</em></p>",
"plain":":rb_energy_1:, :rb_exhaust:: Buff a friendly unit. (If it doesn't have a buff, it gets a +1 :rb_might: buff.)"
},
"set":{
"set_id":"OGN",
"label":"Origins"
},
"media":{
"image_url":"https://cmsassets.rgpub.io/sanity/images/dsfx7636/game_data_live/ffe064e002d3b9a366748eb85102a769b2545835-744x1039.png",
"artist":"Six More Vodka",
"accessibility_text":"Riftbound Legend: Blind Monk. [1], [T]: Buff a friendly unit. (If it doesn't have a buff, it gets a +1 [S] buff.)"
},
"tags":[
"Lee Sin"
],
"orientation":"portrait",
"metadata":{
"clean_name":"Blind Monk",
"alternate_art":false,
"overnumbered":false,
"signature":false
}
}
],
"total":1,
"page":1,
"size":1,
"pages":1
}

We can sort the results by different categories too. For example here we're sorting by might in descending order to get the card with the highest might value

https://api.riftcodex.com/cards?size=1&sort=might&dir=-1
Response
{
"items":[
{
"id":"2be808f2-6cd3-4450-96a9-8279f9b522d2",
"name":"Mountain Drake",
"riftbound_id":"ogn-142-298",
"tcgplayer_id":"652926",
"public_code":"OGN-142/298",
"collector_number":142,
"attributes":{
"energy":9,
"might":10,
"power":null
},
"classification":{
"type":"Unit",
"supertype":null,
"rarity":"Uncommon",
"domain":[
"Body"
]
},
"text":{
"rich":"",
"plain":""
},
"set":{
"set_id":"OGN",
"label":"Origins"
},
"media":{
"image_url":"https://cmsassets.rgpub.io/sanity/images/dsfx7636/game_data_live/8a9c1d334b217e9bd0b23dfca2054de4d0b90ff1-744x1039.png",
"artist":"Kudos Productions",
"accessibility_text":"Riftbound Unit: Mountain Drake."
},
"tags":[
"Dragon"
],
"orientation":"portrait",
"metadata":{
"clean_name":"Mountain Drake",
"alternate_art":false,
"overnumbered":false,
"signature":false
}
}
],
"total":553,
"page":1,
"size":1,
"pages":553
}

Finally, some searching. Let's search for all cards with "dragons" in their text.

http://api.riftcodex.com/cards/search?query=teemo
Response
{
"items":[
{
"id":"50edee5b-f77b-45ea-b1b5-b3f105699517",
"name":"Herald of Scales",
"riftbound_id":"ogn-140-298",
"tcgplayer_id":"652924",
"public_code":"OGN-140/298",
"collector_number":140,
"attributes":{
"energy":4,
"might":3,
"power":null
},
"classification":{
"type":"Unit",
"supertype":null,
"rarity":"Uncommon",
"domain":[
"Body"
]
},
"text":{
"rich":"<p>Your Dragons' Energy costs are reduced by :rb_energy_2:, to a minimum of :rb_energy_1:.</p>",
"plain":"Your Dragons' Energy costs are reduced by :rb_energy_2:, to a minimum of :rb_energy_1:."
},
"set":{
"set_id":"OGN",
"label":"Origins"
},
"media":{
"image_url":"https://cmsassets.rgpub.io/sanity/images/dsfx7636/game_data_live/be49bceea1d328769774fb4daac4732861f6e4fd-744x1039.png",
"artist":"Polar Engine Studio",
"accessibility_text":"Riftbound Unit: Herald of Scales. Your Dragons' Energy costs are reduced by [2], to a minimum of [1]."
},
"tags":[
"Mount Targon"
],
"orientation":"portrait",
"metadata":{
"clean_name":"Herald of Scales",
"alternate_art":false,
"overnumbered":false,
"signature":false
}
},
{
"id":"5252feec-2907-474b-81c2-f424bb466df1",
"name":"Harnessed Dragon",
"riftbound_id":"ogn-234-298",
"tcgplayer_id":"653028",
"public_code":"OGN-234/298",
"collector_number":234,
"attributes":{
"energy":8,
"might":6,
"power":2
},
"classification":{
"type":"Unit",
"supertype":null,
"rarity":"Rare",
"domain":[
"Order"
]
},
"text":{
"rich":"<p>When you play me, kill an enemy unit.</p>",
"plain":"When you play me, kill an enemy unit."
},
"set":{
"set_id":"OGN",
"label":"Origins"
},
"media":{
"image_url":"https://cmsassets.rgpub.io/sanity/images/dsfx7636/game_data_live/00bc15bc1c2f5b8e6d1713819998df1c04864dcb-744x1039.png",
"artist":"Envar Studio",
"accessibility_text":"Riftbound Unit: Harnessed Dragon. When you play me, kill an enemy unit."
},
"tags":[
"Dragon",
"Demacia"
],
"orientation":"portrait",
"metadata":{
"clean_name":"Harnessed Dragon",
"alternate_art":false,
"overnumbered":false,
"signature":false
}
},
{
"id":"bb537e01-3cc0-4b66-9168-4a1a58cbef05",
"name":"Dragon's Rage",
"riftbound_id":"ogn-258-298",
"tcgplayer_id":"653056",
"public_code":"OGN-258/298",
"collector_number":258,
"attributes":{
"energy":4,
"might":null,
"power":1
},
"classification":{
"type":"Spell",
"supertype":"Signature",
"rarity":"Epic",
"domain":[
"Calm",
"Body"
]
},
"text":{
"rich":"<p>Move an enemy unit. Then choose another enemy unit at its destination. They deal damage equal to their Mights to each other.</p>",
"plain":"Move an enemy unit. Then choose another enemy unit at its destination. They deal damage equal to their Mights to each other."
},
"set":{
"set_id":"OGN",
"label":"Origins"
},
"media":{
"image_url":"https://cmsassets.rgpub.io/sanity/images/dsfx7636/game_data_live/7f4cbd4fb340cc13b3fbe0ec0db706464d9b29f4-744x1039.png",
"artist":"Kudos Productions",
"accessibility_text":"Riftbound Spell: Dragon's Rage. Move an enemy unit. Then choose another enemy unit at its destination. They deal damage equal to their Mights to each other."
},
"tags":[
"Lee Sin"
],
"orientation":"portrait",
"metadata":{
"clean_name":"Dragons Rage",
"alternate_art":false,
"overnumbered":false,
"signature":false
}
}
],
"total":3,
"page":1,
"size":50,
"pages":1
}

Conclusion

And that's it for now! It's still very early days at the moment and it's a one man band here, so please bear with me as I iron out any bugs. Always happy to hear any suggestions for improvements or new features too.