Valorant API Documentation
repository·trunk·Indexed 20 days ago
https://github.com/techchrism/valorant-api-docsA collection of documented endpoints and TypeScript return types for the unofficial Valorant API. It provides raw types and Zod-powered data transformation schemas via the valorant-api-types package (v0.10.1). The documentation covers various API categories including Contracts, Current Game, Local Chat, Party, Pre-Game, PVP Endpoints, Riot Auth, Session, Store, and Third-Party API by Officer, as well as instructions for connecting to local HTTPS and WebSocket APIs.
What's inside valorant-api-docs
- The PVP Endpoints provide access to player-specific data, match history, matchmaking ratings (MMR), and game content. These endpoints allow developers to retrieve information regarding account progression, player loadouts, competitive leaderboards, and gameplay restrictions.
Overview of Riot Auth endpoints
trunkThe Riot Auth documentation provides a set of endpoints required to handle the authentication flow for Riot services. The process typically involves preparing cookies, performing the authorization request, handling multi-factor authentication (MFA) if required, and using cookies for re-authentication or retrieving entitlements and player information.Use Valorant API types and generate code
trunkThe project provides a TypeScript module published on npm. Developers can consume this module to:
- Use the predefined Valorant API types in their own TypeScript projects.
- Generate documentation from the module.
- Generate API client code based on the defined endpoints.
Manage game sessions with Session endpoints
trunkThe Session endpoints allow you to interact with the current game session state. There are two primary operations available:
- Get Session Information: Retrieve details about the current active game session.
- Re-connect Session: Re-establish a connection to the current game session.
Identify Region and Shard
trunkRegions and shards are used to construct remote API URLs.
Determining Region
- Locally: Use the
RiotClientSession_FetchSessionsendpoint and look for the-ares-deployment=argument, or scrape theShooterGamelog for region strings in URLs. - Manually: Users can provide one of the following Region IDs:
na(North America)latam(Latin America)br(Brazil)eu(Europe)ap(Asia Pacific)kr(Korea)
Determining Shard
Shards are often tied to regions but can vary. Use the following mapping:
Region ID Shard(s) latam na br na na na OR pbe eu eu ap ap kr kr - Locally: Use the
Understand Client Platform data
trunkThe client platform is represented as a Base-64 encoded JSON string containing the following fields:
{ "platformType": "PC", "platformOS": "Windows", "platformOSVersion": "10.0.19042.1.256.64bit", "platformChipset": "Unknown" }ew0KCSJwbGF0Zm9ybVR5cGUiOiAiUEMiLA0KCSJwbGF0Zm9ybU9TIjogIldpbmRvd3MiLA0KCSJwbGF0Zm9ybU9TVmVyc2lvbiI6ICIxMC4wLjE5MDQyLjEuMjU2LjY0Yml0IiwNCgkicGxhdGZvcm1DaGlwc2V0IjogIlVua25vd24iDQp9Retrieve Riot Entitlement
trunkOnce you have obtained a valid Riot token, use theEntitlementendpoint to retrieve the player's entitlement.Set up the Valorant API Docs Web development environment
trunkTo run the Valorant API Docs Web frontend locally, install the dependencies and start the development server using
npm. This project is built with Astro, TypeScript, and Tailwind CSS and generates a static site.npm install npm run devParse and transform data using Zod schemas
trunkThe package uses
zodto document and transform return data. If you havezodinstalled as a dev dependency, you can use the endpoint schemas to parse raw JSON and transform it into a processed format. This is useful for handling data that requires transformation (e.g., converting base64-encoded strings into objects).- Use
z.input<typeof endpoint.responses['200']>to get the type of the raw incoming data. - Use
z.output<typeof endpoint.responses['200']>to get the type of the data after it has been processed by the schema. - Call
.parse(returnData)on the schema to perform the transformation at runtime.
import {presenceEndpoint} from 'valorant-api-types' import {z} from 'zod' // presences[0].private -> base64-encoded json string type PresenceResponseRaw = z.input<typeof presenceEndpoint.responses['200']> // presences[0].private -> {sessionLoopState: string, customGameName: string, ...} type PresenceResponseProcessed = z.output<typeof presenceEndpoint.responses['200']> async function getPresence(): Promise<PresenceResponseProcessed > { const returnData = await (await fetch('...')).json() return presenceEndpoint.responses['200'].parse(returnData) }- Use
Install valorant-api-types
trunkInstall the package using npm. Choose the installation method based on whether you need the endpoint data or only the TypeScript types:
- For endpoint data and types:
npm install valorant-api-types - For types only (development dependency):
npm install valorant-api-types --save-dev
npm install valorant-api-types # OR npm install valorant-api-types --save-dev- For endpoint data and types:
Fetch local Swagger documentation
trunkYou can fetch JSON Swagger documentation for local endpoints to import them into tools like Swagger UI or Insomnia. This is useful for exploring and testing local API surfaces.
Note: This documentation source is deprecated. For the latest documentation, visit https://valapidocs.techchrism.me/endpoint/local-swagger-docs.
GET https://127.0.0.1:{lockfile port}/swagger/v3/openapi.json Authorization: Basic {base64 encoded "riot:{lockfile password}"}Obtain a Player's PUUID
trunkTo retrieve a player's unique identifier (PUUID), use one of the following methods:
- Locally: Use the
TEXT_CHAT_RNet_FetchSessionendpoint. - Remotely: Use the
RSO_GetPlayerInfoendpoint with a valid Riot token.
- Locally: Use the