Deathbox
Deathbox · Developers

Build on Deathbox

Bring Deathbox guns and skins into your game, sign players in with their Deathbox identity, reward them for what they have done in Deathbox, get told when they rank up, show their player card, and add the Deathbox swap.

Login with Deathbox · Webhooks · Player card · Unity · Godot · Swap widget

Getting a key

API keys are for wallets that hold at least 100,000 $DEATH on Elysium. Keys stop working while the wallet that made them holds less.

Open Deathbox, sign in with that wallet and go to SYSTEM › DEVELOPER. Name your game and press Create key. The key is shown once; copy it then. You can have five keys at a time and revoke any of them there.

Send the key in an x-api-key header. Each key can make 300 requests a minute.

Base URL: https://api.deathbox.pro/api/dev

Read-only, by design

No other game can change a Deathbox career. The developer API only reads. An API key cannot add XP, rank, prestige, DCASH, kills or anything else to a Deathbox operator: progress is only ever earned by playing Deathbox. Use it to reward players in your game for what they did in ours.

Endpoints

GET /catalog

Every gun and every Market skin: name, rarity, the skin token's address on Elysium (when it trades) and a link to its 3D model.

curl -H "x-api-key: YOUR_KEY" https://api.deathbox.pro/api/dev/catalog
{
  "weapons": [{ "id": "glock", "name": "Glock", "model": "https://deathbox.pro/dev-assets/models/glock/factory.glb" }, …],
  "skins": [{
    "ticker": "GLOCKDATA", "weapon": "glock", "skin": "datastream", "name": "Datastream", "rarity": "legendary",
    "model": "https://deathbox.pro/dev-assets/models/glock/datastream.glb",
    "token": { "address": "0xa95966DF8dcC23D1C05E82296E832863e62C2699", "chain": "Elysium" }
  }, …]
}

GET /inventory?address=0x…

The skin tokens and the $DEATH a wallet holds, each with its model. Show a skin to a player only when their wallet holds its token.

const res = await fetch('https://api.deathbox.pro/api/dev/inventory?address=' + wallet, {
  headers: { 'x-api-key': 'YOUR_KEY' },
});
const { skins } = await res.json();
for (const s of skins) loadGun(s.model);   // e.g. GLTFLoader in three.js

GET /player?address=0x…

A wallet's Deathbox identity and progress: every operator it holds (on Elysium, Ronin or Robinhood Chain) and its own career, each with rank, prestige, XP, kills, deaths, wins, matches, time played and clan. best is the highest one.

{
  "address": "0x…",
  "best": { "name": "Gossaper", "rank": 42, "prestige": 3, "xp": 913400, "kills": 5120, "wins": 211, "clan": { "tag": "DTH", … } },
  "operators": [ … ],
  "readOnly": true
}
// A reward in your game for Deathbox veterans
const { best } = await (await fetch(url, { headers: { 'x-api-key': KEY } })).json();
if (best?.prestige >= 1) unlock('deathbox-veteran-banner');

POST /swap/quote

A ready-to-sign swap through Relay, across chains. Send the amount in the token's smallest unit. The answer is Relay's quote: steps to send with the player's wallet, and details with what they get.

POST https://api.deathbox.pro/api/dev/swap/quote
x-api-key: YOUR_KEY
{
  "user": "0xPlayer…",
  "originChainId": 8453, "originCurrency": "0x0000000000000000000000000000000000000000",
  "destinationChainId": 99901, "destinationCurrency": "0xC585aCCa50B29DB0AfF2Fa12090078173Aa3cCCc",
  "amount": "10000000000000000"
}

Login with Deathbox

Let players sign in to your game with their Deathbox wallet. They sign one message (no gas) on our page, which tells them which game is asking and what it will see. Your game gets back a one-time code and swaps it for the player's verified wallet and Deathbox profile.

1. Send the player to the sign-in page

