nrg.market API reference Interactive reference

nrg.market API

TRON energy for USDT transfers, on demand

The API reference as plain HTML, generated from the contract at /openapi.yaml. The interactive reference shows the same contract and can send test requests.

nrg.market delivers TRON energy to the sending wallet right before a USDT (TRC-20) transfer, so the transaction does not burn TRX.

Quick start

  1. Top up your balance in TRX at the address from GET /deposit-address.
  2. (Optional) Estimate the cost: POST /estimate.
  3. Create an order: POST /orders with an Idempotency-Key header.
  4. Wait for the ready status (webhook order.ready or polling).
  5. Send the USDT transaction before send_before.

The same five steps work in the sandbox at https://sandbox.nrg.market/v1, where step 1 is a grant of test money and POST /sandbox/deposit rather than a transfer on chain. See "Sandbox" below.

Modes

Lease durations

An order names how long the energy is leased for: duration_s, five minutes by default. Which durations are on sale is answered by GET /tariff in products[].duration_s — read it rather than hard-coding a list, since a product goes on and off sale without a change to this document. The lease decides both the price and the length of the send_before window.

One price per product (since 2026-10-26)

Each lease on sale has one current price, recomputed against the market; there are no time-of-day zones and no schedule of future prices. On 2026-10-26 the zone fields were removed from this contract, without a deprecation period: from GET /tariff, at the top level and in products[], the name of the running zone, the moment it ends and the schedule of zone segments with their averages; the zone of every point of GET /tariff/history and of ours in GET /market; and the zone of POST /estimate and of an order. Nothing else in those responses changed, and the price fields mean exactly what they meant. Webhooks never carried zones.

Energy maintenance (Auto-refill)

/auto-refill-rules are "keep energy on this wallet" rules: energy is replenished after every spend, so no separate order per transfer is needed. A rule is described by an address and a mandatory daily budget — a spending cap per UTC day. The price of a single top-up is in GET /tariff; maintenance.* events report top-ups and stops.

The resource originally shipped as /maintenance-rules. That path remains an alias until 2026-12-01: same responses plus Deprecation: true and Sunset headers. Event names (maintenance.*), the maintenance_price_trx tariff field and the maintenance_rule_conflict error code are not renamed: a path can have an alias, an event name cannot.

Queue mode

/queue-sessions is a session on one sender wallet for a run of USDT transfers you are about to send: a target level of free energy, Start, Stop and the ordered list of the payments. From Start the session keeps the wallet at the target with the cheapest five-minute energy, bought packet by packet and sized to the next transfers in the queue; it pauses by itself when the wallet's USDT does not cover the next payment and resumes when it does; it completes when the queue is exhausted. You pay only for packets whose delivery is seen on-chain, one queue.packet_delivered event per packet. The mode is on for every account by default; on an account it has been switched off for, every /queue-sessions path answers 404.

Amounts and time

All amounts are in TRX, as strings with 6 decimal places ("2.080000"). All timestamps are UTC, ISO 8601.

Order price

An order is priced when it is created: every position at energy_units × the product's current per-unit price (a volume position can be priced higher, see energy_units on POST /orders), and the hold is placed for the total. That total is the order's quoted_total_trx, and it never changes.

The price can be raised while the order is being filled, and never falls below that total. Right before a position is bought, its price is compared with what the cheapest vendor available for it at that moment may charge us. If that cost leaves less than our minimum margin under the position's price, the position's per-unit price is raised to the lowest whole-sun price that covers the cost with that margin — capped at a fixed multiple of the per-unit price the order was created at. The difference is held from your available balance at once: total_trx and the position's price_trx grow by it, GET /ledger shows a hold entry for it with the order's id, the order.repriced event is sent, and only then is the energy bought. A market that leaves our margin under the price leaves the price as it is. A position can be raised more than once — for instance when the vendor it was raised for refuses and the next one costs more still.

A raise is never made on credit. If your available balance is short of the difference, or the price would have to go above the cap, there is no raise, and the position is filled as it would have been without one. A transfer position (one with a kind) is not bought: it ends failed with purchase_failed, its hold comes back in full and nothing is charged for it — exactly as when no vendor sells at all. A volume position is refused that way only while nothing has been bought for it and allow_partial is off; otherwise its fill goes on at the price it stands at and ends short — the units delivered are charged, the rest of the hold comes back, and the order ends partially_completed (or failed, if nothing at all could be bought). Keep your available balance above what you order if you would rather pay a dearer market than have a position refused or filled short. A transfer position that fails after it was raised (the vendor refused and nobody else sold) is refunded whole as well, the raise included; total_trx keeps the raised figure, and charged_trx says what was actually charged.

