0, Circle delivers
the advanced currency onchain on your behalf, and you repay the advance later.
For the reasoning behind credit lines, delegate funding, collateral, and fees,
see Settlement Advance.
StableFX uses a single endpoint for all API requests. The base URL is
https://api.circle.com/. The StableFX API uses your API key for authentication
and to determine which environment to use. The TEST environment executes
against Arc testnet and returns mock data.When developing or testing your integration, you should use your TEST API key.
When you are ready to move to production, just update your code to use your
LIVE API key.Prerequisites
Before you begin, make sure you’ve:- Been approved for a Settlement Advance credit line.
- Set up a wallet or application that supports Ethereum Improvement Proposal 712 (EIP-712) signatures.
- Granted a USDC allowance to the
Permit2contract. See How-to: Grant USDC Allowance to Permit2. - Obtained the ID of a confirmed trade.
- Installed curl, or another HTTP client, on your development machine.
{"currency": "USDC", "amount": "350000.00"}.
Steps
Check available credit
Call the get credit line endpoint to confirm how much credit you have available
and the current fee rate in basis points (bps).ResponseThe
availableInCurrencies map shows the available credit converted to each
supported currency. Use it to confirm you have enough credit in the currency you
plan to advance.(Optional) Reserve credit to lock a fee snapshot
To lock a fee snapshot before you fund a trade, reserve credit with the reserve
endpoint. Provide an Response
idempotencyKey and the advance currency and amount. A
reservation holds the credit for about 15 minutes and locks the fee that applies
to the advance. Only one reservation is active per credit line at a time, and a
request with a different idempotencyKey replaces the active reservation.This step is optional. If you don’t need a fee snapshot, skip to the next step.Get the Permit2 typed data to sign
Call the presign endpoint with the ResponseNote the following about the response:
exchangeTradeId of the confirmed trade to
get the Permit2 typed data to sign.primaryTypeisDelegateFundingAuthorizationPermitWitnessTransferFrom.- The witness is a
DelegateFundingAuthorizationwithid(the onchain trade ID),funder,recipient,token, andamount. permitted.amountis always0. No tokens move from your wallet; Circle delivers the advanced currency on your behalf.spenderis theFxEscrowcontract address.- The response also returns the
advanceandcollateralamounts for the trade.
Sign the typed data
Using your EIP-712-capable wallet or application, sign the
makerPermitTypedData returned in the previous step. The signature is a 65-byte
hex string.For example, with a viem wallet client:Request the advance
Submit the signed authorization to the request advance endpoint. Include an
Response
idempotencyKey, the tradeId, the permit2 witness payload, and the
signature. The request is idempotent on tradeId, and funding runs
asynchronously.Track the advance
Call the get advance endpoint with the ResponseTo list multiple advances, call the list advances endpoint. It supports
filtering by
advanceId to track the advance through
its lifecycle. The response reports the status, the advance and collateral
amounts, the feeBps, the accruedFee, the dueDate, and any repayments.
The accruedFee and dueDate are omitted until the advance is funded.status and create-date range, and it paginates with the
pageBefore and pageAfter parameters and a configurable pageSize.The delegate-funded webhooks confirm onchain delivery. The
stablefx.trade.makerDelegateFunded event fires when Circle delivers the
advanced currency, and the stablefx.contract.makerDelegateDeliver.failed event
fires if delivery fails. To subscribe, see
How-to: Set up webhook notifications.
For the full set of trade states, see
Trade states.Repay the advance
Send the repayment onchain to the repayment address on your credit line, then
record it by calling the repayment endpoint. Repayments are applied
first-in-first-out (FIFO) across outstanding transfers in the same currency, and
any excess is recorded as a credit over-repayment. The request is idempotent on
The repayment applies against your credit line rather than a specific advance,
so the request body carries only the
idempotencyKey: a successful request returns 201, and reusing the same key
with different parameters returns 409.idempotencyKey and the amount.Response