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

# List Wallets

> Retrieve all Devdraft wallets associated with your application

The Get Wallets endpoint allows you to retrieve all Devdraft wallets associated with your application. Devdraft wallets are blockchain wallets that can hold and transact with various stablecoins across different supported networks.

## Endpoint Details

* **Method:** `GET`
* **URL:** `/api/v0/wallets`
* **Content-Type:** `application/json`

## Authentication

This endpoint requires API key authentication using both:

* `x-client-key`: Your application's client key
* `x-client-secret`: Your application's client secret

Include both headers in your request as shown in the examples below.

## Request

This endpoint doesn't require any request body or query parameters. The wallets returned are automatically filtered to only show wallets associated with your authenticated application.

## Response

### Success Response (200 OK)

<CodeGroup>
  ```json Response theme={null}
  {
    "data": [
      {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "bridge_id": "wa_devdraft123abc",
        "address": "0x742d35Cc6Ff82a8C2D8D1Da9da17c7eDfD5bE0a3",
        "chain": "base",
        "balances": [
          {
            "balance": "1000.50",
            "currency": "usdc",
            "chain": "base",
            "contract_address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
          },
          {
            "balance": "250.75",
            "currency": "eurc",
            "chain": "base",
            "contract_address": "0x60a3E35Cc302bfa44Cb288Bc5a4F316Fdb1adb42"
          }
        ],
        "created_at": "2024-01-15T10:30:00Z",
        "updated_at": "2024-01-20T14:45:00Z",
        "business": {
          "id": "bus_550e8400e29b41d4a716446655440000",
          "name": "Your Business Name"
        },
        "app": {
          "id": "app_123e4567e89b12d3a456426614174000",
          "name": "Your App Name"
        }
      },
      {
        "id": "660f9500-f30c-52e5-b827-557766551111",
        "bridge_id": "wa_devdraft456def",
        "address": "7xKXKRoBrJgCXVb2KhxZZzPHxYMJ4DpHWGQ8RvxS6JEq",
        "chain": "solana",
        "balances": [
          {
            "balance": "2500.00",
            "currency": "usdc",
            "chain": "solana",
            "contract_address": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
          }
        ],
        "created_at": "2024-01-18T09:15:00Z",
        "updated_at": "2024-01-20T16:30:00Z",
        "business": {
          "id": "bus_550e8400e29b41d4a716446655440000",
          "name": "Your Business Name"
        },
        "app": {
          "id": "app_123e4567e89b12d3a456426614174000",
          "name": "Your App Name"
        }
      }
    ]
  }
  ```
</CodeGroup>

### Response Fields

#### Wallet Object

| Field       | Type   | Description                                        |
| ----------- | ------ | -------------------------------------------------- |
| id          | string | Unique identifier for the wallet in our system     |
| bridge\_id  | string | Devdraft's internal Bridge wallet identifier       |
| address     | string | Blockchain address of the wallet                   |
| chain       | string | Blockchain network (see supported networks below)  |
| balances    | array  | Array of token balances in the wallet              |
| created\_at | string | ISO 8601 timestamp when wallet was created         |
| updated\_at | string | ISO 8601 timestamp when wallet was last updated    |
| business    | object | Business information associated with the wallet    |
| app         | object | Application information associated with the wallet |

#### Balance Object

| Field             | Type   | Description                                            |
| ----------------- | ------ | ------------------------------------------------------ |
| balance           | string | Token balance amount (as string to preserve precision) |
| currency          | string | Token currency (see supported currencies below)        |
| chain             | string | Blockchain network where this balance exists           |
| contract\_address | string | Smart contract address of the token                    |

## Supported Networks

Devdraft currently supports the following blockchain networks for wallets:

