npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@pure0cd/freefire-api

v1.1.0

Published

A powerful Node.js library to interact with Garena Free Fire API using Protobuf. Login, Search Players, and get Profile Stats.

Readme

Free Fire API

The Ultimate Unofficial SDK

Disclaimer: This is an unofficial project and is not affiliated, associated, authorized, endorsed by, or in any way officially connected with Garena Online Private Limited or Garena Free Fire.



Free Fire API is a robust and efficient Node.js library designed for developers who need to interact with Garena's game servers programmatically. Whether you are building a stats tracker, a tournament management platform, or a profile viewer, this library offers a seamless and type-safe interface.


🔍 Smart Search

👤 Full Profile

📊 Deep Stats

🎒 Inventory



Install the package via npm:

npm install @pure0cd/freefire-api

⚡ Quick Start

The library handles authentication automatically as a guest if you don't provide credentials.

1. 🔍 Search Player

Search for a player by their in-game nickname.

const FreeFireAPI = require('@pure0cd/freefire-api');
const api = new FreeFireAPI();

(async () => {
    // Auto-login (Guest) is handled automatically!
    const players = await api.searchAccount("Miyya");
    console.log(players);
})();

Response Example:

[
  {
    "accountid": "16207002",
    "nickname": "Miyya",
    "level": 74,
    "exp": 4567890,
    "region": "ID",
    "liked": "12345"
  }
]

2. 👤 Get Player Profile

Retrieve detailed information about a specific player using their UID.

(async () => {
    const profile = await api.getPlayerProfile("16207002");
    console.log(profile);
})();

Response Example:

{
  "basicinfo": {
    "accountid": "16207002",
    "nickname": "Miyya",
    "level": 74,
    "exp": 4567890,
    "region": "ID",
    "liked": "12345",
    "createat": 1512977151,
    "lastloginat": 1738243535
  },
  "claninfo": {
    "clanid": "100200300",
    "clanname": "MY_GUILD"
  },
  "petinfo": {
    "name": "Falco",
    "level": 7,
    "exp": 1200
  }
}

3. 📊 Get Player Stats

Fetch statistics for Battle Royale (BR) or Clash Squad (CS).

Parameters:

  • mode: 'br' or 'cs'
  • type: 'career', 'ranked', or 'normal'
(async () => {
    // Battle Royale Career Stats
    const brStats = await api.getPlayerStats("16207002", "br", "career");
    console.log(brStats);
})();

Response Example:

{
  "solostats": {
    "games": 1500,
    "wins": 200,
    "kills": 4500,
    "kd": "3.00"
  },
  "duostats": {
    "games": 800,
    "wins": 150,
    "kills": 2000
  },
  "quadstats": {
    "games": 3000,
    "wins": 600,
    "kills": 10000
  }
}

4. 🎒 Get Inventory

See what items (Outfits, Weapons, Skills, Pets) the player is currently equipping.

(async () => {
    const items = await api.getPlayerItems("16207002");
    console.log(items);
})();

Response Example:

{
  "outfit": [
    { "id": "101001", "name": "Skull Mask" },
    { "id": "102005", "name": "Red Jacket" }
  ],
  "weapons": {
    "shown_skins": [
      { "id": "907001", "name": "AK47 - Blue Flame" }
    ]
  },
  "skills": {
    "equipped": [
      { "id": "123", "name": "Alok: Drop the Beat" }
    ]
  },
  "pet": {
    "name": "Falco",
    "id": { "id": "123001", "name": "Falco" }
  }
}

🔐 Using Custom Credentials

If you want to use a specific account:

await api.login("YOUR_UID", "YOUR_PASSWORD");

The library includes a suite of test scripts to verify individual features. You can run them using npm run commands:

Standard Tests

| Command | Description | | :--- | :--- | | npm test | Runs the search test by default | | npm run test:login | Tests authentication (logs in as guest) | | npm run test:search | Tests player search functionality | | npm run test:profile | Tests fetching player profile details | | npm run test:stats | Tests fetching career and ranked statistics | | npm run test:items | Tests fetching equipped items (outfits, pets, skills) | | npm run test:all | Runs all available tests sequentially |

-------------- login.js:
Loaded 27989 items into database.
Starting Login Test...
[i] No credentials provided, using public default account.
Login success!
Token: eyJhbG..............
OpenID: ee3fa7..............


-------------- search.js:
Loaded 27989 items into database.
Starting Search Test for 'folaa'...
[i] No credentials provided, using public default account.
Found 10 players.
Top Result: Folaa (UID: 16778836)
[1] Folaa - UID: 16778836 - LVL: 3
[2] FolAa_66 - UID: 1943283579 - LVL: 46
[3] Folaa_golgem - UID: 14576052221 - LVL: 6
[4] folaa_ji - UID: 9436868269 - LVL: 7
[5] Folaa- - UID: 2357144535 - LVL: 1
[6] FOLAA-khna9 - UID: 2359319137 - LVL: 1
[7] Folaa! - UID: 8638700824 - LVL: 7
[8] folaa!! - UID: 8341924255 - LVL: 17
[9] folaa..... - UID: 6973843243 - LVL: 2
[10] folaa***** - UID: 5824293752 - LVL: 5


-------------- profile.js:
Loaded 27989 items into database.
Starting Profile Test for UID: 12345678...
[i] No credentials provided, using public default account.

--- Basic Info ---
Nickname: FB:ㅤ@GMRemyX
Level: 68
EXP: 2301178
Region: SG
Likes: 3637393
Created At: 12/7/2017, 5:19:29 AM
Last Login: 1/30/2026, 8:05:20 AM

--- Pet Info ---
Pet Name: SiNo
Pet Level: 7


