> For the complete documentation index, see [llms.txt](https://sub2.gitbook.io/sub2/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sub2.gitbook.io/sub2/sdk/query-subscriptions.md).

# Query subscriptions

Here is an example of how to query  subscriptions given their respective index using sub2-sdk. As mentioned [here](/sub2/concepts/subscription.md), subscriptions are stored in one public array called `subscriptions` and are uniquely identified by their index in the array. Since the array is public, we can query all the information of a subscription using their index. Assuming sub2-sdk is installed and initialised like shown [here](/sub2/sdk.md), we can query the subscription as follows:

<pre class="language-typescript"><code class="lang-typescript"><strong>import { Subscription } from 'sub2-sdk';
</strong><strong>
</strong><strong>const subscriptions: Subscription[] = await sub2SDK.getSubscriptions(indices);
</strong></code></pre>

Here, `indices` has type `bigint[]`.The `getSubscription` function returns a promise with a Subscription\[] array. Each Subscription object contains both the on-chain data and auxiliary information:

```typescript
interface Subscription {
  id: bigint;
  sender: `0x${string}`,
  recipient: `0x${string}`,
  sponsor: `0x${string}`,
  amount: bigint,
  token: `0x${string}`,
  maxProcessingFee: bigint,
  processingFeeToken: `0x${string}`,
  cooldown: number,
  auctionDuration: number,
  paymentCounter: number,
  status: 'canceled' | 'expired' | 'auction' |  'waiting';
  lastPayment: Date,
  nextPaymentAvailable: Date;
  nextPaymentDue: Date;
}
```

Now we have obtained all information about the subscriptions!
