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

# Wallets

> Create and manage server-managed wallets with the Camino Treasury API

## Overview

Server-managed Ethereum wallets. Camino Treasury holds the keys and can sign transactions on your behalf. Each organization can create multiple wallets with labels.

## Prerequisites

* An API key from the [Camino Treasury dashboard](https://app.caminotreasury.com)

<Note>
  API keys are scoped to a single organization. All wallets and data returned are isolated to that organization.
</Note>

## List Wallets

Optional query params: `sort` (`created_at` or `label`, default `created_at`) and `order` (`asc` or `desc`, default `asc`).

```javascript theme={null}
const response = await fetch('https://api.caminotreasury.com/v1/wallets', {
  headers: { 'x-api-key': 'your-api-key' }
});

const { data, count } = await response.json();
// {
//   "data": [
//     {
//       "address": "0x742d35cc6634c0532925a3b844bc454e4438f44e",
//       "label": "Main Treasury",
//       "createdAt": "2024-01-15T10:30:00.000Z",
//       "updatedAt": "2024-01-15T10:30:00.000Z"
//     }
//   ],
//   "count": 1
// }
```

Wallets are identified by their on-chain `address` across every endpoint.

## Get a Single Wallet

```javascript theme={null}
const address = '0x742d35cc6634c0532925a3b844bc454e4438f44e';
const response = await fetch(`https://api.caminotreasury.com/v1/wallets/${address}`, {
  headers: { 'x-api-key': 'your-api-key' }
});

const wallet = await response.json();
// {
//   "address": "0x742d35cc6634c0532925a3b844bc454e4438f44e",
//   "label": "Main Treasury",
//   "createdAt": "2024-01-15T10:30:00.000Z",
//   "updatedAt": "2024-01-15T10:30:00.000Z"
// }
```

Returns 404 if the wallet doesn't exist or belongs to another organization. Returns 400 if the address doesn't match `^0x[a-fA-F0-9]{40}$`.

## Create a Wallet

Create a new server-managed wallet. The address is generated automatically.

```javascript theme={null}
const response = await fetch('https://api.caminotreasury.com/v1/wallets', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': 'your-api-key'
  },
  body: JSON.stringify({
    label: 'Deposit Wallet'
  })
});

const wallet = await response.json();
// {
//   "address": "0x742d35cc6634c0532925a3b844bc454e4438f44e",
//   "label": "Deposit Wallet",
//   "createdAt": "2024-01-16T08:00:00.000Z",
//   "updatedAt": "2024-01-16T08:00:00.000Z"
// }
```

### Auto-labeled wallets

If you omit `label` (or send an empty body), the server assigns `Wallet N` where N is the next number for your organization. The counter includes deleted wallets so numbers are never reused.

```javascript theme={null}
// Both forms create a wallet labeled "Wallet 1" (assuming an empty org)
await fetch('https://api.caminotreasury.com/v1/wallets', {
  method: 'POST',
  headers: { 'x-api-key': 'your-api-key' },
});

// Or with an empty JSON body
await fetch('https://api.caminotreasury.com/v1/wallets', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': 'your-api-key',
  },
  body: '{}',
});
```

You can rename any wallet later via [Update a Wallet](#update-a-wallet).

| Field   | Type                           | Description                                                     |
| ------- | ------------------------------ | --------------------------------------------------------------- |
| `label` | string (optional, 1–100 chars) | Human-readable name. If omitted, the server assigns `Wallet N`. |

## Update a Wallet

Renames a wallet. `label` is the only updatable field — the address is permanent.

```javascript theme={null}
const address = '0x742d35cc6634c0532925a3b844bc454e4438f44e';
const response = await fetch(`https://api.caminotreasury.com/v1/wallets/${address}`, {
  method: 'PATCH',
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': 'your-api-key'
  },
  body: JSON.stringify({
    label: 'Updated Name'
  })
});

const wallet = await response.json();
// Returns the full updated wallet (same shape as Get a Single Wallet).
```

Returns 404 if the wallet doesn't exist or belongs to another organization. Returns 400 if the address is malformed or `label` is missing/empty/oversized.

## Wallet Fields

| Field       | Type           | Description                                                                  |
| ----------- | -------------- | ---------------------------------------------------------------------------- |
| `address`   | string         | Ethereum wallet address (lowercase). Identifier across all wallet endpoints. |
| `label`     | string \| null | Human-readable name                                                          |
| `createdAt` | string         | ISO 8601 timestamp                                                           |
| `updatedAt` | string         | ISO 8601 timestamp                                                           |

## Next Steps

<CardGroup cols={2}>
  <Card title="Deposit and Start Earning" icon="arrow-up-right" href="/guides/deposit-and-earn">
    Deposit USDC into C0 and start earning yield
  </Card>

  <Card title="Platform Overview" icon="book-open" href="/get-started/platform-overview">
    Learn how Camino Treasury is organized
  </Card>
</CardGroup>
