Buy — API Key

Legacy v0 REST endpoints for buying Energy with an API key — account info, order book, TRX estimate, create order, order details, order history, and wallet activation.

All endpoints on this page authenticate with an API key sent in the apikey header. The key is tied to your TronSave internal account, and orders are paid from that account's balance. See Authentication to get a key.

Base URL (mainnet): https://api.tronsave.io

TRON Nile Testnet: replace the base URL with https://api-dev.tronsave.io.

  • Estimate TRX: POST https://api-dev.tronsave.io/v0/estimate-trx

  • Create order: POST https://api-dev.tronsave.io/v0/internal-buy-energy

  • Get Internal Account Info: GET https://api-dev.tronsave.io/v0/user-info

  • Get Internal Account Order History: GET https://api-dev.tronsave.io/v0/orders

  • Get one order details: GET https://api-dev.tronsave.io/v0/order/:id

  • Get Order Book: GET https://api-dev.tronsave.io/v0/order-book

Every endpoint below is rate limited to 15 requests per 1 second.


Get Internal Account Info

Get account info by API key.

GET https://api.tronsave.io/v0/user-info

Rate limit: 15 requests per 1 second.

Headers

Name
Type
Description

apikey*

String

TronSave API key that represents your internal account.

* Required.

Response

Field
Type
Description

id

string

Internal account id.

balance

string

Internal account balance in SUN.

represent_address

string

Represents the internal account as the requester of the order.

deposit_address

string

Deposit address of the internal account.

Request examples


Get Order Book

Get the order book by API key.

GET https://api.tronsave.io/v0/order-book

Rate limit: 15 requests per 1 second.

Headers

Name
Type
Description

apikey*

String

TronSave API key that represents your internal account.

* Required.

Query parameters

Name
Type
Description

address

string

Energy receiver address.

min_delegate_amount

number

The minimum amount of Energy delegated from one provider.

duration_sec

number

Order duration in seconds.

Response

Request examples


Estimate TRX

Estimate the TRX cost for a purchase before creating the order.

POST https://api.tronsave.io/v0/estimate-trx

Rate limit: 15 requests per 1 second.

Headers

Name
Type
Description

apikey*

String

TronSave API key that represents your internal account.

* Required.

Request body

Field
Position
Type
Required
Description

amount

body

number

true

The number of resources.

buy_energy_type

body

string, number

true

"FAST", "MEDIUM", "SLOW", or a number:

- FAST: If the market is ready to fill = 100%, FAST = MEDIUM. If the market is ready to fill < 100%, FAST = MEDIUM + 10. If market ready to fill = 0%, FAST = SLOW + 20.

- MEDIUM: The lowest price for the maximum market fill for this order. If market ready to fill = 0%, MEDIUM = SLOW + 10.

- SLOW: The lowest price that can be set for this order.

- If the price is a number, the price unit is SUN.

duration_millisec

body

number

true

The duration of the bought resource, in milliseconds.

request_address

body

string

false

The address of the requester.

target_address

body

string

false

The address of the resource receiver.

is_partial

body

boolean

false

Allow the order to be filled partially or not.

Request body example

Response

Field
Type
Required
Description

unit_price

number

true

Price in SUN of Energy that fits your buy_energy_type.

duration_millisec

number

true

Duration in milliseconds.

available_energy

number

true

Total available Energy on the TronSave market that matches unit_price.

estimate_trx

number

true

Estimated total TRX value to pay for all available_energy at unit_price over duration_millisec.

Request examples


Buy Energy (Create Order)

Create a new buy Energy order by API key. The order is paid from your internal account balance.

POST https://api.tronsave.io/v0/internal-buy-energy

Rate limit: 15 requests per 1 second.

Headers

Name
Type
Description

apikey*

String

TronSave API key that represents your internal account.

* Required.

Request body

Name
Type
Description

resource_type*

String

"ENERGY".

