# Create Gas Request

This creates a Gas Request using this method.

## API Specification

## Create Gas Request

<mark style="color:green;">`POST`</mark> `https://api.krypcore.com/api/v0/gasless/createGasRequest`

Creates a Gas Request under the given instance.&#x20;

#### Headers

| Name                                            | Type   | Description            |
| ----------------------------------------------- | ------ | ---------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | User Auth key obtained |

#### Request Body

| Name                                                    | Type   | Description                                                  |
| ------------------------------------------------------- | ------ | ------------------------------------------------------------ |
| protocol<mark style="color:red;">\*</mark>              | String | ChainID representing the blockchain protocol                 |
| network<mark style="color:red;">\*</mark>               | String | The blockchain network for which the gas request is intended |
| chainId<mark style="color:red;">\*</mark>               | String | ChainID representing the blockchain protocol                 |
| requestedGasLimit<mark style="color:red;">\*</mark>     | String | Requested gas limit for the transaction (in ether)           |
| additionalInformation<mark style="color:red;">\*</mark> | String | Additional information related to the gas request            |
| userId<mark style="color:red;">\*</mark>                | String | Dapp ID or user ID associated with the gas request           |
| subscriptionId<mark style="color:red;">\*</mark>        | String | Subscription ID of user                                      |

{% tabs %}
{% tab title="200: OK SUCCESS" %}

```javascript
{
    "data": null,
    "message": "Gas request created successfully",
    "status": true
}
```

{% endtab %}

{% tab title="401: Unauthorized Failure in authentication" %}

```
{
    "message": "Invalid API key in request"
}
```

{% endtab %}
{% endtabs %}

Take a look at how you might call this method using our official libraries, or via `curl`

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

```bash
curl --location 'https://api.krypcore.com/api/v0/gasless/createGasRequest' \
--header 'Authorization: 81d4a427-xxxx-xxxx-xxxx-f8482816e872' \
--header 'Content-Type: application/json' \
--data '{
"protocol": "80001",
"network": "polygon-mumbai",
"chainId": 80001,
"requestedGasLimit": 0.5,
"additionalInformation": "",
"userId": "DEV_XENO_76_xxxxxxx",
"subscriptionId": "xxxxxxxxxx"
}'
```

{% endtab %}

{% tab title="Node.js (Fetch)" %}

```javascript
var myHeaders = new Headers();
myHeaders.append("Authorization", "81d4a427-xxxx-xxxx-xxxx-f8482816e872");
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
  "protocol": "80001",
  "network": "polygon-mumbai",
  "chainId": 80001,
  "requestedGasLimit": 0.5,
  "additionalInformation": "",
  "userId": "DEV_XENO_76_xxxxxxx",
  "subscriptionId": "xxxxxxxxxx"
});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://api.krypcore.com/api/v0/gasless/createGasRequest", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
```

{% endtab %}

{% tab title="Python " %}

```python
import requests
import json

url = "https://api.krypcore.com/api/v0/gasless/createGasRequest"

payload = json.dumps({
  "protocol": "80001",
  "network": "polygon-mumbai",
  "chainId": 80001,
  "requestedGasLimit": 0.5,
  "additionalInformation": "",
  "userId": "DEV_XENO_76_xxxxxxx",
  "subscriptionId": "xxxxxxxxxx"
})
headers = {
  'Authorization': '81d4a427-xxxx-xxxx-xxxx-f8482816e872',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

```

{% endtab %}

{% tab title="Golang" %}

```go
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.krypcore.com/api/v0/gasless/createGasRequest"
  method := "POST"

  payload := strings.NewReader(`{`+"
"+`
"protocol": "80001",`+"
"+`
"network": "polygon-mumbai",`+"
"+`
"chainId": 80001,`+"
"+`
"requestedGasLimit": 0.5,`+"
"+`
"additionalInformation": "",`+"
"+`
"userId": "DEV_XENO_76_xxxxxxx",`+"
"+`
"subscriptionId": "xxxxxxxxxx"`+"
"+`
}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Authorization", "81d4a427-xxxx-xxxx-xxxx-f8482816e872")
  req.Header.Add("Content-Type", "application/json")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
```

{% endtab %}
{% endtabs %}
