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

# Exchange

> Get quotes and initiate crypto-to-fiat swaps

## Overview

Convert cryptocurrency to fiat currency with real-time quotes and seamless bank transfers. This guide covers getting exchange rates and initiating offramp transactions.

**What you'll learn:**

* Get exchange quotes
* Initiate crypto-to-fiat swaps
* Understand deposit addresses
* Monitor swap progress
* Handle different scenarios

***

## Exchange Process

<Steps>
  <Step title="Get Quote">
    Check current exchange rate for your crypto amount
  </Step>

  <Step title="Verify Bank Account">
    Confirm recipient bank details
  </Step>

  <Step title="Initiate Swap">
    Create offramp order with bank details
  </Step>

  <Step title="Deposit Crypto">
    Send crypto to the provided deposit address
  </Step>

  <Step title="Receive Fiat">
    Fiat sent to your bank account
  </Step>
</Steps>

***

## Get Exchange Quote

Get real-time exchange rate before initiating a swap.

<CodeGroup>
  ```javascript Node.js theme={null}
  import MoneiSDK from 'monei-sdk';

  const monei = new MoneiSDK({
    apiKey: process.env.MONEI_API_KEY,
  });

  // Get quote for 100 USDT to NGN
  const quote = await monei.offrampExchange.getQuote({
    token: 'USDT',
    network: 'base',
    amount: 100,
    fiat: 'NGN'
  });

  console.log('Exchange Quote:');
  console.log('================');
  console.log('Token:', quote.token);
  console.log('Amount:', quote.amount, quote.token);
  console.log('Network:', quote.network);
  console.log('Fiat Currency:', quote.fiat);
  console.log('Exchange Rate:', quote.rate, 'NGN per', quote.token);
  console.log('You will receive:', quote.amount * quote.rate, 'NGN');
  ```

  ```python Python theme={null}
  from monei import MoneiClient

  monei = MoneiClient(
      api_key=os.getenv('MONEI_API_KEY')
  )

  # Get quote
  quote = monei.offramp_exchange.get_quote(
      token='USDT',
      network='base',
      amount=100,
      fiat='NGN'
  )

  print('Exchange Quote:')
  print('=' * 20)
  print(f'Token: {quote.token}')
  print(f'Amount: {quote.amount} {quote.token}')
  print(f'Network: {quote.network}')
  print(f'Rate: {quote.rate} NGN per {quote.token}')
  print(f'You will receive: {quote.amount * quote.rate} NGN')
  ```

  ```bash cURL theme={null}
  curl "https://api.monei.cc/api/v1/offramp/exchange/quote?token=USDT&network=base&amount=100&fiat=NGN" \
    -H "x-api-key: YOUR_API_KEY"
  ```
</CodeGroup>

**Query Parameters:**

| Parameter | Type   | Required | Description                                          |
| --------- | ------ | -------- | ---------------------------------------------------- |
| `token`   | string | Yes      | Token symbol (USDT, USDC, CNGN)                      |
| `network` | string | Yes      | Network (base, polygon, arbitrum, etc.)              |
| `amount`  | number | Yes      | Amount of crypto to convert                          |
| `fiat`    | string | No       | Fiat currency (NGN, GHS, KES, USD) - defaults to NGN |

**Response:**

```json theme={null}
{
  "token": "USDT",
  "amount": 100,
  "network": "base",
  "fiat": "NGN",
  "rate": 1550.25
}
```

***

## Supported Tokens & Networks

<Tabs>
  <Tab title="USDT">
    **Tether USD**

    | Network         | Status      |
    | --------------- | ----------- |
    | Polygon         | ✓ Supported |
    | Arbitrum One    | ✓ Supported |
    | BNB Smart Chain | ✓ Supported |
    | Ethereum        | ✓ Supported |
    | Tron            | ✓ Supported |
    | Lisk            | ✓ Supported |
    | Celo            | ✓ Supported |

    **Most Popular:** BNB Smart Chain, Polygon (lowest fees)
  </Tab>

  <Tab title="USDC">
    **USD Coin**

    | Network         | Status      |
    | --------------- | ----------- |
    | Base            | ✓ Supported |
    | Polygon         | ✓ Supported |
    | Arbitrum One    | ✓ Supported |
    | BNB Smart Chain | ✓ Supported |
    | Ethereum        | ✓ Supported |
    | Celo            | ✓ Supported |

    **Most Popular:** Base, Polygon
  </Tab>

  <Tab title="CNGN">
    **Canza Finance NGN**

    | Network         | Status      |
    | --------------- | ----------- |
    | Base            | ✓ Supported |
    | Polygon         | ✓ Supported |
    | BNB Smart Chain | ✓ Supported |
    | Ethereum        | ✓ Supported |

    **Note:** Pegged to Nigerian Naira (NGN)
  </Tab>
