# Listen for canceled subscriptions

Similar to how we can use the sub2 SDK to listen to new subscriptions for a given recipient, we can also listen to canceled subscriptions. It is assumed that sub2-sdk is installed and setup as done [here](https://sub2.gitbook.io/sub2/sdk).

```typescript
const unwatch: WatchEventReturnType = sub2SDK.watchCanceledSubscriptions(recipientAddress, callbackFn);
```

Here `recipientAddress` is of type `` `0x{string}` `` and callbackFn is of type `(subscriptionIndex: bigint) => any`. The callback function is defined by you and is what is called on newly observed canceled  subscriptions. For example, you can make a callback function which checks that the subscription index corresponds to an active subscription in your backend and update access accordingly.&#x20;

The returned value `unwatch` of the viem type `WatchEventReturnType` is a function that can be called to stop listening for events.


---

# Agent Instructions: 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:

```
GET https://sub2.gitbook.io/sub2/sdk/listen-for-canceled-subscriptions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
