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

# API Examples

> API Samples for interacting with Onboard Connect's low-code integration

## Base URL

```bash Staging theme={null}
https://external.dev.onboardpay.co
```

```bash Production theme={null}
https://api-3p.onboard.xyz
```

## List of endpoints

### Trade options

This endpoint provides a list of supported fiat currencies, blockchain networks, payment channels, and transaction limits supported by Onboard. users to configure their trades.

> **Sample Request**
>
> ```bash URL theme={null}
> GET /exchange/api/orders/trade-options
> ```

> **Sample Response**
>
> ```json Response theme={null}
> {
>     "fiats": [
>         {
>             "name": "Nigerian Naira",
>             "isoCode": "NGN",
>             "symbol": "NGN",
>             "logo": "https://s3.us-west-2.amazonaws.com/country-flags-staging.getonboard.co/NG.png",
>             "unicodeSymbol": "₦",
>             "transactionLimits": {
>                 "kyc": {
>                     "minSingleTransactionLimit": 86.12310458350001,
>                     "maxSingleTransactionLimit": 3444924.18334,
>                     "dailyTransactionLimit": 10334772.55002
>                 },
>                 "noKyc": {
>                     "minSingleTransactionLimit": 86.12310458350001,
>                     "maxSingleTransactionLimit": 43061.55229175,
>                     "dailyTransactionLimit": 43061.55229175,
>                     "maxLifetimeLimit": 43061.55229175
>                 }
>             }
>         },
>         {
>             "name": "US Dollar",
>             "isoCode": "USD",
>             "symbol": "USD",
>             "logo": "https://s3.us-west-2.amazonaws.com/country-flags-staging.getonboard.co/US.png",
>             "unicodeSymbol": "$",
>             "transactionLimits": {
>                 "kyc": {
>                     "minSingleTransactionLimit": 0.05,
>                     "maxSingleTransactionLimit": 2000,
>                     "dailyTransactionLimit": 6000
>                 },
>                 "noKyc": {
>                     "minSingleTransactionLimit": 0.05,
>                     "maxSingleTransactionLimit": 25,
>                     "dailyTransactionLimit": 25,
>                     "maxLifetimeLimit": 25
>                 }
>             }
>         },
>         ...
>     ],
>     "networks": [
>         {
>             "name": "Binance Smart Chain Testnet",
>             "networkId": "bsc_testnet",
>             "chainId": 97,
>             "nativeAsset": "BNB",
>             "explorer": "https://testnet.bscscan.com",
>             "availableTokens": [
>                 {
>                     "symbol": "BNB",
>                     "isNative": true
>                 },
>                 {
>                     "symbol": "USDT",
>                     "isNative": false
>                 }
>             ]
>         },
>         {
>             "name": "Base Sepolia Testnet",
>             "networkId": "base_sepolia",
>             "chainId": 84532,
>             "nativeAsset": "ETH",
>             "explorer": "https://sepolia.basescan.org",
>             "availableTokens": [
>                 {
>                     "symbol": "ETH",
>                     "isNative": true
>                 },
>                 {
>                     "symbol": "USDC",
>                     "isNative": false
>                 }
>             ]
>         },
>         ...
>     ],
>     "transactionLimitsConfig": {
>         "kyc": {
>             "minSingleTransactionLimit": 0.05, // in USD
>             "maxSingleTransactionLimit": 2000, // in USD
>             "dailyTransactionLimit": 6000 // in USD
>         },
>         "noKyc": {
>             "minSingleTransactionLimit": 0.05, // in USD
>             "maxSingleTransactionLimit": 25, // in USD
>             "dailyTransactionLimit": 25, // in USD
>             "maxLifetimeLimit": 25 // in USD
>         }
>     },
>     "paymentChannels": [
>         {
>             "paymentChannelId": "BANK_TRANSFER_NIGERIA",
>             "name": "Bank Transfer - Nigeria",
>             "supportedCurrencies": [
>                 {
>                     "country": "NG",
>                     "currency": "NGN"
>                 }
>             ]
>         },
>         {
>             "paymentChannelId": "BANK_TRANSFER_SOUTH_AFRICA",
>             "name": "Bank Transfer - South Africa",
>             "supportedCurrencies": [
>                 {
>                     "country": "ZA",
>                     "currency": "ZAR"
>                 }
>             ]
>         },
>         ...
>     ]
> }
> ```

#### Explanation of key properties

**fiats**

| Property | Description |
| - | - |
| `name` | Full name of the fiat currency. |
| `isoCode` | ISO 4217 code representing the currency. |
| `symbol` | Symbol for the currency. |
| `unicodeSymbol` | Unicode character for the currency. |
| `logo` | URL to the flag or icon representing the currency. |

**networks**

| Property | Description |
| - | - |
| `name` | Full name of the blockchain network. |
| `networkId` | Identifier used within Onboard for the network. |
| `chainId` | Standard chain ID for the blockchain. |
| `nativeAsset` | Native token used for transactions on the network. |
| `explorer` | URL to the blockchain explorer for the network. |

**transactionLimitsConfig**

| Property | Description |
| - | - |
| `kyc` | Limits for users with KYC verification, denominated in USD. |
| `noKyc` | Limits for users without KYC verification, denominated in USD. Contains an additional `maxLifetimeLimit` property, which specifies the total allowable transaction limit over the lifetime of a user without completing KYC verification. |

**paymentChannels**

| Property | Description |
| - | - |
| `paymentChannelId` | Unique ID for the payment channel. |
| `name` | Display name for the payment channel. |
| `supportedCurrencies` | Array of countries and their currencies supported by the channel. |

### Get trade URL

Returns the trade URL for the paramaters provided. The URL retuned in the response can then be used in a browser / web view to start an ONRAMP / OFFRAMP

