# Wallet Balance

This API endpoint allows clients to check if a specific Non-Fungible Token (NFT) is present within a wallet. This can be useful for scenarios like token gating, where access to specific resources or features is controlled based on token ownership.

## Endpoint Details

| Description | Data                                                                                                     |
| ----------- | -------------------------------------------------------------------------------------------------------- |
| API Name    | [getWalletNftBalance](https://sandbox.api.labs.zelus.io/docs/api-json#/Wallet/get_v1_wallet_nft_balance) |
| HTTP Method | GET                                                                                                      |
| URL         | `/v1/wallet/nft/balance`                                                                                 |

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

#### Headers

| Key          | Value              |
| ------------ | ------------------ |
| Content-Type | `application/json` |
| x-api-key    | API\_KEY           |

#### Query Parameters

| Parameter      | Type             | Description                                                 |
| -------------- | ---------------- | ----------------------------------------------------------- |
| **contractId** | string, required | Identifier for the contract, formatted as `contract_<UUID>` |
| **nftTokenId** | string, required | Identifier for the NFT.                                     |

User can be identified by one of the parameter:

| Parameter         | Type             | Description                          |
| ----------------- | ---------------- | ------------------------------------ |
| **walletAddress** | string, optional | Address                              |
| **walletId**      | string, optional | Wallet ID (`wallet_UUID`)            |
| **email**         | string, optional | Wallet email                         |
| **phone**         | string, optional | Wallet phone, format: "+!2223334444" |
| {% endtab %}      |                  |                                      |

{% tab title="Response" %}

#### Response format

```tsx
result: {
    value: number, // 0,1,...
    transactionStatus?: string // "pending" or "complete"
} | error? : IResponseError
```

#### Success response

```json
{
  "result": {
    "value": 3,
    "transactionStatus": "finished"
  }
}
```

#### Error messages

* More than one user ID is defined.
  * `{ "code: 400, "message": "Validation error: \"value\" must contain at least one of [email, phone, walletId, walletAddress]" }`
* Contracts not found
  * `{ "code: 400, "message": "Contracts not found" }`
* User wallet not found
  * `{ "code: 400, "message": "User wallet not found" }`
    {% endtab %}
    {% endtabs %}

## Examples

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

```bash
curl -X GET "https://sandbox.api.labs.zelus.io/v1/wallet/nft/balance?contractId=contract_63b848e9-b316-48a3-adfd-065403ab88ae&nftTokenId=1&email=email@example.com" \
     -H "Content-Type: application/json" \
     -H "x-api-key: YOUR_API_KEY"
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://sandbox.api.labs.zelus.io/v1/wallet/nft/balance"
headers = {
    "Content-Type": "application/json",
    "x-api-key": "YOUR_API_KEY"
}
data = {
    "contractId": "contract_63b848e9-b316-48a3-adfd-065403ab88ae",
    "nftTokenId": "2",
    "walletAddress": "0x0097f04ac9b2af2fb40c2c30a65023a78eaff5d6"
}

response = requests.get(url, json=data, headers=headers)
print(response.json()["result"]["value"])
```

{% endtab %}

{% tab title="NodeJS" %}

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

const url = "https://sandbox.api.labs.zelus.io/v1/wallet/nft/balance";
const headers = {
    "Content-Type": "application/json",
    "x-api-key": "YOUR_API_KEY"
};
const data = {
    "contractId": "contract_63b848e9-b316-48a3-adfd-065403ab88ae",
    "nftTokenId": "3",
    "wallet": "wallet_60afcf25-2c1f-4b90-9fea-6174fd416040"
};

axios.get(url, data, {headers})
    .then(response => {
        console.log(response.data.result.value);
    })
    .catch(error => {
        console.error(error);
    });
```

{% 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.labs.zelus.io/zelus-labs-api/reference/wallet/getwalletnftbalance.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.
