curl --request POST \
--url https://api.bookie.app/v1/transactions/build \
--header 'Authorization: Bearer bookie_live_abc123def456' \
--header 'Content-Type: application/json' \
--data '{
"intentId": "intent_abc123def456",
"walletAddress": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
"simulate": true
}'
const response = await fetch(
'https://api.bookie.app/v1/transactions/build',
{
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.BOOKIE_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
intentId: 'intent_abc123def456',
walletAddress: '7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU',
simulate: true
})
}
);
import requests
response = requests.post(
'https://api.bookie.app/v1/transactions/build',
headers={
'Authorization': f'Bearer {api_key}',
'Content-Type': 'application/json'
},
json={
'intentId': 'intent_abc123def456',
'walletAddress': '7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU',
'simulate': True
}
)
{
"transaction": "AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAQAHEAoMCg...",
"simulation": {
"success": true,
"computeUnits": 185432,
"logs": [
"Program JUP6LkbZbjS1jKKwapdH673ZbPzwpKeZ9wH2TUXzQf4 invoke [1]",
"Program log: Instruction: Swap",
"Program JUP6LkbZbjS1jKKwapdH673ZbPzwpKeZ9wH2TUXzQf4 success"
]
},
"expectedOutput": {
"outputAmount": "736250000",
"priceImpact": 0.12,
"fee": 5000
}
}
{
"error": {
"code": "simulation_failed",
"message": "Transaction simulation failed",
"details": {
"reason": "Slippage tolerance exceeded",
"logs": ["Program log: Error: Slippage tolerance exceeded"]
}
}
}
Intent Operations
Build Transaction
Build a Solana transaction from parsed intent
POST
/
v1
/
transactions
/
build
curl --request POST \
--url https://api.bookie.app/v1/transactions/build \
--header 'Authorization: Bearer bookie_live_abc123def456' \
--header 'Content-Type: application/json' \
--data '{
"intentId": "intent_abc123def456",
"walletAddress": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
"simulate": true
}'
const response = await fetch(
'https://api.bookie.app/v1/transactions/build',
{
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.BOOKIE_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
intentId: 'intent_abc123def456',
walletAddress: '7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU',
simulate: true
})
}
);
import requests
response = requests.post(
'https://api.bookie.app/v1/transactions/build',
headers={
'Authorization': f'Bearer {api_key}',
'Content-Type': 'application/json'
},
json={
'intentId': 'intent_abc123def456',
'walletAddress': '7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU',
'simulate': True
}
)
{
"transaction": "AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAQAHEAoMCg...",
"simulation": {
"success": true,
"computeUnits": 185432,
"logs": [
"Program JUP6LkbZbjS1jKKwapdH673ZbPzwpKeZ9wH2TUXzQf4 invoke [1]",
"Program log: Instruction: Swap",
"Program JUP6LkbZbjS1jKKwapdH673ZbPzwpKeZ9wH2TUXzQf4 success"
]
},
"expectedOutput": {
"outputAmount": "736250000",
"priceImpact": 0.12,
"fee": 5000
}
}
{
"error": {
"code": "simulation_failed",
"message": "Transaction simulation failed",
"details": {
"reason": "Slippage tolerance exceeded",
"logs": ["Program log: Error: Slippage tolerance exceeded"]
}
}
}
Authorization
string
required
Bearer token. Format:
Bearer bookie_live_abc123def456Body Parameters
string
required
Intent ID from parse intent endpoint
string
required
Solana wallet address that will sign the transaction
boolean
default:"true"
Run pre-flight simulation before building
Response
string
Base64 encoded serialized transaction
object
Simulation results (if enabled)Properties:
success(boolean): Whether simulation passedcomputeUnits(number): Compute units consumedlogs(array): Program execution logs
object
Expected transaction outcomeProperties:
outputAmount(string): Expected output amountpriceImpact(number): Price impact percentagefee(number): Transaction fee in lamports
curl --request POST \
--url https://api.bookie.app/v1/transactions/build \
--header 'Authorization: Bearer bookie_live_abc123def456' \
--header 'Content-Type: application/json' \
--data '{
"intentId": "intent_abc123def456",
"walletAddress": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
"simulate": true
}'
const response = await fetch(
'https://api.bookie.app/v1/transactions/build',
{
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.BOOKIE_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
intentId: 'intent_abc123def456',
walletAddress: '7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU',
simulate: true
})
}
);
import requests
response = requests.post(
'https://api.bookie.app/v1/transactions/build',
headers={
'Authorization': f'Bearer {api_key}',
'Content-Type': 'application/json'
},
json={
'intentId': 'intent_abc123def456',
'walletAddress': '7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU',
'simulate': True
}
)
{
"transaction": "AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAQAHEAoMCg...",
"simulation": {
"success": true,
"computeUnits": 185432,
"logs": [
"Program JUP6LkbZbjS1jKKwapdH673ZbPzwpKeZ9wH2TUXzQf4 invoke [1]",
"Program log: Instruction: Swap",
"Program JUP6LkbZbjS1jKKwapdH673ZbPzwpKeZ9wH2TUXzQf4 success"
]
},
"expectedOutput": {
"outputAmount": "736250000",
"priceImpact": 0.12,
"fee": 5000
}
}
{
"error": {
"code": "simulation_failed",
"message": "Transaction simulation failed",
"details": {
"reason": "Slippage tolerance exceeded",
"logs": ["Program log: Error: Slippage tolerance exceeded"]
}
}
}
Always simulate transactions before presenting them to users. Failed simulations indicate the transaction would fail on-chain.