TRON energy API

Five requests take you from a price to a delegated order: estimate, quote, order, poll, webhook. Every request is HMAC-signed, every order carries your own idempotency key, and the contract is published as OpenAPI rather than described in prose.

Base URL https://api.tenergy.me/v1 on mainnet and https://api-nile.tenergy.me/v1 on Nile, with separate keys, a separate account and a separate ledger.

  • OpenAPI
  • HMAC
  • Webhooks
  • TS SDK
  • Nile testnet

Estimate an order — no key needed

curl -sG https://api-nile.tenergy.me/v1/estimate \
  -d resource=energy -d amount=65000 -d tier=1h
const query = new URLSearchParams({ resource: "energy", amount: "65000", tier: "1h" });
const res = await fetch(`https://api-nile.tenergy.me/v1/estimate?${query}`);
const estimate = await res.json();

// integers in SUN: 1 TRX = 1,000,000 SUN
console.log(estimate.price_sun_per_unit, "SUN per energy");
console.log(estimate.total_amount_sun / 1e6, "TRX for 65,000 energy, 1 hour");
import json, urllib.parse, urllib.request

query = urllib.parse.urlencode({"resource": "energy", "amount": 65000, "tier": "1h"})
with urllib.request.urlopen(f"https://api-nile.tenergy.me/v1/estimate?{query}") as res:
    estimate = json.load(res)

# integers in SUN: 1 TRX = 1,000,000 SUN
print(estimate["price_sun_per_unit"], "SUN per energy")
print(estimate["total_amount_sun"] / 1e6, "TRX for 65,000 energy, 1 hour")
Sends this request to api.tenergy.me. Public, no key.
Press Run to see the live answer.

Four ways to buy

Same energy, same delegation on chain — the route depends on who is buying and how often.

RouteWhat it needsTime to first orderPrice
Direct transferNone — send TRX to a published addressSeconds3.00 TRX per 65,000 energy, flat
Dashboard quick buyAddress challenge, then a depositUnder two minutesThe published grid
REST APIAn API key and a funded balanceOne requestThe published grid
MCP server / agentThe same API keyOne tool callThe published grid

SDKs and compatibility shims

TypeScript SDK @tenergy/sdk

One typed method per operation, generated from the contract.

  • Signs every request with a fresh timestamp, retries included
  • Retries GET and DELETE only; a create is sent once
  • waitForOrder and webhook verification built in

Not on npm yet — until it is, the signing helper in the quickstart does the same in cURL, TypeScript or Python.

Five lines to your first order

TypeScript
import { TenergyClient } from "@tenergy/sdk";

const tenergy = new TenergyClient({
  baseUrl: "https://api-nile.tenergy.me/v1",
  apiKey: process.env.TENERGY_KEY!,
  apiSecret: process.env.TENERGY_SECRET!,
});

const quote = await tenergy.createQuote({
  resource: "energy", amount: 65_000, tier: "1h", receiver,
});
const order = await tenergy.createOrder({
  quote_id: quote.id, client_order_id: `payout-${invoiceId}`,
});
const done = await tenergy.waitForOrder(order.id);
if (done.partial) await reconcile(done.delivered_amount, done.refunded_amount_sun);
PackageShapeMigration guide
@tenergy/sdkNative, typed, generated from the contractSDK guide
@tenergy/catfee-compatCatFee-shaped client and webhooks/compare/catfee
@tenergy/netts-compatNetts-shaped orders and orchestrator/compare/netts
@tenergy/feesaver-compatFeeSaver-shaped buyEnergy and status/compare/feesaver
@tenergy/tronzap-compatDrop-in for tronzap-sdk/compare/tronzap

The compatibility shims are not published yet; each migration guide maps the endpoints one by one today.

Docs you can read in any order

Three columns, search on Ctrl K, code in cURL, TypeScript and Python, the reference generated from the contract — and every page as markdown at its own path plus .md.

Open the docs →
The quickstart page of the TEnergy docs: navigation on the left, code tabs in the middle, the page outline on the right

Machine-readable

DocumentWhat it is for
/openapi.yamlThe contract. Generate a client from it; it wins every divergence with prose.
/llms.txtA curated map for an agent: what to read, in the order that gets it to a purchase.
/llms-full.txtThe whole corpus as one markdown file, for agents that prefer one fetch to twenty.
/.well-known/quickstart.jsonThe purchase flow as JSON: endpoints, auth, units, which steps need a human.
/docs/agent-quickstartThe operator prompt to paste into your own agent, with a copy button.
/docs/quickstart.mdEvery docs page as markdown: add .md to its path.

FAQ

How is a request authenticated?

Three headers: X-API-KEY, X-API-TIMESTAMP and X-API-SIGN, where the signature is base64(HMAC-SHA256(secret, timestamp + method + path + query + body)). The clock tolerance is five seconds.

Which permissions does a new key get?

Exactly the ones you choose. scopes is required, there is no default set and no preselected checkbox anywhere — in the contract, the dashboard or the agent flow.

Polling or webhooks?

Webhooks where you have a public HTTPS endpoint: we sign them and you verify. Polling GET /v1/orders/{id} is documented as the supported fallback, because many agent runtimes have no public URL.