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_HEREYesBearer token for authorization. See note below.

Request Body

    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.