# getFeeForMessage

Get the fee the network will charge for a particular message

#### Parameters required for this RPC call

* **message**: A Base-64 encoded message, for which we are getting the fees.
* **minContextSlot**: The minimum slot that the request can be evaluated at.
* **configuration** : This contains the following parameters, all are optional fields.
  * **commitment**: The commitment describes how finalized a block is at that point in time. Only <mark style="color:yellow;">confirmed</mark> and <mark style="color:yellow;">finalized</mark> are supported, defaults to <mark style="color:yellow;">finalized</mark>.
  * **encoding**: Encoding format for each returned transaction. The supported options are *json*, *jsonParsed*, <mark style="color:yellow;">base58</mark> and <mark style="color:yellow;">base64</mark>. You can know more about [Parsed responses](https://solana.com/docs/rpc#parsed-responses) more on Solana docs.

{% tabs %}
{% tab title="cURL" %}

```bash
curl https://rpc.shyft.to?api_key=YOUR-API-KEY -s -X \
  POST -H "Content-Type: application/json" -d ' 
   {
     "jsonrpc": "2.0",
     "id": 1,
     "method": "getFeeForMessage",
     "params": [
       "AQABAgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAQAA",
       {
         "commitment": "processed"
       }
     ]
   }
 '
```

{% endtab %}

{% tab title="Web3.js" %}

```javascript
import { Connection, Message, clusterApiUrl } from "@solana/web3.js";

const connection = new Connection("https://rpc.shyft.to?api_key=YOUR-API-KEY", "confirmed");
let b64Message =
  "AQABAgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAQAA";
let message = Message.from(Buffer.from(b64Message, "base64"));

let fee = await connection.getFeeForMessage(message);

console.log(fee);
```

{% endtab %}

{% tab title="Response" %}

```json
{
  "jsonrpc": "2.0",
  "result": {
    "context": { "slot": 5068 },
    "value": 5000
  },
  "id": 1
}
```

{% endtab %}
{% endtabs %}
