Who it is for#
- Shops and marketplaces that want to sell CS2 skins with stock ready to deliver.
- Bots and trading services (Discord, Telegram, websites) that need to buy and deliver right away.
- Apps and platforms that deliver skins to their own users.
You need: an NTSkins account with a confirmed e-mail, balance on the account and a server to keep the key. The key never goes into a browser or an app.
Getting access#
1Create the account, confirm the e-mail
Log in with Steam, confirm your e-mail and accept the Terms of Service in Settings.
2Request merchant access
In Settings → API, tell us who you are, your website and how you will use the API.
3Approved? Create your key
Our team reviews the request. Once approved, you create the key in the same tab and can call the API.
First call#
With the key in hand, call /ping. If it answers ok: true, the key is right.
export NTSKINS_API_KEY="nts_live_..." # your key (Settings → API)
curl -s https://ntskins.com/api/merchant/v1/ping \
-H "X-API-Key: $NTSKINS_API_KEY"// ping.mjs — Node 18+ (fetch is built in): NTSKINS_API_KEY=... node ping.mjs
const BASE = 'https://ntskins.com/api/merchant/v1';
const res = await fetch(`${BASE}/ping`, {
headers: { 'X-API-Key': process.env.NTSKINS_API_KEY },
});
console.log(res.status, await res.json());# ping.py — pip install requests
import os
import requests
BASE = "https://ntskins.com/api/merchant/v1"
r = requests.get(f"{BASE}/ping", headers={"X-API-Key": os.environ["NTSKINS_API_KEY"]}, timeout=15)
print(r.status_code, r.json()){
"ok": true,
"merchant": { "id": "cm3x7k2p90001ab12cd34ef56", "name": "Acme Skins" },
"key": { "name": "production", "can_buy": true },
"server_time": "2026-11-29T15:04:05.000Z"
}Authentication and format#
Base URL
https://ntskins.com/api/merchant/v1Send the key in the X-API-Key header (or Authorization: Bearer). HTTPS only.
GET /api/merchant/v1/balance HTTP/1.1
Host: ntskins.com
X-API-Key: nts_live_...
# or, the same key as a bearer token:
Authorization: Bearer nts_live_...Format- JSON in and out, UTF-8.
Prices- Integers in USD cents:
2650= US$ 26.50. Timestamps- ISO-8601 UTC, ex. 2026-11-29T15:04:05.000Z
Pagination- Send the
next_cursoryou got back ascursor.next_cursor: null= last page. Key types- “Can buy” or read-only (
KEY_READ_ONLYonPOST /orders). Each key can have up to 10 allowed IPs (IP_NOT_ALLOWEDoutside them).
Keep the key on your server
Rate limits#
- 120 requests per minute per key (default; your account’s limit is shown in Settings → API).
GET /items: 6 per minute. It returns the whole catalogue at once, so you never need more.- Orders in progress (
pending+offer_sent) have a cap per account (default 20). Above it:409 TOO_MANY_PENDING.
Headers on every response
X-RateLimit-Limit- Requests allowed in the window.
X-RateLimit-Remaining- How many are left.
X-RateLimit-Reset- Seconds until the window resets.
Retry-After- Only on
429(and503): seconds to wait.
HTTP/1.1 429 Too Many Requests
Retry-After: 12
X-RateLimit-Limit: 120
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 12
Content-Type: application/json
{ "code": "RATE_LIMITED", "message": "Too many requests, retry later" }Errors#
Every error comes with the HTTP status and a { code, message } body. Branch on code: it is stable. message is in English and may change. Some errors carry extra fields.
HTTP/1.1 402 Payment Required
Content-Type: application/json
{
"code": "INSUFFICIENT_BALANCE",
"message": "Not enough balance for this order",
"required_cents": 2650,
"balance_cents": 1200
}400
BAD_REQUESTInvalid parameter or body (the message says which).
400
INVALID_TRADE_URLtrade_urlis not a valid Steam Trade URL.400
NO_TRADE_URLNo
trade_urlin the order and the account has no saved Trade URL.400
STEAM_ACCOUNTThe recipient’s Steam account cannot receive the item right now (private inventory, cannot trade…).
401
UNAUTHORIZEDMissing, wrong or revoked key.
402
INSUFFICIENT_BALANCENot enough balance. Carries
required_centsandbalance_cents.403
ACCESS_NOT_ACTIVEThe account’s merchant access is not active.
403
IP_NOT_ALLOWEDThe key has an IP allowlist and the caller’s IP is not on it.
403
KEY_READ_ONLYRead-only key. To buy, use a key with “can buy”.
403
TERMS_REQUIREDThe account must accept the current Terms of Use: log in to the site once and accept them, then repeat the order.
403
TRADE_URL_NOT_ALLOWEDDelivery to another Steam account is not enabled for your account.
404
ITEM_NOT_FOUNDThe
item_keyor name is not in the catalogue.404
UNIT_NOT_AVAILABLEThe unit is no longer available.
404
ORDER_NOT_FOUNDNo such order on this account.
409
PRICE_CHANGEDThe unit’s price is now above your
max_price_cents. Carriescurrent_price_cents.409
UNIT_NOT_AVAILABLEThe unit was sold while the order was being placed.
409
NO_UNIT_AT_PRICEBuy by name: nothing available at or below
max_price_cents. Carrieslowest_price_cents.409
ORDER_IN_PROGRESSAn order with this
external_idis still being created. Look it up byexternal_idin a few seconds.409
EXTERNAL_ID_CONFLICTThis
external_idwas already used with different data. Use one per order.409
TOO_MANY_PENDINGToo many orders in progress at once. Wait for some to finish.
429
RATE_LIMITEDRate limit hit. Wait
Retry-Afterseconds.500
ORDER_UNCERTAINRare: the purchase may have gone through but could not be recorded. Repeat the SAME call later (same
external_id) or contact support. Do not use a newexternal_id.502
UPSTREAM_ERRORTemporary failure on our side. Nothing was charged, or it was already refunded to the balance.
503
PURCHASES_UNAVAILABLEPurchases are paused right now. Try again later.
503
CATALOG_WARMINGThe full catalogue is being built (on the first call, or after a while without use). Wait
Retry-Afterseconds.503
CATALOG_UNAVAILABLEThe units could not be read right now. Try again after
Retry-Afterseconds.
Endpoints
Key and balance#
GET/ping
{ ok, merchant: { id, name }, key: { name, can_buy }, server_time }.GET/balance
{ balance_cents, currency: "USD" }.curl -s https://ntskins.com/api/merchant/v1/balance \
-H "X-API-Key: $NTSKINS_API_KEY"const BASE = 'https://ntskins.com/api/merchant/v1';
const res = await fetch(`${BASE}/balance`, { headers: { 'X-API-Key': process.env.NTSKINS_API_KEY } });
const { balance_cents, currency } = await res.json();
console.log(`${(balance_cents / 100).toFixed(2)} ${currency}`);import os
import requests
BASE = "https://ntskins.com/api/merchant/v1"
r = requests.get(f"{BASE}/balance", headers={"X-API-Key": os.environ["NTSKINS_API_KEY"]}, timeout=15)
body = r.json()
print(f"{body['balance_cents'] / 100:.2f} {body['currency']}"){ "balance_cents": 125000, "currency": "USD" }How orders are paid
402 INSUFFICIENT_BALANCE and nothing is charged.Endpoints
Catalogue#
GET/items
updated_at).Download the whole catalogue
Use limit=20000: everything comes in one call. While the catalogue is being built for the first time the answer is 503 CATALOG_WARMING with Retry-After; the examples already wait and retry.
# The whole instant catalogue in one call (GET /items allows 6 calls per minute)
curl -s "https://ntskins.com/api/merchant/v1/items?limit=20000" \
-H "X-API-Key: $NTSKINS_API_KEY" \
-o catalog.json// catalog.mjs — Node 18+
const BASE = 'https://ntskins.com/api/merchant/v1';
const KEY = process.env.NTSKINS_API_KEY;
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
async function getCatalog() {
let items = [];
let cursor = null;
for (;;) {
const url = new URL(`${BASE}/items`);
url.searchParams.set('limit', '20000');
if (cursor) url.searchParams.set('cursor', cursor);
const res = await fetch(url, { headers: { 'X-API-Key': KEY } });
if (res.status === 429 || res.status === 503) {
// RATE_LIMITED or CATALOG_WARMING: wait as told, then ask again
await sleep(Number(res.headers.get('Retry-After') || 30) * 1000);
continue;
}
const body = await res.json();
if (!res.ok) throw new Error(`${body.code}: ${body.message}`);
items = items.concat(body.items);
if (!body.next_cursor) return { items, updatedAt: body.updated_at };
cursor = body.next_cursor;
}
}
const { items, updatedAt } = await getCatalog();
console.log(items.length, 'items, snapshot of', updatedAt);# catalog.py — pip install requests
import os
import time
import requests
BASE = "https://ntskins.com/api/merchant/v1"
s = requests.Session()
s.headers["X-API-Key"] = os.environ["NTSKINS_API_KEY"]
def get_catalog():
items, cursor = [], None
while True:
params = {"limit": 20000}
if cursor:
params["cursor"] = cursor
r = s.get(f"{BASE}/items", params=params, timeout=60)
if r.status_code in (429, 503):
# RATE_LIMITED or CATALOG_WARMING: wait as told, then ask again
time.sleep(int(r.headers.get("Retry-After", "30")))
continue
body = r.json()
if not r.ok:
raise RuntimeError(f"{body['code']}: {body['message']}")
items.extend(body["items"])
if not body["next_cursor"]:
return items, body["updated_at"]
cursor = body["next_cursor"]
items, updated_at = get_catalog()
print(len(items), "items, snapshot of", updated_at)Filter
Query parameters
searchstring- Part of the name, e.g.
redline. categorystringknife,gloves,rifle,sniper,pistol,smg,heavy,agent,sticker,container,music_kit,patch,graffitiexteriorstringfn,mw,ft,ww,bsstattrakbooleantrue/falsesouvenirbooleantrue/falsemin_price_centsinteger- Minimum price, in USD cents.
max_price_centsinteger- Maximum price, in USD cents.
sortstringpopular(default),price_asc,price_desc,namelimitinteger- 1–20000, default 1000. Use
20000to get everything in one call. cursorstring- The previous page’s
next_cursor.
# Factory New knives up to US$ 500.00, cheapest first
curl -s "https://ntskins.com/api/merchant/v1/items?category=knife&exterior=fn&max_price_cents=50000&sort=price_asc&limit=100" \
-H "X-API-Key: $NTSKINS_API_KEY"const BASE = 'https://ntskins.com/api/merchant/v1';
const params = new URLSearchParams({ category: 'knife', exterior: 'fn', max_price_cents: '50000', sort: 'price_asc', limit: '100' });
const res = await fetch(`${BASE}/items?${params}`, { headers: { 'X-API-Key': process.env.NTSKINS_API_KEY } });
const { items, total, next_cursor } = await res.json();import os
import requests
BASE = "https://ntskins.com/api/merchant/v1"
params = {"category": "knife", "exterior": "fn", "max_price_cents": 50000, "sort": "price_asc", "limit": 100}
r = requests.get(f"{BASE}/items", params=params, headers={"X-API-Key": os.environ["NTSKINS_API_KEY"]}, timeout=30)
body = r.json() # body["items"], body["total"], body["next_cursor"]{
"items": [
{
"item_key": "a1b2c3d4e5",
"market_hash_name": "★ Karambit | Doppler (Factory New)",
"phase": "Phase 2",
"category": "knife",
"exterior": "fn",
"stattrak": false,
"souvenir": false,
"price_from_cents": 48250,
"units": 3,
"float_min": 0.0081,
"float_max": 0.0412,
"image_url": "https://community.cloudflare.steamstatic.com/economy/image/<id>/360fx360f"
}
],
"total": 1,
"next_cursor": null,
"updated_at": "2026-11-29T15:00:00.000Z",
"currency": "USD"
}Fields of each item
item_keystring- Item identifier. Treat it as opaque: use it as received (URL-encoded in paths).
market_hash_namestring- Steam market name, e.g. AK-47 | Redline (Field-Tested).
phasestring | null- Doppler phase (e.g.
Phase 2,Ruby);nullfor other items. categorystring- One of the filter categories above.
exteriorstring | nullfn…bs;nullfor items without wear.stattrak · souvenirboolean- StatTrak™ / Souvenir.
price_from_centsinteger- The lowest price among the units, at snapshot time.
unitsinteger- How many units are available.
float_min · float_maxnumber | null- Float range of the units; null for items without wear.
image_urlstring- Item image.
Catalogue prices are a snapshot
price_from_cents to list and filter. The price that counts is the unit’s price at order time: read the units (below) before you charge your customer.Endpoints
Units#
A unit is the concrete copy: float, pattern, stickers and its own price. Lists come cheapest first.
GET/items/{item_key}/units
limit (1–60, default 20), cursor. Answers { item, units: [unit], total, next_cursor }.GET/units?market_hash_name=…&phase=…
AK-47 | Redline (Field-Tested)); phase is optional. Same limit and cursor.GET/units/{unit_id}
{ unit, available: true } or 404 UNIT_NOT_AVAILABLE.# Units of one catalogue row (item_key comes from GET /items)
curl -s "https://ntskins.com/api/merchant/v1/items/a1b2c3d4e5/units?limit=20" \
-H "X-API-Key: $NTSKINS_API_KEY"
# Same thing by exact name (+ optional phase)
curl -s --get "https://ntskins.com/api/merchant/v1/units" \
--data-urlencode "market_hash_name=AK-47 | Redline (Field-Tested)" \
-H "X-API-Key: $NTSKINS_API_KEY"
# One unit, read live right now
curl -s "https://ntskins.com/api/merchant/v1/units/s-12345" \
-H "X-API-Key: $NTSKINS_API_KEY"const BASE = 'https://ntskins.com/api/merchant/v1';
const headers = { 'X-API-Key': process.env.NTSKINS_API_KEY };
const name = 'AK-47 | Redline (Field-Tested)';
const res = await fetch(`${BASE}/units?market_hash_name=${encodeURIComponent(name)}&limit=5`, { headers });
const { item, units, total } = await res.json();
for (const u of units) console.log(u.unit_id, u.price_cents, u.float, u.paint_seed);
// Before showing a unit as "available" to your own customer, read it live:
const one = await fetch(`${BASE}/units/${encodeURIComponent(units[0].unit_id)}`, { headers });
console.log(one.status === 404 ? 'sold' : (await one.json()).unit.price_cents);import os
import requests
BASE = "https://ntskins.com/api/merchant/v1"
H = {"X-API-Key": os.environ["NTSKINS_API_KEY"]}
r = requests.get(f"{BASE}/units", params={"market_hash_name": "AK-47 | Redline (Field-Tested)", "limit": 5}, headers=H, timeout=15)
body = r.json()
for u in body["units"]:
print(u["unit_id"], u["price_cents"], u["float"], u["paint_seed"])
# Before showing a unit as "available" to your own customer, read it live:
one = requests.get(f"{BASE}/units/{body['units'][0]['unit_id']}", headers=H, timeout=15)
print("sold" if one.status_code == 404 else one.json()["unit"]["price_cents"]){
"item": {
"item_key": "f6g7h8i9j0",
"market_hash_name": "AK-47 | Redline (Field-Tested)",
"phase": null,
"image_url": "https://community.cloudflare.steamstatic.com/economy/image/<id>/360fx360f"
},
"units": [
{
"unit_id": "s-12345",
"item_key": "f6g7h8i9j0",
"market_hash_name": "AK-47 | Redline (Field-Tested)",
"phase": null,
"price_cents": 2650,
"float": 0.2134,
"paint_seed": 412,
"stickers": [{ "name": "Sticker | Natus Vincere | Katowice 2019", "image_url": "https://community.cloudflare.steamstatic.com/economy/image/<id>" }],
"charm": null,
"inspect_url": "steam://rungame/730/76561202255233023/+csgo_econ_action_preview%20...",
"delivery_minutes": 5
}
],
"total": 14,
"next_cursor": "eyJvIjoyMH0"
}Endpoints
Orders#
POST/orders
201 { order }. A repeat with the same external_id returns the same order (200).Body (JSON)
external_idstringrequired- 8–64 characters, unique per order: your own ID. Repeating the same
external_idreturns the same order (200) instead of buying again. max_price_centsintegerrequired- The most you accept to pay. You are never charged more.
unit_idstring- Buys that unit. Send
unit_idormarket_hash_name. market_hash_namestring- Buys the cheapest available unit of that item, at or below
max_price_cents. phasestring- Optional, with
market_hash_name(Dopplers). trade_urlstring- Optional. Without it, the skin goes to your account’s Trade URL. Another Steam account needs that permission enabled on your account (otherwise
TRADE_URL_NOT_ALLOWED).
# Buy one specific unit, never above max_price_cents
curl -s -X POST https://ntskins.com/api/merchant/v1/orders \
-H "X-API-Key: $NTSKINS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"external_id": "your-order-123",
"unit_id": "s-12345",
"max_price_cents": 2750
}'
# Or by name: the cheapest available unit at or below max_price_cents,
# delivered to another Steam account (needs the third-party Trade URL permission)
curl -s -X POST https://ntskins.com/api/merchant/v1/orders \
-H "X-API-Key: $NTSKINS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"external_id": "your-order-124",
"market_hash_name": "AK-47 | Redline (Field-Tested)",
"max_price_cents": 2750,
"trade_url": "https://steamcommunity.com/tradeoffer/new/?partner=123456789&token=AbCdEfGh"
}'const BASE = 'https://ntskins.com/api/merchant/v1';
const res = await fetch(`${BASE}/orders`, {
method: 'POST',
headers: { 'X-API-Key': process.env.NTSKINS_API_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({
external_id: 'your-order-123', // your own order id: same id = same order
unit_id: 's-12345',
max_price_cents: 2750,
}),
});
const body = await res.json();
if (res.status === 201 || res.status === 200) console.log(body.order.id, body.order.status);
else console.error(res.status, body.code, body.message);import os
import requests
BASE = "https://ntskins.com/api/merchant/v1"
r = requests.post(
f"{BASE}/orders",
headers={"X-API-Key": os.environ["NTSKINS_API_KEY"]},
json={
"external_id": "your-order-123", # your own order id: same id = same order
"unit_id": "s-12345",
"max_price_cents": 2750,
},
timeout=30,
)
body = r.json()
if r.status_code in (200, 201):
print(body["order"]["id"], body["order"]["status"])
else:
print(r.status_code, body["code"], body["message"]){
"order": {
"id": "cm41b7k9x0004qz2l8e5r1t6a",
"external_id": "your-order-123",
"status": "pending",
"unit_id": "s-12345",
"market_hash_name": "AK-47 | Redline (Field-Tested)",
"price_cents": 2650,
"currency": "USD",
"trade_url": "https://steamcommunity.com/tradeoffer/new/?partner=123456789&token=AbCdEfGh",
"trade_offer_id": null,
"trade_offer_url": null,
"refunded": false,
"cancel_reason": null,
"created_at": "2026-11-29T15:04:05.000Z",
"delivered_at": null,
"expires_at": null
}
}Most common errors here: PRICE_CHANGED, UNIT_NOT_AVAILABLE, NO_UNIT_AT_PRICE, INSUFFICIENT_BALANCE, TRADE_URL_NOT_ALLOWED, STEAM_ACCOUNT, TOO_MANY_PENDING. See Errors.
Read orders
GET/orders/{id}
{ order }.GET/orders/by-external-id/{external_id}
{ order }. 404 ORDER_NOT_FOUND = it does not exist.GET/orders
status, limit (1–100, default 50), cursor. Answers { orders: [order], next_cursor }.# By our id
curl -s https://ntskins.com/api/merchant/v1/orders/cm41b7k9x0004qz2l8e5r1t6a \
-H "X-API-Key: $NTSKINS_API_KEY"
# By your external_id (e.g. after a timeout, to know whether the order exists)
curl -s https://ntskins.com/api/merchant/v1/orders/by-external-id/your-order-123 \
-H "X-API-Key: $NTSKINS_API_KEY"
# Newest first, filtered by status
curl -s "https://ntskins.com/api/merchant/v1/orders?status=offer_sent&limit=50" \
-H "X-API-Key: $NTSKINS_API_KEY"const BASE = 'https://ntskins.com/api/merchant/v1';
const headers = { 'X-API-Key': process.env.NTSKINS_API_KEY };
const byExt = await fetch(`${BASE}/orders/by-external-id/${encodeURIComponent('your-order-123')}`, { headers });
if (byExt.status === 404) console.log('no such order: safe to create it');
else console.log((await byExt.json()).order.status);
// Walk every order, newest first
let cursor = null;
do {
const qs = new URLSearchParams({ limit: '100', ...(cursor ? { cursor } : {}) });
const page = await (await fetch(`${BASE}/orders?${qs}`, { headers })).json();
for (const o of page.orders) console.log(o.external_id, o.status, o.price_cents);
cursor = page.next_cursor;
} while (cursor);import os
import requests
BASE = "https://ntskins.com/api/merchant/v1"
H = {"X-API-Key": os.environ["NTSKINS_API_KEY"]}
r = requests.get(f"{BASE}/orders/by-external-id/your-order-123", headers=H, timeout=15)
print("no such order: safe to create it" if r.status_code == 404 else r.json()["order"]["status"])
# Walk every order, newest first
cursor = None
while True:
params = {"limit": 100}
if cursor:
params["cursor"] = cursor
page = requests.get(f"{BASE}/orders", params=params, headers=H, timeout=30).json()
for o in page["orders"]:
print(o["external_id"], o["status"], o["price_cents"])
cursor = page["next_cursor"]
if not cursor:
breakStatus and delivery#
- pendingPaid from the balance; the trade offer is being prepared.
- offer_sentOffer sent. The recipient must accept it on Steam before
expires_at. - deliveredDelivered. Done.
- cancelledNot delivered (e.g. offer not accepted in time). The amount went back to the balance automatically:
refunded: true. - revertedSteam reversed the trade after delivery. Rare; our support handles it.
No webhooks in v1
GET /orders/{id} every 10–15 seconds while the order is pending or offer_sent. That is plenty.Offers come from our Steam delivery accounts. The recipient should check the offer contents before accepting.
Objects#
unit
unit_idstring- The concrete copy. This is what goes into
POST /orders. item_key · market_hash_name · phasestring- The item the unit belongs to.
price_centsinteger- The unit’s price, in USD cents.
floatnumber | null- Exact float; null for items without wear.
paint_seedinteger | null- Pattern (paint seed).
stickersarray[{ name, image_url }]charmobject | null{ name }ornullinspect_urlstring | null- In-game inspect link.
delivery_minutesinteger- Estimated minutes until the trade offer goes out.
order
idstring- NTSkins order ID.
external_idstring- Your ID, as you sent it.
statusstringpending·offer_sent·delivered·cancelled·revertedunit_id · market_hash_namestring- What was bought.
price_cents · currencyinteger · "USD"- What came out of the balance.
trade_urlstring- Where the offer goes.
trade_offer_id · trade_offer_urlstring | null- The Steam offer, once sent.
refundedbooleantruewhen the amount went back to the balance.cancel_reasonstring | null- Why it was cancelled (when
cancelled). created_at · delivered_atstring · string | null- ISO-8601 UTC.
expires_atstring | null- Deadline to accept the Steam offer. Can be null before the offer is sent.
Full example#
From item name to delivery: find the cheapest unit, buy with no risk of buying twice, follow it to the end.
# 1. Cheapest unit of the item
curl -s --get "https://ntskins.com/api/merchant/v1/units" \
--data-urlencode "market_hash_name=AK-47 | Redline (Field-Tested)" \
--data-urlencode "limit=1" \
-H "X-API-Key: $NTSKINS_API_KEY"
# 2. Buy it (use the unit_id and price_cents you just got)
curl -s -X POST https://ntskins.com/api/merchant/v1/orders \
-H "X-API-Key: $NTSKINS_API_KEY" -H "Content-Type: application/json" \
-d '{"external_id":"my-shop-0001","unit_id":"s-12345","max_price_cents":2650}'
# 3. Poll until status is delivered, cancelled or reverted
curl -s https://ntskins.com/api/merchant/v1/orders/by-external-id/my-shop-0001 \
-H "X-API-Key: $NTSKINS_API_KEY"// buy.mjs — Node 18+: NTSKINS_API_KEY=... node buy.mjs
import { randomUUID } from 'node:crypto';
const BASE = 'https://ntskins.com/api/merchant/v1';
const KEY = process.env.NTSKINS_API_KEY;
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
async function api(path, init = {}) {
const res = await fetch(BASE + path, {
...init,
headers: { 'X-API-Key': KEY, 'Content-Type': 'application/json', ...init.headers },
});
const body = await res.json().catch(() => ({}));
if (!res.ok) throw Object.assign(new Error(`${res.status} ${body.code}: ${body.message}`), { status: res.status, body });
return body;
}
// 1. The cheapest unit of the item, read live
const name = 'AK-47 | Redline (Field-Tested)';
const { units } = await api(`/units?market_hash_name=${encodeURIComponent(name)}&limit=1`);
if (!units.length) throw new Error('nothing available right now');
const unit = units[0];
// 2. Buy it. Store external_id BEFORE calling: a retry with the same id never buys twice.
const externalId = `my-shop-${randomUUID()}`;
let { order } = await api('/orders', {
method: 'POST',
body: JSON.stringify({ external_id: externalId, unit_id: unit.unit_id, max_price_cents: unit.price_cents }),
});
// 3. Poll every 15 s until the order is final
while (order.status === 'pending' || order.status === 'offer_sent') {
await sleep(15000);
({ order } = await api(`/orders/${encodeURIComponent(order.id)}`));
}
console.log(order.status, order.trade_offer_url ?? '', order.refunded ? '(refunded to balance)' : '');# buy.py — pip install requests
import os
import time
import uuid
import requests
BASE = "https://ntskins.com/api/merchant/v1"
s = requests.Session()
s.headers["X-API-Key"] = os.environ["NTSKINS_API_KEY"]
def api(method, path, **kw):
r = s.request(method, BASE + path, timeout=30, **kw)
body = r.json() if r.content else {}
if not r.ok:
raise RuntimeError(f"{r.status_code} {body.get('code')}: {body.get('message')}")
return body
# 1. The cheapest unit of the item, read live
units = api("GET", "/units", params={"market_hash_name": "AK-47 | Redline (Field-Tested)", "limit": 1})["units"]
if not units:
raise SystemExit("nothing available right now")
unit = units[0]
# 2. Buy it. Store external_id BEFORE calling: a retry with the same id never buys twice.
order = api("POST", "/orders", json={
"external_id": f"my-shop-{uuid.uuid4()}",
"unit_id": unit["unit_id"],
"max_price_cents": unit["price_cents"],
})["order"]
# 3. Poll every 15 s until the order is final
while order["status"] in ("pending", "offer_sent"):
time.sleep(15)
order = api("GET", f"/orders/{order['id']}")["order"]
print(order["status"], order.get("trade_offer_url") or "", "(refunded to balance)" if order["refunded"] else "")Good practice#
- Keep the key on your server. Never in a browser, an app, a screenshot or a repository.
- Always send
max_price_cents: it is the most you accept to pay. - Prices in
GET /itemsare a snapshot. What counts is the unit’s price at order time. - Create and store the
external_idbefore calling. Timed out? Repeat with the sameexternal_idor look up/orders/by-external-id/…: you never buy twice. - An order not accepted on Steam in time is cancelled and refunded to the balance (
refunded: true). - Offers come from our delivery accounts: the recipient should check the offer before accepting.
- Honour
Retry-After. Download the whole catalogue withlimit=20000instead of paging in a loop. - Use of the API is subject to the site’s Terms of Service.
Ready to integrate?
Request access. Questions about the integration: talk to us.