A volume position (kind: bulk) can be raised before its first piece is bought and between pieces. It has one per-unit price, so a raise between pieces prices the units already delivered too. If the fill then ends short without buying anything after the raise, the raise is taken back: the position returns to the per-unit price its last delivered piece was bought at, the hold is lowered by the difference (a hold_release entry in GET /ledger), and another order.repriced reports total_trx going down.

What you are finally charged is charged_trx, counted at the price each position stands at when the order settles. POST /estimate quotes the price an order would be created with at that moment — not a final price. Queue-mode packets are priced against the market packet by packet (see queue.packet_delivered).

Idempotency

POST /orders requires an Idempotency-Key header. A retry with the same key returns the original order and does not create a new one. The same key with a different request body → 409 idempotency_conflict. POST /queue-sessions and POST /queue-sessions/{session_id}/items require the header with the same semantics.

Any endpoint, including one that lists no 503, may answer a retryable 503 capacity_unavailable when the service is momentarily overloaded or waiting on database maintenance. Nothing is reserved or charged by such an answer: retry later, and retry an order under the same Idempotency-Key.

Rate limits

Four independent buckets, counted per API key: orders (120/min), reference requests (600/min), address checks (GET /address-check, 60/min — every miss of its cache is a question to the chain) and the webhook probe (POST /webhooks/{webhook_id}/test, 10/min — it opens a connection to an address you chose and tells you why it failed, and the honest use of it is a person pressing a button). On overflow — 429 rate_limited with a Retry-After header. For the public endpoints without a key (GET /tariff, GET /tariff/history, GET /contract.yaml) the reference limit is counted per IP instead.

POST /estimate pays for the addresses it asks about, not only for the call: one token for the call, plus one for each unique address in the body (to and from together) that our short-lived address cache does not hold. A cached address is free, so repeating an estimate costs one token. The charge is capped at what the bucket can hold: a body larger than the bucket (500 pairs with distinct from are 1000 uncached addresses) costs the whole bucket and passes on a full one. A body the bucket cannot pay for right now is refused with 429 rate_limited before anything is asked of the chain, and its Retry-After is the time until the bucket is full again (the same as RateLimit-Reset). After it the same body passes, provided the key spends nothing else from the same bucket meanwhile: the other reference endpoints (GET /balance, GET /ledger and the rest) are paid from it too. GET /address-book with include=chain pays for the addresses of its page the same way: one token for the call, plus one for each address the cache does not hold. GET /address-check costs one token of its own bucket, as before — it asks about one address.

POST /orders, POST /queue-sessions and POST /queue-sessions/{session_id}/items also spend a node budget: 1000 transfers per minute per account (not per key — every key of the account and the cabinet share it). An order costs one per transfer of the body, a queue session's creation one per item plus one for the sender, an append one per item; the request's own token still comes from the orders bucket. The charge is made before anything is asked of the chain and is capped at what the budget holds, so the largest body (500 transfers) always passes on a full budget. A body the budget cannot pay for right now is 429 rate_limited with nothing asked of the chain; its Retry-After is the time after which the same body fits, and its RateLimit-* describe the node budget (transfers per minute), not the orders bucket. Successful answers keep carrying the orders bucket's state.

Two endpoints answer without those headers, and neither absence is the outage signal described below: GET /health has no limiter of any kind, and GET /contract.yaml is counted but does not yet report the count.

Every rate-limited answer — the successful ones too — carries the state of your bucket, so you can slow down before the refusal instead of after it:

The sandbox adds one allowance more, on its own endpoint and counted per day rather than per minute: POST /sandbox/deposit takes ten calls per client per UTC day. It refuses with the same 429 rate_limited and the same Retry-After.

Repeated authorization failures

Failed authorizations are counted apart from the rate limits above, and they answer with their own code: 429 too_many_auth_failures, also with Retry-After. Branch on the code, never on message:

The counter is keyed on the presented key together with your address, so a forgotten machine holding a revoked key cannot lock out the working integrations that share an office NAT with it. Credentials that resolve to no key at all are counted per address — there is nothing else to count them by. A request presenting a valid, active key is never refused by this counter.

While an address is inside such a window, every refusal it gets is too_many_auth_failures — including one whose credential is a real key that failed for another reason, an address outside its allowlist among them. That is deliberate: telling those two refusals apart would tell whoever is guessing which of the strings they are trying are live keys. A key that works keeps working and still answers 200.

This counter is not a bucket — it has a budget and a window that grows, and nothing that refills — so too_many_auth_failures carries Retry-After and no RateLimit-*. There is no bucket state to report, and reporting one would be inventing it.

Browsers are not supported

