Create an FX quote
curl --request POST \
--url https://api-sandbox.circle.com/v1/exchange/quotes \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"from": {
"currency": "EURC",
"amount": "100.00"
},
"to": {
"currency": "EURC",
"amount": "100.00"
},
"type": "tradable"
}
'import requests
url = "https://api-sandbox.circle.com/v1/exchange/quotes"
payload = {
"from": {
"currency": "EURC",
"amount": "100.00"
},
"to": {
"currency": "EURC",
"amount": "100.00"
},
"type": "tradable"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
from: {currency: 'EURC', amount: '100.00'},
to: {currency: 'EURC', amount: '100.00'},
type: 'tradable'
})
};
fetch('https://api-sandbox.circle.com/v1/exchange/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-sandbox.circle.com/v1/exchange/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([
'from' => [
'currency' => 'EURC',
'amount' => '100.00'
],
'to' => [
'currency' => 'EURC',
'amount' => '100.00'
],
'type' => 'tradable'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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-sandbox.circle.com/v1/exchange/quotes"
payload := strings.NewReader("{\n \"from\": {\n \"currency\": \"EURC\",\n \"amount\": \"100.00\"\n },\n \"to\": {\n \"currency\": \"EURC\",\n \"amount\": \"100.00\"\n },\n \"type\": \"tradable\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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-sandbox.circle.com/v1/exchange/quotes")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"from\": {\n \"currency\": \"EURC\",\n \"amount\": \"100.00\"\n },\n \"to\": {\n \"currency\": \"EURC\",\n \"amount\": \"100.00\"\n },\n \"type\": \"tradable\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.circle.com/v1/exchange/quotes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"from\": {\n \"currency\": \"EURC\",\n \"amount\": \"100.00\"\n },\n \"to\": {\n \"currency\": \"EURC\",\n \"amount\": \"100.00\"\n },\n \"type\": \"tradable\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "b8627ae8-732b-4d25-b947-1df8f4007a29",
"rate": 0.9259,
"from": {
"currency": "EURC",
"amount": "100.00"
},
"to": {
"currency": "EURC",
"amount": "100.00"
},
"type": "tradable",
"expiry": "2020-04-10T02:13:30.000Z",
"timestamp": "2020-04-10T02:13:30.000Z",
"estimatedSettlementTime": "2020-04-10T02:13:30.000Z",
"source": {
"type": "wallet",
"id": "1000662322",
"description": "End User Wallet"
},
"destination": {
"type": "wallet",
"id": "1000662322",
"description": "End User Wallet"
},
"clientEntityId": "a3f1b2c4-d5e6-7890-abcd-ef1234567890"
}
}Create an FX quote
Create a quote to swap USDC and EURC for an end user's account. Only USDC <> EURC swaps are supported. Tradable quotes that include a fiat currency are rejected.
- `tradable` quotes lock a rate for a few seconds (until `expiry`). Execute
one with Create an FX trade. Set `source` to the end user's account.
- `reference` quotes return an indicative rate only and can't be traded.
POST
/
v1
/
exchange
/
quotes
Create an FX quote
curl --request POST \
--url https://api-sandbox.circle.com/v1/exchange/quotes \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"from": {
"currency": "EURC",
"amount": "100.00"
},
"to": {
"currency": "EURC",
"amount": "100.00"
},
"type": "tradable"
}
'import requests
url = "https://api-sandbox.circle.com/v1/exchange/quotes"
payload = {
"from": {
"currency": "EURC",
"amount": "100.00"
},
"to": {
"currency": "EURC",
"amount": "100.00"
},
"type": "tradable"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
from: {currency: 'EURC', amount: '100.00'},
to: {currency: 'EURC', amount: '100.00'},
type: 'tradable'
})
};
fetch('https://api-sandbox.circle.com/v1/exchange/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-sandbox.circle.com/v1/exchange/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([
'from' => [
'currency' => 'EURC',
'amount' => '100.00'
],
'to' => [
'currency' => 'EURC',
'amount' => '100.00'
],
'type' => 'tradable'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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-sandbox.circle.com/v1/exchange/quotes"
payload := strings.NewReader("{\n \"from\": {\n \"currency\": \"EURC\",\n \"amount\": \"100.00\"\n },\n \"to\": {\n \"currency\": \"EURC\",\n \"amount\": \"100.00\"\n },\n \"type\": \"tradable\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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-sandbox.circle.com/v1/exchange/quotes")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"from\": {\n \"currency\": \"EURC\",\n \"amount\": \"100.00\"\n },\n \"to\": {\n \"currency\": \"EURC\",\n \"amount\": \"100.00\"\n },\n \"type\": \"tradable\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.circle.com/v1/exchange/quotes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"from\": {\n \"currency\": \"EURC\",\n \"amount\": \"100.00\"\n },\n \"to\": {\n \"currency\": \"EURC\",\n \"amount\": \"100.00\"\n },\n \"type\": \"tradable\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "b8627ae8-732b-4d25-b947-1df8f4007a29",
"rate": 0.9259,
"from": {
"currency": "EURC",
"amount": "100.00"
},
"to": {
"currency": "EURC",
"amount": "100.00"
},
"type": "tradable",
"expiry": "2020-04-10T02:13:30.000Z",
"timestamp": "2020-04-10T02:13:30.000Z",
"estimatedSettlementTime": "2020-04-10T02:13:30.000Z",
"source": {
"type": "wallet",
"id": "1000662322",
"description": "End User Wallet"
},
"destination": {
"type": "wallet",
"id": "1000662322",
"description": "End User Wallet"
},
"clientEntityId": "a3f1b2c4-d5e6-7890-abcd-ef1234567890"
}
}Authorizations
Body
application/json
Was this page helpful?