# Get Total Supply

Total Supply details can be gathered using this method. The weightage for this API is 5

## API Specification

## Get Total Supply

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

Total Supply details can be gathered  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                                                                             |
| ------------------------------------------------- | ------ | --------------------------------------------------------------------------------------- |
| contractAddress<mark style="color:red;">\*</mark> | String | The contract address of the ERC20 token for which you want to retrieve the total supply |
| chainId<mark style="color:red;">\*</mark>         | String | The Chain ID to specify the blockchain network                                          |

{% tabs %}
{% tab title="200: OK Total Supply" %}

```javascript
{
    Data: 130000,
    Message: "Total Supply fetched successfully",
    Status: "SUCCESS"
}
```

{% endtab %}

{% tab title="400: Bad Request Mandatory Parameters are missing" %}

```javascript
{
    Data: null,
    Message: "Mandatory params missing",
    Status: "FAILURE"
}
```

{% endtab %}

{% tab title="401: Unauthorized invalid API Key" %}

```javascript
{
    Data: null,
    Message: "Error while fetching total supply Error while getting total supply no contract code at given address",
    Status: "Failure"
}
```

{% 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/ft-manager/getTotalSupply' \
--header 'Authorization: xxxxxxxxxxxxxxxxx' \
--header 'DappId: xxxxxxxxxxxxxxxxx' \
--header 'ChainId: xxxx' \
--header 'Content-Type: application/json' \
--data '{
  "chainId": "xxxx",
  "contractAddress": "0x8E3129B655817ac4edC996425643Cbe58b905cE0"
}'
```

{% endtab %}

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

```javascript
const axios = require('axios');
let data = JSON.stringify({
  "chainId": "xxxx",
  "contractAddress": "0x8E3129B655817ac4edC996425643Cbe58b905cE0"
});

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://api.krypcore.com/api/v0/ft-manager/getTotalSupply',
  headers: { 
    'Authorization': 'xxxxxxxxxxxxxxxxx', 
    'DappId': 'xxxxxxxxxxxxxxxxx', 
    '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 = "https://api.krypcore.com/api/v0/ft-manager/getTotalSupply"

payload = json.dumps({
  "chainId": "xxxx",
  "contractAddress": "0x8E3129B655817ac4edC996425643Cbe58b905cE0"
})
headers = {
  'Authorization': 'xxxxxxxxxxxxxxxxx',
  'DappId': 'xxxxxxxxxxxxxxxxx',
  '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 := "https://api.krypcore.com/api/v0/ft-manager/getTotalSupply"
  method := "POST"

  payload := strings.NewReader(`{
  "chainId": "xxxx",
  "contractAddress": "0x8E3129B655817ac4edC996425643Cbe58b905cE0"
}`)

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

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Authorization", "xxxxxxxxxxxxxxxxx")
  req.Header.Add("DappId", "xxxxxxxxxxxxxxxxx")
  req.Header.Add("ChainId", "xxxx")
  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 %}
