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
Header | Value | Required | Description |
---|---|---|---|
Content-Type | application/json | Yes | Specifies that the request body is JSON formatted. |
x-api-key | API_KEY_HERE | Yes | Bearer token for authorization. See note below. |
Request Body
{
"amount": 5000,
"symbol": "POL", //must have existing wallet
"blockChain": "MATIC", //must have existing wallet
"recipient": { // for crypto to crypto transaction
"address": "0xa0b86991c6218b36c1d19d4a2exxxxxxxxxxxxxxxxx"
}
}
Source Fields
Field | Type | Description |
---|---|---|
amount | number | Amount of cryptocurrency to transfer. |
symbol | string | Currency symbol (e.g., POL). |
blockChain | string | Type of source asset. |
Recipient Fields
Field | Type | Description |
---|---|---|
recipient.address | string | Wallet 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
Field | Type | Description |
---|---|---|
message | string | Description of the request result. |
status | string | Status of the request (success or error ). |
data | object | Contains the estimated gas fee levels. |
data.feeLevel | array | List of available gas fee levels. |
data.feeLevel[].type | string | Fee priority level (LOW , MEDIUM , HIGH ). |
data.feeLevel[].fee | object | Fee amount data for the given level. |
data.feeLevel[].fee.network | object | Fee details from the network perspective. |
data.feeLevel[].fee.network.name | string | Name of the network (e.g., "Polygon"). |
data.feeLevel[].fee.network.blockchain | string | Name of the blockchain (e.g., "MATIC"). |
data.feeLevel[].fee.network.amount | number | Estimated fee amount in the network. |
data.feeLevel[].fee.cryptoCurrency | object | Fee details from the cryptocurrency perspective. |
data.feeLevel[].fee.cryptoCurrency.name | string | Name of the cryptocurrency (e.g., "Polygon"). |
data.feeLevel[].fee.cryptoCurrency.symbol | string | Symbol of the cryptocurrency (e.g., "POL"). |
data.feeLevel[].fee.cryptoCurrency.amount | number | Estimated fee amount in the cryptocurrency. |
Error
HTTP Status Code | Error Code | Message | Description |
---|---|---|---|
400 | INVALID_REQUEST | Invalid request payload. | The request body is malformed or missing required fields. |
401 | UNAUTHORIZED | Unauthorized access. | The Authorization or x-api-key header is missing or invalid. |
403 | FORBIDDEN | Access denied. | You do not have permission to access this resource. |
404 | RECIPIENT_NOT_FOUND | Recipient address not found or invalid. | The provided recipient wallet address is invalid or not recognized. |
422 | UNSUPPORTED_NETWORK | Unsupported network or currency. | The given source network or currency is not supported for gas estimation. |
500 | INTERNAL_ERROR | Internal server error. | An unexpected error occurred on the server side. |