For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Contact SupportDiscordGo to dashboard
HomeDocsAPI ReferenceLiquidity IntegrationChangelog
HomeDocsAPI ReferenceLiquidity IntegrationChangelog
    • API Overview
  • EVM APIs
  • Solana Swap APIs
      • POSTSwap Instructions
  • Cross-Chain APIs
LogoLogo
Contact SupportDiscordGo to dashboard
Solana Swap APIsSolana Swap

Swap Instructions

||View as Markdown|
POST
https://host.com/swap-instructions
POST
/swap-instructions
$curl -X POST https://host.com/swap-instructions \
> -H "Content-Type: application/json" \
> -d '{
> "token_out": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
> "token_in": "So11111111111111111111111111111111111111112",
> "amount_in": 100000000000,
> "taker": "3emsAVdmGKERbHjmGfQ6oZ1e35dkf5iYcS6U4CPKFVaa"
>}'
200Successful
1{
2 "amount_out": 16377638151,
3 "instructions": [
4 {
5 "program_id": [
6 140,
7 151,
8 37,
9 143,
10 78,
11 36,
12 137,
13 241,
14 187,
15 61,
16 16,
17 41,
18 20,
19 142,
20 13,
21 131,
22 11,
23 90,
24 19,
25 153,
26 218,
27 255,
28 16,
29 132,
30 4,
31 142,
32 123,
33 216,
34 219,
35 233,
36 248,
37 89
38 ],
39 "accounts": [
40 {
41 "pubkey": [
42 39,
43 100,
44 151,
45 186,
46 11,
47 184,
48 101,
49 145,
50 114,
51 183,
52 46,
53 221,
54 140,
55 102,
56 225,
57 143,
58 86,
59 23,
60 100,
61 217,
62 200,
63 106,
64 97,
65 10,
66 58,
67 126,
68 15,
69 121,
70 192,
71 186,
72 249,
73 219
74 ],
75 "is_signer": true,
76 "is_writable": true
77 },
78 {
79 "pubkey": [
80 62,
81 154,
82 107,
83 241,
84 171,
85 162,
86 21,
87 22,
88 87,
89 224,
90 13,
91 175,
92 92,
93 199,
94 158,
95 17,
96 200,
97 120,
98 219,
99 211,
100 93,
101 118,
102 181,
103 250,
104 14,
105 37,
106 90,
107 74,
108 47,
109 100,
110 28,
111 64
112 ],
113 "is_signer": false,
114 "is_writable": true
115 }
116 ],
117 "data": [
118 0,
119 0,
120 232,
121 118,
122 72,
123 23,
124 0,
125 0,
126 0,
127 72,
128 105,
129 77,
130 203,
131 3,
132 0,
133 0,
134 0,
135 3,
136 0,
137 17,
138 1,
139 0,
140 3,
141 19,
142 17,
143 9,
144 0,
145 0,
146 0,
147 0,
148 0,
149 0,
150 0,
151 0,
152 0,
153 0,
154 0,
155 0,
156 0,
157 0,
158 0,
159 0,
160 0,
161 17,
162 1,
163 0,
164 11,
165 37,
166 17,
167 9,
168 0,
169 0,
170 0,
171 0,
172 0,
173 0,
174 0,
175 0,
176 0,
177 0,
178 0,
179 0,
180 0,
181 0,
182 0,
183 0,
184 7,
185 16,
186 39
187 ]
188 }
189 ],
190 "address_lookup_tables": [
191 "Crx2hke6VcSmPbRTqWDUiV9nVNMNoC2qz9VTGvQrEn7W"
192 ],
193 "zid": "0x39c2df48bb55489cc0376110"
194}
Get swap instructions
Was this page helpful?
Previous

getGaslessTrades

Next

getQuotes

Built with

Request

This endpoint expects an object.
token_outstringRequired

Output Token Mint. For native SOL output, use So11111111111111111111111111111111111111111.

token_instringRequired

Input Token Mint. For native SOL input, use So11111111111111111111111111111111111111111.

amount_inuint64Required

Amount of tokenIn in its base units

takerstringRequired
Taker Account.
slippage_bpsintegerOptional0-10000

Optional. Slippage tolerance in basis points (bps). Must be between 0 and 10,000. Default is 50 bps (0.5%).

recipientstringOptional
Optional. Recipient for swap output. If output token is native SOL this must be the address of the recipient, else a valid token account for that output token mint
reserve_transaction_bytesintegerOptional>=0
Optional. Requests a minimum number of bytes be free in the returned transaction, for composing the swap with additional instructions. Default is 0 bytes.
swap_fee_ppmstringOptional

Optional. Comma-separated volume-based swap fees in parts per million (ppm). Must be provided together with swap_fee_recipient. Each entry must be between 0 and 1_000_000. A value of 0 disables that fee entry. Fees are applied sequentially on the same side: each entry is charged on the remaining amount after previous entries on that side have been deducted, and each fee amount is rounded up to the next base unit when needed (e.g. with swap_fee_ppm=50000,25000 both on the buy side, the second fee is 25000ppm of the amount remaining after the first fee, not of the original amount).

swap_fee_recipientstringOptional

Optional. Comma-separated recipients for the swap fees. Must be provided together with swap_fee_ppm. The number of entries must match swap_fee_ppm. If the respective token for swap_fee_side is native SOL this must be an address, else a valid token account for that token mint.

swap_fee_sidestringOptional

Optional. 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_ppmuintOptional

Optional. Trade surplus cap in parts per million of the total realized trade size. Must be provided together with trade_surplus_token_account, 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.

trade_surplus_recipientstringOptional

Optional. Recipient that should receive trade surplus. Must be provided together with trade_surplus_cap_ppm, or both fields must be omitted. If the output token is native SOL this must be an address, else a valid token account for that token mint. When 0x controls trade surplus collection, the request value is ignored and the configured 0x recipient is used instead.

Response

The request has succeeded.
object
OR
object