Here is a breakdown of the new stream key API and how to use it. (Note: This page is a work in progress).
Stream Key Explanation
A stream key is generated from within the game settings in the Settings > Game > Stream Key section. A player can use their 64-bit Steam ID, with the in-game Stream Key, to generate a URL allowing access to the API. The URL takes the following form:
https://tb-api.xyz/stream/get?s=[your SteamID64]&key=[your stream key]
When a player has started playing with the stream key enabled, the page accessed with the URL will display a JSON string with a format similar to the one below:
{
"current": {
"char": 2,
"lasthit": 15,
"world": 3,
"level": 1,
"crown": 1,
"wepA": 4,
"wepB": 20,
"skin": 0,
"ultra": 0,
"charlvl": 4,
"loops": 0,
"win": false,
"mutations": "00000000000000000000010100010",
"kills": 86,
"health": 1,
"steamid": 76561198054979849,
"type": "normal",
"timestamp": 1453917332
},
"previous": null
}
Sections of the Stream Key
The stream key is a JSON file with multiple fields, each containing a value corresponding to the status of the player during the most recent update. An example JSON string is shown below.
Current / Previous
If the run is noted as "current", this means it's currently in progress. If it's noted as "previous", it means it has ended and will no longer be updated. When a run ends, it gets moved from "current" to "previous", and the former "previous" run gets removed.
If there are no available runs, the value will be "null" like in the example above. Runs automatically expire 30 minutes after not being updated.
Health
The current health total of the player.
"health":
B-Skin
Indicates if the player is currently using a B-Skin.
"skin": 0
or
"skin": 1
Character
Indicates the current character being played. The characters are displayed as numbers from 1 to 15, not including 13. The last two are the secret characters.
| Number | Character |
|---|---|
| 1 | Fish |
| 2 | Crystal |
| 3 | Eyes |
| 4 | Melting |
| 5 | Plant |
| 6 | Y.V. |
| 7 | Steroids |
| 8 | Robot |
| 9 | Chicken |
| 10 | Rebel |
| 11 | Horror |
| 12 | Rogue |
| 14 | Skeleton |
| 15 | Frog |
Mutations
Indicates the current mutations chosen by the player. The player's mutation status is held in a 29-bit binary number, with each bit representing one mutation. A bit set to '1' indicates that the player has that mutation. A bit set to '0' indicates that the player does not have that mutation.
The JSON is in the following format:
"mutations":"00001000000000000010000001000"
The mutations are as follows (with bit positions relative to the first position, big-endian):
| Bit Position | Mutation If Bit Set |
|---|---|
| 0 | Heavy Heart |
| 1 | Rhino Skin |
| 2 | Extra Feet |
| 3 | Plutonium Hunger |
| 4 | Rabbit Paw |
| 5 | Throne Butt |
| 6 | Lucky Shot |
| 7 | Bloodlust |
| 8 | Gamma Guts |
| 9 | Second Stomach |
| 10 | Back Muscle |
| 11 | Scarier Face |
| 12 | Euphoria |
| 13 | Long Arms |
| 14 | Boiling Veins |
| 15 | Shotgun Shoulders |
| 16 | Recycle Gland |
| 17 | Laser Brain |
| 18 | Last Wish |
| 19 | Eagle Eyes |
| 20 | Impact Wrists |
| 21 | Bolt Marrow |
| 22 | Stress |
| 23 | Trigger Fingers |
| 24 | Sharp Teeth |
| 25 | Patience |
| 26 | Hammerhead |
| 27 | Strong Spirit |
| 28 | Open Mind |
Area
The current area of the player.
The JSON is in the following format:
"level":1
The normal area numbers are the same as they appear in game (1-1, 1-2, 1-3, etc.). The majority of secret levels have an area of 1, as they are considered their own world. Crown vaults seem to have different area values depending on which level you entered them from and whether or not you entered with a crown. (Additional testing is ongoing regarding secret levels and crown vaults.)
[TODO: Learn more about the loop levels (Campfire/HQ), as well as crown vaults]
Crown
Indicates the current crown of the player.
| Crown Number | Crown |
|---|---|
| 1 | No Crown |
| 2 | Crown of Death |
| 3 | Crown of Life |
| 4 | Crown of Haste |
| 5 | Crown of Guns |
| 6 | Crown of Hatred |
| 7 | Crown of Blood |
| 8 | Crown of Destiny |
| 9 | Crown of Love |
| 10 | Crown of Luck |
| 11 | Crown of Curses |
| 12 | Crown of Risk |
| 13 | Crown of Protection |
World
The current world of the player.
The JSON is in the following format:
"world":2
The world numbers are the same as they appear in game (World 1 being the Desert, World 2 being the Sewers, etc.), with the exception of the secret levels.
| World Number | World Name |
|---|---|
| 100 | Crown Vault |
| 1 | Desert |
| 101 | Oasis |
| 2 | Sewers |
| 102 | Pizza Sewers |
| 3 | Scrapyard |
| 103 | Y.V's Mansion |
| 4 | Crystal Caves |
| 104 | Cursed Crystal Caves |
| 5 | Frozen City |
| 105 | Jungle |
| 6 | Labs |
| 7 | The Palace |
| 0 | Campfire |
| 107 | Y.V's Crib |
| 106 | I.D.P.D. Headquarters |
[TODO: Complete list of worlds]
Loop
Indicates the current loop number.
The JSON is in the following format:
"loops":0
Weapons
Uses two fields to indicate the current weapons held by the player.
The JSON is in the following format:
"wepA":17, "wepB":5
| Gun ID | Gun name |
|---|---|
| 0 | Nothing |
| 1 | Revolver |
| 2 | Triple Machinegun |
| 3 | Wrench |
| 4 | Machinegun |
| 5 | Shotgun |
| 6 | Crossbow |
| 7 | Grenade Launcher |
| 8 | Double Shotgun |
| 9 | Minigun |
| 10 | Auto Shotgun |
| 11 | Auto Crossbow |
| 12 | Super Crossbow |
| 13 | Shovel |
| 14 | Bazooka |
| 15 | Sticky Launcher |
| 16 | SMG |
| 17 | Assault Rifle |
| 18 | Disc Gun |
| 19 | Laser Pistol |
| 20 | Laser Rifle |
| 21 | Slugger |
| 22 | Gatling Slugger |
| 23 | Assault Slugger |
| 24 | Energy Sword |
| 25 | Super Slugger |
| 26 | Hyper Rifle |
| 27 | Screwdriver |
| 28 | Laser Minigun |
| 29 | Blood Launcher |
| 30 | Splinter Gun |
| 31 | Toxic Bow |
| 32 | Sentry Gun |
| 33 | Wave Gun |
| 34 | Plasma Gun |
| 35 | Plasma Cannon |
| 36 | Energy Hammer |
| 37 | Jackhammer |
| 38 | Flak Cannon |
| 39 | Golden Revolver |
| 40 | Golden Wrench |
| 41 | Golden Machinegun |
| 42 | Golden Shotgun |
| 43 | Golden Crossbow |
| 44 | Golden Grenade Launcer |
| 45 | Golden Laser Pistol |
| 46 | Chicken Sword |
| 47 | Nuke Launcher |
| 48 | Ion Cannon |
| 49 | Quadruple Machinegun |
| 50 | Flamethrower |
| 51 | Dragon |
| 52 | Flare Gun |
| 53 | Energy Screwdriver |
| 54 | Hyper Launcher |
| 55 | Laser Cannon |
| 56 | Rusty Revolver |
| 57 | Lightning Pistol |
| 58 | Lightning Rifle |
| 59 | Lightning Shotgun |
| 60 | Super Flak Cannon |
| 61 | Sawed-off Shotgun |
| 62 | Splinter Pistol |
| 63 | Super Splinter Gun |
| 64 | Lighting SMG |
| 65 | Smart Gun |
| 66 | Heavy Crossbow |
| 67 | Blood Hammer |
| 68 | Lightning Cannon |
| 69 | Pop Gun |
| 70 | Plasma Rifle |
| 71 | Pop Rifle |
| 72 | Toxic Launcher |
| 73 | Flame Cannon |
| 74 | Lightning Hammer |
| 75 | Flame Shotgun |
| 76 | Double Flame Shotgun |
| 77 | Auto Flame Shotgun |
| 78 | Cluster Launcher |
| 79 | Grenade Shotgun |
| 80 | Grenade Rifle |
| 81 | Rogue Rifle |
| 82 | Party Gun |
| 83 | Double Minigun |
| 84 | Gatling Bazooka |
| 85 | Auto Grenade Shotgun |
| 86 | Ultra Revolver |
| 87 | Ultra Laser Pistol |
| 88 | Sledgehammer |
| 89 | Heavy Revolver |
| 90 | Heavy Machinegun |
| 91 | Heavy Slugger |
| 92 | Ultra Shovel |
| 93 | Ultra Shotgun |
| 94 | Ultra Crossbow |
| 95 | Ultra Grenade Launcher |
| 96 | Plasma Minigun |
| 97 | Devastator |
| 98 | Golden Plasma Gun |
| 99 | Golden Slugger |
| 100 | Golden Splinter Gun |
| 101 | Golden Screwdriver |
| 102 | Golden Bazooka |
| 103 | Golden Assault Rifle |
| 104 | Super Disc Gun |
| 105 | Heavy Auto Crossbow |
| 106 | Heavy Assault Rifle |
| 107 | Blood Cannon |
| 108 | Dog Spin Attack |
| 109 | Dog Missile |
| 110 | Incinerator |
| 111 | Super Plasma Cannon |
| 112 | Seeker Pistol |
| 113 | Seeker Shotgun |
| 114 | Eraser |
| 115 | Guitar |
| 116 | Bouncer SMG |
| 117 | Bouncer Shotgun |
| 118 | Hyper Slugger |
| 119 | Super Bazooka |
| 120 | Frog Pistol |
| 121 | Black Sword |
| 122 | Golden Nuke Launcher |
| 123 | Golden Disc Gun |
| 124 | Heavy Grenade Launcher |
| 125 | Gun Gun |
| 201 | Golden Frog Pistol |
Timestamp
Set to the UNIX timestamp of the time when you started your run.
"timestamp":1454012759
Kills
Indicates the number of enemies that the player has killed.
The JSON is in the following format:
"kills":158
Type
This field indicates what is the type of the run.
The JSON is in the following format:
"type": "normal"
The following values are possible: "normal", "daily", "weekly" and "hard".
Ultra
This field indicates the ultra mutation of the player.
"ultra" : 0
No ultra mutation
"ultra" : 1 or 2
Which ultra mutation was picked (from left to right).
Lasthit
This field indicates the ID of the last enemy that hit the player. (If the player's health is 0, then this would indicate what they died to.)
The JSON is in the following format:
"lasthit":7
| Enemy ID | Enemy name |
|---|---|
| -1 | Nothing |
| 0 | Bandit |
| 1 | Maggot |
| 2 | Rad Maggot |
| 3 | Big Maggot |
| 4 | Scorpion |
| 5 | Gold Scorpion |
| 6 | Big Bandit |
| 7 | Rat |
| 8 | Rat King |
| 9 | Green Rat |
| 10 | Gator |
| 11 | Exploder |
| 12 | Toxic Frog |
| 13 | Mom |
| 14 | Assassin |
| 15 | Raven |
| 16 | Salamander |
| 17 | Sniper |
| 18 | Big Dog |
| 19 | Spider |
| 20 | (Not in game) |
| 21 | Laser Crystal |
| 22 | Hyper Crystal |
| 23 | Snow Bandit |
| 24 | Snowbot |
| 25 | Wolf |
| 26 | Snowtank |
| 27 | Lil Hunter |
| 28 | Freak |
| 29 | Explo Freak |
| 30 | Rhino Freak |
| 31 | Necromancer |
| 32 | Turret |
| 33 | Technomancer |
| 34 | Guardian |
| 35 | Explo Guardian |
| 36 | Dog Guardian |
| 37 | Throne |
| 38 | Throne II |
| 39 | Bone Fish |
| 40 | Crab |
| 41 | Turtle |
| 42 | Venus Grunt |
| 43 | Venus Sarge |
| 44 | Fireballer |
| 45 | Super Fireballer |
| 46 | Jock |
| 47 | Cursed Spider |
| 48 | Cursed Crystal |
| 49 | Mimic |
| 50 | Health Mimic |
| 51 | Grunt |
| 52 | Inspector |
| 53 | Shielder |
| 54 | Crown Guardian |
| 55 | Explosion |
| 56 | Small Explosion |
| 57 | Fire Trap |
| 58 | Shield |
| 59 | Toxin |
| 60 | Horror |
| 61 | Barrel |
| 62 | Toxic Barrel |
| 63 | Golden Barrel |
| 64 | Car |
| 65 | Venus Car |
| 66 | Venus Car Fixed |
| 67 | Venuz Car 2 |
| 68 | Icy Car |
| 69 | Thrown Car |
| 70 | Mine |
| 71 | Crown of Death |
| 72 | Rogue Strike |
| 73 | Blood Launcher |
| 74 | Blood Cannon |
| 75 | Blood Hammer |
| 76 | Disc |
| 77 | Curse Eat |
| 78 | Big Dog Missile |
| 79 | Halloween Bandit |
| 80 | Lil Hunter Fly |
| 81 | Throne Death |
| 82 | Jungle Bandit |
| 83 | Jungle Assassin |
| 84 | Jungle Fly |
| 85 | Crown of Hatred |
| 86 | Ice Flower |
| 87 | Cursed Ammo Pickup |
| 88 | Underwater Lightning |
| 89 | Elite Grunt |
| 90 | Blood Gamble |
| 91 | Elite Shielder |
| 92 | Elite Inspector |
| 93 | Captain |
| 94 | Van |
| 95 | Buff Gator |
| 96 | Generator |
| 97 | Lightning Crystal |
| 98 | Golden Snowtank |
| 99 | Green Explosion |
| 100 | Small Generator |
| 101 | Golden Disc |
| 102 | Big Dog Explosion |
| 103 | IDPD Freak |
| 104 | Throne II Death |
| 105 | (Not in game) |
