Trading
Core trading endpoints for getting quotes and executing trades.
Flow: quote → sign → execute
Returns a quote with an unsigned transaction ready to sign. This is the main endpoint for preparing trades.
What you get:
Serialized unsigned transaction (hex for EVM, base64 for Solana)
Expected output amount
Minimum output with slippage protection
Routing information
Gas estimates
Quote ID for execution
Optional: Approval transaction (EVM only, if needed)
Quote expiration: 30 seconds
Approval Mechanics (EVM Only):
BUY trades:
Returns trade transaction (nonce n)
May return post-buy approval transaction (nonce n+1)
Approval enables immediate selling after buy completes
SELL trades:
May return approval transaction (nonce n) if token not yet approved
Returns trade transaction (nonce n+1)
Approval must execute before trade
How to check if approval is needed: - Check if response contains approve field
If present, sign and include both transactions in execute request
Nonces are pre-calculated, do not modify
Transaction format:
EVM chains: Hex string (0x...)
Solana: Base64 encoded string
API key authentication. Include your API key in the Authorization header:
Authorization: Bearer YOUR_API_KEY
Contact [email protected] to obtain an API key.
Token contract address
- For BUY: Token you want to receive (destination)
- For SELL: Token you want to sell (source)
Example: 0x08978686e93859c41e9f8983c1c8523df98c2bf5
0x08978686e93859c41e9f8983c1c8523df98c2bf5Trade amount:
- For BUY: Amount in native token (ETH, BNB, SOL, etc.)
- For SELL: Amount in token units (with decimals)
Examples:
- BUY 0.1 ETH worth:
0.1 - SELL 1000 tokens (18 decimals):
1000000000000000000000
0.1Trade direction
BUYPossible values: Slippage tolerance in basis points (1 bps = 0.01%)
Recommended values:
- High liquidity: 50-100 bps (0.5-1%)
- Normal liquidity: 100-200 bps (1-2%)
- Low liquidity: 200-500 bps (2-5%)
Example: 200 = 2% slippage
200Wallet address that will sign and execute the transaction.
Must be a valid address for the network:
- EVM: 0x... format
- Solana: Base58 format
0xE64E104caaF2947f816C13889D031f0DE1b1e9ECBlockchain network. Auto-detected from token address if not provided.
Available networks: BASE, ETH, BSC, ARB, AVAX, ABSTRACT, HYPEREVM, INK, STORY, XLAYER, PLASMA, UNICHAIN, SOL
BASEPossible values: Gas priority level:
- LOW: Cheapest, slower confirmation
- MEDIUM: Standard speed and cost (default)
- HIGH: Faster, higher cost
- INSTANT: Fastest, highest cost (for sniping)
MEDIUMExample: MEDIUMPossible values: Run transaction simulation (default: false)
- true: Simulate transaction before returning quote
- false: Skip simulation for faster response
Recommended: true in production to catch errors
falseExample: falseIntegrator fee recipient address. Defaults to trader if not provided.
Used in combination with fee to earn fees on trades.
0xYourIntegratorWalletIntegrator fee in basis points (0-10000 bps = 0-100%)
Fee split:
- 70% to integrator
- 30% to protocol
Example: 100 bps (1%) → Integrator gets 0.7%, Protocol gets 0.3% + 0.15% base = 0.45%
0Example: 100Quote generated successfully
Invalid request parameters or malformed request
Missing or invalid API key
Resource not found (token, pool, or route)
Rate limit exceeded
GET /api/v1/quote?token=text&amount=1&side=BUY&slippage=1&trader=text HTTP/1.1
Host: api.naos.trade
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"success": true,
"path": [
{
"step": {
"input": "0x4200000000000000000000000000000000000006",
"output": "0x08978686e93859c41e9f8983c1c8523df98c2bf5",
"poolType": "UNISWAP V4",
"fee": 3000
}
}
],
"stats": {
"valueAmountInUsd": 306.24,
"amountOut": "121856096780647035442298880",
"amountOutMin": "119418974845034084425531392",
"gasCostUsd": 0.15,
"txCostUsd": 1.15,
"buyTax": 0,
"sellTax": 0,
"transferTax": 0
},
"transaction": {
"trade": "0x02f8d282215180843b9aca008...",
"approve": "0x02f86c82215181843b9aca00...",
"quoteId": "550e8400-e29b-41d4-a716-446655440000"
}
}Execute a signed transaction on the blockchain. This broadcasts the transaction and waits for confirmation.
Process:
Validates signed transaction
Simulates transaction (unless skipped)
Broadcasts to blockchain
Waits for confirmation
Returns transaction hash and details
Approval Transaction Execution:
When approve is provided:
For BUY trades:
Trade transaction broadcast and confirmed
API returns success to user
Approval transaction executed synchronously (background)
Token ready for future sells
For SELL trades:
Approval transaction broadcast and confirmed (if provided)
If approval fails, request fails
Trade transaction broadcast and confirmed
API returns success
Nonce Ordering:
BUY: Trade (n) → Approval (n+1)
SELL: Approval (n) → Trade (n+1)
MEV Protection:
Available on ETH and BSC only
Protects against front-running and sandwich attacks
Recommended for trades > $10,000
Simulation:
Set
simulation: truein production (recommended)Catches errors before wasting gas
Only skip for time-critical trades
Solana Timing:
Wait 1-2 seconds after /quote before calling /execute
Ensures database synchronization of Jupiter quote IDs
API key authentication. Include your API key in the Authorization header:
Authorization: Bearer YOUR_API_KEY
Contact [email protected] to obtain an API key.
Signed trade transaction from user's wallet
- EVM: Hex string (0x...)
- Solana: Base64 encoded
0x02f8d282215180843b9aca008...Blockchain network to execute on
BASEPossible values: Enable MEV protection (ETH/BSC only)
When to use:
- Trades > $10,000
- Low liquidity tokens
- High slippage trades
Trade-offs:
- Pros: Protected from front-running
- Cons: Slower confirmation, slightly higher gas
falseRun pre-broadcast transaction simulation
Recommended: true (always simulate in production)
Simulation catches:
- Insufficient balance
- Slippage exceeded
- Token restrictions
- Other revert scenarios
trueQuote ID from the /quote response. Required to match the quote.
550e8400-e29b-41d4-a716-446655440000Signed approval transaction (optional, EVM only)
When to include:
- If the /quote response contained
approve - Sign the approval transaction with your wallet
- Include in this field
Execution order:
- BUY: Trade executes first, then approval (background)
- SELL: Approval executes first, then trade
Important:
- Do not modify nonces from the quote
- Both transactions must be signed with provided nonces
- Solana never requires this field
0x02f86c82215180843b9aca00...Trade executed successfully
Invalid request parameters or malformed request
Missing or invalid API key
Internal server error
POST /api/v1/execute HTTP/1.1
Host: api.naos.trade
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 180
{
"trade": "0x02f8d282215180843b9aca008...",
"approve": "0x02f86c82215181843b9aca00...",
"network": "BASE",
"mev": false,
"simulation": true,
"quoteId": "550e8400-e29b-41d4-a716-446655440000"
}{
"success": true,
"status": "SUCCESS",
"txRes": {
"traderAddress": "0xE64E104caaF2947f816C13889D031f0DE1b1e9EC",
"fromToken": "0x4200000000000000000000000000000000000006",
"toToken": "0x08978686e93859c41e9f8983c1c8523df98c2bf5",
"received": "121856096780647035442298880",
"spent": "0.1",
"txHash": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
"network": "BASE"
}
}Last updated

