POST

Authorizations

x-api-key
string
header
required

A partner's API key. Optional: without it a request is anonymous. An invalid key is 401 unauthorized.

Headers

Idempotency-Key
string

Repeats with the same key and body get the first response; 1 to 255 visible ASCII characters

Body

application/json

The body of POST /v1/quotes: a firm quote, ready to fund.

Across chains, a quote settles through escrows and needs sender, recipient and executionCondition. On one chain it is a swap: it needs sender and recipient and takes no executionCondition. A private swap (privacy: "shielded") names none of the three.

fromChain
string
required

The source chain's slug.

Example:

"base"

fromAsset
string
required

The token sold: an address, or native for an EVM chain's native coin.

Example:

"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913"

fromAmount
string
required

How much is sold, in the token's base units, base 10.

Pattern: ^[0-9]+$
Example:

"1000000"

toChain
string
required

The destination chain's slug: the source chain's for a same-chain swap.

Example:

"starknet"

toAsset
string
required

The token bought: an address, or native.

Example:

"0x053c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8"

sender
string

Across chains, the user's refund address on the source chain; on one chain, the account that swaps.

Example:

"0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266"

recipient
string

The address paid on the destination chain.

Example:

"0x04a7c1e8f2d5b6a39e0c7d18b2f4e6a5c3d9b8a7f6e5d4c3b2a1908f7e6d5c4b"

executionCondition
string

Across chains: SHA-256 of the client's 32-byte fulfillment, in hex. Never reuse one.

Pattern: ^0x[0-9a-fA-F]{64}$
Example:

"0x66687aadf862bd776c8fc18b8e9f8e20089714856ee233b3902a591d0d5f2925"

slippageBps
integer<int32>

How far under the expected output the user accepts, in basis points: a swap reverts below it, and a cross-chain solver commits to the expected amount less it. The server picks a default without it.

Required range: x >= 0
Example:

50

privacy
string

shielded: a private swap on Starknet, from the user's shielded balance in the privacy pool to a new shielded note, sent by Tern's relayer. Same chain only.

Allowed value: "shielded"

Response

The firm quote

A firm quote: a solver's commitment (or a swap's route), and its progress. Every quote route and webhook returns this one object.

id
string
required

q_ and a ULID.

Pattern: ^q_[0-9A-HJKMNP-TV-Z]{26}$
Example:

"q_01JB8Z5W3F6V9Q2X4K7M1N0P8R"

status
required

Where a firm quote stands. completed, refunded and expired are final.

Allowed value: "awaiting_deposit"
route
required

How a quote settles.

Allowed value: "escrow"
from
object
required

What the user sends: the source side of a quote.

to
object
required

What the recipient gets: the destination side of a quote.

createdAt
integer<int64>
required

When the quote was made, in Unix seconds.

Required range: x >= 0
Example:

1793084030

expiresAt
integer<int64>
required

Escrows: the deposit deadline. Swaps: the time to send by (the route goes stale). Unix seconds.

Required range: x >= 0
Example:

1793085830

fees
object

The fees the user accepted, when known.

etaSecs
integer<int64>

Seconds from the deposit (or the swap) being seen until the recipient is paid, as estimated at quote time.

Required range: x >= 0
Example:

40

execute
object

What to send. On creation, everything; on reads, an escrow quote's depositAddress, and its transactions when asked for with withTransactions=true.