Convert USD to Cryptocurrency

This guide explains how to convert USD funds to cryptocurrency within CryptoConnect. The workflow includes checking available currency pairs, previewing exchange rates, and initiating the conversion.

Step 1 — Determine available currency pairs

Before requesting a quote, identify the valid values for baseCurrency and quoteCurrency. The full list of supported trading pairs, along with the minimum and maximum transaction amounts for each pair, can be retrieved from the Get a trade currency pair API. Supported cryptocurrencies currently include USDC, USDT, and WUSD.

In a currency pair, the baseCurrency is the asset being traded, while the quoteCurrency is the asset used to price it. For example, in the pair USDC → USD, USDC is the baseCurrency.

Request Example

# Replace ${YOUR_API_ACCESS_TOKEN} with your API access token.
curl --request GET \
     --url https://api-sandbox.interlace.money/open-api/v3/cryptoconnect/convert/currency-pair?fromCurrency=USD&toCurrency=USDC \
     --header 'accept: application/json' \
     --header 'x-access-token: ${YOUR_API_ACCESS_TOKEN}'

Response Example

{
    "code": 0,
    "message": "ok",
    "data": {
        "symbol": "USDC-USD",
        "baseCurrency": "USDC",
        "baseMin": "0.5",
        "quoteCurrency": "USD",
        "quoteMin": "0.5"
    }
}

Step 2 — Preview exchange rates and fees (optional)

Once the currency pair is set, you can use the Get an estimate quote API to preview the exchange rates and any applicable fees. This step provides greater transparency and is optional but recommended. If you choose to skip it, the system will automatically request a quote during the final transaction.

To request a quote, specify the following fields:

  • baseCurrency: The cryptocurrency to trade (e.g., "USDC").
  • quoteCurrency: The currency used to price the baseCurrency (e.g., "USD").
  • side: The trade direction relative to the baseCurrency: BUY if purchasing the baseCurrency or SELL if selling it.
  • rfqCurrency: The currency in which the quote amount is expressed (can be the baseCurrency or the quoteCurrency).
  • rfqAmount: The trade amount denominated in the rfqCurrency.

How the Fields Work Together

These parameters define the details of the quote request.

Example 1: Buying USDC with USD

  • baseCurrency: "USDC"
  • quoteCurrency: "USD"
  • side: "BUY"
  • rfqCurrency: "USD"
  • rfqAmount: "5"

This means: "I want to buy USDC by spending 5 USD. How much USDC will I receive?"

Conversely, if you wanted to purchase a specific amount of cryptocurrency, you would set the rfqCurrency to match the baseCurrency.

Example 2: Buying a Fixed Amount of USDC

  • baseCurrency: "USDC"
  • quoteCurrency: "USD"
  • side: "BUY"
  • rfqCurrency: "USDC"
  • rfqAmount: "10"

This means: "I want to buy exactly 10 USDC. How much USD will that cost me?"

Request Example

# Replace ${YOUR_API_ACCESS_TOKEN} with your API access token.
curl --request POST \
     --url https://api-sandbox.interlace.money/open-api/v3/cryptoconnect/convert/estimate-quote \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --header 'x-access-token: ${YOUR_API_ACCESS_TOKEN}' \
     --data '{
         "accountId": "b27c8873-e400-47cd-adc1-035cfa0d5347",
         "baseCurrency": "USDC",
         "quoteCurrency": "USD",
         "side": "BUY",
         "rfqCurrency": "USDC",
         "rfqAmount": "10"
     }'

Response Example

{
    "code": "000000",
    "message": "success",
    "data": {
        "id": "84226cee-c9cb-466d-b59e-e2d90f0a55c6",
        "quoteTime": "1762505468086",
        "baseCurrency": "USDC",
        "baseAmount": "10",
        "quoteCurrency": "USD",
        "quoteAmount": "10.050251",
        "side": "BUY",
        "rate": "1",
        "rfqAmount": "10",
        "rfqCurrency": "USDC",
        "fee": "0.050251",
        "feeCurrency": "USD",
        "ttlMs": "60000"
    }
}

Step 3 — Convert USD to cryptocurrency

The final step is to initiate the conversion by using the Create a trade API. This endpoint executes the transaction and converts the USD in your CryptoConnect Wallet into the specified digital asset at the confirmed rate. Currently, CryptoConnect supports conversions between USD ↔ USDC/USDT/WUSD and USDC ↔ USDT.

Request Example

# Replace ${YOUR_API_ACCESS_TOKEN} with your API access token.
curl --request POST \
     --url https://api-sandbox.interlace.money/open-api/v3/cryptoconnect/convert/trades \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --header 'x-access-token: ${YOUR_API_ACCESS_TOKEN}' \
     --data '{
         "referenceId": "06d10183-0644-4947-aeba-cb1c081d3607",
         "accountId": "b27c8873-e400-47cd-adc1-035cfa0d5347",
         "baseCurrency": "USDC",
         "quoteCurrency": "USD",
         "side": "BUY",
         "rfqCurrency": "USD",
         "rfqAmount": "10"
     }'

Response Example

{
    "code": "000000",
    "message": "success",
    "data": {
        "id": "2ac90592-eacf-42f5-a634-2f980812fbf8",
        "accountId": "b27c8873-e400-47cd-adc1-035cfa0d5347",
        "symbol": "USDC-USD",
        "baseWalletId": "32aae8b7-4a69-474f-b7d5-337e190af878",
        "baseCurrency": "USDC",
        "baseAmount": "9.95",
        "quoteCurrency": "USD",
        "quoteAmount": "10",
        "side": "BUY",
        "rate": "1",
        "fee": "0.05",
        "feeCurrency": "USD",
        "status": "COMPLETE",
        "referenceId": "06d10183-0644-4947-aeba-cb1c081d3607",
        "createTime": "1762505401267",
        "completeTime": "1762505402230"
    }
}