Turn a quote into a signable transaction
Turn a quote into a transaction you can sign.
Pass one quote object from the quote endpoint, unmodified, together with the wallet that will sign. The response carries a transaction built and ready to sign, with a fresh blockhash on Solana and a simulation already run against it.
Solana:
transactionis a base64-encoded serializedVersionedTransaction. Deserialize, sign, and send it to the execute endpoint base64-encoded.EVM (Base):
swapTxDataholds the transaction fields to sign. WhenneedsApprovalis true, sign and sendapprovalTxDatafirst and wait for it to confirm.
This step is optional for same-chain swaps, where the quote already carries signable transaction data — but it is required for swaps out of Solana to another chain, whose quotes carry routing instructions rather than a transaction. Preferring this endpoint everywhere means one signing path instead of one per route, and it applies the network fee floor that keeps Solana bridge transactions from being dropped while they wait to be included.
The transaction is not broadcast here. Send the signed result to the execute endpoint.
API key for authentication
A quote plus the wallet that will sign it.
Chain the quote is on: 'solana' or 'base'
solanaPossible values: Wallet that will sign and send the transaction
BqLNQpXhtRosNTFvJnCFbwtxUAmVoJBqYCKGYqA6vLzTSkip the pre-signing simulation. Simulation catches failures before you spend a signature, so leave this off unless you are re-preparing a quote you have already validated.
falseAn unsigned transaction ready to sign
Bad Request
Unauthorized
Forbidden
Not Found
Unprocessable Content
Too Many Requests
Internal Server Error
Bad Gateway
Service Unavailable
Gateway Timeout
POST /api/v1/trade/prepare HTTP/1.1
Host: api.nansen.ai
apikey: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 153
{
"chain": "solana",
"wallet_address": "BqLNQpXhtRosNTFvJnCFbwtxUAmVoJBqYCKGYqA6vLzT",
"quote": {
"ANY_ADDITIONAL_PROPERTY": "anything"
},
"skip_simulation": false
}{
"error": "text",
"message": "text",
"code": "missing_field",
"status": 1,
"request_id": null,
"doc_url": "https://docs.nansen.ai/getting-started/error-handling#rate_limit_exceeded",
"param": "text",
"retry_after": 1,
"detail": "No API key found in request"
}Last updated
Was this helpful?