nrg.market API reference Interactive reference

Tariff

Current prices. The time-of-day schedule is for reference; the commitment is the price of an order (see "Order price" above).

GET /tariff

Current tariff

Authentication: Optional — an API key in Authorization: Bearer … (authentication); the endpoint answers without one too.

The current price of every lease on sale. Public endpoint, no authorization required; rate limited by IP, since a public request carries no key.

A key is optional. Send Authorization: Bearer … and the answer is about your account: if prices were agreed for it, they are the ones in this response, and custom says so — at the top level for the five-minute product, and on each entry of products for that lease. Without agreed prices a keyed answer is the public tariff with custom: false. A keyed request is rate limited by the key rather than the IP, and its answer is never cacheable: Cache-Control: private, no-store with Vary: Authorization. An invalid key is 401 — never a silent fall-back to the public tariff, so a broken key is visible as one.

One price per product. The current price is recomputed against the market at a fixed interval of a few minutes; there is no schedule of future prices. Our only commitment to you is the price of a specific order: set when it is created, and raised at fulfillment only by the rule in "Order price" above. How the price has moved is GET /tariff/history.

The public response is cacheable for what is left of the window in which our servers hold the current price (Cache-Control: public, max-age=N). The time of day plays no part in N.

The top-level fields are the five-minute product, and they stay that way: current_price_sun, custom and typical_price_trx describe the 300-second lease exactly as they did before longer ones went on sale. Everything we sell is in products, one entry per lease on sale, ascending by duration_s — including the five-minute one, so the array reads on its own. A client that offers a choice of lease reads products; a client that only ever buys five minutes can keep reading the top level and change nothing.

products is the list POST /orders and POST /estimate accept as duration_s. It is data rather than schema: a product goes on or off sale without a release, so the array is the answer to "what can I buy right now", and an enumeration copied into your code is the same question answered on the day you copied it.

Responses

200

OK

Content type application/json.

FieldTypeRequiredDescription
current_price_sunintegerrequired

Price per unit of energy, in sun, for the five-minute lease. The same number as the 300-second entry of products; per-product prices live there.

Example: 32.

custombooleanrequired

true — for this product your agreed price is in force now; false — the public price. About the five-minute product, like every top-level field; each entry of products carries its own. Only a request with a key can see true. The terms of the agreement are not in this response or anywhere else in the API — only the prices they produce.

Example: false.

typical_price_trxobjectrequired

Approximate price of a single transfer at the current price

typical_price_trx.singleTRXrequired
typical_price_trx.doubleTRXrequired
maintenance_price_trxobjectrequired

The two rates of a single top-up under an energy maintenance rule (/auto-refill-rules). Every top-up delivers the full ~131,000 energy to the wallet, and the rate is chosen by the spend of the previous transfer: ~65,000 spent — single, ~131,000 spent — double. The very first top-up of a rule is always double.

It is not the price of a lease: a top-up is a different product than an order and has a price of its own. The price is dynamic — we keep it below retail prices for comparable products — so read it here rather than memorizing it. You are charged the price in effect at the moment the top-up is recognized.

maintenance_price_trx.singleTRXrequired
maintenance_price_trx.doubleTRXrequired
trx_usdUSD or nulloptional

Market price of one TRX in USD — reference only. Nothing in this response, and nothing we charge, is derived from it: every amount here is in TRX and every charge is made in TRX.

null means we do not know the rate at this moment; the rest of the tariff is unaffected. Do not use it to settle anything — it is a convenience for showing a price in dollars, refreshed a few times an hour.

Example: 0.337700.

productsarray of ProductTariffrequired

The leases on sale right now, ascending by duration_s, one entry each. Never empty and never without the 300-second product: the default of every request that omits a duration has to be buyable.

A duration missing from this array is a duration POST /orders and POST /estimate refuse with 400 invalid_request. GET /tariff/history is the exception — it charts a product whether or not it is on sale today, because history is about what was, not about what you can buy.

