Skip to main content
POST
/
v1
/
ramp
/
gasFee
Generate Estimated Gas Fee
const options = {
  method: 'POST',
  headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    amount: 5,
    symbol: 'USDC',
    blockchain: 'MATIC-AMOY',
    recipient: {address: '0xd62acd62fdb155afaa5d12c6caf01119d413dfd9'}
  })
};

fetch('https://sandboxapi.me-cash.com/v1/ramp/gasFee', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
{
  "status": "success",
  "message": "gas fee estimated successfully",
  "data": {
    "amount": 5,
    "symbol": "USDC",
    "blockchain": "MATIC-AMOY",
    "gas": {
      "LOW": "0.01875321",
      "MEDIUM": "0.02923792",
      "HIGH": "0.03810231"
    }
  }
}

Generate Gas Fee

The Get Gas Fee endpoint fetches the gas fee required for a cryptocurrency transaction based on source and recipient details.

Endpoint

POST {{baseURL}}/v1/ramp/gasFee

Headers

HeaderValueRequiredDescription
Content-Typeapplication/jsonYesSpecifies that the request body is JSON formatted.
x-api-keyAPI_KEY_HEREYesAPI key for authorization. See note below.

Request Body

curl --location --request POST '{{baseURL}}/v1/ramp/gasFee' \
--header 'x-api-key: API_KEY_HERE' \
--header 'Content-Type: application/json' \
--data '{
    "amount": 5000,
    "symbol": "POL",
    "blockChain": "MATIC",
    "recipient": {
        "address": "0xa0b86991c6218b36c1d19d4a2exxxxxxxxxxxxxxxxx"
    }
}'

Request Breakdown

Source Fields

FieldTypeDescription
amountnumberAmount of cryptocurrency to transfer.
symbolstringCurrency symbol (e.g., POL).
blockChainstringType of source asset.

Recipient Fields

FieldTypeDescription
recipient.addressstringWallet address of the recipient.

Successful Response (200 OK)

{
  "message": "fetch estimated gas fee successfully",
  "status": "success",
  "data": {
    "feeLevel": [
      {
        "type": "LOW",
        "fee": {
          "network": { "name": "Polygon", "blockchain": "MATIC", "amount": 0.01909123 },
          "cryptoCurrency": { "name": "Polygon", "symbol": "POL", "amount": 0.01909123 }
        }
      },
      {
        "type": "MEDIUM",
        "fee": {
          "network": { "name": "Polygon", "blockchain": "MATIC", "amount": 0.02109588 },
          "cryptoCurrency": { "name": "Polygon", "symbol": "POL", "amount": 0.02109588 }
        }
      },
      {
        "type": "HIGH",
        "fee": {
          "network": { "name": "Polygon", "blockchain": "MATIC", "amount": 0.0373431 },
          "cryptoCurrency": { "name": "Polygon", "symbol": "POL", "amount": 0.0373431 }
        }
      }
    ]
  }
}

Response Fields

FieldTypeDescription
messagestringDescription of the request result.
statusstringStatus of the request (success or error).
dataobjectContains the estimated gas fee levels.
data.feeLevelarrayList of available gas fee levels.
data.feeLevel[].typestringFee priority level (LOW, MEDIUM, HIGH).
data.feeLevel[].feeobjectFee amount data for the given level.
data.feeLevel[].fee.networkobjectFee details from the network perspective.
data.feeLevel[].fee.network.namestringName of the network (e.g., “Polygon”).
data.feeLevel[].fee.network.blockchainstringName of the blockchain (e.g., “MATIC”).
data.feeLevel[].fee.network.amountnumberEstimated fee amount in the network.
data.feeLevel[].fee.cryptoCurrencyobjectFee details from the cryptocurrency perspective.
data.feeLevel[].fee.cryptoCurrency.namestringName of the cryptocurrency (e.g., “Polygon”).
data.feeLevel[].fee.cryptoCurrency.symbolstringSymbol of the cryptocurrency (e.g., “POL”).
data.feeLevel[].fee.cryptoCurrency.amountnumberEstimated fee amount in the cryptocurrency.

Error

HTTP Status CodeError CodeMessageDescription
400INVALID_REQUESTInvalid request payload.The request body is malformed or missing required fields.
401UNAUTHORIZEDUnauthorized access.The Authorization or x-api-key header is missing or invalid.
403FORBIDDENAccess denied.You do not have permission to access this resource.
404RECIPIENT_NOT_FOUNDRecipient address not found or invalid.The provided recipient wallet address is invalid or not recognized.
422UNSUPPORTED_NETWORKUnsupported network or currency.The given source network or currency is not supported for gas estimation.
500INTERNAL_ERRORInternal server error.An unexpected error occurred on the server side.

Authorizations

x-api-key
string
header
required

Body

application/json
amount
number
required
Example:

5

symbol
string
required
Example:

"USDC"

blockchain
string
required
Example:

"MATIC-AMOY"

recipient
object
required

Response

Gas fee estimated successfully.

status
string
Example:

"success"

message
string
Example:

"gas fee estimated successfully"

data
object