v2 — Extend with API Key
Full working example showing how to extend an existing TronSave order using an API Key, in JavaScript, PHP, and Python.
This is a complete, runnable example for extending an existing order on TronSave using an API Key. It calls the v2 extend endpoints in two steps: first it estimates which delegates are extendable and how much TRX it will cost, then it submits the extend request and returns an orderId.
Prerequisites
You need a TronSave API Key tied to an Internal Account. There are two ways to obtain one:
Option 1: Generate the API Key on the TronSave website.
Option 2: Generate the API Key on Telegram.
See Authentication for both methods and details on how the API Key authorizes requests against your Internal Account.
How it works
The flow uses two endpoints:
/v2/get-extendable-delegates— returns theextendDatapayload, the estimated TRX cost, and whether the extension is possible./v2/extend-request— submits theextendDataand returns anorderId.
Set these variables before running:
API_KEY
Your TronSave API Key.
RECEIVER
The address that receives the resource delegate.
RESOURCE_TYPE
ENERGY or BANDWIDTH. Optional; defaults to ENERGY.
extendTo
The time, in seconds (Unix timestamp), you want to extend the delegation to.
maxPriceAccepted
Optional. The maximum price (in SUN) you are willing to pay to extend.
Full example
Next steps
Get Extendable Delegates — full reference for step 1.
Submit Extend Request — full reference for step 2.
Authentication — how to obtain and use an API Key.
Last updated