</Tabs>

***

## Initiate Swap

Create an offramp order to convert crypto to fiat.

<CodeGroup>
  ```javascript Node.js theme={null}
  // Initiate swap: 100 USDT → NGN
  const order = await monei.offrampExchange.initiateSwap({
    amount: 100,
    token: 'USDT',
    network: 'base',
    fiatCurrency: 'NGN',
    bankCode: 'GTBINGLA', // GTBank
    accountNumber: '0123456789',
    accountName: 'JOHN DOE'
  });

  console.log('Offramp Order Created:');
  console.log('======================');
  console.log('Reference:', order.reference);
  console.log('Status:', order.status);
  console.log('Amount:', order.amount, order.token);
  console.log('Fiat Amount:', order.fiatAmount, order.fiatCurrency);
  console.log('\nDeposit Details:');
  console.log('Network:', order.onChain.network);
  console.log('Address:', order.onChain.depositAddress);
  console.log('Expected Amount:', order.onChain.expectedAmount);
  console.log('\nBank Details:');
  console.log('Bank:', order.bankDetails.bankName);
  console.log('Account:', order.bankDetails.accountNumber);
  console.log('Account Name:', order.bankDetails.accountName);
  console.log('\nNext Step:');
  console.log(`Send exactly ${order.onChain.expectedAmount} ${order.token} to:`);
  console.log(order.onChain.depositAddress);
  ```

  ```python Python theme={null}
  # Initiate swap
  order = monei.offramp_exchange.initiate_swap(
      amount=100,
      token='USDT',
      network='base',
      fiat_currency='NGN',
      bank_code='GTBINGLA',
      account_number='0123456789',
      account_name='JOHN DOE'
  )

  print('Offramp Order Created:')
  print('=' * 25)
  print(f'Reference: {order.reference}')
  print(f'Status: {order.status}')
  print(f'Amount: {order.amount} {order.token}')
  print(f'Fiat: {order.fiat_amount} {order.fiat_currency}')
  print(f'\nDeposit Address: {order.on_chain.deposit_address}')
  print(f'Network: {order.on_chain.network}')
  print(f'Expected: {order.on_chain.expected_amount} {order.token}')
  print(f'\nBank: {order.bank_details.bank_name}')
  print(f'Account: {order.bank_details.account_number}')
  print(f'\nSend {order.on_chain.expected_amount} {order.token} to:')
  print(order.on_chain.deposit_address)
  ```

  ```bash cURL theme={null}
  curl -X POST https://api.monei.cc/api/v1/offramp/exchange/initiate \
    -H "x-api-key: YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "amount": 100,
      "token": "USDT",
      "network": "base",
      "fiatCurrency": "NGN",
      "bankCode": "GTBINGLA",
      "accountNumber": "0123456789",
      "accountName": "JOHN DOE"
    }'
  ```
</CodeGroup>

**Request Body:**

| Field           | Type   | Required | Description                        |
| --------------- | ------ | -------- | ---------------------------------- |
| `amount`        | number | Yes      | Amount of crypto to swap           |
| `token`         | string | Yes      | Token symbol (USDT, USDC, CNGN)    |
| `network`       | string | Yes      | Blockchain network                 |
| `fiatCurrency`  | string | Yes      | Fiat currency (NGN, GHS, KES, USD) |
| `bankCode`      | string | Yes      | Recipient bank code                |
| `accountNumber` | string | Yes      | Recipient account number           |
| `accountName`   | string | Yes      | Recipient account name             |

**Response:**

```json theme={null}
{
  "statusCode": 200,
  "message": "Swap initiated successfully",
  "data": {
    "reference": "OFFRAMP-ABC123XYZ",
    "status": "awaiting_deposit",
    "amount": 100,
    "token": "USDT",
    "network": "base",
    "fiatCurrency": "NGN",
    "fiatAmount": 155025,
    "exchangeRate": 1550.25,
    "onChain": {
      "network": "base",
      "depositAddress": "0x1234567890abcdef1234567890abcdef12345678",
      "expectedAmount": 100,
      "tokenContract": "0x...",
      "expiresAt": "2024-02-15T12:00:00Z"
    },
    "bankDetails": {
      "bankCode": "GTBINGLA",
      "bankName": "Guaranty Trust Bank",
      "accountNumber": "0123456789",
      "accountName": "JOHN DOE"
    },
    "createdAt": "2024-02-15T11:30:00Z",
    "expiresAt": "2024-02-15T12:00:00Z"
  }
}
```

***

