# List All Whitelisted Contracts

The "List All Whitelisted Contracts" API endpoint provided by Krypcore enables users to retrieve information about all whitelisted contracts under a specific instance.

## API Specification

## List All Whitelisted Contracts

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

List all whitelisted contracts 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                                    |
| ---------------------------------------- | ------ | ---------------------------------------------- |
| page<mark style="color:red;">\*</mark>   | String | number of pages                                |
| limit<mark style="color:red;">\*</mark>  | String | Limit of contracts shown per page              |
| searchValue                              | String | Search value for filtering contracts           |
| searchIn                                 | String | Field to search within the contract list       |
| filterValue                              | String | Value for filtering the contract list          |
| filterIn                                 | String | Field to apply the filter on                   |
| userId<mark style="color:red;">\*</mark> | String | Dapp ID or user ID associated with the request |

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

```javascript
{
    "data": {
        "data": [],
        "limit": 5,
        "page": 1,
        "total": 0
    },
    "message": "Whitelisted contract details fetched 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/listAllWhitelistedContracts' \
--header 'Authorization: 81d4a427-xxxx-xxxx-xxxx-f8482816e872' \
--header 'Content-Type: application/json' \
--data '{
    "page": 1,
    "limit": 5,
    "searchValue": "",
    "searchIn": [],
    "filterValue": "ACTIVE",
    "filterIn": ["contractStatus"],
    "userId":"xxxxxxxxxxxxxx"
}'
```

{% 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({
  "page": 1,
  "limit": 5,
  "searchValue": "",
  "searchIn": [],
  "filterValue": "ACTIVE",
  "filterIn": [
    "contractStatus"
  ],
  "userId": "xxxxxxxxxxxxxx"
});

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

fetch("https://api.krypcore.com/api/v0/gasless/listAllWhitelistedContracts", 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/listAllWhitelistedContracts"

payload = json.dumps({
  "page": 1,
  "limit": 5,
  "searchValue": "",
  "searchIn": [],
  "filterValue": "ACTIVE",
  "filterIn": [
    "contractStatus"
  ],
  "userId": "xxxxxxxxxxxxxx"
})
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/listAllWhitelistedContracts"
  method := "POST"

  payload := strings.NewReader(`{`+"
"+`
    "page": 1,`+"
"+`
    "limit": 5,`+"
"+`
    "searchValue": "",`+"
"+`
    "searchIn": [],`+"
"+`
    "filterValue": "ACTIVE",`+"
"+`
    "filterIn": ["contractStatus"],`+"
"+`
    "userId":"xxxxxxxxxxxxxx"}`)

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


---

# 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/gasless-api/list-all-whitelisted-contracts.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.
