Converting USD to Cryptocurrency
This guide explains how to convert USD funds to cryptocurrency in CryptoConnect. The workflow covers checking available currency pairs, optionally previewing exchange rates, and executing the conversion.
Determining 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 and USDT.
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/v2/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"
}
}
Preview Exchange Rates and Fees (Optional)
Once the currency pair is set, you may use the Get an estimate quote API to preview the exchange rates and any applicable fees. This step improves transparency in converting USD to a stablecoin such as USDC. This step is optional but recommended. If you 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 thebaseCurrency
(e.g., "USD").side
: The trade direction relative to thebaseCurrency
:buy
if purchasing thebaseCurrency
orsell
if selling it.rfqCurrency
: The currency in which the quote amount is expressed (can be thebaseCurrency
or thequoteCurrency
).rfqAmount
: The trade amount denominated in therfqCurrency
.
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/v2/cryptoconnect/wallets/907d6edf-0033-4629-bcba-ee0363b5e737/addresses \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'x-access-token: ${YOUR_API_ACCESS_TOKEN}' \
--data '{
"baseCurrency": "USDC",
"quoteCurrency": "USD",
"side": "buy",
"rfqCurrency": "USDC",
"rfqAmount": "10"
}'
Response Example
{
"code": 0,
"message": "ok",
"data": {
"id": "8da31d6c-de64-498d-a8cb-dd60dd6593d8",
"quoteTime": "1758545442523",
"baseCurrency": "USDC",
"baseAmount": "10",
"quoteCurrency": "USD",
"quoteAmount": "10.050251",
"side": "buy",
"rate": "1",
"rfqAmount": "10",
"rfqCurrency": "USDC",
"fee": "0.050251",
"feeCurrency": "USD",
"ttlMs": "60000"
}
}
Convert USD to Cryptocurrency
The final step is to execute the conversion by using the Create a trade API. This endpoint finalizes the transaction and converts the USD in your CryptoConnect wallet into the specified digital asset at the confirmed rate.
Request Example
# Replace ${YOUR_API_ACCESS_TOKEN} with your API access token.
curl --request POST \
--url https://api-sandbox.interlace.money/open-api/v2/cryptoconnect/wallets/907d6edf-0033-4629-bcba-ee0363b5e737/addresses \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'x-access-token: ${YOUR_API_ACCESS_TOKEN}' \
--data '{
"idempotencyKey": "99a2b450-07af-48db-837f-c4b8a33a9e35",
"baseCurrency": "USDC",
"quoteCurrency": "USD",
"side": "buy",
"rfqCurrency": "USDC",
"rfqAmount": "10",
"quoteId": "8da31d6c-de64-498d-a8cb-dd60dd6593d8"
}'
Response Example
{
"code": 0,
"message": "ok",
"data": {
"id": "35e76429-3181-40c8-bbeb-2292360f9d36",
"accountId": "b27c8873-e400-47cd-adc1-035cfa0d5347",
"symbol": "USDC-USD",
"baseWalletId": "32aae8b7-4a69-474f-b7d5-337e190af878",
"baseCurrency": "USDC",
"baseAmount": "10",
"quoteCurrency": "USD",
"quoteAmount": "10.050251",
"side": "buy",
"rate": "1",
"fee": "0.050251",
"feeCurrency": "USD",
"status": "Closed",
"idempotencyKey": "99a2b450-07af-48db-837f-c4b8a33a9e35",
"createTime": "1758545505113",
"updateTime": "1758545506014",
"completeTime": "1758545506008"
}
}
Updated 19 days ago