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 fee schedule that applies to advances, expressed 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 hold capacity on your credit line 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. You
can have one active reservation per currency. While a reservation is active, a
request for the same currency with a different idempotencyKey is rejected;
cancel the active reservation first.This step is optional. If you don’t need to reserve credit, skip to the next
step.Get the Permit2 typed data to sign
Call the presign endpoint with the ResponseNote the following about the response:
tradeId 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 fees object (unpaid and total), the dueDate, and any
repayments. The fees.total, paidDate, and dueDate fields are omitted
until the advance is paid.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 a webhook endpoint. For the
full set of trade states, see Trade states.Repay the advance
Record a repayment against the credit line backing the advance by calling the
repayment endpoint. Any excess beyond the outstanding balance is credited to
your Circle Mint account balance. For USDC and EURC repayments, round the amount
up to two decimal places; other stablecoins, such as MXNB, QCAD, AUDF, and ZARU,
aren’t subject to rounding. 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