-------------- stats.js:
Loaded 27989 items into database.
Starting Stats Test for UID: 16207002...
Fetching BR Career...
[i] No credentials provided, using public default account.

--- BR Career ---
Solo: {"accountid":"16207002","gamesplayed":1055,"wins":88,"kills":2769,"detailedstats":{"deaths":967,"top10times":0,"topntimes":279,"distancetravelled":3224879,"survivaltime":458396,"revives":0,"highestkills":20,"damage":812652,"roadkills":47,"headshots":1453,"headshotkills":630,"knockdown":0,"pickups":58619}}
Duo: {"accountid":"16207002","gamesplayed":461,"wins":80,"kills":1383,"detailedstats":{"deaths":381,"top10times":0,"topntimes":144,"distancetravelled":1544324,"survivaltime":217132,"revives":98,"highestkills":22,"damage":487692,"roadkills":48,"headshots":960,"headshotkills":367,"knockdown":1320,"pickups":32130}}
Squad: {"accountid":"16207002","gamesplayed":6340,"wins":1215,"kills":15821,"detailedstats":{"deaths":5125,"top10times":0,"topntimes":2043,"distancetravelled":26160398,"survivaltime":3167926,"revives":1298,"highestkills":34,"damage":7127329,"roadkills":122,"headshots":12471,"headshotkills":3858,"knockdown":17298,"pickups":577093}}
Fetching BR Ranked...

--- BR Ranked ---
Solo: {"accountid":"16207002","gamesplayed":4,"wins":1,"kills":25,"detailedstats":{"deaths":3,"top10times":0,"topntimes":3,"distancetravelled":13591,"survivaltime":1857,"revives":0,"highestkills":15,"damage":6317,"roadkills":0,"headshots":19,"headshotkills":8,"knockdown":0,"pickups":483}}
Duo: {"accountid":"16207002","gamesplayed":3,"wins":1,"kills":8,"detailedstats":{"deaths":2,"top10times":0,"topntimes":2,"distancetravelled":14501,"survivaltime":1607,"revives":3,"highestkills":4,"damage":2561,"roadkills":0,"headshots":2,"headshotkills":0,"knockdown":10,"pickups":383}}
Squad: {"accountid":"16207002","gamesplayed":456,"wins":40,"kills":1310,"detailedstats":{"deaths":416,"top10times":0,"topntimes":61,"distancetravelled":1576126,"survivaltime":142580,"revives":52,"highestkills":21,"damage":566518,"roadkills":0,"headshots":1139,"headshotkills":352,"knockdown":1489,"pickups":40318}}
Fetching CS Career...

--- CS Career ---
Data: {
  "csstats": {
    "accountid": "16207002",
    "gamesplayed": 3043,
    "wins": 1757,
    "kills": 12356,
    "detailedstats": {
      "mvpcount": 987,
      "doublekills": 2147,
      "triplekills": 829,
      "fourkills": 164,
      "damage": 5336165,
      "headshotkills": 3858,
      "knockdowns": 14065,
      "revivals": 829,
      "assists": 5363,
      "deaths": 9763,
      "streakwins": 0,
      "throwingkills": 0,
      "onegamemostdamage": 0,
      "onegamemostkills": 0,
      "ratingpoints": 0,
      "ratingenabledgames": 0,
      "headshotcount": 0,
      "hitcount": 0
    }
  }
}
Fetching CS Ranked...

--- CS Ranked ---
Data: {
  "csstats": {
    "accountid": "16207002",
    "gamesplayed": 63,
    "wins": 50,
    "kills": 244,
    "detailedstats": {
      "mvpcount": 17,
      "doublekills": 38,
      "triplekills": 19,
      "fourkills": 3,
      "damage": 108165,
      "headshotkills": 82,
      "knockdowns": 308,
      "revivals": 28,
      "assists": 152,
      "deaths": 158,
      "streakwins": 14,
      "throwingkills": 2,
      "onegamemostdamage": 5703,
      "onegamemostkills": 12,
      "ratingpoints": 579.7000122070312,
      "ratingenabledgames": 63,
      "headshotcount": 270,
      "hitcount": 3046
    }
  }
}


-------------- items.js:
Loaded 27989 items into database.
Starting Items Test for UID: 12345678...
Getting Player Items...
[i] No credentials provided, using public default account.

--- Summary ---
Outfit Items: 1
Weapon Items: 0
Skills Equipped: 5
Skills: 214049006, 205000455, 211000016, 203052001, 204000470
Pet Name: SiNo
Pet ID: Poring

--- First 5 Outfits ---
- Unknown Item (ID: 50)


All tests passed successfully!

| File/Folder | Description | | :--- | :--- | | lib/api.js | Core API implementation logic. | | lib/crypto.js | AES encryption handling for secure communication. | | lib/protobuf.js | Protocol Buffer encoder for Garena's binary format. | | data/items.json | Database mapping Item IDs to Names and Assets. | | proto/ | Protocol Buffer definitions (.proto files). |


Check out these awesome projects using this library:

Want to list your project here? If you have a project using this library and want to be listed, please contact via email: [email protected]


We perform this work standing on the shoulders of giants. Special thanks to the open-source community for their Reverse Engineering efforts.

  • 0xMe/FreeFire-Api: Prior research established a Python-based workflow. This project converts that logic into an easy-to-use JavaScript implementation, with equivalent functionality.

This project is licensed under the GNU General Public License v3.0 and Maintained by pure0cd.


If you find this project helpful and would like to support the development, you can treat me to a coffee! ☕

Donate via SocialBuzz: https://sociabuzz.com/0cd/tribe

A huge thank you to everyone who has supported! Your support keeps this project alive. ❤️