> For the complete documentation index, see [llms.txt](https://docs.streamnft.tech/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.streamnft.tech/for-developers/api-reference/rental-integration/user-nfts.md).

# User NFTs

The Asset Manager API provides functionalities for managing asset managers in a blockchain-based ecosystem. Asset managers are entities responsible for managing various assets, such as digital tokens, NFTs (Non-Fungible Tokens), and other digital assets, on a blockchain network. These APIs allows users to retrieve information about asset managers based on their chain ID and contract address.

**Endpoint:**

> * Main Net Base URL: <https://indexer.streamnft.tech/>
> * Test Net Base URL: <https://stagingindexer.streamnft.tech/>

## **1. Use StreamNFT Indexer (1 API Call to get all User NFTs)**

{% openapi src="/files/JDvLeszlVCuXftU6TcEv" path="/getNFTs/{chainId}/{wallet}" method="get" %}
[openapi: 3.yml](https://2149345960-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F60fGWUP51b2HhkWIrtTW%2Fuploads%2FWP8VXOGi3kSHdwa6ls9J%2Fopenapi%3A%203.yml?alt=media\&token=ecf4e985-c4d9-4317-8a12-07f905e89c2f)
{% endopenapi %}

## **2. Use External Indexer (2 API Call to get all User NFTs)**

*Query Parameters specific for rentals***:**

* `collection`: Filter for token address of the NFT collection
* `rentee`: Filter for assets rented by a wallet
* `state`: Filter for all assets on Marketplace (STALE) or rented out (RENT)
* `onlyRentData` : Output only rental data (NFT rentee, NFT owner,  rental expiry, state)

{% openapi src="/files/YWXbKkMC1LmJdKtNi8qq" path="/assetManager/{chainId}" method="get" %}
[openapi.yml](https://2149345960-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F60fGWUP51b2HhkWIrtTW%2Fuploads%2F487GZkzQet3aXAmxAbT0%2Fopenapi.yml?alt=media\&token=41d5ce99-7329-4bd4-bcfd-32dccbd1fb77)
{% endopenapi %}

**Response:**

* Successful responses return an array of asset managers for provided token address with detailed information, such as the current rentee and the state of each asset.

### Example: How to Integrate **External Indexer**

* Get all rented collection NFTs by user wallet

```javascript
let nfts= indexerCall(wallet.address) // indexer call to get nfts by wallet
nfts.push.apply(nfts, await getNFTs(chainId,wallet.address,tokenAddress));

async function getNFTs(chainId, address,tokenAddress){
    const nfts = await fetch(`https://indexer.streamnft.tech/assetManager/${chainId}?user=${walletAddress}&collection=${collectionAddress}`)
    .then(response => {
        if (!response.ok) {
        throw new Error(`HTTP error! Status: ${response.status}`);
        }
        return response.json();
    })
    .catch(error => {
        // Handle network errors or API response errors here
        console.error('Error:', error.message);
    });
    return nfts;
}
```

* Get all rented NFTs by user wallet

```javascript
let nfts= indexerCall(wallet.address) // indexer call to get nfts by wallet
nfts.push.apply(nfts, await getNFTs(chainId,wallet.address));

async function getNFTs(chainId, address){
    const nfts = await fetch(`https://indexer.streamnft.tech/assetManager/${chainId}?user=${walletAddress}`)
    .then(response => {
        if (!response.ok) {
        throw new Error(`HTTP error! Status: ${response.status}`);
        }
        return response.json();
    })
    .catch(error => {
        // Handle network errors or API response errors here
        console.error('Error:', error.message);
    });
    return nfts;
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.streamnft.tech/for-developers/api-reference/rental-integration/user-nfts.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
