> For the complete documentation index, see [llms.txt](https://csm-docs.cozy.finance/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://csm-docs.cozy.finance/developer-guides/stake-into-a-rewards-manager/unstake.md).

# Unstake

Stakers can exchange their stake receipt tokens for the underlying asset they staked in the Rewards Manager (typically a Safety Module deposit receipt token). There is no delay to unstake - stakers can immediately unstake from a Rewards Manager.

### Using CozyRouter to unstake assets

The recommended way to programmatically unstake assets is to call `CozyRouter.unstake` (see CozyRouter):

```solidity
function unstake(
    IRewardsManager rewardsManager_,
    uint16 stakePoolId_,
    uint256 stakeReceiptTokenAmount,
    address receiver_
) public payable;
```

This method will internally call`RewardsManager.unstake`.

Prior to calling this function, the user must have approved `CozyRouter` to a spend sufficient amount of their `StakePool.stakeReceiptToken` balance.

### Unstake mechanics

On `RewardsManager.unstake`, we follow the following steps:

* Claim rewards on behalf of the `owner_`, transferring the reward assets to `receiver_`.
* Decrement `StakePool.amount`.
* Burn the `owner_`'s stake receipt tokens.
* Transfer the `receiver_` the relevant amount of stake assets.
* Emit a `Unstaked` event.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://csm-docs.cozy.finance/developer-guides/stake-into-a-rewards-manager/unstake.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