<Tabs>
  <Tab title="Layer 1 Networks">
    * **Ethereum** (`ethereum`) - Ethereum mainnet
    * **Solana** (`solana`) - Solana blockchain
    * **Polygon** (`polygon`) - Polygon (Matic) network
    * **Avalanche C-Chain** (`avalanche_c_chain`) - Avalanche C-Chain
    * **Tron** (`tron`) - Tron network
  </Tab>

  <Tab title="Layer 2 Networks">
    * **Base** (`base`) - Coinbase's Layer 2 network
    * **Arbitrum** (`arbitrum`) - Arbitrum One
    * **Optimism** (`optimism`) - Optimism mainnet
  </Tab>

  <Tab title="Other Networks">
    * **Stellar** (`stellar`) - Stellar network
  </Tab>
</Tabs>

## Supported Currencies

<AccordionGroup>
  <Accordion title="Stablecoins" icon="coins">
    * **USDC** (`usdc`) - USD Coin (available on all networks)
    * **EURC** (`eurc`) - Euro Coin (available on Ethereum, Solana, Base)
    * **USDT** (`usdt`) - Tether USD (available on Ethereum, Polygon, Tron)
    * **DAI** (`dai`) - Dai Stablecoin (available on Ethereum, Polygon)
    * **PYUSD** (`pyusd`) - PayPal USD (available on Ethereum)
  </Accordion>

  <Accordion title="Network-Specific Tokens" icon="link">
    * **ETH** (`eth`) - Ethereum (on Ethereum network)
    * **SOL** (`sol`) - Solana (on Solana network)
    * **MATIC** (`matic`) - Polygon (on Polygon network)
    * **AVAX** (`avax`) - Avalanche (on Avalanche C-Chain)
  </Accordion>
</AccordionGroup>

