# Estimate Contract Interaction Gas Limit EVM

This endpoint helps customer in estimating the Contract Interaction Gas Limit needed for a transaction. It gives information for gas expenses for a specific contract when calling a specific function.

- **Endpoint:** `POST https://rest.cryptoapis.io/blockchain-fees/evm/{blockchain}/{network}/estimate-contract-interaction-gas-limit`
- **Authentication:** `x-api-key` header
- **Credits cost:** 40 credits for 1 result by default; per blockchain: Ethereum: 40, Ethereum Classic: 52, Binance Smart Chain: 100, Polygon: 80, Arbitrum: 64, Avalanche: 72, Base: 48, Optimism: 56, Tron: 60
- **Documentation page:** https://developers.cryptoapis.io/v-2.2024-12-12-175/RESTapis/blockchain-fees-evm/estimate-contract-interaction-gas-limit-evm/post

## Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `blockchain` | string | yes | Represents the specific blockchain protocol name, e.g. Arbitrum. Allowed values: `arbitrum`, `avalanche`, `base`, `optimism`, `polygon`, `tron`. |
| `network` | string | yes | Represents the name of the blockchain network used; blockchain networks are usually identical as technology and software, but they differ in data, e.g. - "mainnet" is the live network with actual data while network like "testnet" is a test network. Allowed values: `sepolia`, `mainnet`, `fuji`, `amoy`, `nile`. |

## Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `context` | string | no | In batch situations the user can use the context to correlate responses with requests. This property is present regardless of whether the response was successful or returned as an error. `context` is specified by the user. |

## Request body (application/json)

```json
{
  "context": "yourExampleString",
  "data": {
    "item": {
      "amount": "0.12",
      "inputData": "0x70a0823100000000000000000000000066a9893cc07d91d95644aedd05d03f95e1dba8af",
      "recipient": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
      "sender": "0x4337006f33e2940FcbEbD899bF2396117E65dF9B"
    }
  }
}
```

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `context` | string | no | In batch situations the user can use the context to correlate responses with requests. This property is present regardless of whether the response was successful or returned as an error. `context` is specified by the user. |
| `data` | object | yes |  |
| `data.item` | object | yes |  |
| `data.item.amount` | string | yes | Represents transactions' amount. Should be 0 for non-payable functions. |
| `data.item.inputData` | string | yes | ABI encoded value hex value of function name and parameters, e.g. "balanceOf(0x66a9893cc07d91d95644aedd05d03f95e1dba8af)" should be represented as "0x70a0823100000000000000000000000066a9893cc07d91d95644aedd05d03f95e1dba8af" |
| `data.item.recipient` | string | yes | Represents the address which receives this transaction. |
| `data.item.sender` | string | yes | Represents the address which sends this transaction. |

## Responses

| Status | Description |
| --- | --- |
| 200 | The request has been successful. |
| 400 | 400 |
| 401 | 401 |
| 402 | 402 |
| 403 | 403 |
| 409 | The data provided seems to be invalid. |
| 415 | The selected Media Type is unavailable. The Content-Type header should be 'application/json'. |
| 422 | Your request body for POST requests must have a structure of { data: { item: [...properties] } } |
| 429 | The request limit has been reached. There can be maximum {requests} requests per {seconds} second(s) made. Please contact our team via email if you need more or upgrade your plan. |
| 500 | An unexpected server error has occurred, we are working to fix this. Please try again later and in case it occurs again please report it to our team via email. |

### Example 200 response

```json
{
  "apiVersion": "2024-12-12",
  "requestId": "601c1710034ed6d407996b30",
  "context": "yourExampleString",
  "data": {
    "item": {
      "gasLimit": 550000
    }
  }
}
```

### 200 response fields

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `apiVersion` | string | yes | Specifies the version of the API that incorporates this endpoint. |
| `requestId` | string | yes | Defines the ID of the request. The `requestId` is generated by Crypto APIs and it's unique for every request. |
| `context` | string | no | In batch situations the user can use the context to correlate responses with requests. This property is present regardless of whether the response was successful or returned as an error. `context` is specified by the user. |
| `data` | object | yes |  |
| `data.item` | object | yes |  |
| `data.item.gasLimit` | integer | yes | Represents the amount of gas used by this specific transaction alone. |
