Preview Order
Simulates provider selection and cost calculation without placing an order. Use this to show users estimated costs before they confirm.
GET
/api/v1/orders/previewQuery parameters
resourcestringREQUIREDResource type to purchaseOne of:
ENERGYBANDWIDTHamountnumberREQUIREDAmount of resource units to purchaseMinimum 65000 for energy
durationnumberREQUIREDRental duration in seconds
max_price_sunnumberOPTIONALMaximum acceptable price per unit in SUN. Providers above this price are excluded.
TIP
Call preview before creating an order to display accurate cost estimates in your UI. The preview response matches the same provider selection logic used by POST /orders.
Request examples
curl "https://merx.exchange/api/v1/orders/preview?resource=ENERGY&amount=100000&duration=86400"Response
200Preview result
{
"best": {
"provider": "sohu",
"displayName": "Sohu Energy",
"price_sun": 32,
"cost_trx": 3.2,
"duration_sec": 86400
},
"fallbacks": [
{
"provider": "tronsave",
"displayName": "TronSave",
"price_sun": 34,
"cost_trx": 3.4,
"duration_sec": 86400
}
],
"no_providers": false
}Response fields
bestobject | nullBest matching provider, or null if none availablebest.providerstringProvider identifierbest.displayNamestringHuman-readable provider namebest.price_sunnumberPrice per unit in SUNbest.cost_trxnumberTotal cost in TRXbest.duration_secnumberMatched duration in secondsfallbacksarrayAlternative providers sorted by priceno_providersbooleanTrue when no providers can fulfill the request