## Complete Offramp Flow

<CodeGroup>
  ```javascript Node.js theme={null}
  async function completeOfframp() {
    // 1. Get quote
    console.log('Step 1: Getting quote...');
    const quote = await monei.offrampExchange.getQuote({
      token: 'USDT',
      network: 'base',
      amount: 100,
      fiat: 'NGN'
    });
    
    console.log(`Rate: ${quote.rate} NGN per USDT`);
    console.log(`You will receive: ₦${(quote.amount * quote.rate).toLocaleString()}`);
    
    // 2. Verify bank account
    console.log('\nStep 2: Verifying bank account...');
    const verification = await monei.offrampPayouts.verifyBankAccount({
      bankCode: 'GTBINGLA',
      accountNumber: '0123456789'
    });
    
    console.log(`Account Name: ${verification.accountName}`);
    
    // 3. Initiate swap
    console.log('\nStep 3: Initiating swap...');
    const order = await monei.offrampExchange.initiateSwap({
      amount: 100,
      token: 'USDT',
      network: 'base',
      fiatCurrency: 'NGN',
      bankCode: verification.bankCode,
      accountNumber: verification.accountNumber,
      accountName: verification.accountName
    });
    
    console.log(`\n✓ Order created: ${order.reference}`);
    console.log(`Status: ${order.status}`);
    console.log(`\nDeposit Address: ${order.onChain.depositAddress}`);
    console.log(`Amount to send: ${order.onChain.expectedAmount} USDT`);
    console.log(`Network: ${order.onChain.network}`);
    console.log(`Expires: ${new Date(order.expiresAt).toLocaleString()}`);
    
    // 4. Send crypto (user does this manually or via SDK)
    console.log('\n⚠️ IMPORTANT: Send crypto to deposit address');
    console.log('After sending, track status using order.reference');
    
    return order;
  }

  // Execute
  const order = await completeOfframp();
  ```

  ```python Python theme={null}
  async def complete_offramp():
      # 1. Get quote
      print('Step 1: Getting quote...')
      quote = monei.offramp_exchange.get_quote(
          token='USDT',
          network='base',
          amount=100,
          fiat='NGN'
      )
      
      print(f'Rate: {quote.rate} NGN per USDT')
      print(f'You will receive: ₦{quote.amount * quote.rate:,.0f}')
      
      # 2. Verify bank
      print('\nStep 2: Verifying bank account...')
      verification = monei.offramp_payouts.verify_bank_account(
          bank_code='GTBINGLA',
          account_number='0123456789'
      )
      
      print(f'Account Name: {verification.account_name}')
      
      # 3. Initiate swap
      print('\nStep 3: Initiating swap...')
      order = monei.offramp_exchange.initiate_swap(
          amount=100,
          token='USDT',
          network='base',
          fiat_currency='NGN',
          bank_code=verification.bank_code,
          account_number=verification.account_number,
          account_name=verification.account_name
      )
      
      print(f'\n✓ Order created: {order.reference}')
      print(f'Status: {order.status}')
      print(f'\nDeposit: {order.on_chain.deposit_address}')
      print(f'Amount: {order.on_chain.expected_amount} USDT')
      print(f'Network: {order.on_chain.network}')
      
      print('\n⚠️ Send crypto to deposit address')
      
      return order

  # Execute
  order = await complete_offramp()
  ```
</CodeGroup>

***

## Deposit Address

Each offramp order generates a unique deposit address.

**Important Notes:**

<AccordionGroup>
  <Accordion icon="lock" title="Unique Per Transaction">
    Each order has a unique deposit address. Do not reuse addresses from previous transactions.
  </Accordion>

  <Accordion icon="clock" title="Time-Limited">
    Deposit addresses expire (typically 30 minutes). Send crypto before expiration.
  </Accordion>

  <Accordion icon="coins" title="Exact Amount">
    Send the exact expected amount. Partial or excess amounts may delay processing.
  </Accordion>

  <Accordion icon="network-wired" title="Correct Network">
    Ensure you send on the correct network (Base, Polygon, etc.). Wrong network = lost funds.
  </Accordion>

  <Accordion icon="ban" title="Single Use">
    Each address is for one transaction only. Multiple deposits to same address won't be processed.
  </Accordion>
</AccordionGroup>

***

## Exchange Rates

Rates update in real-time based on market conditions.