buy_energy_type*

String

- FAST: If the market is ready to fill = 100%, FAST = MEDIUM. If the market is ready to fill < 100%, FAST = MEDIUM + 10. If market ready to fill = 0%, FAST = SLOW + 20.

- MEDIUM: The lowest price for the maximum market fill for this order. If market ready to fill = 0%, MEDIUM = SLOW + 10.

- SLOW: The lowest price that can be set for this order.

- If the price is a number, the price unit is SUN.

amount*

Number

Amount of resource to buy.

allow_partial_fill*

Boolean

If true, the order can be filled from many delegators, making it easier to fill than when false. Amounts greater than 200k Energy can set this parameter.

target_address*

String

The address that receives the resource.

duration_millisec

Number

Order duration in milliseconds. Default: 259200000 (3 days).

sponsor

String

Sponsor code.

only_create_when_fulfilled

Boolean

true => order only creates when it can be fulfilled.

false => order will create even if it cannot be fulfilled.

Default value: false.

max_price_accepted

Number

Only create an order when the estimated price is less than this value.

add_order_incomplete

Boolean

true => order only creates when there is no incomplete order with the same parameters in the order list.

false => order will create even when there is no incomplete order with the same parameters in the order list.

Default value: false.

* Required.

Request body example

Responses

Returns the order id on success.

Request examples


Get One Order Details

Get the details of one order by API key.

GET https://api.tronsave.io/v0/order/:id

Rate limit: 15 requests per 1 second.

Headers

Name
Type
Description

apikey*

String

TronSave API key that represents your internal account.

* Required.

Response

The canonical path for this endpoint is GET https://api.tronsave.io/v0/order/:id, where :id is the order id. Pass the id as a path segment (not a query parameter). All examples below use this path.

Request examples


Get Internal Account Order History

Get many orders sorted by creation time. Default: returns the 10 newest orders.

GET https://api.tronsave.io/v0/orders

Rate limit: 15 requests per 1 second.

Headers

Name
Type
Description

apikey*

String

TronSave API key that represents your internal account.

* Required.

Query parameters

Name
Type
Description

page

Integer

Starts from 0. Default: 0.

pageSize

Integer

Default: 10.

Response

Request examples


Activate Wallet Address

Before activating any wallet address, you must first check its current activation status. Only addresses with status 0 (Inactive) should be submitted for activation.

Step 1 — Check Active Status

Check the activation status of one or more TRON wallet addresses.

POST https://api.tronsave.io/v0/helper/is-active-address-check

Request body

Field
Type
Required
Description

addresses

array<string>

true

List of TRON wallet addresses to check.

Response

Returns an integer array where each value corresponds to the address at the same index in the request.

Value
Status
Description
Action

0

Inactive

The address exists but has never been activated.

Proceed to Step 2 to activate.

1

Contract

The address is a smart contract.

Skip — activation is not applicable.

2

Active

The address is already activated.

Skip — no action needed.

3

Fetch failed

Could not retrieve the status from the network.

Retry later or check connectivity.

4

Invalid address

The address format is not valid.

Verify and correct the address.

Filter the result array and collect all addresses where the corresponding status value equals 0. Those addresses are used in Step 2.

Example

Step 2 — Activate Wallets

Submit a batch of inactive addresses for activation. This endpoint creates activation requests for each address provided.

Fee: Each activation costs 1.5 TRX per address. Ensure your account has a sufficient balance before calling this endpoint.

POST https://api.tronsave.io/v0/helper/multi-active-address

Headers

Name
Type
Description

apikey*

String

TronSave API key that represents your internal account.

* Required.

Request body

Only include addresses with status 0 from Step 1.

Field
Type
Required
Description

addresses

array<string>

true

List of not-active TRON addresses to activate.

Response

Field
Type
Description

message

string

Confirmation message indicating how many activation requests were created.

Request examples

Next steps

Last updated