## Example Requests

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://api.devdraft.ai/api/v0/wallets" \
    -H "Content-Type: application/json" \
    -H "x-client-key: your_client_key_here" \
    -H "x-client-secret: your_client_secret_here"
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.devdraft.ai/api/v0/wallets', {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json',
      'x-client-key': 'your_client_key_here',
      'x-client-secret': 'your_client_secret_here'
    }
  });

  if (!response.ok) {
    throw new Error(`HTTP error! status: ${response.status}`);
  }

  const wallets = await response.json();
  console.log('Your wallets:', wallets);

  // Example: Find wallets by network
  const baseWallets = wallets.data.filter(wallet => wallet.chain === 'base');
  const solanaWallets = wallets.data.filter(wallet => wallet.chain === 'solana');

  // Example: Calculate total USDC balance across all wallets
  const totalUSDC = wallets.data.reduce((total, wallet) => {
    const usdcBalance = wallet.balances.find(balance => balance.currency === 'usdc');
    return total + (usdcBalance ? parseFloat(usdcBalance.balance) : 0);
  }, 0);

  console.log(`Total USDC across all wallets: ${totalUSDC}`);
  ```

  ```python Python theme={null}
  import requests

  url = "https://api.devdraft.ai/api/v0/wallets"
  headers = {
      'Content-Type': 'application/json',
      'x-client-key': 'your_client_key_here',
      'x-client-secret': 'your_client_secret_here'
  }

  response = requests.get(url, headers=headers)

  if response.status_code == 200:
      wallets = response.json()
      print("Your wallets:", wallets)
      
      # Example: Find wallets by network
      base_wallets = [w for w in wallets['data'] if w['chain'] == 'base']
      solana_wallets = [w for w in wallets['data'] if w['chain'] == 'solana']
      
      # Example: Calculate total USDC balance
      total_usdc = 0
      for wallet in wallets['data']:
          for balance in wallet['balances']:
              if balance['currency'] == 'usdc':
                  total_usdc += float(balance['balance'])
      
      print(f"Total USDC across all wallets: {total_usdc}")
  else:
      print(f"Error: {response.status_code}")
      print(response.text)
  ```

  ```php PHP theme={null}
  <?php
  $curl = curl_init();

  curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://api.devdraft.ai/api/v0/wallets',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => array(
      'Content-Type: application/json',
      'x-client-key: your_client_key_here',
      'x-client-secret: your_client_secret_here'
    ),
  ));

  $response = curl_exec($curl);
  $httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
  curl_close($curl);

  if ($httpCode === 200) {
      $wallets = json_decode($response, true);
      print_r($wallets);
      
      // Example: Calculate total USDC balance
      $totalUSDC = 0;
      foreach ($wallets['data'] as $wallet) {
          foreach ($wallet['balances'] as $balance) {
              if ($balance['currency'] === 'usdc') {
                  $totalUSDC += floatval($balance['balance']);
              }
          }
      }
      
      echo "Total USDC across all wallets: $totalUSDC\n";
  } else {
      echo "Error: " . $httpCode . "\n";
      echo $response;
  }
  ?>
  ```
</CodeGroup>

## Error Responses

<CodeGroup>
  ```json 401 Unauthorized theme={null}
  {
    "statusCode": 401,
    "message": "Invalid API credentials",
    "error": "Unauthorized"
  }
  ```

  ```json 403 Forbidden theme={null}
  {
    "statusCode": 403,
    "message": "Insufficient permissions to access wallets",
    "error": "Forbidden"
  }
  ```

  ```json 500 Internal Server Error theme={null}
  {
    "statusCode": 500,
    "message": "Failed to retrieve wallets",
    "error": "Internal Server Error"
  }
  ```
</CodeGroup>

## Wallet Management

<AccordionGroup>
  <Accordion title="Wallet Types" icon="wallet">
    * **App Wallets**: Associated with your application, created automatically
    * **Client Wallets**: Associated with specific customers/clients
    * **Treasury Wallets**: Used for internal fund management
  </Accordion>

  <Accordion title="Balance Updates" icon="arrows-rotate">
    * **Real-time**: Balances are fetched in real-time from blockchain networks
    * **Multi-network**: Wallets can hold tokens across multiple networks
    * **Precision**: All amounts returned as strings to preserve decimal precision
  </Accordion>

  <Accordion title="Security Features" icon="shield">
    * **Application Scoping**: Only your app's wallets are returned
    * **Rate Limiting**: Standard rate limits apply (see rate limiting docs)
    * **Audit Trail**: All wallet operations are logged for compliance
  </Accordion>
</AccordionGroup>

## Important Notes

<Warning>
  **Balance Precision**: All balance amounts are returned as strings to preserve decimal precision and avoid floating-point arithmetic issues in your application.
</Warning>

<Info>
  **Real-time Data**: The wallet balances are fetched in real-time from the blockchain networks, ensuring you always get the most current balance information.
</Info>

<Tip>
  **Performance**: Consider caching wallet data for frequently accessed information, but always fetch fresh data for transaction-critical operations.
</Tip>

## Use Cases

<CardGroup cols={2}>
  <Card title="Portfolio Overview" icon="chart-pie">
    Display all wallet balances to users in a dashboard
  </Card>

  <Card title="Asset Management" icon="coins">
    Track stablecoin holdings across different networks
  </Card>

  <Card title="Transaction Planning" icon="route">
    Check available balances before initiating transfers
  </Card>

  <Card title="Reporting" icon="file-chart-column">
    Generate financial reports and statements
  </Card>

  <Card title="Monitoring" icon="chart-line">
    Monitor wallet activity and balance changes
  </Card>

  <Card title="Multi-Chain Strategy" icon="link">
    Manage cross-chain liquidity and optimization
  </Card>
</CardGroup>

## Next Steps

After retrieving your wallets, you can:

<Steps>
  <Step title="Analyze Portfolio">
    Review balances across different networks and currencies
  </Step>

  <Step title="Plan Transactions">
    Use wallet addresses and balances for transfer planning
  </Step>

  <Step title="Monitor Changes">
    Set up monitoring for balance changes and transactions
  </Step>

  <Step title="Integrate Dashboard">
    Display wallet data in your application's user interface
  </Step>
</Steps>

## Related Endpoints

* `POST /api/v0/transfers/direct-wallet` - Create wallet-to-wallet transfer
* `POST /api/v0/transfers/stablecoin-conversion` - Convert between stablecoins
* `GET /api/v0/transfers/{id}` - Check transfer status
* `POST /api/v0/webhooks` - Set up wallet balance notifications