This API is called from your server, not from a page. Authenticated endpoints answer no CORS headers at all and allow no browser origin: reaching them from client-side code would mean shipping nrg_live_… to everyone who loads the page, and a key shipped to everyone is a leaked key. A preflight request to one of them gets 405 in the usual error envelope and nothing that looks like permission. The keyless reference endpoints (GET /tariff, GET /tariff/history, GET /health and GET /contract.yaml) do answer browsers — GET only, from our own origins.

A Fireblocks workspace connects to nrg.market over the Fireblocks Provider Connectivity API v2, served at /link/v2 — signed requests, no bearer token, and deposits only. This document does not describe it: that plane implements the vendor's own specification, answers in the vendor's error schemas, and accepts none of the keys described here. What we expose there and how a signing key is issued is written up in docs/api-spec.md §11.

Send your own User-Agent

Not a requirement: this API answers a default Python-urllib/3.x agent exactly like any other, and no client signature is refused here. Send an agent naming your integration anyway — it is what lets us find your requests in a log when you ask us about them.

One host does refuse it, and it is not this one. The documentation site is served separately from the API, and its edge answers some programmatic clients — Python-urllib among them — with a 403 in text/plain carrying error code: 1010: no {"error": {…}} envelope and no error code of ours, because the request never reached us. That rule is not ours to lift on that host and we are not promising it will change. If you want this document from a program, take it from the API instead — GET /contract.yaml serves it byte for byte from this host, with nothing of the sort in front of it.

Sandbox

There are two servers entries. Production is the live service, on TRON mainnet, against your real balance. The sandbox at https://sandbox.nrg.market is the same /v1 surface and the same code, running over test money, a simulated chain and simulated energy providers. Build against the sandbox; when the integration works, change the base URL and the key.

A key belongs to one host or the other

The cabinet that issues a key decides its kind: app.nrg.market issues nrg_live_… keys for https://api.nrg.market/v1, and sandbox-app.nrg.market issues nrg_test_… keys for https://sandbox.nrg.market/v1, where registration is self-serve. Neither host accepts the other's keys, and the two accounts share nothing — separate databases, separate balances, separate webhook endpoints and secrets.

A key presented to the wrong host is refused with 401 and the ordinary unauthorized code — the same code as any key we do not accept, because the code is what you branch on and this is not a branch of its own. Only the message differs: it names the base URL that key does belong to, so a deployment pointed at the wrong host says so in one line of your log instead of looking like a revoked key. Read that as a message to a human, not as an instruction to a program: the host your client talks to is configuration, never something to discover at runtime and switch to.

What the sandbox proves, and what it does not

It is the same code over test money, so the money rules are the ones you will meet in production: orders in all three modes, holds and their release, the status machine, send_before and expiry, partial batches, charging, the ledger and idempotency all behave there as they behave here. Webhooks are real deliveries and not a mock — your URL, your secret, a real X-NRG-Signature over the bytes we send, the same retry ladder and the same delivery log — so a receiver verified against the sandbox is a verified receiver.

The prices are the live ones: the sandbox's tariff mirrors production's within a few minutes (about two as a rule, three at the worst), so an estimate rehearsed there is the live price of that moment — not a promise of tomorrow's.

What it cannot prove is the part the chain does: energy never actually arrives anywhere. The chain underneath is simulated, so a delegation "confirmed" there is a fact about our simulator and not about TRON. Whether real energy lands on a real wallet, and whether your transfer goes through without burning TRX, is learned in production and nowhere else.

The energy keeper does not run on the sandbox, and this is the one place it is said. /v1/maintenance-rules is mounted there and behaves normally — a rule is created, listed, edited and deleted, and the validation of every field is the production validation. What does not happen is the work: the loop that watches an address and tops it up is not among the stand's background tasks, so a rule accepted there is never executed. Nothing marks it as inert — the rule reads back exactly as it would on production.

In consequence none of maintenance.topup, maintenance.paused and maintenance.budget_exhausted will ever reach your endpoint from the sandbox, however long you wait or however you configure the rule. You can subscribe to them, and the subscription is real; the deliveries are not coming. Build the CRUD half of a keeper integration against the stand and treat the three events as unexercised code, the way the list below asks you to treat the branches that depend on the chain. balance.low is not in that group — it does fire on the sandbox, off POST /sandbox/deposit.

Test money

Activating a new sandbox account — confirming the e-mail, or the first Google sign-in — grants 10,000 TRX of test balance; it arrives as an adjustment_credit row in GET /ledger. For more, POST /sandbox/deposit credits what you ask for — up to 100,000 TRX per call, ten calls per client per UTC day — down the same path the deposit watcher uses in production: a deposit entry with a sandbox-<uuid> txid, and a real deposit.credited event — for 1 TRX and more, as in production; a smaller amount is credited without it.

Scenario addresses

