> ## Documentation Index
> Fetch the complete documentation index at: https://docs.portalhq.io/llms.txt
> Use this file to discover all available pages before exploring further.

# yieldIntegrations.yieldxyz.exit

> Exit a yield position.

## Function Signature

```dart theme={null}
Future<YieldXyzActionResponse> exit({
  required String yieldId,
  String? address,
  String? amount,
  String? arguments,
})
```

## Description

Withdraw assets from a yield opportunity.

## Parameters

| Parameter   | Type      | Required | Description                                           |
| ----------- | --------- | -------- | ----------------------------------------------------- |
| `yieldId`   | `String`  | Yes      | The ID of the yield opportunity to exit               |
| `address`   | `String?` | No       | Wallet address (defaults to current wallet)           |
| `amount`    | `String?` | No       | Amount to withdraw (null for full withdrawal)         |
| `arguments` | `String?` | No       | Additional protocol-specific arguments as JSON string |

## Returns

**`YieldXyzActionResponse`** - An object containing:

| Property           | Type                               | Description                                                                                          |
| ------------------ | ---------------------------------- | ---------------------------------------------------------------------------------------------------- |
| `id`               | `String`                           | Action ID for tracking                                                                               |
| `intent`           | `YieldXyzActionIntent`             | Action intent (`enter`, `exit`, `manage`)                                                            |
| `type`             | `String`                           | Action type                                                                                          |
| `yieldId`          | `String`                           | The yield opportunity ID                                                                             |
| `address`          | `String`                           | Wallet address used                                                                                  |
| `amount`           | `String?`                          | Withdrawal amount                                                                                    |
| `amountRaw`        | `String?`                          | Raw withdrawal amount                                                                                |
| `amountUsd`        | `String?`                          | USD equivalent amount                                                                                |
| `transactions`     | `List<YieldXyzActionTransaction?>` | List of transactions to be signed and broadcast                                                      |
| `executionPattern` | `YieldXyzActionExecutionPattern`   | Execution pattern (`synchronous`, `asynchronous`, `batched`)                                         |
| `createdAt`        | `String`                           | Creation timestamp                                                                                   |
| `completedAt`      | `String?`                          | Completion timestamp                                                                                 |
| `status`           | `YieldXyzActionStatus`             | Current status (`created`, `processing`, `success`, `failed`, `canceled`, `waitingForNext`, `stale`) |

## Example

```dart theme={null}
import 'package:portal_flutter/portal_flutter.dart';

final portal = Portal();

final response = await portal.yieldIntegrations.yieldxyz.exit(
  yieldId: 'aave-v3-usdc-ethereum',
  amount: '50.0',
);

print('Action ID: ${response.id}');
```

## Errors

| Code              | Description                   |
| ----------------- | ----------------------------- |
| `NOT_INITIALIZED` | Portal was not initialized    |
| `YIELD_FAILED`    | Failed to exit yield position |

## Related

* [Earn with Yield.xyz guide](../guide/yield-xyz)
* [yieldIntegrations.yieldxyz.enter](./yield-enter)
* [yieldIntegrations.yieldxyz.getBalances](./yield-getbalances)
* [yieldIntegrations.yieldxyz.track](./yield-track)
