nrg.market API reference Interactive reference

Utility

Address checks and service status

GET /address-check

Check an address

Authentication: Required — an API key in Authorization: Bearer … (authentication).

Whether the address is activated, holds USDT, is on Tether's blacklist, or is a contract.

Parameters

NameInRequiredTypeDescription
addressqueryrequiredTronAddress

Responses

200

OK

Content type application/json.

FieldTypeRequiredDescription
addressTronAddressrequired
activatedbooleanrequired
holds_usdtbooleanrequired
blacklistedbooleanrequired
is_contractbooleanrequired
expected_kindTransferKindrequired

400

Malformed request

Content type application/json.

Schema: Error.

401

Invalid key or IP not allowed

Content type application/json.

Schema: Error.

429

Rate limit exceeded (rate_limited), or too many failed authorizations from this credential (too_many_auth_failures). Both are 429 and both carry Retry-After; they differ in what you should do about it, which is why they differ in code and not only in message. rate_limited also carries the RateLimit-* state of the bucket it came from; too_many_auth_failures does not, because the counter behind it is not a bucket. See "Rate limits" and "Repeated authorization failures" above.

On POST /orders a rate_limited may also carry details.reason = bulk_volume_cap: not requests per minute but energy per window — a mode c order whose volumes would take your account past the bulk allowance. details carries cap_units (the allowance), spent_units (your volume already inside the window), requested_units (what this order asked for) and window_s (the width of the window, 3600). Retry-After is the first instant at which this body can be accepted: enough of your counted volume has to leave the window to make room for requested_units, which is not in general the moment the oldest position leaves — one departure frees only that position's units. An order whose own volume is larger than the whole allowance is not answered here at all: no waiting would help it, and it is 400 invalid_request with details.reason = bulk_order_over_cap. It is a pace limit like the others, so it is the same code: the order is not wrong, and the same body sent later is accepted. It carries no RateLimit-* headers: those describe a bucket of requests per minute, and this allowance is energy per hour — details above is its whole state.

Content type application/json.

Schema: Error.

HeaderTypeDescription
Retry-Afterinteger

Seconds to wait before retrying.

RateLimit-Limitinteger

Requests per minute in this bucket — per UTC day on POST /sandbox/deposit, the one allowance in this API that is not counted per minute. Absent in exactly three cases, and in none is a number invented for it: the limiter could not read the bucket state (the request is let through then), the answer is too_many_auth_failures, which is counted by the authorization-failure counter and not by a bucket — see "Repeated authorization failures" — or it is the volume allowance (details.reason = bulk_volume_cap), which is energy per hour rather than requests per minute.

RateLimit-Remaininginteger

Requests left in this bucket right now.

RateLimit-Resetinteger

Seconds until the bucket is full again.

503

