SkillAgentSearch skills...

R6api.js

🍫 Node.js wrapper around Rainbow Six Siege APIs

Install / Use

/learn @danielwerg/R6api.js

README

[!IMPORTANT]

R6API.js won't be maintained in foreseeable future. The reasons are simple — I've pretty much lost the interest in players statistics which is core of this package and working with Ubisoft APIs is pain in an ass most of the time (as of launch of Heavy Mettle players stats endpoint is broken again). For most up to date version see next branch. A lot of things, such as assets and constants from this package was moved to my new package — R6Data

<div align="center"> <h1>R6API.js</h1> <h3>🍫 Node.js wrapper around Rainbow Six: Siege API</h3> <p> <a href="https://github.com/danielwerg/r6api.js/blob/master/license"><img src="https://img.shields.io/github/license/danielwerg/r6api.js" alt="License" /></a> <a href="https://github.com/danielwerg/r6api.js/releases/latest"><img src="https://img.shields.io/github/v/release/danielwerg/r6api.js?label=version" alt="Version" /></a> <a href="https://github.com/danielwerg/r6api.js/releases/latest"><img src="https://img.shields.io/github/release-date/danielwerg/r6api.js?label=latest%20release" alt="Latest release" /></a> <a href="https://www.npmjs.com/package/r6api.js"><img src="https://img.shields.io/npm/dw/r6api.js" alt="NPM weakly downloads" /></a> <a href="https://discord.gg/hshRpWk"><img src="https://img.shields.io/discord/612212753498767360?label=discord&color=5865F2" alt="Discord guild" /></a> </p> </div>

Table of Contents

Links

Installation

$ yarn add r6api.js
# OR
$ npm install r6api.js

Initialization

To setup this package, you need to provide Ubisoft account credentials (email and password). Credentials should be handled as you would handle any other secure value, it is recommended to use dotenv package to load environment variables from a .env.

Do not use your real Ubisoft account. It is highly recommended to create a new account for using this package. Visit account.ubisoft.com/login to create new account.

Example

<!-- START_SECTION:EXAMPLE -->
require('dotenv').config();
const R6API = require('r6api.js').default;

// // Or ES6 way
// import * as dotenv from 'dotenv';
// dotenv.config();
// import R6API from 'r6api.js';

const { UBI_EMAIL: email = '', UBI_PASSWORD: password = '' } = process.env;
const r6api = new R6API({ email, password });

// export default async () => { // ES6
exports.default = async () => {
  const username = 'Daniel.Nt';
  const platform = 'uplay';

  const { 0: player } = await r6api.findByUsername(platform, username);
  if (!player) return 'Player not found';

  const { 0: stats } = await r6api.getStats(platform, player.id);
  if (!stats) return 'Stats not found';
  const {
    pvp: { general }
  } = stats;

  return `${player.username} has played ${general.matches} matches.`;
};
<!-- END_SECTION:EXAMPLE --> <!-- START_SECTION:EXAMPLE_OUTPUT -->
Daniel.Nt has played 5648 matches.
<!-- END_SECTION:EXAMPLE_OUTPUT -->

API

Table of Contents

Definitions

| Param | Type | Description | | ----------- | -------------------- | --------------------------------------------------------------------- | | platform | string | Either uplay (pc), xbl (Xbox Live) or psn (PlayStation Network) | | platformAll | string | platform, steam, epic or amazon | | username/s | string \| string[] | | | id/s | string \| string[] | |


constructor

Options

| Param | Type | Required | Default | Description | | --------------- | -------- | -------- | ------- | --------------------------------------------------------------------- | | email | string | false | | Ubisoft account email | | password | string | false | | Ubisoft account password | | ubiAppId | string | false | | Ubi-AppId header value | | authFileDirPath | string | false | | Path for directory where authentication file is stored | | authFileName | string | false | | Name for authentication file | | authFilePath | string | false | | If set authFileDirPath and authFileName options are being ignored |

const { UBI_EMAIL: email = '', UBI_PASSWORD: password = '' } = process.env;
const r6api = new R6API({ email, password });

findByUsername

Find player by their username.

Usernames limit: 50

(platformAll, username/s) => Promise<Array>

