Create Swap Instructions
Headers
Request
Base-58 encoded taker wallet address.
Input token mint, base-58 encoded. Use So11111111111111111111111111111111111111111 for native SOL.
Output token mint, base-58 encoded. Use So11111111111111111111111111111111111111111 for native SOL.
DEX sources to exclude from routing. Valid source names are returned by /enabled-sources.
A swap destination: either an existing token account (or wallet for native SOL)
address, or an owner whose token account should be used, and created if required.
If an account is created, its rent is paid by sponsor if present, else by taker.
If the created ATA belongs to the taker, the sponsor keeps close authority and can
reclaim the rent once the account is empty. ATAs created for anyone else (custom
recipient, fee or surplus recipient) leave the rent as a permanent sponsor cost.
Transaction fee payer and rent payer for a fully-sponsored swap. Must differ from the taker and from every native destination in the request. The taker remains the swap authority and must still sign.
Comma-separated volume-based swap fees in parts per million.
Must be provided together with swap_fee_recipient.
Each entry must be between 0 and the per-app maximum (100_000 unless configured otherwise).
A value of 0 disables that fee entry.
Multiple fees on the same side are applied sequentially, each on the amount remaining after prior deductions — not the original amount. Fee amounts are rounded up to the nearest base unit.
Fee recipients for the swap fees: either a comma-separated list of existing token accounts, or a structured list mixing addresses with owners whose token accounts should be the fee recipient.
Comma-separated fee sides for each fee entry.
Supported values are buy and sell.
This field may be omitted only when every fee uses the default buy side.
When provided, the number of entries must match swap_fee_ppm.
Trade surplus cap in parts per million of the total realized trade size.
Must be provided together with trade_surplus_recipient, or both fields must be omitted.
A value of 0 disables trade surplus collection for the request.
When 0x controls trade surplus collection, the request value is ignored and the configured 0x policy is applied instead.
The transferred amount is capped relative to trade size.
A swap destination: either an existing token account (or wallet for native SOL)
address, or an owner whose token account should be used, and created if required.
If an account is created, its rent is paid by sponsor if present, else by taker.
If the created ATA belongs to the taker, the sponsor keeps close authority and can
reclaim the rent once the account is empty. ATAs created for anyone else (custom
recipient, fee or surplus recipient) leave the rent as a permanent sponsor cost.
Response
Unique 12-byte hex identifier for this request.
Present when the caller requested full sponsorship. The returned transaction must use this address as fee payer; both sponsor and taker sign.