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

# Create stablecoin wallet

> Create a unified balance, non-custodial stablecoin wallet.

**POST `/wallet/create`** creates a **non-custodial** stablecoin wallet: one unified balance across supported chains, with deposit addresses per network. You receive the **`private_key`** only in this response—store it securely; Switch cannot show it again later except via **POST `/wallet/export`** when you explicitly request recovery.

<Note>
  Use **GET `/asset`** to see which stablecoins support the wallet product (`wallet_supported`). See [Get stablecoins](/guides/get-stablecoins).
</Note>

## Example request

<CodeGroup>
  ```bash cURL theme={"dark"}
  curl https://api.onswitch.xyz/wallet/create \
    --request POST \
    --header 'Content-Type: application/json' \
    --header 'x-service-key: '"$YOUR_SERVICE_KEY" \
    --data '{
    "name": "My Wallet",
    "callback_url": "https://your-app.com/webhook"
  }'
  ```

  ```javascript Node.js theme={"dark"}
  const res = await fetch('https://api.onswitch.xyz/wallet/create', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'x-service-key': process.env.YOUR_SERVICE_KEY,
    },
    body: JSON.stringify({
      name: 'My Wallet',
      callback_url: 'https://your-app.com/webhook',
    }),
  });

  const json = await res.json();
  const data = json.data ?? {};
  console.log(data.id, Object.keys(data.address ?? {}));
  ```

  ```python Python theme={"dark"}
  import json
  import os
  import urllib.request

  payload = {
      "name": "My Wallet",
      "callback_url": "https://your-app.com/webhook",
  }

  req = urllib.request.Request(
      "https://api.onswitch.xyz/wallet/create",
      method="POST",
      data=json.dumps(payload).encode("utf-8"),
      headers={
          "Content-Type": "application/json",
          "x-service-key": os.environ["YOUR_SERVICE_KEY"],
      },
  )

  with urllib.request.urlopen(req, timeout=60) as r:
      out = json.load(r)
      data = out.get("data") or {}
      print(data.get("id"), list((data.get("address") or {}).keys()))
  ```
</CodeGroup>

## Frequently Asked Questions

<AccordionGroup>
  <Accordion title="Webhook URL" icon="webhook">
    Set **`callback_url`** to receive wallet-related notifications at your server. For general webhook behaviour and security practices, see [Webhooks](/webhook).

    ```json theme={"dark"}
    {
      "callback_url": "https://your-app.com/webhook"
    }
    ```
  </Accordion>

  <Accordion title="What to store" icon="database">
    After creation, store only **`data.id`** (for subsequent wallet related API calls) and **`data.private_key`** (for custody and signing) using your own secure storage. Store **`data.address`** if you want to show per-chain deposit addresses without calling **GET `/wallet/{wallet_id}`** again.
  </Accordion>
</AccordionGroup>

### Example response

```json theme={"dark"}
{
  "success": true,
  "message": "Wallet created successfully",
  "timestamp": "2026-04-01T12:00:00.000Z",
  "data": {
    "id": "699a6555fd4cab59e6175f79",
    "name": "My Wallet",
    "private_key": "0xb8ce59fc3717ada4c02eadf9682a9e934f625ebb",
    "address": {
      "BASE": "0xA3B3b28d8E3ec225f555f4AB9fC3607De545Ff49",
      "ETHEREUM": "0xA3B3b28d8E3ec225f555f4AB9fC3607De545Ff49",
      "POLYGON": "0xA3B3b28d8E3ec225f555f4AB9fC3607De545Ff49",
      "BSC": "0xA3B3b28d8E3ec225f555f4AB9fC3607De545Ff49",
      "ARBITRUM": "0xA3B3b28d8E3ec225f555f4AB9fC3607De545Ff49",
      "OPTIMISM": "0xA3B3b28d8E3ec225f555f4AB9fC3607De545Ff49",
      "GNOSIS": "0xA3B3b28d8E3ec225f555f4AB9fC3607De545Ff49",
      "AVALANCHE": "0xA3B3b28d8E3ec225f555f4AB9fC3607De545Ff49",
      "MONAD": "0xA3B3b28d8E3ec225f555f4AB9fC3607De545Ff49",
      "PLASMA": "0xA3B3b28d8E3ec225f555f4AB9fC3607De545Ff49",
      "LINEA": "0xA3B3b28d8E3ec225f555f4AB9fC3607De545Ff49",
      "MANTLE": "0xA3B3b28d8E3ec225f555f4AB9fC3607De545Ff49",
      "HYPEREVM": "0xA3B3b28d8E3ec225f555f4AB9fC3607De545Ff49",
      "BERACHAIN": "0xA3B3b28d8E3ec225f555f4AB9fC3607De545Ff49",
      "SONIC": "0xA3B3b28d8E3ec225f555f4AB9fC3607De545Ff49",
      "SOLANA": "2dTHot2BVjqqGD3S5Z2bzEVYnyEcJCdr9SawzqTdKo4h"
    },
    "note": "Do not share your private key. This key grants full control of your account."
  }
}
```

## Security

<Warning>
  The **`private_key`** is returned **only when the wallet is created**. Anyone with the key can move funds. Do not log it, embed it in client-side code, or send it over insecure channels. If you lose it and never exported a backup, recovery may not be possible.
</Warning>

## Need Help?

<CardGroup cols={2}>
  <Card title="Email Support" icon="mail" href="mailto:contact@onswitch.xyz">
    Send us a message.
  </Card>

  <Card title="Book a call" icon="calendar" href="https://calendly.com/contact-onswitch/30min">
    Hop on a call with us.
  </Card>
</CardGroup>
