Skip to content

Create Wallet

Create a new HD (Hierarchical Deterministic) wallet for a customer with BIP-39 mnemonic seed phrase.

Endpoint

POST /api/v1/wallet/customer/create

Authentication

Requires API key authentication via X-API-Key header.

Request Body

FieldTypeRequiredDescription
customer_idstringYesUnique identifier for your customer
word_countintegerNoMnemonic word count: 12 or 24 (default: 12)

Example Request

javascript
const response = await fetch('https://payments-api-dev-966260606560.europe-west2.run.app/api/v1/wallet/customer/create', {
  method: 'POST',
  headers: {
    'X-API-Key': 'your-api-key',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    customer_id: 'user_12345',
    word_count: 12
  })
});

const wallet = await response.json();
console.log('Wallet ID:', wallet.wallet_id);
console.log('Mnemonic:', wallet.mnemonic);
python
import requests

response = requests.post(
    'https://payments-api-dev-966260606560.europe-west2.run.app/api/v1/wallet/customer/create',
    headers={
        'X-API-Key': 'your-api-key',
        'Content-Type': 'application/json'
    },
    json={
        'customer_id': 'user_12345',
        'word_count': 12
    }
)

wallet = response.json()
print(f"Wallet ID: {wallet['wallet_id']}")
print(f"Mnemonic: {wallet['mnemonic']}")
bash
curl -X POST https://payments-api-dev-966260606560.europe-west2.run.app/api/v1/wallet/customer/create \
  -H "X-API-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "customer_id": "user_12345",
    "word_count": 12
  }'

Response

Success Response (200 OK)

FieldTypeDescription
customer_idstringCustomer identifier
wallet_idintegerWallet database ID
mnemonicarrayBIP-39 mnemonic phrase (array of words)
created_atstringISO 8601 timestamp
json
{
  "customer_id": "user_12345",
  "wallet_id": 42,
  "mnemonic": [
    "abandon", "ability", "able", "about", "above", "absent",
    "absorb", "abstract", "absurd", "abuse", "access", "accident"
  ],
  "created_at": "2026-01-03T04:00:00Z"
}

CAUTION

Critical Security Notice: The mnemonic is ONLY returned once during wallet creation. It is NEVER accessible again through any API endpoint. You must either:

  • Save it securely in your database (encrypted)
  • Display it to your user for backup
  • Both

Loss of the mnemonic means permanent loss of access to all derived wallets.

Error Responses

400 Bad Request

json
{
  "error": "invalid word count: must be 12 or 24"
}

409 Conflict

json
{
  "error": "customer user_12345 already has a wallet"
}

401 Unauthorized

json
{
  "error": "invalid API key"
}

500 Internal Server Error

json
{
  "error": "failed to create wallet: database error"
}

Best Practices

Wallet Management

  • Create one wallet per customer - wallets are reusable across all blockchain networks
  • Store the wallet_id in your database linked to the customer
  • Securely handle the mnemonic - encrypt before storage or prompt user to back it up
  • Use 24 words for enhanced security (256-bit entropy vs 128-bit)
  • Never log or transmit mnemonics through insecure channels

Next Steps

After creating a wallet:

  1. Derive addresses for specific blockchain networks
  2. Enable deposit monitoring for webhook notifications
  3. Display derived addresses to your users for deposits

Built with ❤️ by Rach Finance