@valapi Documentation
Generate by mdBook
- node-valapi isn't endorsed by Riot Games and doesn't reflect the views or opinions of Riot Games or anyone officially involved in producing or managing Riot Games properties. Riot Games, and all associated properties are trademarks or registered trademarks of Riot Games, Inc.
- node-valapi was created under Riot Games' "Legal Jibber Jabber" policy using assets owned by Riot Games. Riot Games does not endorse or sponsor this project.
- MIT License
About
valorant.ts
is a NodeJS package that make more easier to use Valorant API
- All-in-one:
- Authentication
- Two-Factor Authentication
- Riot Identity
- CAPTCHAs
- Crosshair Serializer
- Official API
- Leaderboard
- valorant-api.com
- ID
- Information
- Web Client
- Daily Store
- Personal Data
- Authentication
- Open-source
- Typescript Support
- Built-In API Endpoints
Explanation
[NAME]
you need to replace something with it (in this case ex. John, Alex)
Contributors
list of the contributors who helped me improve this module
Developers
Report Bugs
Special Thanks
Valorant API
Rules and Regulations
node-valapi
Data Source
- HeyM1ke / ValorantClientAPI
- techchrism / valorant-api-docs
- ev3nvy / valorant-reauth-script
- Kavan72 / endpoints.txt
- soup061222 / VALORANT-EXAMPLE
Third-Party
Dependency
Package (NPM)
Mentioned
Introduced
Riot Authentication
Install
npm install @valapi/auth
Peer Dependencies
- @valapi/lib
Client
import { Auth } from "@valapi/auth";
Config
interface Config {
/**
* Authenticated User
*/
user?: AuthUserInfo;
/**
* Riot Client SDK Version
*
* ValorantApiCom.Internal.riotClientVersion() [riotGamesApiInfo.VS_FIXEDFILEINFO.FileVersion]
*/
sdk?:
/**
* Riot Client Build
*
* ValorantApiCom.Version.get() [riotClientBuild]
*/
build?: string;
/**
* Riot Client Version
*
* ValorantApiCom.Version.get() [riotClientVersion]
*/
version?: string;
/**
* Riot Client Platform
*
* Where is Riot Client run on?
*/
platform?: ClientPlatfrom;
/**
* Request Config
*/
axiosConfig?: AxiosRequestConfig;
/**
* HTTPS Agent Config
*/
agentConfig?: AgentOptions & CookieAgentOptions;
}
Constructor
const auth = new Auth( config? );
Serialize
JSON
const serializeJson = auth.toJSON();
Cookie
const serializeCookie = auth.cookie.serializeSync();
CAPTCHAs
This is an example of many ways to get a captcha response
const hCaptcha = await auth.captcha();
interface hCaptcha {
sitekey: string;
rqdata: string;
}
Express
Setup an express server
npm install express
import * as express from "express";
const port = 8880;
const app = express();
app.get("/", (req, res) => {
res.sendFile("index.html");
});
app.get("/captcha", (req, res) => {
res.send(hCaptcha);
});
app.get("/verify/:token", async (req, res) => {
res.sendStatus(200);
app.set("captchaResponse", req.params.token);
});
app.listen(port);
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/@hcaptcha/vanilla-hcaptcha" async defer></script>
</head>
<body>
<h-captcha id="signupCaptcha" auto-render="false"></h-captcha>
</body>
<script>
window.onload = async () => {
const captcha = document.getElementById('signupCaptcha');
const response = await fetch("/captcha");
const data = await response.json();
captcha.render({ "sitekey": data.sitekey });
captcha.setData(data.rqdata);
captcha.addEventListener('verified', async event => {
await fetch(`/verify/${event.token}`);
});
};
</script>
</html>
get a captcha response
const captchaResponse = app.set("captchaResponse");
CAPTCHA Solver
npmjs/valapi will not assist and be relevant in any legal actions that happen when using Captcha Solver, so use it at your own risk
const captchaResponse = await CaptchaSolver({
type: "HCaptchaTaskProxyLess",
url: "https://auth.riotgames.com",
sitekey: hCaptcha.sitekey,
rqdata: hCaptcha.rqdata,
});
ref.
Identity Authorization
Once these steps are finished, the authorization should be finished as well
Login credentials
await auth.login({
username: "BestUsername",
password: "SuperSecretPassword",
captcha: captchaResponse
});
Multi-factor authentication
if (auth.isMultifactor) {
const loginCode = 428793;
await auth.multifactor(loginCode);
}
ref.
Cookie Authorization
You can save only cookies for ~30 days
import { AuthInstance } from "@valapi/auth";
const instance = new AuthInstance({ cookie: serializeCookie });
const auth = new Auth({ user: instance.toJSON() });
I recommend running this every time you deserialize
// new Date() >= auth.expirationDate
if (!auth.isAuthenticated) {
await auth.reauthorize();
}
ref.
Introduced
Crosshair Compiler
Install
npm install @valapi/crosshair
Peer Dependencies
- @valapi/lib
Crosshair Compiler
This feature is in Pre-alpha
Client
import { ValCrosshair } from "@valapi/crosshair";
const crosshair = new ValCrosshair();
Usage
Import
crosshair.import(profileCode);
Export
crosshair.export(); // => Profile Code
Introduced
Built-In feature.
Install
npm install @valapi/lib
Peer Dependencies
- @valapi/lib
Resources
Resource | Method |
---|---|
CrosshairColor | fromName |
fromID | |
CrosshairHexColor | fromName |
fromHex | |
ItemTypeId | fromName |
fromID | |
Locale | fromName |
fromID | |
QueueId | fromName |
fromID | |
Region | fromName |
fromID |
Usage
import { [Resource] } from "@valapi/lib";
[Resource].fromName("Name"); // change name to identify
[Resource].fromID("1id3"); // change identify to name
Region
Usage
import { Region } from "@valapi/lib";
Usage
Region | Full Name |
---|---|
na | North_America |
latam | Latin_America |
br | Brazil |
pbe | Public_Beta_Environment |
eu | Europe |
kr | Korea |
ap | Asia_Pacific |
Region.Default.North_America; // => "na"
Region.Default.Latin_America; // => "latam"
Region.Default.Brazil; // => "br"
Region.Default.Public_Beta_Environment; // => "pbe"
Region.Default.Europe; // => "eu"
Region.Default.Korea; // => "kr"
Region.Default.Asia_Pacific; // => "ap"
Example
new Client({
region: Region.Default.Asia_Pacific
});
Introduced
Official Api From Riot Games
Install
npm install @valapi/riot-api
Peer Dependencies
- @valapi/lib
Introduced
import { RiotApi } from "@valapi/riot-api";
Config
You Can Get Api Key From developer.riotgames.com
interface Config {
/**
* API Key
*/
apiKey: string;
/**
* Region
*/
region: Region.Identify;
/**
* Request Config
*/
axiosConfig?: CreateAxiosDefaults;
}
Client
const client = new RiotApi([config]);
API
Service | Function | Arguments |
---|---|---|
AccountV1 | byPuuid | puuid |
byRiotId | gameName, tagLine | |
activeShardsByGameAndPuuid | puuid, game? | |
byAccessToken | authorization | |
ContentV1 | contents | locale? |
MatchV1 | byMatchId | matchId |
listByPuuid | puuid | |
recentByQueue | queueId | |
RankedV1 | leaderboardsByAct | actId, size?, startIndex? |
StatusV1 | platformData |
Usage
const data = await riotApi.[Service].[Function]([Arguments]);
Introduced
Third-Party API by Officer
Install
npm install @valapi/valorant-api.com
Peer Dependencies
- @valapi/lib
Introduced
import { ValorantApiCom } from "@valapi/valorant-api.com";
Config
interface Config {
/**
* Language
*/
language?: ValorantApiCom.Language;
/**
* Request Config
*/
axiosConfig?: CreateAxiosDefaults;
/**
* Response Option
*/
responseOptions?: {
/**
* Delete properties that have a `null` value
*/
ignore_null?: boolean;
};
}
Client
const client = new ValorantApiCom([config?]);
API
Some of API are base on dash.valorant-api.com
Service | Function | Arguments |
---|---|---|
Agent | get | isPlayableCharacter? |
getByUuid | uuid | |
Buddies | get | |
getLevels | ||
getByUuid | uuid | |
getLevelByUuid | uuid | |
Bundles | get | |
getByUuid | uuid | |
Bundles | get | |
getByUuid | uuid | |
Ceremonies | get | |
getByUuid | uuid | |
CompetitiveTiers | get | |
getByUuid | uuid | |
ContentTiers | get | |
getByUuid | uuid | |
Contracts | get | |
getByUuid | uuid | |
Currencies | get | |
getByUuid | uuid | |
Events | get | |
getByUuid | uuid | |
Gamemodes | get | |
getEquippables | ||
getByUuid | uuid | |
getEquippableByUuid | uuid | |
Gear | get | |
getByUuid | uuid | |
Internal | uuid | |
riotClientVersion | ||
LevelBorders | get | |
getByUuid | uuid | |
Maps | get | |
getByUuid | uuid | |
Missions | get | |
getByUuid | uuid | |
Objectives | get | |
getByUuid | uuid | |
PlayerCards | get | |
getByUuid | uuid | |
PlayerTitles | get | |
getByUuid | uuid | |
Seasons | get | |
getCompetitiveSeasons | ||
getByUuid | uuid | |
getCompetitiveSeasonByUuid | uuid | |
Sprays | get | |
getLevels | ||
getByUuid | uuid | |
getLevelByUuid | uuid | |
Themes | get | |
getByUuid | uuid | |
Versions | get | |
Weapons | get | |
getSkins | ||
getSkinChromas | ||
getSkinLevels | ||
getByUuid | uuid | |
getSkinByUuid | uuid | |
getSkinChromaByUuid | uuid | |
getSkinLevelByUuid | uuid |
Usage
const data = await valorantApiCom.[Service].[Function]([Arguments]);
Language
valorant-api.com has a specific language called all
, that will return all languages.
Example:
{
'ar-AE': 'فايد',
'en-US': 'Fade',
'ja-JP': 'フェイド',
'ko-KR': '페이드',
'zh-TW': '菲德'
}
but if you aren't using all
language, you can use en-US
, th-TH
, and more, but it will return only one language you choose.
Example:
"フェイド"; // ja-JP (japanese)
Introduced
API from Web Client
Install
npm install @valapi/web-client
Peer Dependencies
- @valapi/lib
- @valapi/auth
Introduced
import { WebClient } from "@valapi/web-client";
Config
interface Config {
/**
* Authenticated User
*/
user: AuthUserInfo;
/**
* Account Region
*/
region?: Region.ID;
}
Client
const client = new WebClient([config]);
API
Service | Function | Arguments |
---|---|---|
AccountXP | getPlayer | subject |
Config | get | |
Content | get | |
ContractDefinitions | getActiveStory | |
get | ||
getItemProgression | ||
Contracts | get | subject |
activate | subject, contractId | |
unlockItemProgression | subject, definitionId | |
unlockContractProgression | subject, contractId | |
unlockItemSidegrade | subject, definitionId, sidegradeId, optionId | |
upgrade | subject, contractId | |
CoreGame | fetchPlayer | subject |
fetchMatch | matchId | |
fetchMatchLoadouts | matchId | |
disassociatePlayer | subject, matchId | |
fetchAllChatMUCToken | matchId | |
fetchTeamChatMUCToken | matchId | |
fetchVoiceToken | matchId | |
DailyTicket | get | subject |
renew | subject | |
DisplayNameService | fetchPlayers | subject |
Favorites | get | subject |
add | subject, itemId | |
remove | subject, itemId | |
Latency | fetchStats | |
fetchStat | ||
MassRewards | reconcilePlayer | subject |
Match | fetchMatchDetails | matchId |
fetchMatchHistory | subject, queueId?, startIndex?, endIndex? | |
fetchQueueData | ||
MMR | getPlayer | subject |
hideActRankBadge | subject | |
getLeaderboard | seasonId, startIndex?, size?, serachUsername? | |
getCompetitiveUpdates | subject, queueId?, startIndex?, endIndex? | |
Party | refreshCompetitiveTier | subject, partyId |
refreshPlayerIdentity | subject, partyId | |
refreshPings | subject, partyId | |
get | partyId | |
getMUCToken | partyId | |
getVoiceToken | partyId | |
setAccessibility | partyId, accessibility | |
inviteByDisplayName | partyId, gameName, tagLine | |
declineJoinRequest | partyId, requestId | |
Party.MatchMaking | changeQueue | partyId, queueId |
makeDefaultQueue | partyId, queueId | |
startSoloExperience | subject | |
start | partyId | |
leave | partyId | |
Party.Player | get | subject |
remove | subject | |
joinParty | subject, partyId | |
leaveParty | subject, partyId | |
setReady | subject, partyId, isReady | |
leaveFromParty | subject, partyId | |
transferOwner | subject, partyId | |
Party.CustomGame | makeInto | partyId |
start | partyId | |
changeSettings | partyId, settings | |
changeTeam | partyId, team, subject | |
setBalance | partyId | |
getConfig | ||
Party.PartyCode | create | partyId |
delete | partyId | |
join | partyCode | |
Personalization | getPlayerLoadout | subject |
changePlayerLoadout | subject, loadout | |
PreGame | getPlayer | subject |
getMatch | matchId | |
getMatchLoadouts | matchId | |
selectCharacter | matchId, agentId | |
lockCharacter | matchId, agentId | |
fetchVoiceToken | matchId | |
fetchChatToken | matchId | |
quitMatch | matchId | |
Restrictions | fetchPlayerReportToken | matchId, offenderSubject |
fetchPlayerRestrictions | ||
Session | connect | subject |
heartbeat | subject | |
disconnect | subject | |
get | subject | |
reconnect | subject | |
Store | getWallet | subject |
getOffers | ||
getEntitlements | subject, itemTypeId | |
Store.StoreFront | get | subject |
revealNightMarketOffers | subject | |
getAgent |
Usage
const data = await webClient.[Service].[Function]([Arguments]);