## `swap_preflight`

1 credit · 0.005 USDC

`GET /swap_preflight`

Before a Solana swap: price impact on the best route, sandwich share on the pool from our history, Token-2022 transfer fees and hooks, freeze authority, and a verdict (ok, high slippage risk, high sandwich risk, unknown) with reasons.

| Parameter | Type | Description |
| --- | --- | --- |
| `amount`required | `number` | Amount in quote units for buy, in token units for sell |
| `mint`required | `string` | Token to buy or sell |
| `quote` | `string` | Quote mint, SOL by default |
| `side`required | `buy \| sell` |  |

**curl**

```sh
curl "https://api.dexra.dev/swap_preflight?amount=100&mint=DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263&quote=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v&side=buy" \
  -H "Authorization: Bearer dxr_…"
```

**TypeScript**

```ts
import { Dexra } from '@dexra/client'

const dexra = new Dexra({ apiKey: process.env.DEXRA_API_KEY })
const result = await dexra.swapPreflight({ amount: 100, mint: "DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263", quote: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", side: "buy" })
console.log(result.summary)
```

**Python**

```python
import os
from dexra import Dexra

dexra = Dexra(api_key=os.environ["DEXRA_API_KEY"])
result = dexra.swap_preflight(amount=100, mint="DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263", quote="EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", side="buy")
print(result["summary"])
```

**MCP**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "swap_preflight",
    "arguments": {
      "amount": 100,
      "mint": "DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",
      "quote": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
      "side": "buy"
    }
  }
}
```

[Try it in the Playground](https://dexra.dev/app/playground?tool=swap_preflight)

Source: https://dexra.dev/docs/tools/swap_preflight
