A NodeJS module that wraps the Valorant Api in a user friendly interface, available on NPM.
This is an unofficial package so it's not developed or maintained by Riot Games. Use it carefully and follow the ToS.
All methods available from Valorant API are supported, for more information regarding them, please visit documentation.
For Typescript users, all the request and response api interfaces are created and exported to be used.
The package is available through NPM, which means you can choose to install it using either npm
or yarn
NPM:
npm install riot-valorant-api
Yarn:
yarn add riot-valorant-api
In order to use the API, Riot has some rules and requires the users to register their product. It can be for personal or professional use, choose according to your needs. For more information regarding the registration, check Riot Portal.
To start using the package, you need to import and initialize the API class. You need to create it with your API_TOKEN
which you get from creating an application on the Riot Portal and the your region.
Using Typescript or bundler:
import { RiotValorantApi, Regions.EUROPE } from "riot-valorant-api";
const valorantApi = new RiotValorantApi("YOUR_TOKEN_API", Regions.EUROPE);
Using native NodeJS:
const { RiotValorantApi, Regions.EUROPE } = require("riot-valorant-api");
const valorantApi = new RiotValorantApi("YOUR_TOKEN_API", Regions.EUROPE);
Here are a few examples of the methods supported by the module.
Get all content from Valorant. You can pass a locale or fetch the data with all the available locales
const content: Content = await valorantApi.ContentV1.getAllContent(Locales.EN_GB)
Get match by id
const match: Match = await valorantApi.MatchV1.getMatchById("MATCH_ID")
Get matchlist for games played by puuid
const matchlist : MatchList = await valorantApi.MatchV1.getMatchListsByPuuid("PUUID")
Get recent matches
const recentMatches: RecentMatches = await valorantApi.MatchV1.getRecentMatches(Queue.COMPETITIVE)
Get leaderboard for the competitive queue
const leaderboard: Leaderboard = await valorantApi.RankedV1.getLeaderboardByAct("ACT_ID", size = 20, startIndex = 0)
Get Valorant status for the given platform
const status: PlatformData = await valorantApi.StatusV1.getPlatformData()
All errors threw by the package will have the structure represented in ApiError.
export interface ApiError {
request: {
method: string; // Method
path: string; // Path
baseUrl: string; // Base Url
headers: { [header: string]: string }; // Headers
};
status: number; // Status code
error: string; // Error message
}
To run the tests for this project:
NPM:
npm run test
Yarn:
yarn test
If you encounter any problems, bugs or other issues with the package, please create an issue in the GitHub repo.