Quick Start
Quick Start
Get up and running with wallet monitoring in just 5 minutes. This guide walks you through creating your first wallet and receiving transaction notifications.
Prerequisites
- A SanPay account (sign up here)
- An API key from the dashboard
-
Get Your API Key
Navigate to the Dashboard and create a new API key. You'll use this key to authenticate all API requests.
-
Create a Wallet
Create a wallet to organize your monitored addresses:
curl -X POST https://api.sanpay.io/v1/wallets \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "blockchain": "bitcoin", "label": "My First Wallet" }'const response = await fetch('https://api.sanpay.io/v1/wallets', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json', }, body: JSON.stringify({ blockchain: 'bitcoin', label: 'My First Wallet', }), }); const wallet = await response.json(); console.log('Wallet ID:', wallet.id);Response:
{ "id": "wal_abc123", "blockchain": "bitcoin", "label": "My First Wallet", "createdAt": "2024-01-15T10:30:00Z" } -
Generate an Address
Generate a new address within your wallet:
curl -X POST https://api.sanpay.io/v1/wallets/wal_abc123/addresses \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json"Response:
{ "id": "addr_xyz789", "address": "bc1qxy2kgdygjrsqvzq3rj...", "walletId": "wal_abc123", "createdAt": "2024-01-15T10:31:00Z" } -
Configure Webhooks
Set up a webhook endpoint to receive transaction notifications:
curl -X POST https://api.sanpay.io/v1/webhooks \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "url": "https://your-app.com/webhooks/sanpay", "events": ["transaction.detected", "transaction.confirmed"] }' -
Receive Notifications
When a transaction is detected or confirmed, you'll receive a webhook notification:
{ "event": "transaction.confirmed", "data": { "id": "tx_def456", "txHash": "abc123...", "address": "bc1qxy2kgdygjrsqvzq3rj...", "amount": "0.00150000", "confirmations": 6, "timestamp": "2024-01-15T10:45:00Z" } }
What's Next?
- API Reference – Complete API documentation
- Webhooks Guide – Deep dive into webhook handling
- Best Practices – Security and performance tips