Response format

Plain text by default on the original endpoints, JSON with result=json. The newer endpoints are always JSON.

On /products, /stock, /balance, /order, /replace and the buy endpoints, add result=json for a JSON body. Anything else, or nothing, gives plain text. Errors follow the same switch.

/me, /limits, /orders, /ledger, /webhooks, /preorder/hours and /preorder/cancel always answer JSON, errors included. /orders and /ledger also give CSV with format=csv.

Text

Request
curl -X POST "https://www.nfa.pub/api/v1/cs2?type=prime" \  -H "X-Api-Key: rsk_..."
Response
76561198168801886----eyAidHlwIjogIkpXVCIs...
Request
curl "https://www.nfa.pub/api/v1/stock?product=xg-dayz"
Response
xg-dayz	75	in_stock

JSON

Request
curl -X POST "https://www.nfa.pub/api/v1/cs2?type=prime&result=json" \  -H "X-Api-Key: rsk_..."
Response
{  "ok": true,  "order_id": "4b53000e7b4677d2-c69a8e94132d75e8",  "accounts": ["76561198168801886----eyAid..."],  "count": 1,  "charged_eur": 0.3,  "cached": false}

Money and time

Fields ending in Cents are whole euro cents. Fields ending in _eur are euros. Timestamps on the newer endpoints are ISO 8601 in UTC. /order gives unix milliseconds, and webhook created is unix seconds.

Errors

A text error is the bare code, so the body is exactly E1401. A JSON error has ok, code and an error sentence. Either way the code is also in the X-Error-Code header, so you can branch without reading the body. See Errors.

Response format · API reference · nfa.pub