Request & Response Format

Request & Response Format

Request Fields

Required Fields

Field
Type
Description

prompt

string

Natural language trading instruction

walletAddress

string

Your wallet address (EVM 0x... or Solana)

provider

string

Your agent/integration name for tracking

Optional Fields

Field
Type
Default
Description

chain

string

β€”

Preferred chain (e.g., "base", "ethereum", "arbitrum")

slippage

number

1

Slippage tolerance percentage

async

boolean

false

Use async mode for long operations

Example Request

{
  "prompt": "swap 50 USDC for ETH on arbitrum",
  "walletAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f7AAAA",
  "provider": "my-trading-bot",
  "chain": "arbitrum",
  "slippage": 0.5,
  "async": false
}

Prompt Best Practices

Your prompt quality directly affects the response. Follow these guidelines to avoid wasted API calls.

βœ… Good Prompts

Prompt
Why It's Good

"Buy $50 worth of ETH on Base"

Clear action, amount, token, chain

"Swap 100 USDC for WETH on Arbitrum"

All details specified

"Bridge 50 USDC from Ethereum to Base"

Source and destination chains

"What is the price of 0x4ed4...fed on Base?"

Contract address for obscure tokens

"Send 10 USDC to 0x742d...AAAA on Base"

Recipient address included

❌ Bad Prompts

Prompt
Problem
Better Version

"Buy some crypto"

No token, amount, or chain

"Buy $50 of ETH on Base"

"Get me ETH"

No amount or chain

"Buy $100 of ETH on Arbitrum"

"Trade tokens"

Missing everything

"Swap 50 USDC for ETH on Base"

"What's the price?"

No token specified

"What's the price of ETH on Base?"

"Buy XYZ"

Ambiguous token, no chain

"Buy $20 of XYZ on Base" or use CA

Required Information by Operation

Operation
Required Info

Buy

Token, amount (USD or token), chain

Sell

Token, amount, chain

Swap

From token, to token, amount, chain

Bridge

Token, amount, source chain, destination chain

Send

Token, amount, recipient address, chain

Price Check

Token (symbol or CA), chain


Response Types

Every response includes a type field indicating what kind of result was returned:

Type
Description
Has Transactions
Charged

transaction

Trade prepared, ready to sign

βœ… Yes

βœ… $0.20

info

Informational response or clarification request

❌ No

βœ… $0.20

error

Something went wrong

❌ No

βœ… $0.20

⚠️ Important: You are charged $0.20 for every API call, regardless of the response type.


Transaction Response

When your prompt results in a tradeable action (buy, sell, swap, bridge, etc.):

Transaction Object Fields

Field
Type
Description

type

string

Transaction type: swap, bridge, transfer, wrap, etc.

description

string

Human-readable description

chain

string

Target chain

sequence

number

Order for multi-tx operations

to

string

Contract address to call

data

string

Encoded calldata

value

string

Native token value (wei)

chainId

number

Chain ID

gas

string

Estimated gas limit

expiresAt

number

Quote expiration (Unix ms)

Operation Object Fields

Field
Type
Description

operation_id

string

Unique operation identifier

operation_type

string

buy, sell, swap, bridge, send, etc.

token_symbol

string

Input token symbol

token_address

string

Input token address

token_out_symbol

string

Output token symbol (for swaps)

token_out_address

string

Output token address

amount

number

Trade amount

amount_type

string

usd or token

chain

string

Target chain


Info Response

When your prompt is informational (price check, balance, etc.):


Clarification Response

When your prompt is unclear or missing information:

⚠️ Note: This still costs $0.20. Validate prompts before sending.


Error Response

When something goes wrong:

Common Errors

Error
Cause

Insufficient balance

Wallet doesn't have enough tokens

Token not found

Unknown token symbol or address

Chain not supported

Requested chain isn't available

Quote expired

Took too long, quote is stale

Honeypot detected

Token failed security scan


Multi-Transaction Operations

Some operations require multiple transactions (e.g., approve + swap):

Execute transactions in sequence order. Wait for each transaction to confirm before sending the next.


Bridge Response

Bridge operations include source and target chain info:


Perpetuals Response (Avantis)

For perpetual trades on Avantis:


Prediction Markets Response (Myriad)

For prediction market trades on Myriad:


Async Mode

When using async: true, the initial response is different:

Initial Response (202)

Poll Until Complete

Final Response

Same format as sync mode (transaction, info, or error).


Signing Transactions

Once you receive a transaction response, sign and broadcast each transaction:

Important: Transactions have an expiresAt timestamp. Sign and broadcast promptly to avoid quote expiration.


Next Steps

Last updated