> **Sample Parameters**
>
> ```bash URL theme={null}
> GET /exchange/api/orders/trade-url&apiKey=onb_test_f284e796ffe4ae3426bddd6f05f098cf&product=web3&tradeType=sell&fiat=NGN&token=USDT&tokenAmount=1&networkId=bsc_testnet&autoselect=true
> ```

> **Sample Response**
>
> ```json Response theme={null}
> {
>     "tradeUrl": "https://app.dev.onboardpay.co/express/confirm?cexOrderId=51&fiat=NGN&token=USDT&walletAddress=0x0a1756f20c3993eAEaeD87934a6aa95936ac889d&tradeType=Sell&network=bsc_testnet&tokenAmount=1&offerId=d1bf4ad0-22ff-43de-aecb-c0ebfb85bc51&product=WEB3&thirdPartyOrderTradeId=fb34dc78-00e4-463a-8f1b-c617c634b148"
> }
> ```

See [here](https://nestcoin.mintlify.site/onboard-exchange/connect/query-parameters.md) for a full list of parameters that can be used in the URL.

### Start trade

This endpoint can be used in place of `Get Trade URL`, which returns the trade url in JSON. Instead, the `Start trade` endpoint automatically resolves to the trade URL. This endpoint is best used to initiate trades within a browser or webview.

```bash Staging theme={null}
https://external.dev.onboardpay.co/exchange/orders/trade?apiKey=<API_KEY>&product=web3&<TRADE_QUERY_PARAMETERS>
```

```bash Production theme={null}
https://api-3p.onboard.xyz/exchange/orders/trade?apiKey=<API_KEY>&product=web3&<TRADE_QUERY_PARAMETERS>
```

See [here](https://nestcoin.mintlify.site/onboard-exchange/connect/query-parameters.md) for a full list of parameters that can be used in the URL.

#### Sample mobile app integration

For mobile apps, the redirect link can be used within an embedded browser or webview component.

> **🤖 Android**
>
> To integrate Connect to your Android app, see the `Java` and `Kotlin` snippets below:
>
> ```java Java theme={null}
> import android.os.Bundle;
> import android.webkit.WebSettings;
> import android.webkit.WebView;
> import androidx.appcompat.app.AppCompatActivity;
>
> public class MainActivity extends AppCompatActivity {
>     private WebView webView;
>
>     @Override
>     protected void onCreate(Bundle savedInstanceState) {
>         super.onCreate(savedInstanceState);
>         setContentView(R.layout.activity_main);
>
>         webView = findViewById(R.id.webView);
>         WebSettings webSettings = webView.getSettings();
>         webSettings.setJavaScriptEnabled(true);
>
>         // Load the URL
>         webView.loadUrl("https://external.dev.onboardpay.co/exchange/orders/trade?apiKey=<API_KEY>&product=web3&<TRADE_QUERY_PARAMETERS>");
>     }
> }
> ```
>
> ```kotlin Kotlin theme={null}
> import android.os.Bundle
> import android.webkit.WebSettings
> import android.webkit.WebView
> import androidx.appcompat.app.AppCompatActivity
>
> class MainActivity : AppCompatActivity() {
>     private lateinit var webView: WebView
>
>     override fun onCreate(savedInstanceState: Bundle?) {
>         super.onCreate(savedInstanceState)
>         setContentView(R.layout.activity_main)
>
>         webView = findViewById(R.id.webView)
>         val webSettings: WebSettings = webView.settings
>         webSettings.javaScriptEnabled = true
>
>         // Load the URL
>         webView.loadUrl("https://external.dev.onboardpay.co/exchange/orders/trade?apiKey=<API_KEY>&product=web3&<TRADE_QUERY_PARAMETERS>")
>     }
> }
> ```

> **🍏 iOS**
>
> To integrate Connect to your iOS app, see the `Swift` and `Flutter` snippets below:
>
> ```swift Swift theme={null}
> import UIKit
> import WebKit
>
> class ViewController: UIViewController, WKNavigationDelegate {
>     @IBOutlet var webView: WKWebView!
>
>     override func viewDidLoad() {
>         super.viewDidLoad()
>
>         // Set the WKWebView navigation delegate
>         webView.navigationDelegate = self
>
>         // Load the URL
>         if let url = URL(string: "https://external.dev.onboardpay.co/exchange/orders/trade?apiKey=<API_KEY>&product=web3&<TRADE_QUERY_PARAMETERS>") {
>             let request = URLRequest(url: url)
>             webView.load(request)
>         }
>     }
> }
> ```
>
> ```flutter Flutter theme={null}
> class WebViewExample extends StatefulWidget {
>     @override
>     _WebViewExampleState createState() => _WebViewExampleState();
> }
>
> class _WebViewExampleState extends State<WebViewExample> {
>     final String url = "https://external.dev.onboardpay.co/exchange/orders/trade?apiKey=<API_KEY>&product=web3&<TRADE_QUERY_PARAMETERS>";
>     final Completer<WebViewController> _controller =
>         Completer<WebViewController>();
>
>     @override
>     Widget build(BuildContext context) {
>         return Scaffold(
>             appBar: AppBar(
>                 title: Text("Onboard Test App"),
>             ),
>             body: WebView(
>                 initialUrl: url,
>                 onWebViewCreated: (WebViewController webViewController) {
>                 _controller.complete(webViewController);
>                 },
>             ),
>         );
>     }
> }
> ```

### Get an order's current price

> **Sample Parameters**
>
> ```bash URL theme={null}
> GET ?apiKey=&product=web3&tradeType=Sell&fiat=NGN&token=USDT&tokenAmount=120299&networkId=bsc_testnet
> ```

> **Sample Response**
>
> ```json Response theme={null}
> {
>     "price": 1400
> }
> ```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.