Some addresses in the sandbox are wired to behave in a fixed way, the way test card numbers are. They are ordinary base58check TRON addresses and nothing more: no private key exists for any of them, here or anywhere, which is why they can be printed in a public document.

The recipient decides how much energy the transfer needs and what happens to the item after ready — the to of a transfer in mode a, the address parsed out of signed_tx in mode b:

RecipientWhat the sandbox does with it
TDRCjoKpcCqP87TVpxcwXmknadMcPom8ccAn activated USDT holder, so kind: single. Delegation confirms in 2–8 s, and about 45 s after ready a synthetic transfer to it appears — the item ends sent.
TLLmUhBYgU125KkPpeTdP1vz1zqhoZwn9vEmpty, so kind: double — twice the energy and twice the price — and not activated. It stays that way. The sandbox classifies this address by its name, not by its history, so it is empty for ever: every order to it prices as double, however many transfers have already landed.
TDUvBqzR3cYY6zYopYdJ9jWrxQRs9QmvQMDelegation confirms and no transfer ever appears. The item stands at ready until send_before and becomes expired — and is charged, exactly as in production: the energy was delivered whether or not you used it.
TKLeQhXSUba1GG1wdznyMc49oqModZ8FbmOn the USDT blacklist. The order is refused under the production rule — 422 blacklisted_recipient, with details.index and details.address.
any other valid addressBehaves like the holder in the first row.

The sender decides how the purchase and the delegation go — the from of a transfer in modes a and b, and in mode c the wallet you are energising, which is your own:

SenderWhat the sandbox does with it
TQ6ey8qT87bnzBJXj7gVTGCkrU4wUJ1EWQThe purchase fails at every provider. The item ends failed with error: purchase_failed, the hold is released and nothing is charged.
TYWZsWdM9u8QKJTi6XEmenpvCPwg1xmPCCThe first provider is unavailable and the failover succeeds. Nothing in the response says so, which is the point: the order proceeds normally.
TNhq25t5XTEuk3mC9cTcAGB5rr3xuCkGyrDelegation confirms after about 25 s — the slow path, for the code that waits.
any other valid addressDelegation confirms in 2–8 s.

The two tables describe two different things about one transfer, so they combine: the timing of the delegation comes from the sender, the energy kind and everything after ready from the recipient. Mixing the scenario addresses in one batch is how you get partially_completed — one transfer from the failing sender among ordinary ones, and the status falls out of the mix of item outcomes with nothing special asked for.

Neither table's address changes what it is. The sandbox recognises them by name, so kind: double above stays double and the slow sender stays slow, order after order. Nothing here ever "becomes activated" or otherwise carries a history the way a real address does — an address's past on TRON is a production fact and the stand does not have one.

The sender addresses are shared by every client of the stand, and so is the energy delegated to them. Two orders live at once on the same sender draw on one pool: the second may find energy already sitting there and confirm its delivery sooner than the table says, and yours is not the only integration that can put it there. The stated timings — the 25 s of the slow sender, the 2–8 s of the rest — hold exactly on an idle address. When the timing is what you are rehearsing, use a fresh sender address of your own instead: any valid address the sandbox does not recognise takes the ordinary 2–8 s path, and its delegations are private to it.

Mode B in the sandbox

Sign the transaction with any throwaway key: the simulated chain does not verify signatures, so a key generated on the spot and holding nothing is enough to exercise the mode end to end. Everything around the signature is real — the transaction is parsed and validated as production parses it, a malformed one is refused the same way, the item walks broadcasting → broadcasted → confirmed, and the broadcast confirms in about 3 s instead of the roughly one minute solidification takes on mainnet.

Rehearsing against production

An integration should be built against the sandbox. This list is about production itself — what the live service costs to exercise, for the parts you decide to try here anyway:

Endpoints by tag

Webhooks — the events we send to your endpoints, their payloads and how to verify a delivery.

Schemas — every object of the contract, field by field.

Servers

Authentication

bearerAuth: HTTP bearer (Authorization: Bearer …).

The API key from your dashboard — the key of the stand you are calling: Authorization: Bearer nrg_live_... on production, Authorization: Bearer nrg_test_... in the sandbox. The key is shown only once. A key can be restricted to a list of allowed IPs.

The prefix says which host the key belongs to: nrg_live_… to https://api.nrg.market/v1, issued at app.nrg.market, and nrg_test_… to https://sandbox.nrg.market/v1, issued at sandbox-app.nrg.market. Each host accepts its own kind and refuses the other with 401 unauthorized — the same code as any key we do not accept, with the right base URL named in message.

The key is transmitted whole and only in this header. The service stores only values derived from it: the lookup index is a deterministic hash of the entire token, verification is argon2id. A truncated secret is not used as an index (see api-spec.md §8).

Support: nrg.market support.