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

# API Quickstart

> End-to-end on-ramp buy flow: KYC status, fetch quote, payment methods, beneficiary details, create buy transaction, then success webhook.

Enable users to purchase cryptocurrency using fiat currency and have it deposited into their wallets.

## Prerequisites

1. **Register as a Saber merchant** — reach out to our team if you haven't.
2. **Set up your keys** — every API call needs an authentication signature; see [Configuring Your Keys](/getting-started/auth).
3. **Create a user** — see [Registering Users](/user/registration).
4. **Configure your webhooks** — see [Webhook Configuration](/client/dashboard/webhooks).

***

## Implementation

### Step 1: Register the user, complete KYC and Verify KYC Status

Ensure the user’s KYC status is complete before proceeding.

To do so, the user's KYC information can:

1. Be shared with Saber using the KYC sharing API — see [KYC Sharing](/user/kyc/sharing).
2. Or, the SDK can be used to complete the user's KYC — see [KYC Widget](/user/kyc/widget). This needs additional integration with the Saber team.

Once done, the user's KYC status can be checked using the Get User Details endpoint, which returns the `kyc_status` field.

**Sample request:**

```bash theme={null}
curl --location 'https://api.saber.money/api/v2/user?user_uuid={{user_uuid}}' \
  --header 'X-Timestamp: {{timestamp}}' \
  --header 'X-Api-Key: {{api_key}}' \
  --header 'X-Request-Id: {{request_id}}' \
  --header 'X-Signature: {{signature}}'
```

**Sample response:**

```json theme={null}
{
  "success": true,
  "data": {
    "user_uuid": "{{user_uuid}}",
    "kyc_status": "Verified",
    "kyc_country": "IND"
  }
}
```

