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

# Asset Recovery

> Asset Recovery provides a secure mechanism to transfer all assets from a compromised or lost wallet to a designated safe wallet. This critical feature ensures business continuity and fund security in emergency situations.

## Overview

```
flowchart LR
subgraph Source["Source Wallet (Compromised/Lost)"]
Assets[All Assets\nETH, USDC, USDT, etc.]
end

subgraph Recovery["Asset Recovery Process"]
Validate[Validate Ownership]
Transfer[Bulk Transfer]
Confirm[Confirmation]
end

subgraph Destination["Destination Wallet (Safe)"]
Safe[Designated Safe Wallet]
end

Assets --> Validate --> Transfer --> Confirm --> Safe
```

## Why Asset Recovery?

<CardGroup cols={2}>
  <Card title="🚨 Emergency Response" icon="alert">
    Quickly secure funds when a wallet is compromised or keys are lost
  </Card>

  <Card title="⚡ One-Click Recovery" icon="zap">
    Single operation to move all assets from source to destination wallet
  </Card>

  <Card title="🔒 Secure Transfer" icon="shield">
    All transfers are secure, audited, and require proper authentication
  </Card>

  <Card title="📊 Audit Trail" icon="document">
    Complete record of recovery operations for compliance
  </Card>

  <Card title="🌐 Multi-Asset" icon="globe">
    Recover all supported assets across multiple blockchains
  </Card>

  <Card title="🎯 Precision Control" icon="target">
    Recover specific assets or entire wallet contents
  </Card>
</CardGroup>

## When to Use Asset Recovery

### Emergency Scenarios

| Scenario                    | Action                            | Priority |
| --------------------------- | --------------------------------- | -------- |
| **Private key compromised** | Immediate recovery to safe wallet | Critical |
| **Team member departure**   | Recover assets from their wallets | High     |
| **Suspicious activity**     | Move funds to secure location     | Critical |
| **Wallet sunsetting**       | Consolidate before deactivation   | Medium   |
| **Security audit**          | Temporary fund relocation         | Low      |

### Recovery Triggers

```
flowchart TD
Trigger[Recovery Trigger] --> Type{Trigger Type}

| Type --> | Manual | Manual[Admin Initiated] |
| -------- | ------ | ----------------------- |

Manual --> Human[Human Review Required]
Auto --> Conditions{Conditions Met?}

| Conditions --> | Yes | Execute[Execute Recovery] |
| -------------- | --- | ------------------------- |

Human --> Execute
Execute --> Complete[Recovery Complete]
```

## Prerequisites

Before performing asset recovery, ensure:

* ✅ You have a **destination wallet** (safe wallet) configured
* ✅ You have **proper authentication** (API key with recovery permissions)
* ✅ The **source wallet** is accessible (even if compromised)
* ✅ You understand which **assets** will be recovered
* ✅ You have **notified relevant stakeholders**

## Recovery Process

```
sequenceDiagram
participant Admin
participant API as XentFi API
participant Source as Source Wallet
participant Dest as Destination Wallet
participant Audit as Audit Log

Admin->>API: Initiate asset recovery
API->>API: Validate permissions
API->>Source: Check wallet ownership
Source-->>API: Ownership confirmed

API->>Source: Get all asset balances
Source-->>API: Return balances

API->>API: Calculate gas requirements

loop For Each Asset
API->>Source: Transfer asset
Source->>Dest: Send funds
Dest-->>API: Transfer confirmed
end

API->>Audit: Log recovery details
API-->>Admin: Recovery complete
```

## Performing Asset Recovery

### Recover All Assets

<CodeGroup>
  ```
  curl -X POST https://api.xentfi.com/v1/wallets/{walletId}/recover \
  -H "apiKey: your-api-key" \
  -H "orgId: your-org-id" \
  -H "Content-Type: application/json" \
  -d '{
  "destinationWalletId": "safe-wallet-id",
  "recoverAll": true
  }'
  ```
</CodeGroup>

<CodeGroup>
  ```
  {

  "data": {
  "recoveryId": "rec_123e4567-e89b-12d3-a456-426614174000",
  "sourceWalletId": "source-wallet-id",
  "destinationWalletId": "safe-wallet-id",
  "status": "processing",
  "assets": [
  {
  "symbol": "ETH",
  "amount": "1.5",
  "status": "completed",
  "transactionHash": "0xabc123..."
  },
  {
  "symbol": "USDC",
  "amount": "5000",
  "status": "completed",
  "transactionHash": "0xdef456..."
  },
  {
  "symbol": "USDT",
  "amount": "3000",
  "status": "pending",
  "transactionHash": null
  }
  ],
  "startedAt": "2024-01-15T10:30:00.000Z"
  }
  }
  ```
</CodeGroup>

### Recover Specific Assets

```
curl -X POST https://api.xentfi.com/v1/wallets/{walletId}/recover \
-H "apiKey: your-api-key" \
-H "orgId: your-org-id" \
-H "Content-Type: application/json" \
-d '{
"destinationWalletId": "safe-wallet-id",
"assets": ["ETH", "USDC"],
"skipZeroBalances": true
}'
```

