Skip to main content
Three endpoints share a single shape. Each one resolves the token’s current venue, builds a Solana transaction, signs it with the user’s delegated wallet, and submits it. All amounts are integer strings in base units.

Shared Fields

Every trade takes the following fields.

Request Modes

Each endpoint accepts two body shapes, chosen by whether slippageBps is present. The two are mutually exclusive. Sending slippageBps puts the request in slippage mode, and the explicit bound fields are then not read.

Venue Routing

Tokens trade on the Trench bonding curve until they migrate to a Raydium pool. All three endpoints resolve the venue per request, so the same call works before and after migration.

POST /partner/v1/trades/buy

Spends up to a fixed amount of SOL.
The explicit form replaces slippageBps with a bound you calculated.

POST /partner/v1/trades/buy-exact-out

Buys an exact token amount while capping what you spend. In slippage mode the quote produces a ceiling, so maxSolIn is optional. Sending it anyway applies whichever of the two values is lower, which lets you keep a hard spending limit regardless of what the quote returns.

POST /partner/v1/trades/sell

Response

All three endpoints respond identically.
A status of submitted means the network accepted the transaction, not that it landed. Confirm the signature against Solana through your own RPC before confirming anything to a user.

Partner Fees

Sending a non-zero partnerFeeBps adds a SOL transfer to your registered fee wallet in the same transaction as the trade, which means the fee and the trade settle together. This requires the Partner tier. The basis differs by endpoint, and rounding is always down.
In slippage mode the fee is deducted before the quote is taken, so the derived bound already accounts for it. In explicit mode you have to quote minTokensOut against maxSolIn minus the fee yourself.
See Partner Fees for wallet registration and disclosure requirements.

Retries and Duplicate Trades

The Partner API does not support idempotency keys on any write endpoint. If a trade times out at the network level you cannot ask Trench whether it landed, and resending the request may execute the trade a second time, since nothing deduplicates two identical buys.
We recommend against retrying a trade automatically on a timeout or a 5xx, because the transaction may already be in flight.Record each request before you send it. On an ambiguous failure, check the signature or the user’s recent transactions on-chain, and otherwise surface the uncertainty to the user rather than resolving it by guessing.
A 429, a 409 migration_pending, and a 409 pool_not_open are all safe to retry, because each is rejected before anything reaches the transaction builder.

Errors

The full catalog is on the Error Handling page.