> For the complete documentation index, see [llms.txt](https://docs.bloclabs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bloclabs.com/api/wallet-api/management-api.md).

# Management API

## Wallet Management API

### Overview

Endpoints for creating and managing different types of blockchain wallets.

### Create Wallet

Create a new wallet with specified type and network.

```bash
POST api.bloclabs.com/v1/wallets/create
```

#### Request

```json
{
    "type": "mpc",              // "mpc", "hd", "imported"
    "network": "ethereum",      // "ethereum", "polygon", "binance"
    "label": "Trading Wallet",  // Optional wallet label
    "environment": "mainnet"    // "mainnet", "testnet"
}
```

#### Response

```json
{
    "status": "success",
    "data": {
        "wallet_id": "wallet_xyz123",
        "address": "0x123...abc",
        "type": "mpc",
        "network": "ethereum",
        "label": "Trading Wallet",
        "created_at": "2024-03-15T10:00:00Z"
    }
}
```

### Add Watch Wallet

Add a watch-only wallet for monitoring addresses.

```bash
POST api.bloclabs.com/v1/wallets/watch
```

#### Request

```json
{
    "address": "0x789...def",
    "network": "ethereum",
    "label": "Investment Tracker",
    "notifications": {
        "large_transfers": true,
        "incoming_transactions": true
    }
}
```

#### Response

```json
{
    "status": "success",
    "data": {
        "wallet_id": "watch_abc456",
        "address": "0x789...def",
        "type": "watch",
        "network": "ethereum",
        "label": "Investment Tracker"
    }
}
```

### Get User Wallets

Retrieve all wallets associated with the user.

```bash
GET api.bloclabs.com/v1/wallets
```

#### Query Parameters

```json
{
    "network": "ethereum",  // Optional: Filter by network
    "type": "mpc",         // Optional: Filter by wallet type
    "limit": 10,           // Optional: Number of results (default: 10)
    "offset": 0           // Optional: Pagination offset (default: 0)
}
```

#### Response

```json
{
    "status": "success",
    "data": {
        "wallets": [
            {
                "wallet_id": "wallet_xyz123",
                "address": "0x123...abc",
                "type": "mpc",
                "network": "ethereum",
                "label": "Trading Wallet",
                "balance": "1.5 ETH"
            }
        ],
        "pagination": {
            "total": 5,
            "limit": 10,
            "offset": 0
        }
    }
}
```

### Get Wallet Details

Retrieve detailed information about a specific wallet.

```bash
GET api.bloclabs.com/v1/wallets/{wallet_id}
```

#### Response

```json
{
    "status": "success",
    "data": {
        "wallet_id": "wallet_xyz123",
        "address": "0x123...abc",
        "type": "mpc",
        "network": "ethereum",
        "label": "Trading Wallet",
        "balance": "1.5 ETH",
        "created_at": "2024-03-15T10:00:00Z",
        "last_activity": "2024-03-15T15:30:00Z",
        "status": "active",
        "security": {
            "requires_2fa": true,
            "biometric_enabled": true
        }
    }
}
```

### Delete Wallet

Remove a wallet from your account.

```bash
DELETE api.bloclabs.com/v1/wallets/{wallet_id}
```

#### Request

```json
{
    "confirmation": true,
    "delete_reason": "no longer needed"  // Optional
}
```

#### Response

```json
{
    "status": "success",
    "message": "Wallet successfully deleted",
    "data": {
        "wallet_id": "wallet_xyz123",
        "deleted_at": "2024-03-15T16:00:00Z"
    }
}
```

### Error Responses

#### Invalid Request

```json
{
    "status": "error",
    "message": "Invalid request parameters",
    "errors": [
        {
            "field": "network",
            "message": "Unsupported network specified"
        }
    ]
}
```

#### Wallet Not Found

```json
{
    "status": "error",
    "message": "Wallet not found",
    "code": "WALLET_NOT_FOUND"
}
```

#### Authorization Error

```json
{
    "status": "error",
    "message": "Unauthorized access",
    "code": "UNAUTHORIZED"
}
```

### Notes

* All requests require authentication via Bearer token
* Rate limits apply to all endpoints
* Wallet IDs are unique and immutable
* Watch wallets can't perform transactions