maintenance_price_trx and trx_usd stay top-level: a maintenance top-up is a different product than an order and has no lease, and the exchange rate is about TRX rather than about anything we sell.

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.

GET /tariff/history

Tariff history

Authentication: Optional — an API key in Authorization: Bearer … (authentication); the endpoint answers without one too.

Hourly history of the selling tariff — for charts. Public endpoint, no authorization required; the public response is cacheable (Cache-Control: public, max-age=300).

A key is optional, as on GET /tariff. With one, the history is your account's: an hour sold to you at prices agreed for your account carries those prices and custom: true; every other hour — before the agreement, after it ended, while autopricing was off — carries the public price and custom: false, which is what you were charged then. A keyed request is rate limited by the key, its answer is Cache-Control: private, no-store with Vary: Authorization, and an invalid key is 401.

The history is for reference: our only commitment to you is the price of a specific order (see "Order price" above). There is no forecast here — only what the service actually sold at; hours older than the recorded history show the earliest recorded price.

The response is not paginated, and its size is fixed by range alone. You get exactly one point per hour of the range and never a partial answer: 24 points for 24h, 168 for 7d, 720 for 30d. That is the whole of it — there is no cursor, no limit, and no continuation to follow. The count does not depend on how much history we have recorded and does not grow over time: a young database fills the hours it has no record for from the earliest recorded price rather than dropping them, and an old one still answers with 720 for 30d. Size your buffers for 720 points and you are sized for good; range is a closed enum, so a fourth depth could only arrive as a change to this contract.

One product per request — duration_s, the five-minute lease by default. Each product has its own price series, and mixing two of them into one chart would draw a step at every switch that no price ever made. Unlike /estimate and /orders, this accepts any of the three durations whether or not it is on sale: a product taken off sale still has a past, and a chart that goes blank the moment it does would hide exactly the period worth looking at.

Parameters

NameInRequiredTypeDescription
rangequeryoptionalstring

History depth, and the only thing that decides the size of the answer: 24h → 24 points, 7d → 168, 30d → 720.

One of: 24h, 7d, 30d. Default: 7d.

duration_squeryoptionalinteger

Which product's history to chart, in seconds. One of 300 (default), 3600 or 86400 — all three, on sale or not. Anything else is 400 invalid_request whose details carries both the refused duration_s and allowed, the accepted values.

Written as a plain integer rather than an enum for one reason only: it is the same field as on /orders and /estimate, and a client that has it typed one way there should not have to type it another way here. The set of values it takes is wider, though — that difference is the sentence above, not the schema.

Default: 300. Example: 3600.

Responses

200

OK

Content type application/json.

FieldTypeRequiredDescription
rangestringrequired

Example: 7d.

duration_sintegerrequired

The product these points belong to — the duration_s you asked for, or 300 if you asked for none. Echoed so a chart can label a series without remembering which request produced it.

Example: 300.

pointsarray of objectrequired

Hourly points, UTC, ascending by time; the last one is the start of the current hour. Values are as of t. Exactly one point per hour of range, with no gaps and no pagination — 24, 168 or 720 of them.

points[].tstring (date-time)required
points[].price_sunintegerrequired

Price per unit of energy during that hour, in sun, on the product named by duration_s — for the whole lease, as everywhere else in this contract.

Example: 32.

points[].maintenance_price_trxobjectrequired

Energy-maintenance top-up rates in effect during that hour (see the field of the same name in GET /tariff). The same two numbers whatever duration_s was asked for: a top-up has no lease, so it has no per-product history either.

points[].maintenance_price_trx.singleTRXrequired
points[].maintenance_price_trx.doubleTRXrequired
points[].custombooleanrequired

true marks an hour sold to the asking account at its agreed price, so only a request with a key can see it; false — the public price, and every hour of the public history is false.

Example: false.

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.