# Create ERC20Token

ERC20 Token can be created using this method. The weightage for this API is 5

## API Specification

## Create ERC20Token

<mark style="color:green;">`POST`</mark> `http://api.krypcore.com/api/v0/ft-manager/createERC20`

ERC20 Token can be Created under the given instance.&#x20;

#### Headers

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

#### Request Body

| Name                                                         | Type    | Description                                       |
| ------------------------------------------------------------ | ------- | ------------------------------------------------- |
| chainId<mark style="color:red;">\*</mark>                    | String  | The Chain ID to specify the blockchain network    |
| ERCStandard<mark style="color:red;">\*</mark>                | String  | The standard of ERC (e.g., "ERC20") for the token |
| custodialWalletAccessToken<mark style="color:red;">\*</mark> | String  | Access Token for the custodial wallet             |
| decimal                                                      | Numeric | The required decimal value for the token          |
| premintAddress<mark style="color:red;">\*</mark>             | String  | Pre Mint Address                                  |
| tokenName<mark style="color:red;">\*</mark>                  | String  | The name of the token to be created               |
| tokenSymbol<mark style="color:red;">\*</mark>                | String  | The symbol of the token                           |
| walletType<mark style="color:red;">\*</mark>                 | String  | Type of Wallet                                    |

{% tabs %}
{% tab title="200: OK ERC20Token is Created" %}

```javascript
{
    "Data": {
        "contractAddress": "",
        "referenceId": "b6c67768-e33a-406a-be2a-fe73d03acfcf",
        "txnHash": ""
    },
    "Message": "ERC20 Token Created Successfully",
    "Status": "SUCCESS"
}
```

{% endtab %}

{% tab title="400: Bad Request no / multiple instances found" %}

```javascript
{
    Status: "FAILURE",
    Code: 400,
    Message: "no / multiple instances found"
}
```

{% endtab %}

{% tab title="500: Internal Server Error Token name is taken" %}

```javascript
{
    "Data": null,
    "Message": "Token name is taken, try new name",
    "Status": "Failure"
}
```

{% endtab %}
{% endtabs %}

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

Here, "custodialWalletAccessToken" is wallet id.

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

```bash
curl --location --request POST 'https://api.krypcore.com/api/v0/ft-manager/createERC20' \
--header 'Authorization: xxxxxxxxxxxxxxx' \
--header 'DappId: xxxxxxxxxxxxxxx' \
--header 'Chainid: xxxx' \
--header 'Content-Type: application/json' \
--data-raw '{
  "ERCStandard": "ERC20",
  "chainId": "xxxx",
  "custodialWalletAccessToken": "d263d546-ccc2-4676-9691-d28c3f836822",
  "decimal": 18,
  "premintAddress": "0x466e1862CFC80F216dc4126cc883D731520f36DE",
  "quantity": 100000000,
  "tokenName": "KrypC Token",
  "tokenSymbol": "KC01",
  "walletType": "non-custodial"
}'
```

{% endtab %}

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

```javascript
const axios = require('axios');
let data = JSON.stringify({
  "ERCStandard": "ERC20",
  "chainId": "xxxx",
  "custodialWalletAccessToken": "d263d546-ccc2-4676-9691-d28c3f836822",
  "decimal": 18,
  "premintAddress": "0x466e1862CFC80F216dc4126cc883D731520f36DE",
  "quantity": 10000,
  "tokenName": "KrypC Token",
  "tokenSymbol": "KC01",
  "walletType": "non-custodial"
});

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'http://api.krypcore.com/api/v0/ft-manager/createERC20',
  headers: { 
    'Authorization': 'xxxxxxxxxxxxx', 
    'DappId': 'xxxxxxxxxxxxx', 
    'Chainid': 'xxxx',
    'Content-Type': 'application/json'
  },
  data : data
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});

```

{% endtab %}

{% tab title="Python " %}

```python
import requests
import json

url = "http://api.krypcore.com/api/v0/ft-manager/createERC20"

payload = json.dumps({
  "ERCStandard": "ERC20",
  "chainId": "xxxx",
  "custodialWalletAccessToken": "d263d546-ccc2-4676-9691-d28c3f836822",
  "decimal": 18,
  "premintAddress": "0x688612BD8e65FF693070A875b6a49672502a0707",
  "quantity": 10000,
  "tokenName": "KrypC Token",
  "tokenSymbol": "KC01",
  "walletType": "non-custodial"
})
headers = {
  'Authorization': 'xxxxxxxxxxxxx',
  'DappId': 'xxxxxxxxxxxxx',
  'Chainid': 'xxxx',
  '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 := "http://api.krypcore.com/api/v0/ft-manager/createERC20"
  method := "POST"

  payload := strings.NewReader(`{
  "ERCStandard": "ERC20",
  "chainId": "xxxx",
  "custodialWalletAccessToken": "d263d546-ccc2-4676-9691-d28c3f836822",
  "decimal": 18,
  "premintAddress": "0x688612BD8e65FF693070A875b6a49672502a0707",
  "quantity": 10000,
  "tokenName": "KrypC Token",
  "tokenSymbol": "KC01",
  "walletType": "non-custodial"
}`)

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

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

  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 %}