await r6api.findByUsername('uplay', 'Daniel.Nt');
<!-- START_SECTION:FINDBYUSERNAME_OUTPUT --> <details> <summary>Output</summary>
[
  {
    id: '0b95544b-0228-49a7-b338-6d15cfbc3d6a',
    userId: '0b95544b-0228-49a7-b338-6d15cfbc3d6a',
    idOnPlatform: '0B95544B-0228-49A7-B338-6D15CFBC3D6A',
    platform: 'uplay',
    username: 'Daniel.Nt',
    avatar: {
      146: 'https://ubisoft-avatars.akamaized.net/0b95544b-0228-49a7-b338-6d15cfbc3d6a/default_146_146.png',
      256: 'https://ubisoft-avatars.akamaized.net/0b95544b-0228-49a7-b338-6d15cfbc3d6a/default_256_256.png',
      500: 'https://ubisoft-avatars.akamaized.net/0b95544b-0228-49a7-b338-6d15cfbc3d6a/default_tall.png'
    }
  }
];
</details> <!-- END_SECTION:FINDBYUSERNAME_OUTPUT -->

findById

Find player by their id.

Ids limit: 50

(platformAll | 'all', id/s, options?) => Promise<Array>

Options

<!-- START_SECTION:FINDBYID_OPTIONS -->

| Param | Type | Required | Default | Description | | -------- | --------- | -------- | ------- | ------------------------------- | | isUserId | boolean | false | false | Whether id is userId or not |

<!-- END_SECTION:FINDBYID_OPTIONS -->
// search by profileId (id)
await r6api.findById('all', '91477729-b5ac-463c-9618-03ca154764f5');
// search by userId
await r6api.findById('all', '1baf5bf8-90cd-4ead-8b90-9a11cb2b8adf', {
  isUserId: true
});
// search by idOnPlatform
await r6api.findById('xbl', '2535406338711362');
await r6api.findById('uplay', '0b95544b-0228-49a7-b338-6d15cfbc3d6a');
<!-- START_SECTION:FINDBYID_OUTPUT --> <details> <summary>Output</summary>
[
  {
    id: '0b95544b-0228-49a7-b338-6d15cfbc3d6a',
    userId: '0b95544b-0228-49a7-b338-6d15cfbc3d6a',
    idOnPlatform: '0B95544B-0228-49A7-B338-6D15CFBC3D6A',
    platform: 'uplay',
    username: 'Daniel.Nt',
    avatar: {
      146: 'https://ubisoft-avatars.akamaized.net/0b95544b-0228-49a7-b338-6d15cfbc3d6a/default_146_146.png',
      256: 'https://ubisoft-avatars.akamaized.net/0b95544b-0228-49a7-b338-6d15cfbc3d6a/default_256_256.png',
      500: 'https://ubisoft-avatars.akamaized.net/0b95544b-0228-49a7-b338-6d15cfbc3d6a/default_tall.png'
    }
  }
];
</details> <!-- END_SECTION:FINDBYID_OUTPUT -->

getPlaytime

Get playtime of a player.

Ids limit: 200

(platform, id/s) => Promise<Array>

await r6api.getPlaytime('uplay', '0b95544b-0228-49a7-b338-6d15cfbc3d6a');
<!-- START_SECTION:GETPLAYTIME_OUTPUT --> <details> <summary>Output</summary>
[
  {
    id: '0b95544b-0228-49a7-b338-6d15cfbc3d6a',
    pvp: {
      general: 5984372,
      ranked: 5312097,
      casual: 614423,
      custom: 974,
      other: 56878
    },
    pve: {
      general: 292574
    }
  }
];
</details> <!-- END_SECTION:GETPLAYTIME_OUTPUT -->

getProgression

Get level, xp and alpha pack drop chance of a player.

Ids limit: 200

(platform, id/s) => Promise<Array>

await r6api.getProgression('uplay', '0b95544b-0228-49a7-b338-6d15cfbc3d6a');
<!-- START_SECTION:GETPROGRESSION_OUTPUT --> <details> <summary>Output</summary>
[
  {
    id: '0b95544b-0228-49a7-b338-6d15cfbc3d6a',
    level: 297,
    xp: 73534,
    lootboxProbability: {
      raw: 820,
      percent: '8.20%'
    }
  }
];
</details> <!-- END_SECTION:GETPROGRESSION_OUTPUT -->

getRanks

Get seasonal stats of a player.

Ids limit: 200

(platform, id/s, options?) => Promise<Array>

Options

<!-- START_SECTION:GETRANKS_OPTIONS -->

| Param | Type | Required | Default | Description

Related Skills

View on GitHub
GitHub Stars114
CategoryDevelopment
Updated15d ago
Forks17

Languages

TypeScript

Security Score

100/100

Audited on Mar 13, 2026

No findings