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

# Quickstart

> Get started with StablePay in 5 minutes

This guide walks you through your first StablePay integration — from creating a user to completing an offramp transaction.

## Prerequisites

* A StablePay partner account with API keys
* A webhook endpoint to receive notifications
* Sandbox environment for testing

## Step 1: Create a User

Register a user who will transact on your platform:

```bash theme={null}
curl -X POST https://api.stablepay.global/v2/users \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Rahul Kumar",
    "mobile": "+919876543210",
    "email": "rahul@example.com"
  }'
```

```json theme={null}
{
  "success": true,
  "data": {
    "userId": "usr_abc123",
    "depositAddresses": {
      "evm": "0x742d35Cc6634C0532925a3b844Bc9e7595f3A123",
      "tron": "TN7FbQz9Mwi4pPYkXRmpVMaccut3Fk8BBB"
    },
    "kycStatus": "pending"
  }
}
```

## Step 2: Complete KYC

Complete identity verification before transacting. See the [KYC Flow guide](/guides/kyc-flow) for details.

## Step 3: Create a Transaction

Once KYC is verified, create a transaction:

```bash theme={null}
curl -X POST https://api.stablepay.global/v2/transactions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 550e8400-e29b-41d4-a716-446655440000" \
  -d '{
    "type": "sell",
    "userId": "usr_abc123",
    "amount": "100",
    "asset": "USDT",
    "network": "polygon"
  }'
```

```json theme={null}
{
  "success": true,
  "data": {
    "transactionId": "txn_xyz789",
    "depositAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f3A123",
    "depositNetwork": "polygon",
    "depositAsset": "USDT",
    "expectedAmount": "100",
    "quote": {
      "exchangeRate": 84.50,
      "grossInr": "8450.00",
      "netInr": "8407.75"
    },
    "expiresAt": "2025-06-16T10:30:00Z"
  }
}
```

## Step 4: Deposit & Payout

The user sends USDT to the deposit address. StablePay detects it automatically and initiates the INR payout once confirmations are met.

You'll receive webhooks at each step:

```
transaction.deposit_detected  → Deposit seen on blockchain
transaction.deposit_confirmed → Required confirmations met
transaction.payout_completed  → INR delivered to user's bank
```

## Alternative: Pool Settlement

If you manage liquidity centrally, use `pool_settlement` instead:

```bash theme={null}
# Sweep from your pool wallet
curl -X POST https://api.stablepay.global/v2/transactions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: unique-key-123" \
  -d '{ "type": "pool_settlement", "userId": "usr_abc123", "amount": "100", "asset": "USDT", "network": "tron" }'

# After sweep confirmed (via webhook), trigger payout
curl -X POST https://api.stablepay.global/v2/transactions/txn_xyz789/payout \
  -H "Authorization: Bearer YOUR_API_KEY"
```

See the [Pool Settlement guide](/guides/pool-settlement) for details.

## What's Next

<CardGroup cols={2}>
  <Card title="How It Works" icon="gears" href="/guides/how-it-works">
    Understand the full architecture
  </Card>

  <Card title="KYC Flow" icon="user-check" href="/guides/kyc-flow">
    Set up user verification
  </Card>

  <Card title="Transaction Lifecycle" icon="arrows-rotate" href="/guides/transaction-lifecycle">
    Understand all transaction states
  </Card>

  <Card title="Webhooks" icon="bell" href="/guides/webhooks">
    Configure real-time notifications
  </Card>
</CardGroup>
