Create a trade
POST/v3/tradesDescription
This endpoint allows you to create a Trade.
A Trade
is a combination of a quote
and a transaction
. A trade is required to execute a DEX swap.
Header Parameters
Name | Description | Required |
---|---|---|
App-Name | App-Name for the authorization | yes |
App-Version | App-Version for the authorization | no |
Forwarded | If you are proxying requests to the API, you must include the "Forwarded" header with the original request IP address. This is used for geolocation availability purposes. | no |
Payload
Name | Description | Required |
---|---|---|
pairId | The pair id to create a trade for. | yes |
fromAmount | The amount you want to swap. | yes |
fromAddress | Address from which the user is sending the funds. | yes |
toAddress | The address to receive the exchanged funds | yes |
slippage | Percentage of slippage tolerance with a 2% by default. | no |
swapMode | Default to 'ExactIn'. Use 'ExactOut' and 'toAmount' param if you want to execute an ExactOut swap | no |
toAmount | The amount you want to receive in an ExactOut swap. (only required if swapMode=ExactOut) | no |
Response
SUCCESSFULL SWAP CREATION
{
"id": "cc28c4d790dbf6e8109cbddca68e42406657d4d4a225f2b49a179fc52bead6bb",
"pairId": "SOL_USDCSOL",
"fromAmount": {
"assetId": "SOL",
"value": "1"
},
"toAmount": {
"assetId": "USDCSOL",
"value": "152.54"
},
"slippage": 2,
"swapMode": "ExactIn",
"provider": "jup-sol",
"expiry": 1752515834195,
"fee": {
"amount": {
"assetId": "SOL",
"value": "0.004575179"
}
},
"solanaTransactions": [
{
"type": "swap",
"data": "AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAQAGC57KE+vXZRw4+Zn6KkR0n2JXRLu7UwfoB/jo+90eHBzOAIc4pdz1sXQ22Pv1i4BSXOlSLQLcDhMMxqv/ke2kphQkdbrsCdC/ZQn00fd0L66V9xmhpJfdP72OADSNGdee4VGXpdGcB3C0k3pGFRKaIwNm+8RsbVBU2IdzvEjKu7nn/GO7kCFV3KETKMQ3uJJZHbF5IMxRKI6r7cWH9BmLRZ0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMGRm/lIRcy/+ytunLDm+e8jOW7xfcSayxDmzpAAAAABHnVW/IxwG7udMVuzmgVB/2xst6j9I5RArHNola8E48G3fbh12Whk9nL4UbO63msHLSF7V9bN5E6jPWFfv8AqYyXJY9OJInxuz0QKRSODYMLWhOZ2v8QhASOe9jb6fhZtD/6J/XX9kp0wJsfKVh53ksJqzbfyd1RSzIap7OM5ehRbyOCzJvl/z5eW5HF7yLdbh1gUWRGCfz1+2R2qkfWswgGAAUCwFwVAAYACQParQIAAAAAAAkGAAIAEwUIAQEFAgACDAIAAAAAypo7AAAAAAgBAgERCQYABAAVBRQBAQccFAACBAcVAwoHFwAWEQIEEA8OCBQSExUNAQwLByPlF8uXeuOtKgEAAAAoZAABAMqaOwAAAADMkU0EBwAAAMgAVQgDAgAAAQkBBe6HEwbmt+rEKxKbcHFgc9myVmFXjSn1GxHGyukf444HWh8kIycmIgY6ERQhKBM="
}
]
}
Last updated on