Skip to main content
POST
/
v1
/
exchange
/
stablefx
/
signatures
/
funding
/
presign
Generate funding presign data
curl --request POST \
  --url https://api.circle.com/v1/exchange/stablefx/signatures/funding/presign \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "contractTradeIds": [
    "10",
    "11",
    "12"
  ],
  "fundingMode": "gross",
  "funderAddress": "0x1234567890abcdef1234567890abcdef12345678",
  "recipientAddress": "0xabcdef1234567890abcdef1234567890abcdef12"
}
'
import requests

url = "https://api.circle.com/v1/exchange/stablefx/signatures/funding/presign"

payload = {
"contractTradeIds": ["10", "11", "12"],
"fundingMode": "gross",
"funderAddress": "0x1234567890abcdef1234567890abcdef12345678",
"recipientAddress": "0xabcdef1234567890abcdef1234567890abcdef12"
}
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({
contractTradeIds: ['10', '11', '12'],
fundingMode: 'gross',
funderAddress: '0x1234567890abcdef1234567890abcdef12345678',
recipientAddress: '0xabcdef1234567890abcdef1234567890abcdef12'
})
};

fetch('https://api.circle.com/v1/exchange/stablefx/signatures/funding/presign', 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/signatures/funding/presign",
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([
'contractTradeIds' => [
'10',
'11',
'12'
],
'fundingMode' => 'gross',
'funderAddress' => '0x1234567890abcdef1234567890abcdef12345678',
'recipientAddress' => '0xabcdef1234567890abcdef1234567890abcdef12'
]),
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/signatures/funding/presign"

payload := strings.NewReader("{\n \"contractTradeIds\": [\n \"10\",\n \"11\",\n \"12\"\n ],\n \"fundingMode\": \"gross\",\n \"funderAddress\": \"0x1234567890abcdef1234567890abcdef12345678\",\n \"recipientAddress\": \"0xabcdef1234567890abcdef1234567890abcdef12\"\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/signatures/funding/presign")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"contractTradeIds\": [\n \"10\",\n \"11\",\n \"12\"\n ],\n \"fundingMode\": \"gross\",\n \"funderAddress\": \"0x1234567890abcdef1234567890abcdef12345678\",\n \"recipientAddress\": \"0xabcdef1234567890abcdef1234567890abcdef12\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.circle.com/v1/exchange/stablefx/signatures/funding/presign")

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 \"contractTradeIds\": [\n \"10\",\n \"11\",\n \"12\"\n ],\n \"fundingMode\": \"gross\",\n \"funderAddress\": \"0x1234567890abcdef1234567890abcdef12345678\",\n \"recipientAddress\": \"0xabcdef1234567890abcdef1234567890abcdef12\"\n}"

response = http.request(request)
puts response.read_body
{
  "deliverables": [
    {
      "amount": "100.00"
    }
  ],
  "receivables": [
    {
      "amount": "100.00"
    }
  ],
  "typedData": {
    "domain": {
      "name": "Permit2",
      "chainId": 11155111,
      "verifyingContract": "0xffd21ca8F0876DaFAD7de09404E0c1f868bbf1AE"
    },
    "types": {
      "EIP712Domain": [
        {
          "name": "name",
          "type": "string"
        },
        {
          "name": "chainId",
          "type": "uint256"
        },
        {
          "name": "verifyingContract",
          "type": "address"
        }
      ],
      "TokenPermissions": [
        {
          "name": "token",
          "type": "address"
        },
        {
          "name": "amount",
          "type": "uint256"
        }
      ],
      "SingleTradeWitness": [
        {
          "name": "id",
          "type": "uint256"
        }
      ],
      "PermitWitnessTransferFrom": [
        {
          "name": "permitted",
          "type": "TokenPermissions"
        },
        {
          "name": "spender",
          "type": "address"
        },
        {
          "name": "nonce",
          "type": "uint256"
        },
        {
          "name": "deadline",
          "type": "uint256"
        },
        {
          "name": "witness",
          "type": "SingleTradeWitness"
        }
      ]
    },
    "primaryType": "PermitWitnessTransferFrom",
    "message": {
      "permitted": {
        "token": "0xTOKEN",
        "amount": "1000"
      },
      "spender": "0xffd21ca8F0876DaFAD7de09404E0c1f868bbf1AE",
      "nonce": "42",
      "deadline": "1735689600",
      "witness": {
        "id": "10"
      }
    }
  }
}

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 generating funding presign data

contractTradeIds
string[]
required

List of contract trade IDs. Exactly one contract trade ID is supported when fundingMode is delegate.

Minimum array length: 1
Example:
["10", "11", "12"]
type
enum<string>
required

The type of trader.

Available options:
maker,
taker
fundingMode
enum<string>
default:gross

Funding mode for the presign request. net is supported for maker funding requests only; delegate is supported for both maker and taker.

Available options:
gross,
net,
delegate
funderAddress
string

Address of the funder wallet that will deliver tokens on the trader's behalf. Required when fundingMode is delegate.

Example:

"0x1234567890abcdef1234567890abcdef12345678"

recipientAddress
string

Address that receives the delivered tokens. Required when fundingMode is delegate.

Example:

"0xabcdef1234567890abcdef1234567890abcdef12"

Response

200 - application/json

Funding presign data generated successfully

Response containing Permit2 EIP-712 typed data for funding operations. For gross and net funding modes, contains the trader's Permit2 typed data along with deliverables and receivables. For delegate funding mode, contains separate typed-data payloads for the trader and the funder. No discriminator is defined because the response body carries no fundingMode field; the variant is determined by the fundingMode sent in the request, and the two variants have mutually exclusive required properties.

deliverables
object[]
required

Aggregated assets that the trader needs to deliver.

receivables
object[]
required

Aggregated assets that the trader expects to receive after fee deduction.

typedData
object
required

EIP-712 typed data structure for single Permit2 transfer