Skip to content

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
  1. Get Your API Key

    Navigate to the Dashboard and create a new API key. You'll use this key to authenticate all API requests.

  2. 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"
      }'

    Response:

    {
      "id": "wal_abc123",
      "blockchain": "bitcoin",
      "label": "My First Wallet",
      "createdAt": "2024-01-15T10:30:00Z"
    }
  3. 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"
    }
  4. 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"]
      }'
  5. 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?