Skip to main content
POST
/
v1
/
swap
Produce swap instruction (calldata) for client execution
curl --request POST \
  --url https://api.fiet.finance/v1/swap \
  --header 'Authorization: Basic <encoded-value>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "chainId": 1,
  "tokenIn": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
  "tokenOut": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
  "tradeType": "EXACT_IN",
  "amount": "1000000",
  "slippageBps": 50
}
'
{
  "quote": {
    "asOf": {
      "timestamp": "2023-11-07T05:31:56Z",
      "blockNumber": 123
    },
    "expiresAt": "2023-11-07T05:31:56Z",
    "chainId": 123,
    "tokenIn": "<string>",
    "tokenOut": "<string>",
    "tradeType": "EXACT_IN",
    "amountIn": "<string>",
    "amountOut": "<string>",
    "fees": {},
    "route": {}
  },
  "instructions": [
    {
      "kind": "EVM_CALL",
      "chainId": 123,
      "to": "<string>",
      "data": "<string>",
      "value": "<string>",
      "constraints": {
        "notAfter": "2023-11-07T05:31:56Z",
        "maxSlippageBps": 2500
      }
    }
  ]
}
This endpoint returns swap instructions (calldata + constraints) for you to execute. For execution options, see Swap.

Authorizations

Authorization
string
header
required

Basic Auth (assumed at gateway for MVP)

Body

application/json
chainId
integer<uint64>
required
Example:

1

tokenIn
string
required
Example:

"0x742d35Cc6634C0532925a3b844Bc9e7595f5fE4b"

tokenOut
string
required
Example:

"0x742d35Cc6634C0532925a3b844Bc9e7595f5fE4b"

tradeType
enum<string>
required
Available options:
EXACT_IN,
EXACT_OUT
amount
string
required

Amount (smallest units as string). Interpretation depends on tradeType.

Example:

"1000000"

slippageBps
integer
default:50
required
Required range: 0 <= x <= 5000
recipient
string

Recipient address for swap outputs (when applicable)

Example:

"0x742d35Cc6634C0532925a3b844Bc9e7595f5fE4b"

deadline
string<date-time>

Response

Swap plan

quote
object
required
instructions
object[]

Ordered list of on-chain instructions required to complete the plan.

Notes:

  • For same-chain swaps, this will usually contain exactly 1 instruction.
  • Future upgrades (e.g. approvals, multi-call routers, cross-chain) can return 2+ items.