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

# Wallet Operations

> API reference for UOA wallet signing and withdrawal operations.

## Authentication

All endpoints require the following headers unless otherwise noted:

<ParamField header="Authorization" type="string" required>
  Bearer token (JWT) for end-user authentication. Format: `Bearer YOUR_JWT_TOKEN`
</ParamField>

<ParamField header="X-MAGIC-SECRET-KEY" type="string" required>
  Your Magic secret key for application-level authentication.
</ParamField>

***

## Sign Data

Sign data with the authenticated user's Magic wallet.

```bash cURL icon="square-terminal" theme={null}
curl -X POST 'https://uoa-server.magic.xyz/wallet/sign' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer USER_JWT_TOKEN' \
  -H 'X-MAGIC-SECRET-KEY: YOUR_MAGIC_SECRET_KEY' \
  -d '{
    "message": "Hello, world!"
  }'
```

**Response:**

```json theme={null}
{
  "success": true,
  "signature": "0xabcdef1234567890...",
  "raw_data_hash": "0x1234567890abcdef...",
  "app_user_id": "user-123"
}
```

### Request Parameters

<ParamField body="raw_data_hash" type="string">
  A `0x`-prefixed hex hash to sign directly. Provide either this or `message`.
</ParamField>

<ParamField body="message" type="string">
  A plain text message to hash (keccak256) and sign. Provide either this or `raw_data_hash`.
</ParamField>

<Warning>
  You must provide `raw_data_hash` or `message`. If both are provided, `raw_data_hash` is signed.
</Warning>

### Response Fields

<ResponseField name="success" type="boolean">
  Whether the signing operation completed successfully.
</ResponseField>

<ResponseField name="signature" type="string">
  The hex-encoded signature.
</ResponseField>

<ResponseField name="raw_data_hash" type="string">
  The hash that was signed.
</ResponseField>

<ResponseField name="app_user_id" type="string">
  The user identifier from your application.
</ResponseField>

***

## Withdraw to External Address

Send funds from the authenticated user's Magic wallet to an external address.

```bash cURL icon="square-terminal" theme={null}
curl -X POST 'https://uoa-server.magic.xyz/withdraw' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer USER_JWT_TOKEN' \
  -H 'X-MAGIC-SECRET-KEY: YOUR_MAGIC_SECRET_KEY' \
  -d '{
    "to_address": "0xRecipientAddress...",
    "amount": "50",
    "token": "USDC",
    "chain": "ARB"
  }'
```

**Response:**

`message` is generated by the server (success text includes amount, token, and chain, and notes EIP-7702 gas-sponsored sends when applicable). `tx_hash` is an EVM transaction hash (`0x…`) or a Solana signature string depending on `chain`.

```json theme={null}
{
  "success": true,
  "tx_hash": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890",
  "from_address": "0x1234567890abcdef1234567890abcdef12345678",
  "to_address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
  "amount": "50",
  "token": "USDC",
  "chain": "ARB",
  "message": "Successfully sent 50 USDC on ARB"
}
```

### Request Parameters

<ParamField body="to_address" type="string" required>
  The recipient wallet address. EVM destinations are normalized to checksummed hex; Solana addresses are validated as base58.
</ParamField>

<ParamField body="amount" type="string" required>
  The amount to withdraw as a decimal string.
</ParamField>

<ParamField body="token" type="string" default="USDC">
  The token to withdraw. Values: `ETH`, `USDC`, `USDC.E`, `POL`, `SOL`
</ParamField>

<ParamField body="chain" type="string" default="ARB">
  The chain to withdraw on. Values: `ETH`, `ARB`, `POL`, `SOL`, `INK`
</ParamField>

<ParamField body="gas_sponsored" type="boolean" default="false">
  Request gas-sponsored execution for **EVM** withdrawals when supported (Alchemy EIP-7702 path). Ignored for Solana (`should_sponsor_gas` is false on SOL).
</ParamField>

### Supported Token/Chain Combinations

| Chain | Supported Tokens  |
| ----- | ----------------- |
| ETH   | ETH, USDC         |
| ARB   | ETH, USDC, USDC.E |
| POL   | POL, USDC, USDC.E |
| SOL   | SOL, USDC         |
| INK   | ETH, USDC         |

### Response Fields

<ResponseField name="success" type="boolean">
  Whether the withdrawal was executed successfully.
</ResponseField>

<ResponseField name="tx_hash" type="string">
  The on-chain transaction identifier (EVM: `0x` tx hash; Solana: base58 signature).
</ResponseField>

<ResponseField name="from_address" type="string">
  The sender's wallet address.
</ResponseField>

<ResponseField name="to_address" type="string">
  The recipient's wallet address after server-side normalization.
</ResponseField>

<ResponseField name="amount" type="string">
  The amount withdrawn.
</ResponseField>

<ResponseField name="token" type="string">
  The token that was withdrawn.
</ResponseField>

<ResponseField name="chain" type="string">
  The chain the withdrawal was executed on.
</ResponseField>

<ResponseField name="message" type="string">
  Human-readable status message describing the completed withdrawal.
</ResponseField>
