# How to get the index and ledger canister id for each SNS?

**URL:** <https://forum.dfinity.org/t/how-to-get-the-index-and-ledger-canister-id-for-each-sns/26298>\
**Category:** Developers\
**Created:** [January 8, 2024, 9:28am UTC](https://forum.dfinity.org/t/how-to-get-the-index-and-ledger-canister-id-for-each-sns/26298 "2024-01-08T09:28:41Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![e274426380](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/e274426380/32/2555_2.png) [@e274426380](https://forum.dfinity.org/u/e274426380)\
**Post date:** [January 8, 2024, 9:28am UTC](https://forum.dfinity.org/t/how-to-get-the-index-and-ledger-canister-id-for-each-sns/26298/1 "2024-01-08T09:28:41Z")

</div>

As we all know, the variety of SNS tokens is constantly increasing, so I’m curious to know if there is a stable way to query past, present and future SNS token data.  
For example, it could return the index and ledger canister id for each SNS.

---

<div class="post-metadata">

**Author:** ![infu](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/infu/32/11321_2.png) [@infu](https://forum.dfinity.org/u/infu)\
**Post date:** [January 8, 2024, 9:49am UTC](https://forum.dfinity.org/t/how-to-get-the-index-and-ledger-canister-id-for-each-sns/26298/2 "2024-01-08T09:49:13Z")

</div>

> [@SNS aggregator release](https://forum.dfinity.org/t/sns-aggregator-release/22249):
>
> The GIX team will be submitting an upgrade proposal for the SNS aggregator today. Update: The proposal is [number 124250](https://nns.ic0.app/proposal/?u=qoctq-giaaa-aaaaa-aaaea-cai&proposal=124250)Context: What is the SNS aggregator? [The aggregator](https://3r4gx-wqaaa-aaaaq-aaaia-cai.ic0.app/) collects information on all deployed SNS and re-publishes aggregate values as certified query calls. This data is intended for use by any canister that wishes to provide dashboards. The data will typically be updated about once per minute. Collecting the data from this aggregator will typically be much faster than collecting…

---

<div class="post-metadata">

**Author:** ![peterparker](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@peterparker](https://forum.dfinity.org/u/peterparker)\
**Post date:** [January 8, 2024, 10:14am UTC](https://forum.dfinity.org/t/how-to-get-the-index-and-ledger-canister-id-for-each-sns/26298/3 "2024-01-08T10:14:26Z")

</div>

NNS dapp uses the Sns aggregator so do I in proposals.network so, I can confirm it works well to fetch Snses information.

In the latest I actually load the data to extract a static json file and logos at build time. The script is there if it can be interesting:

> <https://github.com/peterpeterparker/proposals.network/blob/main/scripts/build.snses.mjs>

---

<div class="post-metadata">

**Author:** ![bitdivine](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/bitdivine/32/246_2.png) [@bitdivine](https://forum.dfinity.org/u/bitdivine)\
**Post date:** [January 8, 2024, 7:45pm UTC](https://forum.dfinity.org/t/how-to-get-the-index-and-ledger-canister-id-for-each-sns/26298/4 "2024-01-08T19:45:28Z")

</div>

The aggregator collects data as follows:

- The nns-sns-wasm canister lists the root canisters of all SNSs.
- The root canister of each SNS lists the common management canisters for that SNS

Collecting the data for all SNSs is super slow though, which is why the aggregator collects the data once and then packages it up to serve it quickly to thousands impatient end users who want the data three seconds ago because there is a new SNS in town don’t ya know. ;-).

---

<div class="post-metadata">

**Author:** ![e274426380](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/e274426380/32/2555_2.png) [@e274426380](https://forum.dfinity.org/u/e274426380)\
**Post date:** [January 9, 2024, 7:38am UTC](https://forum.dfinity.org/t/how-to-get-the-index-and-ledger-canister-id-for-each-sns/26298/5 "2024-01-09T07:38:51Z")

</div>

😄That’s what I was looking for, thank you very much!

---

<div class="post-metadata">

**Author:** ![e274426380](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/e274426380/32/2555_2.png) [@e274426380](https://forum.dfinity.org/u/e274426380)\
**Post date:** [January 9, 2024, 7:46am UTC](https://forum.dfinity.org/t/how-to-get-the-index-and-ledger-canister-id-for-each-sns/26298/6 "2024-01-09T07:46:26Z")

</div>

This script helped me get up to speed quickly with Sns aggregator, thanks.

---

<div class="post-metadata">

**Author:** ![e274426380](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/e274426380/32/2555_2.png) [@e274426380](https://forum.dfinity.org/u/e274426380)\
**Post date:** [January 9, 2024, 7:49am UTC](https://forum.dfinity.org/t/how-to-get-the-index-and-ledger-canister-id-for-each-sns/26298/7 "2024-01-09T07:49:13Z")

</div>

The Sns aggregator is a pretty important tool for developers.  
Based on my personal experience of searching for a Sns aggregator for half a day and having to go to the forums for help, I would recommend adding it to the developer documentation.

---

<div class="post-metadata">

**Author:** ![peterparker](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@peterparker](https://forum.dfinity.org/u/peterparker)\
**Post date:** [January 9, 2024, 8:27am UTC](https://forum.dfinity.org/t/how-to-get-the-index-and-ledger-canister-id-for-each-sns/26298/8 "2024-01-09T08:27:10Z")

</div>

> [@e274426380](#):
>
> I would recommend adding it to the developer documentation.

That’s a good idea! We also discussed with @bitdivine giving it a proper custom domain like [sns-aggregator.internetcomputer.org](http://sns-aggregator.internetcomputer.org) or something.

Furthermore, we just merged yesterday a [PR](https://github.com/dfinity/nns-dapp/pull/4086) I provided to improve its landing page with more developer code snippets.

 ![image](https://us1.discourse-cdn.com/flex023/uploads/dfn/original/2X/c/c4b13322d4a395f09b76b5ff185b7a9899825363.png)