We temporarily cannot accept the request: no purchasing quota with the energy providers, or the TRON network is unavailable (without it we cannot check the recipient against the blacklist or the sender's activation). For a volume (energy_units), also when the market data its price would be built from is out of range: nothing is reserved or charged. Retry later.

Content type application/json.

Schema: Error.

GET /health

Service status

Authentication: None — this endpoint is public and takes no API key.

status is the service as a whole: degraded means the API answers and orders are accepted while something behind it (cache, nodes) is not healthy.

components is the same service split into the parts you can feel, each of them either ok or down. It is what our status page shows and it is safe to poll: no component is computed from anything you pay for.

  • api — requests are answered.
  • orders — an order can be created and will be fulfilled.
  • delivery — delegated energy is reaching the address.
  • deposits — deposits are being credited.

A component whose state we cannot establish reads down, never the last known value.

Responses

200

OK

Content type application/json.

FieldTypeRequiredDescription
statusstringrequired

One of: ok, degraded, down.

timestring (date-time)required
componentsobjectrequired
components.apistringrequired

One of: ok, down.

components.ordersstringrequired

One of: ok, down.

components.deliverystringrequired

One of: ok, down.

components.depositsstringrequired

One of: ok, down.

GET /contract.yaml

Machine-readable API contract

Authentication: None — this endpoint is public and takes no API key.

This document itself, byte for byte as it is written in our repository — the same file the documentation site renders. Fetch it with a program: generate a client from it, diff it in CI, vendor it. Public endpoint, no authorization required; rate limited by IP, since a public request carries no key.

This is not /v1/openapi.json. That one is generated by the framework from the code running in this deployment, so it lags: it describes what has shipped. This one is written by hand and is the promise — it can describe an endpoint that goes live in the next release, and where the two disagree, this file is the one we are held to. Generate clients from this one. A mistyped extension (/v1/contract.json) is a 404 rather than the other document, which is why the two paths deliberately share no stem.

Serve-from-the-API is the point of the endpoint: the copy on the documentation site sits behind an edge that answers some programmatic clients with a plain-text 403 error code: 1010 before anything of ours is reached (see "User-Agent" in the client docs). This URL is the API's own host and has no such rule in front of it.

ETag is the SHA-256 of the body, so sha256sum of what you downloaded reproduces it; send it back as If-None-Match to get a 304 instead of the document. That works on every request and is the cheap way to poll for a change.

The answer also carries Cache-Control: public, max-age=300 — the document changes when we deploy, never between requests, so five minutes is how long a stored copy may outlive a release. One exception, and it is easy to hit by accident: a request carrying an Authorization header is answered no-store instead, because this API marks anything asked for with a key as private. This endpoint needs no key — fetch it with a plain client if you want the cacheable answer. With ETag it makes no practical difference.

Responses

200

The contract, exactly as it stands in our repository.

Content type application/yaml.

Type: string.

HeaderTypeDescription
ETagstring

SHA-256 of the body, in quotes.

Content-Dispositionstring

inline, with a filename for browser downloads.

304

Your If-None-Match names the copy we would send.

No body.

429

Rate limit exceeded (rate_limited), or too many failed authorizations from this credential (too_many_auth_failures). Both are 429 and both carry Retry-After; they differ in what you should do about it, which is why they differ in code and not only in message. rate_limited also carries the RateLimit-* state of the bucket it came from; too_many_auth_failures does not, because the counter behind it is not a bucket. See "Rate limits" and "Repeated authorization failures" above.

On POST /orders a rate_limited may also carry details.reason = bulk_volume_cap: not requests per minute but energy per window — a mode c order whose volumes would take your account past the bulk allowance. details carries cap_units (the allowance), spent_units (your volume already inside the window), requested_units (what this order asked for) and window_s (the width of the window, 3600). Retry-After is the first instant at which this body can be accepted: enough of your counted volume has to leave the window to make room for requested_units, which is not in general the moment the oldest position leaves — one departure frees only that position's units. An order whose own volume is larger than the whole allowance is not answered here at all: no waiting would help it, and it is 400 invalid_request with details.reason = bulk_order_over_cap. It is a pace limit like the others, so it is the same code: the order is not wrong, and the same body sent later is accepted. It carries no RateLimit-* headers: those describe a bucket of requests per minute, and this allowance is energy per hour — details above is its whole state.

Content type application/json.

Schema: Error.

HeaderTypeDescription
Retry-Afterinteger

Seconds to wait before retrying.

RateLimit-Limitinteger

Requests per minute in this bucket — per UTC day on POST /sandbox/deposit, the one allowance in this API that is not counted per minute. Absent in exactly three cases, and in none is a number invented for it: the limiter could not read the bucket state (the request is let through then), the answer is too_many_auth_failures, which is counted by the authorization-failure counter and not by a bucket — see "Repeated authorization failures" — or it is the volume allowance (details.reason = bulk_volume_cap), which is energy per hour rather than requests per minute.

RateLimit-Remaininginteger

Requests left in this bucket right now.

RateLimit-Resetinteger

Seconds until the bucket is full again.

500

This deployment does not carry the contract file — a packaging defect on our side, not something a retry fixes. The document is still on the documentation site.

Content type application/json.

Schema: Error.