# Whitelsted tokens

<mark style="color:green;">**`POST`**</mark> **`/WLCHECK`**

\<Check if the token is whitelisted or not>

**Headers**

| Name         | Value                                  | Description                                                                          |
| ------------ | -------------------------------------- | ------------------------------------------------------------------------------------ |
| Content-Type | `application/json`                     | Set to `application/json` to define the payload format.                              |
| `cert`       | **Python (requests):** tuple           | Path to the certificate and key file as a tuple (e.g., `(cert_path, key_path)`).     |
|              | **cURL:** `--cert` and `--key`         | Separate paths to the certificate and key (e.g., `--cert cert_path --key key_path`). |
|              | **Java (Apache HttpClient)**: KeyStore | Certificate and key loaded into `SSLContext` or `KeyStore`.                          |

**Body**

| Name              | Type   | Description   |
| ----------------- | ------ | ------------- |
| apikey            | string | APIKEY        |
| contract\_address | string | Token address |

**Response**

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

```json
{
    "message": "Whitelisted"
}

--------------------------------------------------------------------------------

}
    "message": "Not whitelisted"
}

```

{% endtab %}

{% tab title="500" %}

```json
{
    "message": "Internal server error"
}
```

{% endtab %}
{% endtabs %}

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

```javascript
const axios = require('axios');
const fs = require('fs');

const certFilePath = "path/to/certificate.crt";
const keyFilePath = "path/to/private.key";

const url = "https://api.0xleverage.io/is_whitelisted";
const payload = { contract_address: "0x1234567890abcdef1234567890abcdef12345678" };

axios.post(url, payload, {
    headers: {
        "Content-Type": "application/json",
    },
    httpsAgent: new require('https').Agent({
        cert: fs.readFileSync(certFilePath),
        key: fs.readFileSync(keyFilePath),
    }),
}).then(response => {
    console.log(response.status, response.data);
}).catch(error => {
    console.error(error.response ? error.response.data : error.message);
});

```

{% endtab %}

{% tab title="Python" %}

```python
import requests

cert_tuple = (cert_file_path, key_file_path)

url = "https://api.0xleverage.io/is_whitelisted"
payload = {"contract_address": "0x1234567890abcdef1234567890abcdef12345678"}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, cert=cert_tuple, headers=headers)

print(response.status_code, response.json())

```

{% endtab %}

{% tab title="Typescript" %}

```typescript
import axios from 'axios';
import * as fs from 'fs';

const certFilePath: string = "path/to/certificate.crt";
const keyFilePath: string = "path/to/private.key";

const url: string = "https://api.0xleverage.io/is_whitelisted";
const payload = { contract_address: "0x1234567890abcdef1234567890abcdef12345678" };

axios.post(url, payload, {
    headers: {
        "Content-Type": "application/json",
    },
    httpsAgent: new (require('https').Agent)({
        cert: fs.readFileSync(certFilePath),
        key: fs.readFileSync(keyFilePath),
    }),
}).then(response => {
    console.log(response.status, response.data);
}).catch(error => {
    console.error(error.response ? error.response.data : error.message);
});
```

{% endtab %}

{% tab title="Golang" %}

```go
package main

import (
	"bytes"
	"crypto/tls"
	"encoding/json"
	"fmt"
	"io/ioutil"
	"net/http"
)

func main() {
	certFile := "path/to/certificate.crt"
	keyFile := "path/to/private.key"
	cert, err := tls.LoadX509KeyPair(certFile, keyFile)
	if err != nil {
		fmt.Println("Error loading certificate and key:", err)
		return
	}

	client := &http.Client{
		Transport: &http.Transport{
			TLSClientConfig: &tls.Config{
				Certificates: []tls.Certificate{cert},
			},
		},
	}

	url := "https://api.0xleverage.io/is_whitelisted"
	payload := map[string]string{
		"contract_address": "0x1234567890abcdef1234567890abcdef12345678",
	}

	payloadBytes, _ := json.Marshal(payload)
	req, err := http.NewRequest("POST", url, bytes.NewBuffer(payloadBytes))
	if err != nil {
		fmt.Println("Error creating request:", err)
		return
	}

	req.Header.Set("Content-Type", "application/json")

	resp, err := client.Do(req)
	if err != nil {
		fmt.Println("Error making request:", err)
		return
	}
	defer resp.Body.Close()

	body, _ := ioutil.ReadAll(resp.Body)
	fmt.Println("Status Code:", resp.StatusCode)
	fmt.Println("Response:", string(body))
}
```

{% endtab %}

{% tab title="Rust" %}

```rust
use reqwest::blocking::Client;
use reqwest::Certificate;
use std::fs;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let cert = fs::read("path/to/certificate.crt")?;
    let key = fs::read("path/to/private.key")?;

    // Combine cert and key to use with reqwest
    let identity = reqwest::Identity::from_pem(&[cert, key].concat())?;

    let client = Client::builder()
        .identity(identity)
        .build()?;

    let url = "https://api.0xleverage.io/is_whitelisted";
    let payload = serde_json::json!({
        "contract_address": "0x1234567890abcdef1234567890abcdef12345678"
    });

    let response = client
        .post(url)
        .json(&payload)
        .header("Content-Type", "application/json")
        .send()?;

    println!("Status Code: {}", response.status());
    println!("Response: {}", response.text()?);

    Ok(())
}
```

{% 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.0xleverage.io/overview/leverage-api/whitelsted-tokens.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.
