Wallet
Trade tokens
Swap tokens via the Jupiter aggregator
POST
/
wallets
/
me
/
actions
/
trade
curl -X POST https://api.useknot.xyz/wallets/me/actions/trade \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"from": "USDC",
"to": "SOL",
"amount": 50,
"slippageBps": 50
}'
{
"status": true,
"data": {
"signature": "4kLmN9xR...",
"explorerUrl": "https://solscan.io/tx/4kLmN9xR...",
"inputAmount": "50 USDC",
"outputAmount": "0.581 SOL",
"priceImpact": "0.01%",
"route": ["Raydium", "Orca"]
}
}
Executes a token swap using the Jupiter aggregator, automatically routing through the best available liquidity pools.
Requires authentication via Bearer token. Trading must be enabled in the agent’s policy (
allowTrading: true).Trades are subject to your agent’s policy limits. If the trade value exceeds
maxSingleTransactionInUsd or the daily limit, the request is rejected. Enable trading and configure limits via Update policy.Request body
string
required
Source token to swap from. Accepts a token symbol (e.g.,
USDC) or mint address.string
required
Destination token to swap to. Accepts a token symbol (e.g.,
SOL) or mint address.number
required
Amount of the source token to swap.
number
default:"50"
Maximum acceptable slippage in basis points.
50 equals 0.5%. The transaction fails if the actual slippage exceeds this value.Response
boolean
true when the trade succeeds.object
Show properties
Show properties
string
On-chain transaction signature.
string
Solscan link to inspect the transaction.
string
Amount of the source token spent, with symbol (e.g.,
50 USDC).string
Amount of the destination token received, with symbol (e.g.,
0.581 SOL).string
Price impact of the trade as a percentage (e.g.,
0.01%).array
List of DEX protocols used in the swap route (e.g.,
["Raydium", "Orca"]).Errors
| Status | Description |
|---|---|
400 | Invalid token symbol, amount, or slippage value |
401 | Missing or invalid Bearer token |
403 | Trading disabled by agent policy |
429 | Rate limit exceeded |
curl -X POST https://api.useknot.xyz/wallets/me/actions/trade \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"from": "USDC",
"to": "SOL",
"amount": 50,
"slippageBps": 50
}'
{
"status": true,
"data": {
"signature": "4kLmN9xR...",
"explorerUrl": "https://solscan.io/tx/4kLmN9xR...",
"inputAmount": "50 USDC",
"outputAmount": "0.581 SOL",
"priceImpact": "0.01%",
"route": ["Raydium", "Orca"]
}
}
curl -X POST https://api.useknot.xyz/wallets/me/actions/trade \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"from": "USDC",
"to": "SOL",
"amount": 50,
"slippageBps": 50
}'
{
"status": true,
"data": {
"signature": "4kLmN9xR...",
"explorerUrl": "https://solscan.io/tx/4kLmN9xR...",
"inputAmount": "50 USDC",
"outputAmount": "0.581 SOL",
"priceImpact": "0.01%",
"route": ["Raydium", "Orca"]
}
}