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

# Update Wallet

> PATCH /v1/wallets/:walletId — Update wallet metadata

<Note>
  **Endpoint:** `PATCH https://api.rebelfi.io/v1/wallets/:walletId`
</Note>

Update a wallet's metadata fields. Only provided fields are updated.

### Path Parameters

| Parameter  | Type     | Required | Description |
| ---------- | -------- | -------- | ----------- |
| `walletId` | `number` | Yes      | Wallet ID   |

### Request Body

| Field         | Type     | Required | Description                    |
| ------------- | -------- | -------- | ------------------------------ |
| `userId`      | `string` | No       | External user ID               |
| `orgMetadata` | `object` | No       | Organization-specific metadata |

### Example Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PATCH "https://api.rebelfi.io/v1/wallets/42" \
    -H "x-api-key: your_api_key" \
    -H "Content-Type: application/json" \
    -d '{
      "orgMetadata": { "plan": "enterprise", "tier": 2 }
    }'
  ```

  ```typescript SDK theme={null}
  const wallet = await client.wallets.update(42, {
    orgMetadata: { plan: 'enterprise', tier: 2 }
  });
  ```
</CodeGroup>

### Example Response

```json theme={null}
{
  "walletId": 42,
  "walletAddress": "So11...abc",
  "blockchain": "solana",
  "userId": "user-123",
  "orgMetadata": { "plan": "enterprise", "tier": 2 },
  "createdAt": "2024-01-15T10:30:00.000Z"
}
```

### orgMetadata Behavior

The `orgMetadata` field performs a **full replace** of existing metadata. To preserve existing keys, include all desired keys in the request. Setting `orgMetadata` to `{}` clears all metadata.

### Errors

| Code               | Description                        |
| ------------------ | ---------------------------------- |
| `WALLET_NOT_FOUND` | Wallet with given ID doesn't exist |
