curl --request POST \
--url https://api.circle.com/v1/exchange/stablefx/fund \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"signature": "0x1234567890abcdef...",
"permit2": {
"permitted": {
"token": "0xTOKEN",
"amount": "1000"
},
"spender": "0xffd21ca8F0876DaFAD7de09404E0c1f868bbf1AE",
"nonce": "42",
"deadline": "1735689600",
"witness": {
"id": "10"
}
},
"fundingMode": "gross",
"funderPermit2": {
"permitted": {
"token": "0xTOKEN",
"amount": "1000"
},
"spender": "0xFxEscrow000000000000000000000000000000000",
"nonce": "1234567890",
"deadline": "1782556800",
"witness": {
"id": "987654321",
"recipient": "0xabcdef1234567890abcdef1234567890abcdef12"
}
},
"funderSignature": "0xabcdef1234567890..."
}
'import requests
url = "https://api.circle.com/v1/exchange/stablefx/fund"
payload = {
"signature": "0x1234567890abcdef...",
"permit2": {
"permitted": {
"token": "0xTOKEN",
"amount": "1000"
},
"spender": "0xffd21ca8F0876DaFAD7de09404E0c1f868bbf1AE",
"nonce": "42",
"deadline": "1735689600",
"witness": { "id": "10" }
},
"fundingMode": "gross",
"funderPermit2": {
"permitted": {
"token": "0xTOKEN",
"amount": "1000"
},
"spender": "0xFxEscrow000000000000000000000000000000000",
"nonce": "1234567890",
"deadline": "1782556800",
"witness": {
"id": "987654321",
"recipient": "0xabcdef1234567890abcdef1234567890abcdef12"
}
},
"funderSignature": "0xabcdef1234567890..."
}
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({
signature: '0x1234567890abcdef...',
permit2: {
permitted: {token: '0xTOKEN', amount: '1000'},
spender: '0xffd21ca8F0876DaFAD7de09404E0c1f868bbf1AE',
nonce: '42',
deadline: '1735689600',
witness: {id: '10'}
},
fundingMode: 'gross',
funderPermit2: {
permitted: {token: '0xTOKEN', amount: '1000'},
spender: '0xFxEscrow000000000000000000000000000000000',
nonce: '1234567890',
deadline: '1782556800',
witness: {id: '987654321', recipient: '0xabcdef1234567890abcdef1234567890abcdef12'}
},
funderSignature: '0xabcdef1234567890...'
})
};
fetch('https://api.circle.com/v1/exchange/stablefx/fund', 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/fund",
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([
'signature' => '0x1234567890abcdef...',
'permit2' => [
'permitted' => [
'token' => '0xTOKEN',
'amount' => '1000'
],
'spender' => '0xffd21ca8F0876DaFAD7de09404E0c1f868bbf1AE',
'nonce' => '42',
'deadline' => '1735689600',
'witness' => [
'id' => '10'
]
],
'fundingMode' => 'gross',
'funderPermit2' => [
'permitted' => [
'token' => '0xTOKEN',
'amount' => '1000'
],
'spender' => '0xFxEscrow000000000000000000000000000000000',
'nonce' => '1234567890',
'deadline' => '1782556800',
'witness' => [
'id' => '987654321',
'recipient' => '0xabcdef1234567890abcdef1234567890abcdef12'
]
],
'funderSignature' => '0xabcdef1234567890...'
]),
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/fund"
payload := strings.NewReader("{\n \"signature\": \"0x1234567890abcdef...\",\n \"permit2\": {\n \"permitted\": {\n \"token\": \"0xTOKEN\",\n \"amount\": \"1000\"\n },\n \"spender\": \"0xffd21ca8F0876DaFAD7de09404E0c1f868bbf1AE\",\n \"nonce\": \"42\",\n \"deadline\": \"1735689600\",\n \"witness\": {\n \"id\": \"10\"\n }\n },\n \"fundingMode\": \"gross\",\n \"funderPermit2\": {\n \"permitted\": {\n \"token\": \"0xTOKEN\",\n \"amount\": \"1000\"\n },\n \"spender\": \"0xFxEscrow000000000000000000000000000000000\",\n \"nonce\": \"1234567890\",\n \"deadline\": \"1782556800\",\n \"witness\": {\n \"id\": \"987654321\",\n \"recipient\": \"0xabcdef1234567890abcdef1234567890abcdef12\"\n }\n },\n \"funderSignature\": \"0xabcdef1234567890...\"\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/fund")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"signature\": \"0x1234567890abcdef...\",\n \"permit2\": {\n \"permitted\": {\n \"token\": \"0xTOKEN\",\n \"amount\": \"1000\"\n },\n \"spender\": \"0xffd21ca8F0876DaFAD7de09404E0c1f868bbf1AE\",\n \"nonce\": \"42\",\n \"deadline\": \"1735689600\",\n \"witness\": {\n \"id\": \"10\"\n }\n },\n \"fundingMode\": \"gross\",\n \"funderPermit2\": {\n \"permitted\": {\n \"token\": \"0xTOKEN\",\n \"amount\": \"1000\"\n },\n \"spender\": \"0xFxEscrow000000000000000000000000000000000\",\n \"nonce\": \"1234567890\",\n \"deadline\": \"1782556800\",\n \"witness\": {\n \"id\": \"987654321\",\n \"recipient\": \"0xabcdef1234567890abcdef1234567890abcdef12\"\n }\n },\n \"funderSignature\": \"0xabcdef1234567890...\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.circle.com/v1/exchange/stablefx/fund")
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 \"signature\": \"0x1234567890abcdef...\",\n \"permit2\": {\n \"permitted\": {\n \"token\": \"0xTOKEN\",\n \"amount\": \"1000\"\n },\n \"spender\": \"0xffd21ca8F0876DaFAD7de09404E0c1f868bbf1AE\",\n \"nonce\": \"42\",\n \"deadline\": \"1735689600\",\n \"witness\": {\n \"id\": \"10\"\n }\n },\n \"fundingMode\": \"gross\",\n \"funderPermit2\": {\n \"permitted\": {\n \"token\": \"0xTOKEN\",\n \"amount\": \"1000\"\n },\n \"spender\": \"0xFxEscrow000000000000000000000000000000000\",\n \"nonce\": \"1234567890\",\n \"deadline\": \"1782556800\",\n \"witness\": {\n \"id\": \"987654321\",\n \"recipient\": \"0xabcdef1234567890abcdef1234567890abcdef12\"\n }\n },\n \"funderSignature\": \"0xabcdef1234567890...\"\n}"
response = http.request(request)
puts response.read_bodyFund trades
Executes funding for trades using Permit2 signatures. This endpoint relays the signed permit data to complete the funding operation for trades.
When fundingMode is delegate or net_delegate, the request must include the trader’s delegate-funding authorization in permit2/signature along with the funder’s permit in funderPermit2/funderSignature. The funder delivers the tokens on the trader’s behalf; no tokens transfer from the trader. A single contract trade ID uses single-trade payloads; more than one (or any count for net_delegate) uses batch payloads.
curl --request POST \
--url https://api.circle.com/v1/exchange/stablefx/fund \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"signature": "0x1234567890abcdef...",
"permit2": {
"permitted": {
"token": "0xTOKEN",
"amount": "1000"
},
"spender": "0xffd21ca8F0876DaFAD7de09404E0c1f868bbf1AE",
"nonce": "42",
"deadline": "1735689600",
"witness": {
"id": "10"
}
},
"fundingMode": "gross",
"funderPermit2": {
"permitted": {
"token": "0xTOKEN",
"amount": "1000"
},
"spender": "0xFxEscrow000000000000000000000000000000000",
"nonce": "1234567890",
"deadline": "1782556800",
"witness": {
"id": "987654321",
"recipient": "0xabcdef1234567890abcdef1234567890abcdef12"
}
},
"funderSignature": "0xabcdef1234567890..."
}
'import requests
url = "https://api.circle.com/v1/exchange/stablefx/fund"
payload = {
"signature": "0x1234567890abcdef...",
"permit2": {
"permitted": {
"token": "0xTOKEN",
"amount": "1000"
},
"spender": "0xffd21ca8F0876DaFAD7de09404E0c1f868bbf1AE",
"nonce": "42",
"deadline": "1735689600",
"witness": { "id": "10" }
},
"fundingMode": "gross",
"funderPermit2": {
"permitted": {
"token": "0xTOKEN",
"amount": "1000"
},
"spender": "0xFxEscrow000000000000000000000000000000000",
"nonce": "1234567890",
"deadline": "1782556800",
"witness": {
"id": "987654321",
"recipient": "0xabcdef1234567890abcdef1234567890abcdef12"
}
},
"funderSignature": "0xabcdef1234567890..."
}
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({
signature: '0x1234567890abcdef...',
permit2: {
permitted: {token: '0xTOKEN', amount: '1000'},
spender: '0xffd21ca8F0876DaFAD7de09404E0c1f868bbf1AE',
nonce: '42',
deadline: '1735689600',
witness: {id: '10'}
},
fundingMode: 'gross',
funderPermit2: {
permitted: {token: '0xTOKEN', amount: '1000'},
spender: '0xFxEscrow000000000000000000000000000000000',
nonce: '1234567890',
deadline: '1782556800',
witness: {id: '987654321', recipient: '0xabcdef1234567890abcdef1234567890abcdef12'}
},
funderSignature: '0xabcdef1234567890...'
})
};
fetch('https://api.circle.com/v1/exchange/stablefx/fund', 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/fund",
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([
'signature' => '0x1234567890abcdef...',
'permit2' => [
'permitted' => [
'token' => '0xTOKEN',
'amount' => '1000'
],
'spender' => '0xffd21ca8F0876DaFAD7de09404E0c1f868bbf1AE',
'nonce' => '42',
'deadline' => '1735689600',
'witness' => [
'id' => '10'
]
],
'fundingMode' => 'gross',
'funderPermit2' => [
'permitted' => [
'token' => '0xTOKEN',
'amount' => '1000'
],
'spender' => '0xFxEscrow000000000000000000000000000000000',
'nonce' => '1234567890',
'deadline' => '1782556800',
'witness' => [
'id' => '987654321',
'recipient' => '0xabcdef1234567890abcdef1234567890abcdef12'
]
],
'funderSignature' => '0xabcdef1234567890...'
]),
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/fund"
payload := strings.NewReader("{\n \"signature\": \"0x1234567890abcdef...\",\n \"permit2\": {\n \"permitted\": {\n \"token\": \"0xTOKEN\",\n \"amount\": \"1000\"\n },\n \"spender\": \"0xffd21ca8F0876DaFAD7de09404E0c1f868bbf1AE\",\n \"nonce\": \"42\",\n \"deadline\": \"1735689600\",\n \"witness\": {\n \"id\": \"10\"\n }\n },\n \"fundingMode\": \"gross\",\n \"funderPermit2\": {\n \"permitted\": {\n \"token\": \"0xTOKEN\",\n \"amount\": \"1000\"\n },\n \"spender\": \"0xFxEscrow000000000000000000000000000000000\",\n \"nonce\": \"1234567890\",\n \"deadline\": \"1782556800\",\n \"witness\": {\n \"id\": \"987654321\",\n \"recipient\": \"0xabcdef1234567890abcdef1234567890abcdef12\"\n }\n },\n \"funderSignature\": \"0xabcdef1234567890...\"\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/fund")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"signature\": \"0x1234567890abcdef...\",\n \"permit2\": {\n \"permitted\": {\n \"token\": \"0xTOKEN\",\n \"amount\": \"1000\"\n },\n \"spender\": \"0xffd21ca8F0876DaFAD7de09404E0c1f868bbf1AE\",\n \"nonce\": \"42\",\n \"deadline\": \"1735689600\",\n \"witness\": {\n \"id\": \"10\"\n }\n },\n \"fundingMode\": \"gross\",\n \"funderPermit2\": {\n \"permitted\": {\n \"token\": \"0xTOKEN\",\n \"amount\": \"1000\"\n },\n \"spender\": \"0xFxEscrow000000000000000000000000000000000\",\n \"nonce\": \"1234567890\",\n \"deadline\": \"1782556800\",\n \"witness\": {\n \"id\": \"987654321\",\n \"recipient\": \"0xabcdef1234567890abcdef1234567890abcdef12\"\n }\n },\n \"funderSignature\": \"0xabcdef1234567890...\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.circle.com/v1/exchange/stablefx/fund")
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 \"signature\": \"0x1234567890abcdef...\",\n \"permit2\": {\n \"permitted\": {\n \"token\": \"0xTOKEN\",\n \"amount\": \"1000\"\n },\n \"spender\": \"0xffd21ca8F0876DaFAD7de09404E0c1f868bbf1AE\",\n \"nonce\": \"42\",\n \"deadline\": \"1735689600\",\n \"witness\": {\n \"id\": \"10\"\n }\n },\n \"fundingMode\": \"gross\",\n \"funderPermit2\": {\n \"permitted\": {\n \"token\": \"0xTOKEN\",\n \"amount\": \"1000\"\n },\n \"spender\": \"0xFxEscrow000000000000000000000000000000000\",\n \"nonce\": \"1234567890\",\n \"deadline\": \"1782556800\",\n \"witness\": {\n \"id\": \"987654321\",\n \"recipient\": \"0xabcdef1234567890abcdef1234567890abcdef12\"\n }\n },\n \"funderSignature\": \"0xabcdef1234567890...\"\n}"
response = http.request(request)
puts response.read_bodyAuthorizations
Circle's API Keys are formatted in the following structure "PREFIX:ID:SECRET". All three parts are requred to make a successful request.
Body
- Option 1
- Option 2
Request body for funding operations. signature/permit2 are required for gross/net and for delegate/net_delegate funding.
The type of trader.
maker, taker The trader's Permit2 signature over permit2.
"0x1234567890abcdef..."
The Permit2 message object signed by the trader (type). Single or batch funding message carrying the actual delivery amount for gross/net; for fundingMode delegate/net_delegate, this is instead the trader's zero-amount delegate-funding authorization (single or batch depending on trade count) that authorizes the funder to deliver on their behalf.
- Option 1
- Option 2
- Option 3
- Option 4
Show child attributes
Show child attributes
The funding mode for the operation (optional)
gross, net, delegate, net_delegate The funder's delegate-funding payload, carrying the actual delivery amount(s), collected out-of-band by the funder. Required when fundingMode is delegate or net_delegate.
- Option 1
- Option 2
Show child attributes
Show child attributes
The funder's signature over funderPermit2. Required when fundingMode is delegate or net_delegate.
"0xabcdef1234567890..."
Response
Funding completed successfully
Was this page helpful?