Skip to main content

Prerequisites

Before you begin, make sure you have:

Get started

1

Get your API key

Register for a Riot Games API key at the Riot Games Developer Portal.
Development API keys expire after 24 hours. For production applications, apply for a production API key through the developer portal.
2

Initialize the client

Create a Valaw client instance with your API token and cluster:
client.py:138-156
import valaw
import asyncio

async def main():
    client = valaw.Client("YOUR_RIOT_API_TOKEN", "americas")
The Client constructor accepts three parameters:
  • token (str): Your Riot Games API access token
  • cluster (str): The default cluster for requests. Valid clusters: americas, asia, esports, europe
  • raw_data (bool, optional): Return raw JSON dicts instead of typed objects. Defaults to False
Choose the cluster closest to your server location for optimal performance.
3

Make your first API call

Use the client to fetch VALORANT content data:
client.py:268-293
async def main():
    client = valaw.Client("YOUR_RIOT_API_TOKEN", "americas")
    try:
        # Get game content for North America (en-US locale)
        content = await client.GET_getContent("na", "en-US")
        
        # Access typed response properties
        print(f"Content version: {content.version}")
        print(f"Number of characters: {len(content.characters)}")
        print(f"Number of maps: {len(content.maps)}")
    finally:
        await client.close()
The GET_getContent method accepts:
  • region (str): The region to execute against. Valid regions: ap, br, esports, eu, kr, latam, na
  • locale (str, optional): The locale for localized content (e.g., en-US, es-MX, ja-JP)
Specifying a locale parameter improves response times by filtering content to a specific language.
4

Close the client

Always close the client when you’re done to properly clean up the aiohttp session:
client.py:168-170
try:
    content = await client.GET_getContent("na", "en-US")
    print(content)
finally:
    await client.close()
The try/finally pattern ensures the client is closed even if an exception occurs.
5

Run your script

Execute your async function using asyncio.run():
README.md:33-46
import valaw
import asyncio

async def main():
    client = valaw.Client("YOUR_RIOT_API_TOKEN", "americas")
    try:
        content = await client.GET_getContent("na", "en-US")
        print(content)
    finally:
        await client.close()

asyncio.run(main())
Replace YOUR_RIOT_API_TOKEN with your actual API key from the developer portal.

Complete example

Here’s the complete working example:
import valaw
import asyncio

async def main():
    client = valaw.Client("YOUR_RIOT_API_TOKEN", "americas")
    try:
        content = await client.GET_getContent("na", "en-US")
        print(f"Content version: {content.version}")
        print(f"Characters: {len(content.characters)}")
        print(f"Maps: {len(content.maps)}")
    finally:
        await client.close()

asyncio.run(main())

What’s next?

Now that you’ve made your first API call, explore more advanced features:

API Reference

Browse all available endpoints and methods

Examples

View real-world usage examples

Error handling

Valaw raises specific exceptions for different error conditions:
client.py:47-80
try:
    content = await client.GET_getContent("na", "en-US")
except valaw.Exceptions.RiotAPIResponseError as e:
    print(f"API error {e.status_code}: {e.status_message}")
except valaw.Exceptions.InvalidRegion as e:
    print(f"Invalid region: {e}")
except valaw.Exceptions.InvalidLocale as e:
    print(f"Invalid locale: {e}")
Common exceptions:
  • RiotAPIResponseError: The Riot API returned an error response (rate limit, not found, etc.)
  • InvalidCluster: The provided cluster is not valid
  • InvalidRegion: The provided region is not valid
  • InvalidLocale: The provided locale is not valid
  • InvalidRiotAPIKey: API key is missing or empty

Build docs developers (and LLMs) love