Skip to main content
POST
/
v1
/
buy
Build Buy Transaction
curl --request POST \
  --url https://api.lasersell.io/v1/buy \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
  "user_pubkey": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
  "slippage_bps": 2000,
  "amount": 0.1,
  "amount_in_total": 100000000,
  "input": "SOL",
  "mode": "fast",
  "send_mode": "helius_sender",
  "tip_lamports": 123,
  "partner_fee_recipient": "<string>",
  "partner_fee_bps": 49,
  "partner_fee_lamports": 123
}
'
{
  "tx": "AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...",
  "route": {
    "market_type": "pumpswap",
    "pool_id": "<string>"
  },
  "debug": {}
}
If you plan to track this buy with the Exit Intelligence Stream, you must connect the stream before submitting the buy transaction. The stream detects new positions by observing on-chain token arrivals in real time. If the stream is not connected when the buy lands, the position will not be tracked and no exit signals will be generated for it.
Exactly one of amount or amount_in_total must be provided. amount is automatically converted to atomic units based on the input asset (SOL: 10^9, USD1: 10^6).

SDK Examples

import { ExitApiClient, type BuildBuyTxRequest } from "@lasersell/lasersell-sdk";

const client = ExitApiClient.withApiKey("YOUR_API_KEY");

const request: BuildBuyTxRequest = {
  mint: "TOKEN_MINT_ADDRESS",
  user_pubkey: "YOUR_WALLET_PUBKEY",
  amount: 0.1, // 0.1 SOL
  slippage_bps: 2_000,
};

const response = await client.buildBuyTx(request);
console.log("Unsigned tx (base64):", response.tx);

Error Responses

See Error Handling for the full error envelope specification and retryable error logic.

Authorizations

x-api-key
string
header
required

Your LaserSell API key. Obtain one from the LaserSell dashboard.

Body

application/json
mint
string
required

Token mint address to buy (base58).

Example:

"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"

user_pubkey
string
required

Your wallet public key (base58).

Example:

"9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM"

slippage_bps
integer
required

Maximum slippage tolerance in basis points (e.g., 2000 = 20%).

Example:

2000

amount
number

Human-readable amount to spend (e.g., 0.1 for 0.1 SOL, 10.0 for 10 USD1). Mutually exclusive with amount_in_total. Exactly one of amount or amount_in_total must be provided.

Example:

0.1

amount_in_total
integer

Amount to spend in input-asset atomic units (e.g., lamports for SOL). Mutually exclusive with amount. Exactly one of amount or amount_in_total must be provided.

Example:

100000000

input
enum<string>
default:SOL

Input asset.

Available options:
SOL,
USD1
mode
enum<string>
default:fast

Routing mode hint.

Available options:
fast,
secure
send_mode
enum<string>

Transaction send mode.

Available options:
helius_sender,
astralane,
rpc
tip_lamports
integer

Optional priority fee tip in lamports.

partner_fee_recipient
string

Partner fee recipient wallet (base58 pubkey).

partner_fee_bps
integer

Partner fee in basis points (max 50 = 0.5%). Mutually exclusive with partner_fee_lamports.

Required range: x <= 50
partner_fee_lamports
integer

Partner fee as flat SOL lamports (max 50,000,000). Mutually exclusive with partner_fee_bps.

Required range: x <= 50000000

Response

Unsigned buy transaction built successfully.

tx
string
required

Base64-encoded unsigned Solana VersionedTransaction. Sign this locally with your keypair before submitting.

Example:

"AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA..."

route
object

Routing metadata.

debug
object

Debug information (included when available).