Skip to main content
POST
/
tx
/
buy
Create Buy Transaction
curl --request POST \
  --url https://tx.api.heaven.xyz/tx/buy \
  --header 'Content-Type: application/json' \
  --data '{
  "compute_unit_limit": 200000,
  "compute_unit_price": 40000000,
  "encoded_user_defined_event_data": "",
  "payer": "GrX8TXKsPNokXKzfUg7tYmWs6MLhNseScc4PnzyiqpP7",
  "quote_response": {
    "config_version": 1,
    "max_lamport_spend": 1,
    "max_sol_spend": 123,
    "minimum_out": 1,
    "minimum_out_ui": 123,
    "mint": "<string>",
    "program_id": "<string>",
    "slippage_bps": 1
  },
  "source": "GrX8TXKsPNokXKzfUg7tYmWs6MLhNseScc4PnzyiqpP7"
}'
{
  "tx": "BASE64_ENCODED_TRANSACTION"
}

Body

application/json
encoded_user_defined_event_data
string
required

Arbitrary user-defined event data to include in the transaction for tracking purposes

Example:

""

payer
string
required

Public key of the account that will pay for the transaction

Example:

"GrX8TXKsPNokXKzfUg7tYmWs6MLhNseScc4PnzyiqpP7"

quote_response
object
required
compute_unit_limit
integer | null
default:200000

Maximum compute units to use for the transaction

Required range: x >= 0
compute_unit_price
integer | null
default:40000000

Price per compute unit in micro-lamports

Required range: x >= 0
source
string | null

Public key of the token account to debit tokens from. If not provided, the payer's associated token account will be used.

Example:

"GrX8TXKsPNokXKzfUg7tYmWs6MLhNseScc4PnzyiqpP7"

Response

200 - application/json
tx
string
required

A Base64 encoded transaction that can be signed and submitted to the Solana network.

Example:

"BASE64_ENCODED_TRANSACTION"