Create quote
Create an exchange quote between two assets. Specify either fromAmount (how much
to sell) or toAmount (how much to receive), not both. Quotes expire after 5 minutes.
curl --request POST \
--url https://api.nxos.io/v1/quotes \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"accountId": "acct_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4",
"fromAsset": "USD",
"toAsset": "USDC",
"fromAmount": "10000.00"
}
'import requests
url = "https://api.nxos.io/v1/quotes"
payload = {
"accountId": "acct_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4",
"fromAsset": "USD",
"toAsset": "USDC",
"fromAmount": "10000.00"
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
accountId: 'acct_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4',
fromAsset: 'USD',
toAsset: 'USDC',
fromAmount: '10000.00'
})
};
fetch('https://api.nxos.io/v1/quotes', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.nxos.io/v1/quotes",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'accountId' => 'acct_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4',
'fromAsset' => 'USD',
'toAsset' => 'USDC',
'fromAmount' => '10000.00'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.nxos.io/v1/quotes"
payload := strings.NewReader("{\n \"accountId\": \"acct_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4\",\n \"fromAsset\": \"USD\",\n \"toAsset\": \"USDC\",\n \"fromAmount\": \"10000.00\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.nxos.io/v1/quotes")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"accountId\": \"acct_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4\",\n \"fromAsset\": \"USD\",\n \"toAsset\": \"USDC\",\n \"fromAmount\": \"10000.00\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nxos.io/v1/quotes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"accountId\": \"acct_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4\",\n \"fromAsset\": \"USD\",\n \"toAsset\": \"USDC\",\n \"fromAmount\": \"10000.00\"\n}"
response = http.request(request)
puts response.read_body{
"object": "quote",
"quoteId": "quote_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4",
"accountId": "acct_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4",
"fromAsset": "USD",
"toAsset": "USDC",
"fromAmount": "10000.00",
"toAmount": "9997.000000",
"appliedRate": "1.0003",
"spread": {
"fee": "3.00",
"asset": "USD"
},
"status": "PENDING",
"expiresAt": "2025-03-15T14:35:00.000Z",
"createdAt": "2025-03-15T14:30:00.000Z"
}{
"error": {
"code": "invalid_request",
"message": "The request body is malformed or missing required fields.",
"requestId": "req_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4"
}
}{
"error": {
"code": "missing_api_key",
"message": "No Authorization header provided.",
"requestId": "req_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4"
}
}{
"error": {
"code": "forbidden",
"message": "Your organization is not enabled for this action.",
"requestId": "req_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4"
}
}{
"error": {
"code": "not_found",
"message": "The requested resource was not found.",
"requestId": "req_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4"
}
}{
"error": {
"code": "quote_expired",
"message": "The quote has expired.",
"requestId": "req_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4"
}
}{
"error": {
"code": "rate_limited",
"message": "Rate limit exceeded: 1000 requests per minute. Retry in 23 seconds.",
"requestId": "req_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4"
}
}{
"error": {
"code": "internal_error",
"message": "An unexpected server error occurred.",
"requestId": "req_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4"
}
}Headers
Bearer token. Format: Bearer <api_key>
Unique key per logical operation. UUID v4 recommended. Max 255 characters.
Body
Request body for creating a new quote. Specify either fromAmount or toAmount, not both.
Account to create the quote for.
Source asset code (e.g., USD).
Destination asset code (e.g., USDT).
Amount to convert, in major units of the source asset. Mutually exclusive with toAmount.
Desired destination amount, in major units. Mutually exclusive with fromAmount.
Response
The request has succeeded.
An exchange quote for converting between two assets.
Object type. Always quote.
quote Unique quote identifier.
Account this quote belongs to.
Source asset code (e.g., USD).
Destination asset code (e.g., USDT).
Source amount in major units (e.g., 100.00).
Destination amount in major units (e.g., 99.97).
The exchange rate applied to this quote.
Spread fee details. Null if no spread fee was applied.
Show child attributes
Show child attributes
Current quote status.
PENDING, COMPLETED, EXPIRED, FAILED When this quote expires. Quotes are valid for 5 minutes.
When this quote was created.
curl --request POST \
--url https://api.nxos.io/v1/quotes \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"accountId": "acct_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4",
"fromAsset": "USD",
"toAsset": "USDC",
"fromAmount": "10000.00"
}
'import requests
url = "https://api.nxos.io/v1/quotes"
payload = {
"accountId": "acct_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4",
"fromAsset": "USD",
"toAsset": "USDC",
"fromAmount": "10000.00"
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
accountId: 'acct_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4',
fromAsset: 'USD',
toAsset: 'USDC',
fromAmount: '10000.00'
})
};
fetch('https://api.nxos.io/v1/quotes', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.nxos.io/v1/quotes",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'accountId' => 'acct_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4',
'fromAsset' => 'USD',
'toAsset' => 'USDC',
'fromAmount' => '10000.00'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.nxos.io/v1/quotes"
payload := strings.NewReader("{\n \"accountId\": \"acct_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4\",\n \"fromAsset\": \"USD\",\n \"toAsset\": \"USDC\",\n \"fromAmount\": \"10000.00\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.nxos.io/v1/quotes")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"accountId\": \"acct_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4\",\n \"fromAsset\": \"USD\",\n \"toAsset\": \"USDC\",\n \"fromAmount\": \"10000.00\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nxos.io/v1/quotes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"accountId\": \"acct_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4\",\n \"fromAsset\": \"USD\",\n \"toAsset\": \"USDC\",\n \"fromAmount\": \"10000.00\"\n}"
response = http.request(request)
puts response.read_body{
"object": "quote",
"quoteId": "quote_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4",
"accountId": "acct_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4",
"fromAsset": "USD",
"toAsset": "USDC",
"fromAmount": "10000.00",
"toAmount": "9997.000000",
"appliedRate": "1.0003",
"spread": {
"fee": "3.00",
"asset": "USD"
},
"status": "PENDING",
"expiresAt": "2025-03-15T14:35:00.000Z",
"createdAt": "2025-03-15T14:30:00.000Z"
}{
"error": {
"code": "invalid_request",
"message": "The request body is malformed or missing required fields.",
"requestId": "req_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4"
}
}{
"error": {
"code": "missing_api_key",
"message": "No Authorization header provided.",
"requestId": "req_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4"
}
}{
"error": {
"code": "forbidden",
"message": "Your organization is not enabled for this action.",
"requestId": "req_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4"
}
}{
"error": {
"code": "not_found",
"message": "The requested resource was not found.",
"requestId": "req_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4"
}
}{
"error": {
"code": "quote_expired",
"message": "The quote has expired.",
"requestId": "req_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4"
}
}{
"error": {
"code": "rate_limited",
"message": "Rate limit exceeded: 1000 requests per minute. Retry in 23 seconds.",
"requestId": "req_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4"
}
}{
"error": {
"code": "internal_error",
"message": "An unexpected server error occurred.",
"requestId": "req_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4"
}
}