https://deathbox.pro/connect?key=YOUR_KEY&redirect_uri=https://yourgame.com/deathbox/callback&state=RANDOM

redirect_uri must be https (or http://127.0.0.1 / localhost for a desktop game). After signing in, the player comes back to it with ?code=…&state=…. Check that state is the one you sent. For a popup, add &mode=popup: the page sends { type: 'deathbox:login', code, state } to your window with postMessage and closes.

2. Swap the code (from your server)

POST https://api.deathbox.pro/api/dev/auth/token
x-api-key: YOUR_KEY
{ "code": "…" }

The answer is the same as /player, for the wallet that signed: address, best and operators. A code works once, within five minutes, and only with the key that started the sign-in.

Webhooks

Get told when something happens in Deathbox to a player who signed in to your game. Set a webhook URL on your key in SYSTEM › DEVELOPER; you get a secret once, to check the signature with.

EventWhendata
rank.upThe player reaches a new rank{ rank, prestige }
prestige.upThe player prestiges{ prestige, rank }
match.finishedThe player finishes a match{ won, kills, deaths, xpEarned, totals }
clan.joinedThe player joins (or starts) a clan{ clan: { id, tag, name } }
testYou press Test in the Developer screen{ message }
POST https://yourgame.com/deathbox/webhook
X-Deathbox-Event: rank.up
X-Deathbox-Signature: sha256=…
{ "id": "evt_…", "type": "rank.up", "createdAt": "…",
  "player": { "wallet": "0x…", "operator": "…", "name": "Gossaper" },
  "data": { "rank": 43, "prestige": 3 } }
// Node.js: check it came from Deathbox
const sig = crypto.createHmac('sha256', WEBHOOK_SECRET).update(rawBody).digest('hex');
if (req.headers['x-deathbox-signature'] !== 'sha256=' + sig) return res.status(401).end();

Each event is sent once, with a five-second timeout. Answer with any 2xx. The Developer screen shows the last deliveries and their status.

Player card

A ready-made Deathbox player card for your site or game menu: name, rank, prestige, clan, K/D, kills, wins and time played.

<iframe src="https://deathbox.pro/card?key=YOUR_KEY&address=0xPLAYER"
  width="380" height="200" style="border:0"></iframe>

Options: theme=light, and operator=<id> to show one operator instead of the best one.

Unity

Download the Unity package. Unzip it, then in Unity: Window › Package Manager › + › Add package from disk, and pick its package.json. It brings glTFast for the models.

using Deathbox;
var client = new DeathboxClient("dbx_...");
DeathboxPlayer me = await DeathboxLogin.LoginAsync(client);          // desktop: opens the browser
DeathboxInventory inv = await client.GetInventoryAsync(me.address);
foreach (var skin in inv.skins) await DeathboxModelLoader.LoadAsync(skin, transform);

Godot

Download the Godot 4 addon. Copy addons/deathbox into your project and turn on Deathbox under Project Settings › Plugins.

Deathbox.api_key = "dbx_..."
var me := await Deathbox.login()                      # desktop: opens the browser
var inv := await Deathbox.get_inventory(me.address)
for skin in inv.skins:
    add_child(await Deathbox.load_model(skin.model))

Swap widget

The quickest way: one line on your page. Players connect their own wallet and swap; the 1% Deathbox fee is included.

<iframe src="https://deathbox.pro/swap-widget?key=YOUR_KEY&to=death"
  width="420" height="560" style="border:0"></iframe>
OptionValues
to, fromdeath, hype, hype-hyperevm, eth, eth-base, usdc-base, eth-arbitrum, bnb

3D models

Binary glTF 2.0 (.glb): loads in Unity (glTFast), Godot 4, Unreal (glTFRuntime), three.js and Babylon.js. The skin is already on the gun, with its normal, occlusion-roughness-metal and glow maps; the gun's own parts keep their materials. Models are 1 unit = 1 metre.

Rules