Unofficial Krunker.io Api
Well if you play krunker.io and want to get stats here you go, I guess.
Here is how to use it:
Unofficial Krunker API
Note: This is my first post on repl.it/talk so yea...
This is an unofficial krunker.io api.
Made in Node.js.
Packages Used
All packages are available on npm.
msgpack-lite
- Encode and decode data to and from krunker's WebSocket serveraxios
- Make requests to krunkerws
- WebSockets for retrieving dataexpress
- Web Servercors
- Cors middleware, javascript fetch then works
How to Use
Base Url
https://krunkerio-api--theboys619.repl.co/
User Stats
Endpoints
GET /user/:username
GET /user/:username
- Retrieve stats from player
Average response time: 958ms
Class Stats
Endpoints
GET /class/:classname GET /class/all
GET /class/:classname
- Retrieve default class stats
Average response time: 257ms
GET /class/all
- Retrieve default class stats
Average response time: 364ms
Market Items
Endpoints
GET /market
GET /market
- Retrieve market items
Average response time: 2136ms
Optional Queries
?count=#NUMBER
- Get amount of items in market (max is 100)
?data=raw
- Get raw/original data of the market
Both can be combined, Ex: /market?count=60&data=raw
Game Stats
Endpoints
GET /game
GET /game?game=[GAMEID]
- Retrieve game stats
Average response time: 105ms
Code Examples
All are examples for GET /user/:username
Some may not be correct, not too familiar with some.
Node.js (axios)
const axios = require('axios'); const user = "Theboys619"; axios({ method: "GET", url: `http://krunkerio-api--theboys619.repl.co/user/${user}`, }).then(res => { console.log(res.data.kills); // Displays kills });
Javascript (fetch)
const user = "Theboys619"; fetch(`http://krunkerio-api--theboys619.repl.co/user/${user}`) .then(response => response.json()) .then(data => { console.log(data.kills); // Displays kills });
Python (requests)
import requests user = "Theboys619" url = "http://krunkerio-api--theboys619.repl.co/user/" + user headers = { 'content-type': "application/json", 'cache-control': "no-cache" } response = requests.request("GET", url, headers=headers) print(response.json()["kills"]) # Displays kills
CSharp
string user = "Theboys619"; var client = new RestClient("http://krunkerio-api--theboys619.repl.co/user/" + user); var request = new RestRequest(Method.GET); request.AddHeader("cache-control", "no-cache"); request.AddHeader("content-type", "application/json"); IRestResponse response = client.Execute(request);
cURL
curl -k -i -H "Content-Type: application/json"\ -X GET 'http://krunkerio-api--theboys619.repl.co/user/Theboys619'
Response Examples
User Stats Response
User stats example response:
GET /user/Theboys619
{ "username":"Theboys619", "id":479257, "clan":"A-K", "infected":true, "hacker":false, "featured":false, "score":552490, "spk":"103.62", "level":22, "levelProgress":{ "currentxp":14712, "finalxp":50000 }, "kr":4598, "followers":0, "following":0, "challenges":1, "kills":5332, "meleekills":119, "deaths":2826, "kd":"1.89", "kpg":"14.73", "wins":178, "losses":184, "winloss":"0.97", "elo1":160.61, "elo2":0, "elo4":0, "shots":68894, "hits":19882, "headshots":2347, "accuracy":"28.858826603187502%", "lastplayedclass":"None", "classdata":{ "Triggerman": { "level":12, "currentxp":1445, "finalxp":25555 }, "Hunter": { "level":9, "currentxp":6153, "finalxp":18888 }, "Run N Gun": { "level":14, "currentxp":5717, "finalxp":29999 }, "Spray N Pray": { "level":1, "currentxp":0, "finalxp":1111 }, "Vince": { "level":3, "currentxp":2465, "finalxp":5555 }, "Detective": { "level":7, "currentxp":6770, "finalxp":14444 }, "Marksman": { "level":1, "currentxp":675, "finalxp":1111 }, "Rocketeer": { "level":2, "currentxp":1200, "finalxp":4444 }, "Agent": { "level":1, "currentxp":400, "finalxp":1111 }, "Runner": { "level":2, "currentxp":4335, "finalxp":4444 }, "Bowman": { "level":1, "currentxp":800, "finalxp":1111 }, "Commando": { "level":1, "currentxp":910, "finalxp":1111 } }, "timeplayed":"20h 13m 32s", "createddate":"10/1/2018", "createdtime":"7:01:40pm" }
Class Stats Response
Triggerman default class stats example response:
GET /class/Triggerman
{ "name":"Triggerman", "loadout":[ 1 ], "secondary":true, "colors":[ 10975328, 4013373, 2302755, 2631720, 7098434, 12566463 ], "health":100, "segs":6, "speed":1.05 }
Market Items Response
Market listed items example response:
GET /market?count=1
[ { "player":"hanghy", "marketid":3241527, "funds":66666, "salestart":"10h 5m 48s", "skinid":41683367, "skinindex":943, "type":"Cosmetics", "item":{ "name":"Coroller", "keyW":"Toilet", "id":7, "type":3, "seas":2, "rarity":"Unobtainable", "limited":true, "scl":2, "sclMlt":0.76, "yOff":-2.5, "icon":"https://assets.krunker.io/textures/previews/cosmetics/3_7.png" } } ]
Market Items Raw Response
Raw market items example response:
GET /market?count=1&data=raw
[ { "player":"hanghy", "marketid":3241527, "funds":66666, "salestart":"1586049498042", "skinid":41683367, "skinindex":943 } ]
Game Stats Response
Game Stats example response:
GET /game?game=SV:gwlpx
{ gameid: "SV:gwlpx", region: "us-ca-sv", map: "Subzero", mode: "point", players: "8/8" }
Could you re-make the gameapi please? Thanks so much
pls pls pls fix this thanks
Can you get the api back up please?
Thank you.
I'll see what I can do. They changed it quite a bit. @Cuet1337
0/10, says im not a hacker even though i am
What's your account? Also what is your username? And are you flagged as a hacker on krunker.io? @roylatgnail
@Theboys619 i was joking. Im not flagged as a hacker
oh...makes sense @roylatgnail
Yo whats your discord? also have you gotten the new krunker API? thanks!
I can try. @puddleisthebest
I think I already figured it out anyway @Theboys619
Well I got far enough to reconnect to their servers and get data back. But sadly they have a captcha that I got to figure out how to get around. Which I don't know how hard that's going to be. @puddleisthebest
@Theboys619 damn yeah krunkers been putting aton of captchas recently, I'm kinda new but I found these API links and maybe they'll be useful? idk but you should go check them out here's were I posted them- https://www.reddit.com/r/KrunkerIO/comments/k1rw6f/krunker_api_links_most_recent_update_at_11262020/?utm_source=share&utm_medium=web2x&context=3
Another problem is I cannot host the API on repl.it. I think they might of blocked requests from this site or something like that. @puddleisthebest