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/preview

Query parameters

resourcestringREQUIRED
Resource type to purchaseOne of: ENERGYBANDWIDTH
amountnumberREQUIRED
Amount of resource units to purchaseMinimum 65000 for energy
durationnumberREQUIRED
Rental duration in seconds
max_price_sunnumberOPTIONAL
Maximum 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 available
best.providerstringProvider identifier
best.displayNamestringHuman-readable provider name
best.price_sunnumberPrice per unit in SUN
best.cost_trxnumberTotal cost in TRX
best.duration_secnumberMatched duration in seconds
fallbacksarrayAlternative providers sorted by price
no_providersbooleanTrue when no providers can fulfill the request