Skip to main content
POST
/
v1
/
sell
Build Sell Transaction
curl --request POST \
  --url https://api.lasersell.io/v1/sell \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "mint": "So11111111111111111111111111111111111111112",
  "user_pubkey": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
  "amount_tokens": 1000000,
  "output": "SOL",
  "slippage_bps": 2000,
  "mode": "fast",
  "market_context": {},
  "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": {}
}

SDK Examples

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

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

const request: BuildSellTxRequest = {
  mint: "TOKEN_MINT_ADDRESS",
  user_pubkey: "YOUR_WALLET_PUBKEY",
  amount_tokens: 1_000_000,
  slippage_bps: 2_000,
  output: "SOL",
};

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

// Or get just the base64 string:
const txB64 = await client.buildSellTxB64(request);

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 (base58).

Example:

"So11111111111111111111111111111111111111112"

user_pubkey
string
required

Your wallet public key (base58).

Example:

"9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM"

amount_tokens
integer
required

Amount to sell in the token's atomic units.

Example:

1000000

output
enum<string>
required

Desired output asset.

Available options:
SOL,
USD1
Example:

"SOL"

slippage_bps
integer
required

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

Example:

2000

mode
enum<string>
default:fast

Routing mode hint.

Available options:
fast,
secure
market_context
object

Pre-resolved market context. Omit to let the server resolve automatically.

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 sell 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).