# Approve ERC20Token

ERC Token can be approved using this method. The weightage for this API is 5

## API Specification

## Approve ERC20Token

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

ERC Token can be approved 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.                               |
| approveAddress<mark style="color:red;">\*</mark>             | String | Address that requires approval to manage ERC20 tokens on token owner's behalf |
| custodialWalletAccessToken<mark style="color:red;">\*</mark> | String | The access token for the custodial wallet                                     |
| contractAddress<mark style="color:red;">\*</mark>            | String | The contract address of the ERC20 token                                       |
| quantity<mark style="color:red;">\*</mark>                   | String | The quantity of ERC20 tokens to approve                                       |
| walletType<mark style="color:red;">\*</mark>                 | String | The type of wallet being used                                                 |

{% tabs %}
{% tab title="200: OK ERC20 Token Created Successfully" %}

```javascript
{
    "Data": {
        "referenceId": "xxxxxxxxxxxxx",
        "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="401: Unauthorized Failure in authentication" %}

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

{% endtab %}

{% tab title="500: Internal Server Error Chain id is missing" %}

```javascript
{
    "Data": null,
    "Message": "Mandatory params missing",
    "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 --request POST 'https://api.krypcore.com/api/v0/ft-manager/approveFT' \
--header 'Authorization: xxxxxxxxxxxx' \
--header 'DappId: xxxxxxxxxxxx' \
--header 'ChainId: xxxx' \
--header 'Content-Type: application/json' \
--data '{
  "approveAddress": "0x688612BD8e65FF693070A875b6a49672502a0707",
  "chainId": "xxxx",
  "contractAddress": "0xa9BCB7E413FfE96575390c6F44F54607b44F030a",
  "custodialWalletAccessToken": "d263d546-ccc2-4676-9691-d28c3f836822",
  "quantity": "1000000000000000000",
  "walletType": "non-custodial"
}'
```

{% endtab %}

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

```javascript
const axios = require('axios');
let data = JSON.stringify({
 "approveAddress": "0x688612BD8e65FF693070A875b6a49672502a0707",
  "chainId": "xxxx",
  "contractAddress": "0xa9BCB7E413FfE96575390c6F44F54607b44F030a",
  "custodialWalletAccessToken": "d263d546-ccc2-4676-9691-d28c3f836822",
  "quantity": "1000000000000000000",
  "walletType": "non-custodial"
});

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

payload = json.dumps({
  "approveAddress": "0x688612BD8e65FF693070A875b6a49672502a0707",
  "chainId": "xxxx",
  "contractAddress": "0xa9BCB7E413FfE96575390c6F44F54607b44F030a",
  "custodialWalletAccessToken": "d263d546-ccc2-4676-9691-d28c3f836822",
  "quantity": "1000000000000000000",
  "walletType": "non-custodial"
})
headers = {
  'Authorization': 'xxxxxxxxxxxx',
  'DappId': 'xxxxxxxxxxxx',
  '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/approveFT"
  method := "POST"

  payload := strings.NewReader(`{
  "approveAddress": "0x688612BD8e65FF693070A875b6a49672502a0707",
  "chainId": "xxxx",
  "contractAddress": "0xa9BCB7E413FfE96575390c6F44F54607b44F030a",
  "custodialWalletAccessToken": "d263d546-ccc2-4676-9691-d28c3f836822",
  "quantity": "1000000000000000000",
  "walletType": "non-custodial"
}`)

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

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.krypcore.com/dev-docs/api-reference/core-service-apis/ft-manager-apis/approve-erc20token.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
