Convert
On this page, we’ll dive into the different convert asset endpoints you can use to manage convert asset transactions programmatically. You can convert your crypto balance into fiat assets.
The convert model
The convert model is the data structure that represents a convert asset transaction in Rampable. The following attributes are associated with the convert model:
Properties
- Name
 convertId- Type
 - string
 - Description
 Unique identifier for the convert transaction.
- Name
 userId- Type
 - string
 - Description
 Unique identifier for the user making the convert.
- Name
 input- Type
 - object
 - Description
 Details of the input asset.
- Name
 input.assetType- Type
 - string
 - Description
 The type of asset (e.g., fiat or crypto).
- Name
 input.currency- Type
 - string
 - Description
 The currency used for the input asset (e.g., usdt-tron).
- Name
 input.amount- Type
 - float
 - Description
 The initial amount of the convert in the input currency.
- Name
 input.amountMinusFee- Type
 - float
 - Description
 The final amount after deducting the fee of the convert in the input currency.
- Name
 output- Type
 - object
 - Description
 Details of the output asset.
- Name
 output.assetType- Type
 - string
 - Description
 The type of asset (e.g., fiat or crypto).
- Name
 output.currency- Type
 - string
 - Description
 The currency used for the output asset (e.g., IDR).
- Name
 output.amount- Type
 - float
 - Description
 The initial amount of the convert in the output currency.
- Name
 output.amountMinusFee- Type
 - float
 - Description
 The final amount after deducting the fee of the convert in the output currency.
- Name
 exchangeRate- Type
 - float
 - Description
 The exchange rate applied to the convert.
- Name
 createdAt- Type
 - string
 - Description
 Timestamp when the convert was created.
- Name
 updatedAt- Type
 - string
 - Description
 Timestamp when the convert was last updated.
Estimate Asset Conversion
This endpoint is used to estimate the conversion from an input currency to an output currency. It provides an estimated amount that will be received after the conversion, taking into account the current exchange rate and any applicable fees.
Query Params attributes
- Name
 inputCurrency- Type
 - string
 - Description
 The crypto currency input of the convert.
- Name
 inputAmount- Type
 - float
 - Description
 The amount of the convert in the input currency. This is required if
outputAmountis not provided.
- Name
 outputCurrency- Type
 - string
 - Description
 The fiat currency output of the convert.
- Name
 outputAmount- Type
 - float
 - Description
 The amount of the convert in the output currency. This is required if
inputAmountis not provided.
Request
curl -X GET "https://staging.rampable.co/v1/convert/estimate?inputCurrency=usdt-tron&inputAmount=100&outputCurrency=IDR" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
Response
{
      "statusCode": 200,
      "message": "Convert estimation success",
      "data": {
        "input": {
            "currency": "usdt-tron",
            "type": "crypto",
            "amount": 100
        },
        "output": {
            "currency": "IDR",
            "type": "fiat"
        },
          "estimate": {
              "rate": {
                "crypto": 0.00006073043654,
                "fiat": 16466.208,
              },
              "convertedAmount": 1646620.8,
              "fee": 5000,
              "totalConvertedAmount": 1641620.8
          }
        }
  }
Asset Conversion
This endpoint is used to convert an input amount of cryptocurrency to a fiat output currency. It requires specifying the input currency, input amount, and the desired output currency. The endpoint will process the conversion based on the current exchange rate and applicable fees, and return the converted amount in the output currency.
Ensure the input.currency and output.currency is a valid asset currency code and input.amount or output.amount is a positive number.
Required attributes
- Name
 input- Type
 - object
 - Description
 The input details of the convert transaction.
- Name
 input.currency- Type
 - string
 - Description
 The crypto currency of the input (e.g., usdt-tron).
- Name
 input.amount- Type
 - float
 - Description
 The amount of the input. This is required if
output.amountis not provided.
- Name
 output- Type
 - object
 - Description
 The output details of the convert transaction.
- Name
 output.currency- Type
 - string
 - Description
 The crypto currency of the output (e.g., IDR).
- Name
 output.amount- Type
 - float
 - Description
 The amount of the output. This is required if
input.amountis not provided.
Request
curl --location \
https://staging.rampable.co/v1/convert \
--header 'x-client-secret: ••••••' \
--header 'Content-Type: application/json' \
--header 'Authorization: ••••••' \
--data '{
    "input": {
        "currency" : "usdt-tron",
        "amount": 100
    },
    "output": {
        "currency" : "IDR"
    }
}'
Response
{
  "statusCode": 200,
  "message": "Conversion executed successfully",
  "data": {
    "input": {
        "currency": "usdt-tron",
        "type": "crypto",
        "amount": 100
    },
    "output": {
        "currency": "IDR",
        "type": "fiat"
    },
    "result": {
        "rate": {
          "crypto": 0.00006073043654,
          "fiat": 16466.208,
        },
        "convertedAmount": 1646620.8,
        "fee": 5000,
        "totalConvertedAmount": 1641620.8
    }
  }
}
HTTP Status 400 Example
Error Response
{
    "statusCode": 400,
    "error": "Not Found",
    "message": "insufficient input balance"
}