# Query subscriptions

Here is an example of how to query  subscriptions given their respective index using sub2-sdk. As mentioned [here](../concepts/subscription), 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](), 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!
