<p>You'll probably need two steps for this.</p>
<p>First, fetch all assets at the stake address using this endpoint:</p>
<p><a href="https://cardano-mainnet.blockfrost.io/api/v0/accounts/%7Bstake_address%7D/addresses/assets" rel="nofollow noreferrer">https://cardano-mainnet.blockfrost.io/api/v0/accounts/{stake_address}/addresses/assets</a></p>
<p><em>(documented here: <a href="https://docs.blockfrost.io/#tag/Cardano-Accounts/paths/%7E1accounts%7E1%7Bstake_address%7D%7E1addresses%7E1assets/get" rel="nofollow noreferrer">https://docs.blockfrost.io/#tag/Cardano-Accounts/paths/~1accounts~1{stake_address}~1addresses~1assets/get</a>)</em></p>
<p>Then filter all but those with a quantity of &quot;1&quot; <em>(technically all tokens are identical, but NFTs should only exist with a quantity of &quot;1&quot;)</em>.</p>
<p>Just counting these could already be enough for a rough counter on a website.</p>
<p>But the next step would be to check that only one of each of those token is in existance and the metadata suggests it is actually an NFT.</p>
<p>So you can look up each of those assets using this endpoint:</p>
<p><a href="https://cardano-mainnet.blockfrost.io/api/v0/assets/%7Basset%7D" rel="nofollow noreferrer">https://cardano-mainnet.blockfrost.io/api/v0/assets/{asset}</a></p>
<p><em>(documented here: <a href="https://docs.blockfrost.io/#tag/Cardano-Assets/paths/%7E1assets%7E1%7Basset%7D/get" rel="nofollow noreferrer">https://docs.blockfrost.io/#tag/Cardano-Assets/paths/~1assets~1{asset}/get</a>)</em></p>
<p>If this lookup also shows a quantity of &quot;1&quot; exists and the &quot;onchain_metadata&quot; is populated <em>(with fields from this NFT metadata standard <a href="https://cips.cardano.org/cips/cip25/" rel="nofollow noreferrer">https://cips.cardano.org/cips/cip25/</a>)</em> you could assume it's an NFT, and then just count them up.</p>

CC BY-SA 4.0
2022-05-15T06:04:56.203Z
Thanks Sean, I'll check out those links then. In order to parse that data and filter all but those with a quantity of "1", can you tell me what the data type is?
Murray
CC BY-SA 4.0
2022-05-15T11:54:05.553Z
It's a string as in:
{
"unit": "b0d07d45fe9514f80213f4020e5a61241458be626841cde717cb38a76e7574636f696e",
  "quantity": "125"
}
sean
CC BY-SA 4.0
2022-05-14T12:13:48.113Z
2022-05-14T12:13:48.113Z
sean
<p>I'm wanting to display the NFT count of a wallet on my website. I've gone through the blockfrost SDK and I don't see anything that relates to NFTs. Is there a method to return this value?</p>
<p>Here is my code which currently returns the ADA amount:</p>
<blockquote>

</blockquote>
<pre><code>        const Http = new XMLHttpRequest();        
        const url = 'https://cardano-mainnet.blockfrost.io/api/v0/accounts/stake1u9r0sh6hl6csxt90k5ueh5pl404r6qs995kjnzmp8u3mr2csgg2q8';
        Http.open(&quot;GET&quot;, url);
        Http.setRequestHeader('project_id', 'mainnetxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
        Http.send();
        Http.onreadystatechange = (e) =&gt; {
            if (e.currentTarget.readyState == 4 &amp;&amp; e.currentTarget.status == 200 &amp;&amp; e.currentTarget.responseText != '') {
                var stake = (parseFloat(JSON.parse(Http.responseText).controlled_amount) / 1000000);
                console.log(stake)
            }
        }
</code></pre>
<p>Thanks for any help!</p>

CC BY-SA 4.0
2022-05-14T08:16:47.787Z
I recommend not sharing your project id publicly since it serves as API key so anyone can make requests in the name of your account using this id.
Will
<nft><api><blockfrost><javascript>
How to get NFT count of wallet address
# How to get NFT count of wallet address

(Asked by: username_0 on 2022-05-13)

I'm wanting to display the NFT count of a wallet on my website. I've gone through the blockfrost SDK and I don't see anything that relates to NFTs. Is there a method to return this value?
Here is my code which currently returns the ADA amount:


        const Http = new XMLHttpRequest();        
        const url = 'https://cardano-mainnet.blockfrost.io/api/v0/accounts/stake1u9r0sh6hl6csxt90k5ueh5pl404r6qs995kjnzmp8u3mr2csgg2q8';
        Http.open("GET", url);
        Http.setRequestHeader('project_id', 'mainnetxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
        Http.send();
        Http.onreadystatechange = (e) => {
            if (e.currentTarget.readyState == 4 && e.currentTarget.status == 200 && e.currentTarget.responseText != '') {
                var stake = (parseFloat(JSON.parse(Http.responseText).controlled_amount) / 1000000);
                console.log(stake)
            }
        }

Thanks for any help!

**Tags:** nft, api, blockfrost, javascript
> **Comments:**
> **username_1**: I recommend not sharing your project id publicly since it serves as API key so anyone can make requests in the name of your account using this id.  

---

## 1 answers

### Answer by username_2 on 2022-05-14. Score: 2 | Accepted answer

You'll probably need two steps for this.

First, fetch all assets at the stake address using this endpoint:

[https://cardano-mainnet.blockfrost.io/api/v0/accounts/{stake\_address}/addresses/assets](https://cardano-mainnet.blockfrost.io/api/v0/accounts/%7Bstake_address%7D/addresses/assets)

*(documented here: [https://docs.blockfrost.io/#tag/Cardano-Accounts/paths/~1accounts~1{stake\_address}~1addresses~1assets/get](https://docs.blockfrost.io/#tag/Cardano-Accounts/paths/%7E1accounts%7E1%7Bstake_address%7D%7E1addresses%7E1assets/get))*

Then filter all but those with a quantity of "1" *(technically all tokens are identical, but NFTs should only exist with a quantity of "1")*.

Just counting these could already be enough for a rough counter on a website.

But the next step would be to check that only one of each of those token is in existance and the metadata suggests it is actually an NFT.

So you can look up each of those assets using this endpoint:

[https://cardano-mainnet.blockfrost.io/api/v0/assets/{asset}](https://cardano-mainnet.blockfrost.io/api/v0/assets/%7Basset%7D)

*(documented here: [https://docs.blockfrost.io/#tag/Cardano-Assets/paths/~1assets~1{asset}/get](https://docs.blockfrost.io/#tag/Cardano-Assets/paths/%7E1assets%7E1%7Basset%7D/get))*

If this lookup also shows a quantity of "1" exists and the "onchain\_metadata" is populated *(with fields from this NFT metadata standard <https://cips.cardano.org/cips/cip25/>)* you could assume it's an NFT, and then just count them up.

> **Comments:**
> **username_0**: Thanks Sean, I'll check out those links then. In order to parse that data and filter all but those with a quantity of "1", can you tell me what the data type is?  
> **username_2**: It's a string as in: { "unit": "b0d07d45fe9514f80213f4020e5a61241458be626841cde717cb38a76e7574636f696e",   "quantity": "125" }  

---

