Create Order

Submit a signed TRON transaction to create a resource order — Step 3 of the signed-transaction buy flow.

Finalize a resource purchase by submitting a signed TRON transaction. This is the final step of the signed-transaction flow: after you estimate the TRX required and obtain a signed transaction, call this endpoint to place the order.

POST https://api.tronsave.io/v2/buy-resource

Rate limit: 15 requests per 1 second.

Headers

Header
Value

Content-Type

application/json

Request body

Field
Type
Description

resourceType

String

"ENERGY" or "BANDWIDTH", default: ENERGY

unitPrice

Number

The price unit is equal to SUN.

resourceAmount *

Number

The number of resources.

receiver *

String

Resource receiving address

durationSec

Number

The duration of the bought resource, time unit, is in seconds. Default 259200 (3 days)

sponsor

String

sponsor code

signedTx

SignedTransaction

Signed transaction, note that it is a JSON object (the signed_tx produced in Step 2)

options

Object

optional

options.allowPartialFill

Boolean

Allow the order to be filled partially or not

options.onlyCreateWhenFulfilled

Boolean

[true] => order only creates when it can be fulfilled

[false] => order will create even if it can not be fulfilled

Default value: false

options.maxPriceAccepted

Number

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

options.preventDuplicateIncompleteOrders

Boolean

[true] => Only create if no uncompleted order with the same parameters exists.

[false] => Always create a new order, regardless of existing unfinished ones.

Default value: false

options.minResourceDelegateRequiredAmount

Number

The minimum resource amount delegated by a single provider.

* Required field.

Request body example

Response

Success

Errors

This endpoint authenticates through the signedTx, so it does not return a 401/API-key error. Invalid or missing input is rejected with a 400 schema-validation error before the order is created.

400 Bad Request — a required field is missing or invalid. The message names of the offending property (here, receiver):

The order may also fail with a business-logic error returned in the success envelope (error: true). For example, when the order cannot be fulfilled, or the account balance is insufficient:

Request examples

Replace YOUR_API_KEY and YOUR_TRON_ADDRESS where applicable. The signedTx object below is abbreviated — pass the full signed transaction obtained in Step 2.

Next steps

Last updated