### Dry Run Recovery (Simulation)

```
curl -X POST https://api.xentfi.com/v1/wallets/{walletId}/recover/dry-run \
-H "apiKey: your-api-key" \
-H "orgId: your-org-id" \
-H "Content-Type: application/json" \
-d '{
"destinationWalletId": "safe-wallet-id"
}'
```

<CodeGroup>
  ```
  {

  "data": {
  "recoverableAssets": [
  {
  "symbol": "ETH",
  "amount": "1.5",
  "estimatedGas": "0.002",
  "estimatedValue": "5250"
  },
  {
  "symbol": "USDC",
  "amount": "5000",
  "estimatedGas": "0.0005",
  "estimatedValue": "5000"
  }
  ],
  "totalEstimatedGas": "0.0025",
  "totalEstimatedValue": "10250"
  }
  }
  ```
</CodeGroup>

## Recovery Status

### Status Tracking

| Status       | Description                 | Next Action           |
| ------------ | --------------------------- | --------------------- |
| `pending`    | Recovery initiated, waiting | Monitor progress      |
| `processing` | Transfers in progress       | Wait for completion   |
| `completed`  | All assets recovered        | Verify destination    |
| `partial`    | Some assets recovered       | Retry failed assets   |
| `failed`     | Recovery failed             | Investigate and retry |

### Check Recovery Status

```
curl -X GET https://api.xentfi.com/v1/recovery/{recoveryId} \
-H "apiKey: your-api-key" \
-H "orgId: your-org-id"
```

## Recovery Best Practices

<Info>
  * **Designate safe wallets** - Configure dedicated safe wallets before emergencies
  * **Test recovery process** - Perform dry runs regularly
  * **Document procedures** - Create runbooks for recovery scenarios
  * **Limit permissions** - Restrict recovery to authorized personnel only
  * **Audit regularly** - Review recovery logs for suspicious activity
  * **Notify stakeholders** - Alert team when recovery is initiated
</Info>

## Security Considerations

| Risk                     | Mitigation                            |
| ------------------------ | ------------------------------------- |
| Unauthorized recovery    | Multi-signature approval for recovery |
| Wrong destination wallet | Wallet address whitelisting           |
| Partial recovery         | Automatic retry for failed transfers  |
| Gas price spikes         | Configurable gas limits               |
| Network congestion       | Queue and retry mechanism             |

## Recovery Configuration

### Safe Wallet Setup

```
{
"safeWalletId": "safe-wallet-id",
"name": "Emergency Safe Wallet",
"blockchain": "eth-mainnet",
"address": "0xSafeWalletAddress...",
"isActive": true,
"requiresApproval": true,
"approvers": ["admin1@company.com", "admin2@company.com"]
}
```

### Approval Workflow

```
stateDiagram-v2
[*] --> Requested: Admin requests recovery
Requested --> Approved: 2+ approvers approve
Requested --> Rejected: Any approver rejects
Approved --> Executed: Recovery executed
Rejected --> [*]
Executed --> [*]
```

## Webhook Events

| Event                      | Trigger              | Payload contains                 |
| -------------------------- | -------------------- | -------------------------------- |
| `recovery.started`         | Recovery initiated   | Recovery ID, source, destination |
| `recovery.asset.completed` | Asset transferred    | Asset details, transaction hash  |
| `recovery.asset.failed`    | Transfer failed      | Asset, error reason              |
| `recovery.completed`       | All assets recovered | Summary of transfers             |
| `recovery.failed`          | Recovery failed      | Error details                    |

## Troubleshooting

<AccordionGroup>
  <Accordion title="Insufficient gas for recovery">
    **Solution:** Ensure source wallet has enough native tokens (ETH, MATIC, etc.) for gas fees. Add gas funds if needed.
  </Accordion>

  <Accordion title="Recovery stuck in processing">
    **Possible causes:**

    * Network congestion
    * Gas price too low
    * Destination wallet issues

    **Solution:** Monitor transaction status and retry if needed.
  </Accordion>

  <Accordion title="Partial recovery only">
    **Solution:**

    * Check which assets failed
    * Verify destination supports those assets
    * Retry failed assets individually
  </Accordion>
</AccordionGroup>

## Pricing

| Feature            | Starter | Professional | Business | Enterprise |
| ------------------ | ------- | ------------ | -------- | ---------- |
| Asset recovery     | ❌       | ✅            | ✅        | ✅          |
| Dry run simulation | ❌       | ✅            | ✅        | ✅          |
| Approval workflow  | ❌       | ❌            | ✅        | ✅          |
| Priority execution | ❌       | ❌            | ✅        | ✅          |
| Recovery webhooks  | ❌       | ✅            | ✅        | ✅          |

## Related Products

<CardGroup cols={3}>
  <Card title="Master Wallets" icon="wallet" href="/essentials/master-wallets">
    Source and destination wallet management
  </Card>

  <Card title="Security" icon="shield" href="/essentials/security">
    Security best practices
  </Card>

  <Card title="Webhooks" icon="webhook" href="/essentials/webhooks">
    Recovery event notifications
  </Card>
</CardGroup>
