Converter

Endpoint specification

The converter endpoint allows you to receive information on a transaction without going through the execution flow. You can use the response to display the exact amount before opening the widget. Additionally, the amount from response can be passed into the widget.


EnvironmentURLMethod
Sandboxhttps://sandbox.wert.io/api/v3/partners/convertPOST
Productionhttps://widget.wert.io/api/v3/partners/convertPOST

Headers:

'X-Partner-ID: YOUR_PARTNER_ID' //string, required
'Content-Type: application/json'

Rate limit

To ensure API stability and fair usage, we implement a rate limit on all conversion requests. If you exceed these limits, the API will return a 429 Too Many Requests error.


Limits and Constraints

  • Threshold: 1 request per 250 ms per IP address.
  • Throughput: Approximately 4 requests per second.
  • Lockout Period: Any request sent within 250 ms of the previous request from the same IP will return 429 - Too Many Requests error.

🚧

Recommendation: To prevent users from hitting these limits, we recommend implementing the conversion logic or a request-throttler directly in your frontend.


Parameters

The following properties are used when making a request:

🚧

Only USD is available in sandbox.

PropertyRequiredTypeDescription
fromyesstringBase asset ( Fiat or Crypto). Refer to Supported coins and blockchains
networkyesstringBase asset network. Refer to Supported coins and blockchains
toyesstringQuote asset ( Fiat or Crypto). Refer to Supported coins and blockchains
amountyesnumericalBase asset amount
partner_datarequired for smart contractobjectPartner data object
sc_addressrequired for smart contractstringThe address of your smart contract
sc_input_datarequired for smart contractstringInput data that will be used for the smart contract execution in hex format
signaturerequired for smart contractstringA digital signature used to encrypt the request to ensure you have sent it

Sample request for a crypto transaction

curl -X POST \
--url 'https://sandbox.wert.io/api/v3/partners/convert' \
-H 'Content-Type: application/json' \
-H 'X-Partner-ID: your-partner-id' \
-d '{
    "from": "ETH",
    "network": "sepolia",
    "to": "USD",
    "amount": 0.05
    }'

Sample request for a smart contract transaction

curl -X POST \
--url 'https://sandbox.wert.io/api/v3/partners/convert' \
-H 'Content-Type: application/json' \
-H 'X-Partner-ID: your-partner-id' \
-d '{
    "from": "ETH",
    "network": "sepolia",
    "to": "USD",
    "amount": 0.05,
    "partner_data": {
      "sc_address": "0xC545CEae428785a5AE77bfF262600deC7F7d76d2",
      "sc_input_data": "0x9dae76ea000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000",
      "signature": "d035046e8eda9b2c9c4413bfd31ed42b7df056108c83110aa8ae70f9ca167e1a2047d1b906afa66a770939dd074d1eff27b029ec2c27b39dc30a076e31221209"
    }
}'

Response

The endpoint will return the following information:

Parameter

Description

ticker

The rate at which cryptocurrency is being sold.

fee_percent

% fee taken by the service.

currency_amount

The final amount in fiat that the user will pay.

fee_amount

Amount paid in fiat to cover the service fee.

commodity_amount

The amount of cryptocurrency that the user will receive.

purchase_amount

The amount of fiat that will be used to purchase cryptocurrency
( purchase_amount = currency_amount - fee_amount - currency_miner_fee)

miner_fee

The amount of crypto that will be used to cover blockchain fees.

currency_miner_fee

Price of miner fee in fiat (currency_miner_fee = miner_feeticker).


Sample responses

{
    "status": "ok",
    "body": {
        "ticker": 2672.540034535,
        "fee_percent": 0.05,
        "currency_amount": 144.3,
        "fee_amount": 6.87,
        "commodity_amount": 0.05,
        "purchase_amount": 137.43,
        "miner_fee": 0.00142144,
        "currency_miner_fee": 3.8
    }
}
{
    "status": "error",
    "error_description": "amount: must be no less than 0.",
    "request_id": "string"
}

{
    "status": "error",
    "error_description": "amount is too low",
    "request_id": "string"
}

{
    "status": "error",
    "error_description": "from: cannot be blank; to: cannot be blank.",
    "request_id": "string"
}

{
    "code": 1302,
    "status": "error",
    "error_description": "unknown commodity",
    "request_id": "424f8c727a9b2664f2de61c16b5cf169"
}

{
    "code": 1301,
    "status": "error",
    "error_description": "commodity is disabled",
    "request_id": "83c4bbaa60198284846fd77e0bb72293"
}

{
    "code": 1013,
    "status": "error",
    "error_description": "unknown currency",
    "request_id": "701f7153101206e1e2ef871aa539f40b"
}

{
    "code": 9001,
    "status": "error",
    "error_description": "the partner doesn't exist",
    "request_id": "76fec9b0ba9fda16c68a4ca2d038186d"
}


Documentation related to this page