Skip to main content
POST
/
v1
/
exchange
/
stablefx
/
quotes
Create a quote
curl --request POST \
  --url https://api.circle.com/v1/exchange/stablefx/quotes \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "from": {
    "amount": "100.00"
  },
  "to": {
    "amount": "100.00"
  },
  "type": "tradable",
  "recipientAddress": "0x1234567890abcdef1234567890abcdef12345678"
}
'
import requests

url = "https://api.circle.com/v1/exchange/stablefx/quotes"

payload = {
"from": { "amount": "100.00" },
"to": { "amount": "100.00" },
"type": "tradable",
"recipientAddress": "0x1234567890abcdef1234567890abcdef12345678"
}
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: {amount: '100.00'},
to: {amount: '100.00'},
type: 'tradable',
recipientAddress: '0x1234567890abcdef1234567890abcdef12345678'
})
};

fetch('https://api.circle.com/v1/exchange/stablefx/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.circle.com/v1/exchange/stablefx/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' => [
'amount' => '100.00'
],
'to' => [
'amount' => '100.00'
],
'type' => 'tradable',
'recipientAddress' => '0x1234567890abcdef1234567890abcdef12345678'
]),
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.circle.com/v1/exchange/stablefx/quotes"

payload := strings.NewReader("{\n \"from\": {\n \"amount\": \"100.00\"\n },\n \"to\": {\n \"amount\": \"100.00\"\n },\n \"type\": \"tradable\",\n \"recipientAddress\": \"0x1234567890abcdef1234567890abcdef12345678\"\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.circle.com/v1/exchange/stablefx/quotes")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"from\": {\n \"amount\": \"100.00\"\n },\n \"to\": {\n \"amount\": \"100.00\"\n },\n \"type\": \"tradable\",\n \"recipientAddress\": \"0x1234567890abcdef1234567890abcdef12345678\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.circle.com/v1/exchange/stablefx/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 \"amount\": \"100.00\"\n },\n \"to\": {\n \"amount\": \"100.00\"\n },\n \"type\": \"tradable\",\n \"recipientAddress\": \"0x1234567890abcdef1234567890abcdef12345678\"\n}"

response = http.request(request)
puts response.read_body
{
  "id": "c4d1da72-111e-4d52-bdbf-2e74a2d803d5",
  "rate": 0.915,
  "to": {
    "amount": "100.00"
  },
  "from": {
    "amount": "100.00"
  },
  "createdAt": "2023-01-01T12:04:05Z",
  "expiresAt": "2023-01-01T12:04:05Z",
  "fee": "100.00",
  "collateral": "100.00",
  "typedData": {
    "domain": {
      "name": "Permit2",
      "chainId": 11155111,
      "verifyingContract": "0xffd21ca8F0876DaFAD7de09404E0c1f868bbf1AE"
    },
    "types": {
      "EIP712Domain": [
        {
          "name": "<string>",
          "type": "<string>"
        }
      ],
      "Consideration": [
        {
          "name": "<string>",
          "type": "<string>"
        }
      ],
      "TraderDetails": [
        {
          "name": "consideration",
          "type": "Consideration"
        },
        {
          "name": "recipient",
          "type": "address"
        },
        {
          "name": "fee",
          "type": "uint256"
        },
        {
          "name": "authorizer",
          "type": "address"
        }
      ],
      "TokenPermissions": [
        {
          "name": "<string>",
          "type": "<string>"
        }
      ],
      "PermitWitnessTransferFrom": [
        {
          "name": "<string>",
          "type": "<string>"
        }
      ]
    },
    "primaryType": "PermitWitnessTransferFrom",
    "message": {
      "permitted": {
        "token": "0x3600000000000000000000000000000000000000",
        "amount": "429000000"
      },
      "spender": "0xa8f94168b4981840ba27d423f4ad6332bedee006",
      "nonce": "309585810",
      "deadline": "1770302983",
      "witness": {
        "consideration": {
          "quoteId": "<string>",
          "base": "<string>",
          "quote": "<string>",
          "baseAmount": "<string>",
          "quoteAmount": "<string>",
          "maturity": "1716153600"
        },
        "fee": "80000",
        "authorizer": "0x0000000000000000000000000000000000000000",
        "recipient": "0x1f531ce3c418bbd830d06138a9e5b5eacfdfb3d6"
      }
    }
  }
}

Authorizations

Authorization
string
header
required

Circle's API Keys are formatted in the following structure "PREFIX:ID:SECRET". All three parts are requred to make a successful request.

Body

application/json

Request body for creating an exchange quote

from
object
required

Currency and amount details for a foreign exchange transaction

to
object
required

Currency and amount details for a foreign exchange transaction

tenor
enum<string>
required

The settlement schedule for the trade

Available options:
instant,
hourly,
daily
type
enum<string>
default:tradable

The quote type. Use tradable for executable quotes or reference for indicative quotes.

Available options:
reference,
tradable
recipientAddress
string

The address that should receive taker proceeds. Required for tradable quote requests.

Example:

"0x1234567890abcdef1234567890abcdef12345678"

Response

200 - application/json

Quote created successfully

Quote for an FX transaction

id
string<uuid>

System-generated unique identifier of the resource.

Example:

"c4d1da72-111e-4d52-bdbf-2e74a2d803d5"

rate
number<double>

Exchange rate for the quote

Example:

0.915

to
object

Currency and amount details for a foreign exchange transaction

from
object

Currency and amount details for a foreign exchange transaction

createdAt
string<date-time>

Date and time when the resource was created

Example:

"2023-01-01T12:04:05Z"

expiresAt
string<date-time>

Date and time when the resource expires

Example:

"2023-01-01T12:04:05Z"

fee
string

The fee for the transaction, denominated in the 'to' currency.

Pattern: ^\d+(?:\.\d{1,6})?$
Example:

"100.00"

collateral
string

Optional collateral amount required for the quote, denominated in the 'from' currency.

Pattern: ^\d+(?:\.\d{1,6})?$
Example:

"100.00"

typedData
object

Permit2 EIP-712 typed data for signing before trade creation.