Skip to main content
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

from
string
required
Source token to swap from. Accepts a token symbol (e.g., USDC) or mint address.
to
string
required
Destination token to swap to. Accepts a token symbol (e.g., SOL) or mint address.
amount
number
required
Amount of the source token to swap.
slippageBps
number
default:"50"
Maximum acceptable slippage in basis points. 50 equals 0.5%. The transaction fails if the actual slippage exceeds this value.

Response

status
boolean
true when the trade succeeds.
data
object

Errors

StatusDescription
400Invalid token symbol, amount, or slippage value
401Missing or invalid Bearer token
403Trading disabled by agent policy
429Rate 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"]
  }
}