Find more info about the API [here](https://saber-money.readme.io/reference/registerauser).

***

### Step 2: Fetch a buy price for crypto

* Get a real-time quote for the fiat-to-crypto conversion.
* Use the fetch quote API. This can be used to show the quote information to the user.

> 📘
>
> How long does the quote remain before updating?
>
> As of now the quote can change between calls. This is not a sequential call and is only intended to show the quotes. It currently has no influence on order creation

**Sample request:**

```bash theme={null}
curl --location 'https://api.saber.money/api/v2/wallet/s/quote?from_currency=INR&to_currency=USDT&network=BSC&to_amount=55.38' \
  --header 'X-Timestamp: {{timestamp}}' \
  --header 'X-Client-Id: •••••••' \
  --header 'X-Request-Id: 3456' \
  --header 'X-User-Id: •••••••' \
  --header 'X-Secret-Key: •••••••'
```

**Sample response:**

```json theme={null}
{
  "success": true,
  "data": {
    "from_currency": "INR",
    "to_currency": "USDT",
    "from_amount": 5036.81,
    "pre_fee_to_amount": 55.49,
    "to_amount": 55.38,
    "base_price": 90.77,
    "final_price": 90.95,
    "total_fee": 0.11,
    "fee_currency": "USDT",
    "fee_breakup": {
      "platform_fee": 0.111,
      "network_fee": 0,
      "client_fee": 0,
      "discount": 0,
      "tax_on_fee": 0,
      "tds": 0
    }
  }
}
```

Find more info about the API [here](https://saber-money.readme.io/reference/fetchbuyprice).

***

### Step 3: Fetch the payment methods available

* Fetch the payment methods available for the user to make a fiat payment

**Sample request:**

```bash theme={null}
curl --location 'https://api.saber.money/api/v1/wallet/conversion/fiat/methods?fiat=INR&crypto=USDT&type=buy' \
  --header 'X-Timestamp: {{timestamp}}' \
  --header 'X-Client-Id: •••••••' \
  --header 'X-Request-Id: 2' \
  --header 'X-Secret-Key: •••••••'
```

**Sample response:**

```json theme={null}
{
  "success": true,
  "data": {
    "UPI": {
      "enabled": true,
      "options": {
        "gpay_intent": {
          "id": 1,
          "conversion_type": "BUY",
          "name": "gpay_intent",
          "display_name": "Google Pay",
          "description": null,
          "icon": null,
          "mode": "INTENT",
          "type": "INSTANT",
          "priority": 1
        },
        "paytm_intent": {
          "id": 2,
          "conversion_type": "BUY",
          "name": "paytm_intent",
          "display_name": "Paytm",
          "description": null,
          "icon": null,
          "mode": "INTENT",
          "type": "INSTANT",
          "priority": 3
        },
        "phonepe_intent": {
          "id": 3,
          "conversion_type": "BUY",
          "name": "phonepe_intent",
          "display_name": "PhonePe",
          "description": null,
          "icon": null,
          "mode": "INTENT",
          "type": "INSTANT",
          "priority": 2
        },
        "other_upi_intent": {
          "id": 4,
          "conversion_type": "BUY",
          "name": "other_upi_intent",
          "display_name": "Other UPI Apps",
          "description": null,
          "icon": null,
          "mode": "INTENT",
          "type": "INSTANT",
          "priority": 4
        }
      },
      "category_name": "UPI",
      "category_display_name": "UPI Options"
    },
    "BANK_TRANSFER": {
      "enabled": true,
      "options": {
        "imps_transfer": {
          "id": 6,
          "conversion_type": "BUY",
          "name": "imps_transfer",
          "display_name": "IMPS/NEFT Bank Transfer",
          "description": null,
          "icon": null,
          "mode": "IMPS",
          "type": "MANUAL",
          "priority": 1
        }
      },
      "category_name": "BANK_TRANSFER",
      "category_display_name": "Bank Transfer"
    }
  }
}
```

Find more info about the API [here](https://saber-money.readme.io/reference/fetchpaymentmethods).

***

### Step 4: Fetch beneficiary details

Once the preferred method is selected from the previous step, the beneficiary details for that payment method are to be fetched.

**Note:**

* If the payment method is set to "upi\_transfer," the API will provide the UPI details of the beneficiary. Additionally, a unique verification code will be included, which the user needs to add while making the payment. This verification code is important for reconciling the payment on the system's end, ensuring accurate tracking and processing.
* If the payment method is set to "bank\_transfer," the API will return the bank details of the beneficiary. These details can be used to initiate a bank transfer payment.

**Sample request:**

```bash theme={null}
curl --location 'https://api.saber.money/api/v1/wallet/conversion/fiat/methods/upi_transfer/beneficiary?type=buy&fiat=INR&crypto=USDT' \
  --header 'X-Timestamp: {{timestamp}}' \
  --header 'X-Client-Id: •••••••' \
  --header 'X-Request-Id: s' \
  --header 'X-Secret-Key: •••••••'
```

**Sample response:**

```json theme={null}
{
  "success": true,
  "data": {
    "id": "",
    "bank_name": "RPFAS TECHNOLOGIES PRIVATE LIMITED",
    "ifsc_code": "",
    "account_number": "",
    "upi": "paytmqr28100505010114pimg61rdg6@paytm",
    "account_name": "RPFAS TECHNOLOGIES PRIVATE LIMITED",
    "account_type": "",
    "details": null,
    "code": "AG2F1H"
  }
}
```

Find more info about API [here](https://saber-money.readme.io/reference/fetchbeneficiarydetailsoptional).

***

### Step 5: Create a transaction

Using the information retrieved from the previous steps, create a buy transaction using the buy API.

**Sample request:**

```bash theme={null}
curl --location 'https://api.saber.money/api/v1/wallet/crypto/buy/' \
  --header 'X-Timestamp: {{timestamp}}' \
  --header 'X-Client-Id: •••••••' \
  --header 'X-Request-Id: qsfe' \
  --header 'X-User-Id: •••••••' \
  --header 'X-Secret-Key: •••••••' \
  --data '{
    "from_currency": "INR",
    "to_currency": "USDT",
    "to_amount": 10,
    "source_id": "c41f7d27-781c-41da-b74c-278fe7202af5",
    "payment_method": "bank_transfer",
    "crypto_wallet_address": "0xb84b44140b9c9d2a32707ba35332969c65bc918d",
    "network": "BSC"
  }'
```

**Sample response:**

```json theme={null}
{
  "success": true,
  "data": {
    "fiat_symbol": "INR",
    "crypto_amount": 10,
    "source_id": "c41f7d27-781c-41da-b74c-278fe7202af5",
    "id": "74cbe2f9-4e2a-4bd2-92d2-1a139e7cdcf9",
    "uuid": "74cbe2f9-4e2a-4bd2-92d2-1a139e7cdcf9",
    "crypto_symbol": "USDT",
    "crypto_wallet_address": "0xb84b44140b9c9d2a32707ba35332969c65bc918d",
    "network": "BSC",
    "created_at": 1684394172000,
    "bank_transaction_id": "",
    "fiat_amount": 976.11,
    "status": "INCOMING_PAYMENT_INITIATED",
    "payment_method": "bank_transfer",
    "exchange_rate": 97.61,
    "tag": ""
  }
}
```

Find more info about the API [here](https://saber-money.readme.io/reference/createbuytransaction).

### Step 6: Wait for a Success Callback

Once the user completes the payment, Saber sends a webhook to your configured endpoint.

**Sample webhook:**

```bash theme={null}
curl --location -g '{{configured_webhook}}' \
  --data '{
    "event": "CRYPTO_BUY",
    "id": "74cbe2f9-4e2a-4bd2-92d2-1a139e7cdcf9",
    "uuid": "74cbe2f9-4e2a-4bd2-92d2-1a139e7cdcf9",
    "status": "COMPLETED",
    "fiat_symbol": "INR",
    "crypto_symbol": "USDT",
    "fiat_amount": 976.11,
    "crypto_amount": 10,
    "payment_method": "bank_transfer",
    "exchange_rate": 97.61,
    "crypto_wallet_address": "0xb84b44140b9c9d2a32707ba35332969c65bc918d",
    "source_id": "c41f7d27-781c-41da-b74c-278fe7202af5",
    "bank_transaction_id": "1176073620125",
    "network": "BSC",
    "tag": "",
    "created_at": 1684394172000,
    "user_id": "77c4562e-ce47-4054-9d4e-4df69ca11a11",
    "txn_hash": "0x..."
  }'
```

Once this webhook is received, the transaction will be visible on the Saber dashboard.


## Related topics

- [Quickstart](/docs/quickstart.md)
- [API Authentication](/getting-started/auth.md)
- [Through API Endpoints](/user/bank-account/api.md)
- [From External Wallet](/docs/from-external-wallet.md)