<CodeGroup>
  ```javascript Node.js theme={null}
  // Compare rates across networks
  async function compareNetworks(amount) {
    const networks = ['base', 'polygon', 'arbitrum', 'bsc'];
    const quotes = [];
    
    for (const network of networks) {
      const quote = await monei.offrampExchange.getQuote({
        token: 'USDT',
        network: network,
        amount: amount,
        fiat: 'NGN'
      });
      
      quotes.push({
        network: network,
        rate: quote.rate,
        fiatAmount: amount * quote.rate
      });
    }
    
    // Sort by best rate
    quotes.sort((a, b) => b.rate - a.rate);
    
    console.log(`Best Rates for ${amount} USDT → NGN:\n`);
    quotes.forEach((q, i) => {
      console.log(`${i + 1}. ${q.network}:`);
      console.log(`   Rate: ${q.rate} NGN/USDT`);
      console.log(`   You get: ₦${q.fiatAmount.toLocaleString()}\n`);
    });
    
    return quotes[0]; // Best rate
  }

  // Find best network
  const best = await compareNetworks(100);
  console.log(`Best network: ${best.network}`);
  ```

  ```python Python theme={null}
  # Compare rates
  async def compare_networks(amount):
      networks = ['base', 'polygon', 'arbitrum', 'bsc']
      quotes = []
      
      for network in networks:
          quote = monei.offramp_exchange.get_quote(
              token='USDT',
              network=network,
              amount=amount,
              fiat='NGN'
          )
          
          quotes.append({
              'network': network,
              'rate': quote.rate,
              'fiat_amount': amount * quote.rate
          })
      
      # Sort by rate
      quotes.sort(key=lambda x: x['rate'], reverse=True)
      
      print(f'Best Rates for {amount} USDT → NGN:\n')
      for i, q in enumerate(quotes, 1):
          print(f'{i}. {q["network"]}:')
          print(f'   Rate: {q["rate"]} NGN/USDT')
          print(f'   You get: ₦{q["fiat_amount"]:,.0f}\n')
      
      return quotes[0]

  # Find best
  best = await compare_networks(100)
  ```
</CodeGroup>

***

## Best Practices

<CardGroup cols={2}>
  <Card title="Get Fresh Quotes" icon="refresh">
    Rates change. Get new quote before each transaction
  </Card>

  <Card title="Verify Before Swap" icon="check-double">
    Always verify bank account before initiating
  </Card>

  <Card title="Send Exact Amount" icon="equals">
    Send exactly the expected amount to avoid delays
  </Card>

  <Card title="Correct Network" icon="network-wired">
    Double-check network before sending crypto
  </Card>

  <Card title="Track Order" icon="location-crosshairs">
    Save reference number and monitor progress
  </Card>

  <Card title="Act Quickly" icon="clock">
    Send crypto before deposit address expires
  </Card>
</CardGroup>

***

## Troubleshooting

<AccordionGroup>
  <Accordion icon="circle-xmark" title="Order Creation Failed">
    **Error:** Failed to create offramp order

    **Common causes:**

    * Invalid bank details
    * Unsupported token/network
    * Amount below minimum (\$10)
    * Amount above limit
    * KYC not completed

    **Solution:**

    * Verify all parameters
    * Check supported tokens/networks
    * Ensure amount is within limits
    * Complete KYC verification
  </Accordion>

  <Accordion icon="clock" title="Deposit Address Expired">
    **Problem:** Deposit address expired before sending crypto

    **Solution:**

    * Create new offramp order
    * Get new deposit address
    * Send crypto promptly (within 30 min)
    * Set reminder to send quickly
  </Accordion>

  <Accordion icon="exclamation-triangle" title="Wrong Amount Sent">
    **Problem:** Sent more or less than expected amount

    **If less:**

    * Order may be cancelled
    * Crypto refunded (minus gas)

    **If more:**

    * Excess may be refunded
    * Contact support

    **Prevention:**

    * Copy exact amount from order
    * Double-check before sending
  </Accordion>

  <Accordion icon="network-wired" title="Wrong Network">
    **Error:** Sent crypto on wrong network

    **Example:** Sent USDT on Ethereum instead of Base

    **Solution:**

    * Contact support immediately
    * Provide transaction hash
    * May require manual recovery (fees apply)

    **Prevention:**

    * Verify network in wallet before sending
    * Check deposit address network
  </Accordion>
</AccordionGroup>

***

## Next Steps

<CardGroup cols={2}>
  <Card title="Overview" icon="circle-info" href="/offramp/overview">
    Learn offramp basics
  </Card>

  <Card title="Bank Verification" icon="building-columns" href="/offramp/bank-verification">
    Verify bank accounts
  </Card>

  <Card title="Tracking" icon="location-crosshairs" href="/offramp/tracking">
    Monitor transaction progress
  </Card>

  <Card title="Networks" icon="network-wired" href="/core-concepts/networks">
    Learn about blockchain networks
  </Card>
</CardGroup>
