> ## Documentation Index
> Fetch the complete documentation index at: https://developer.me-cash.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Gas Fee

> Estimates the blockchain network gas fee for a crypto transfer.

<Warning>
  🚧 **The Ramp API is currently under construction.** Endpoints and features described here are subject to change. Do not use in production until this notice is removed.
</Warning>

## 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          | API key for authorization. See note below.         |

***

## Request Body

<CodeGroup>
  ```bash cURL theme={null}
  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"
      }
  }'
  ```

  ```js JavaScript (fetch) theme={null}
  const feeDetails = {
    amount: 5000,
    symbol: "POL",
    blockChain: "MATIC",
    recipient: {
      address: "0xa0b86991c6218b36c1d19d4a2exxxxxxxxxxxxxxxxx"
    }
  };

  fetch('{{baseURL}}/v1/ramp/gasFee', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'x-api-key': 'API_KEY_HERE'
    },
    body: JSON.stringify(feeDetails)
  })
  .then(res => res.json())
  .then(console.log)
  .catch(console.error);
  ```

  ```python Python (requests) theme={null}
  import requests

  url = "{{baseURL}}/v1/ramp/gasFee"

  payload = {
      "amount": 5000,
      "symbol": "POL",
      "blockChain": "MATIC",
      "recipient": {
          "address": "0xa0b86991c6218b36c1d19d4a2exxxxxxxxxxxxxxxxx"
      }
  }

  headers = {
      "x-api-key": "API_KEY_HERE",
      "Content-Type": "application/json"
  }

  response = requests.post(url, json=payload, headers=headers)
  print(response.json())
  ```

  ```js Node.js (axios) theme={null}
  const axios = require('axios');

  const feeDetails = {
    amount: 5000,
    symbol: "POL",
    blockChain: "MATIC",
    recipient: {
      address: "0xa0b86991c6218b36c1d19d4a2exxxxxxxxxxxxxxxxx"
    }
  };

  axios.post('{{baseURL}}/v1/ramp/gasFee', feeDetails, {
    headers: {
      'x-api-key': 'API_KEY_HERE',
      'Content-Type': 'application/json'
    }
  }).then(response => {
    console.log(response.data);
  }).catch(error => {
    console.error(error.response.data);
  });
  ```
</CodeGroup>

## Request Breakdown

### 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)

```json theme={null}
{
  "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.                          |


## OpenAPI

````yaml post /v1/ramp/gasFee
openapi: 3.0.3
info:
  title: meCash API
  version: 3.0.3
  description: >-
    API for meCash services, including FIAT and Ramp operations. This is the
    OpenAPI specification for the meCash API, covering all available endpoints
    for wallet management, currency quotes, and payouts.


    It follows a design-first approach based on OpenAPI 3.0.


    Authentication is handled via an API key passed in the `x-api-key` header.
    Replace `YOUR_API_KEY` with your actual key when making requests.


    Some useful links:

    - [meCash Documentation](https://docs.me-cash.com/)

    - [Authentication Guide](https://docs.me-cash.com/authentication)
servers:
  - url: https://sandboxapi.me-cash.com
    description: Sandbox Server for Testing
security:
  - ApiKeyAuth: []
tags:
  - name: Wallet
    description: Wallet management operations
  - name: Quote
    description: Currency quote operations
  - name: Payout
    description: Payout operations
  - name: Transaction
    description: Transaction management
  - name: Virtual Account
    description: Virtual account operations for static and dynamic accounts
  - name: Bank
    description: Bank account and list operations
  - name: Ramp
    description: Ramp operations for crypto
  - name: Miscellaneous
    description: Utility and miscellaneous operations
  - name: Collection
    description: Mobile money and wallet funding operations
  - name: Bulk Payout
    description: >-
      Bulk transfer operations for sending to multiple beneficiaries in a single
      request
paths:
  /v1/ramp/gasFee:
    post:
      tags:
        - Ramp
      summary: Generate Estimated Gas Fee
      description: Estimates the blockchain network gas fee for a crypto transfer.
      operationId: generateRampGasFee
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - amount
                - symbol
                - blockchain
                - recipient
              properties:
                amount:
                  type: number
                  example: 5
                symbol:
                  type: string
                  example: USDC
                blockchain:
                  type: string
                  example: MATIC-AMOY
                recipient:
                  type: object
                  required:
                    - address
                  properties:
                    address:
                      type: string
                      example: '0xd62acd62fdb155afaa5d12c6caf01119d413dfd9'
      responses:
        '200':
          description: Gas fee estimated successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: success
                  message:
                    type: string
                    example: gas fee estimated successfully
                  data:
                    type: object
                    properties:
                      amount:
                        type: number
                        example: 5
                      symbol:
                        type: string
                        example: USDC
                      blockchain:
                        type: string
                        example: MATIC-AMOY
                      gas:
                        type: object
                        properties:
                          LOW:
                            type: string
                            example: '0.01875321'
                          MEDIUM:
                            type: string
                            example: '0.02923792'
                          HIGH:
                            type: string
                            example: '0.03810231'
        '401':
          $ref: '#/components/responses/PayoutUnauthorized'
        '500':
          $ref: '#/components/responses/PayoutInternalServerError'
components:
  responses:
    PayoutUnauthorized:
      description: Unauthorized. The provided API key is invalid or missing.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/PayoutFailedResponse'
          example:
            message: Invalid API key
            status: failed
    PayoutInternalServerError:
      description: Internal Server Error. The server failed to process the request.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/PayoutFailedResponse'
          example:
            message: Server failed to process request.
            status: failed
  schemas:
    PayoutFailedResponse:
      type: object
      properties:
        message:
          type: string
          description: A human-readable error message.
        status:
          type: string
          example: failed
      required:
        - message
        - status
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````