> ## 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

> Create and manage wallets and wallet groups using Core API

## Wallet Groups

Wallet groups allow you to logically organize wallets for better management and organization.

### Create Wallet Group

Creates a new wallet group for organizing wallets.

```bash cURL icon="square-terminal" theme={null}
curl -X POST 'https://tee.magiclabs.com/v1/api/wallet_group' \
  -H 'Content-Type: application/json' \
  -H 'x-magic-secret-key: sk_live_XXXXXXXX' \
  -d '{
    "metadata": {
      "resource_id": "customer-resource-id"
    }
  }'
```

**Response:**

```json theme={null}
{
  "data": {
    "uuid": "7313a996-eb9c-4568-acef-f622a6b151fd",
    "time_created": 1709931542,
    "time_updated": 1709931542,
    "metadata": {
      "resource_id": "customer-resource-id"
    }
  }
}
```

#### Request Parameters

<ParamField body="metadata.resource_id" type="string" post={["Body"]}>
  Optional identifier for the wallet group. Useful for organizing wallets by customer, project, or environment.
</ParamField>

#### Response Fields

<ResponseField name="data.uuid" type="string">
  Unique identifier for the created wallet group. Use this when creating wallets.
</ResponseField>

<ResponseField name="data.time_created" type="integer">
  Unix timestamp (UTC) when the wallet group was created.
</ResponseField>

<ResponseField name="data.time_updated" type="integer">
  Unix timestamp (UTC) when the wallet group was last updated.
</ResponseField>

### List Wallet Groups

Retrieve all wallet groups for your application.

```bash cURL icon="square-terminal" theme={null}
curl -X GET 'https://tee.magiclabs.com/v1/api/wallet_groups' \
  -H 'x-magic-secret-key: sk_live_XXXXXXXX'
```

**Response:**

```json theme={null}
{
  "data": [
    {
      "uuid": "7313a996-eb9c-4568-acef-f622a6b151fd",
      "time_created": 1709931542,
      "time_updated": 1718035165,
      "metadata": {
        "resource_id": "customer-resource-id"
      }
    }
  ]
}
```

#### Response Fields

<ResponseField name="data" type="array">
  Array of wallet group objects, each containing the same fields as the create response.
</ResponseField>

## Wallet Management

### Create Wallet

Create a new wallet for a user. In v2, the wallet is cryptographically bound to the user's identity via `auth_jwt`. Returns an `access_key` that you must store securely for all subsequent operations.

```bash cURL icon="square-terminal" theme={null}
curl -X POST 'https://tee.magiclabs.com/v2/api/wallet' \
  -H 'Content-Type: application/json' \
  -H 'x-magic-secret-key: sk_live_XXXXXXXX' \
  -d '{
    "auth_jwt": "eyJhbGciOiJSUzI1NiIsImtpZCI6ImFiYzEyMyIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL2F1dGgueW91cmFwcC5jb20iLCJzdWIiOiJ1c2VyXzEyMzQ1NiIsImF1ZCI6Imh0dHBzOi8vdGVlLm1hZ2ljbGFicy5jb20iLCJpYXQiOjE3NTE2NzIwMDAsImV4cCI6MTc1MTY3MjMwMH0.SIGNATURE",
    "network": "mainnet",
    "wallet_group_id": "58a08494-3c83-439a-8a07-551f20xxxxxx",
    "metadata": {
      "resource_id": "customer-resource-id"
    }
  }'
```

**Response:**

```json theme={null}
{
  "data": {
    "uuid": "e982b4a3-14d3-4d66-a3ac-fadfc3ae1875",
    "time_created": 1709931542,
    "time_updated": null,
    "network": "mainnet",
    "wallet_group_id": "58a08494-3c83-439a-8a07-551f20xxxxxx",
    "metadata": {
      "resource_id": "customer-resource-id"
    },
    "key_type": "CORE",
    "public_address": "0x797063FB2e3C31a8b9a10D7EDF6dE612d6aE7Fde",
    "access_key": "ebf0e16c5c22cd734083c803562b5dc0"
  },
  "wallet_id": "e982b4a3-14d3-4d66-a3ac-fadfc3ae1875",
  "wallet_address": "0x797063FB2e3C31a8b9a10D7EDF6dE612d6aE7Fde"
}
```

#### Request Parameters

<ParamField body="auth_jwt" type="string" required post={["Body"]}>
  The user's JWT from your identity provider. The enclave binds the wallet to this identity at creation time.
</ParamField>

<ParamField body="network" type="string" required post={["Body"]}>
  Target blockchain network. Values: `BTC_MAINNET`, `BTC_TESTNET`, `BTC_REGTEST` for Bitcoin; `SOL_MAINNET`, `SOL_TESTNET` for Solana; all other values create an EVM wallet.
</ParamField>

<ParamField body="wallet_group_id" type="string" post={["Body"]}>
  UUID of the wallet group to organize this wallet under.
</ParamField>

<ParamField body="metadata.resource_id" type="string" post={["Body"]}>
  Optional identifier for the wallet (e.g., user ID, customer ID).
</ParamField>

#### Response Fields

<ResponseField name="data.uuid" type="string">
  Unique wallet identifier. Use this as `wallet_id` for all subsequent operations.
</ResponseField>

<ResponseField name="data.public_address" type="string">
  The wallet's public address on the specified network.
</ResponseField>

<ResponseField name="data.access_key" type="string">
  Key shard required for all signing and key-reveal operations. Store securely in your database.
</ResponseField>

<Warning>
  Store `access_key` securely in your database. Unlike v1, v2 wallets do not have a `recovery_key` — recovery is handled via your identity provider's JWT.
</Warning>
