Documentation Index
Fetch the complete documentation index at: https://docs.1tx.fi/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The Transactions API is the execution-facing part of the 1tx backend. Use it when you want 1tx to:- choose the best source chain for a deposit,
- calculate quotes and slippage-protected minimum outputs,
- and return the exact calldata bundle your user should sign.
- Call
POST /transactions/buyorPOST /transactions/sell. - Present the returned transaction bundle to the user wallet.
- Send the transactions in order.
- For cross-chain buys, monitor the bridge via the CCTP API using the source transaction hash.
Transaction build endpoints require both a bearer token and an API key. Discovery endpoints such as
/instruments, /chains, and /quotes only require an API key.Build Buy Transaction
POST/transactions/buy
Build a transaction bundle that calls router buy() for a 1tx instrument.
The backend will:
- validate the instrument,
- auto-select a source chain unless
sourceChainIdis provided, - quote the deposit on the destination chain,
- add an approval transaction only when needed,
- and return the calldata bundle to execute.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
userAddress | string | Yes | Wallet address that will sign the transactions |
instrumentId | string | Yes | Target instrument ID |
amountUsdc | string | Yes | Deposit amount in human-readable USDC, e.g. "1000.50" |
sourceChainId | number | No | Force a specific source chain instead of auto-selecting from balances |
slippageBps | number | No | Slippage tolerance in basis points. Defaults to 50 |
referralFeeBps | number | No | Referral fee in basis points (0–500, i.e. up to 5%). Defaults to 0. Requires referralWallet. |
referralWallet | string | No | Address that receives the referral fee. Required when referralFeeBps > 0. |
Response
Response Fields
| Field | Type | Description |
|---|---|---|
sourceChainId | number | Chain where the returned transactions must be sent |
destinationChainId | number | Chain where the target instrument lives |
isCrossChain | boolean | true when the source chain differs from the instrument chain |
transactions | array | Transactions to execute in order |
transactions[].type | string | approve or deposit |
quote.amountIn | string | Input amount in raw USDC units |
quote.expectedOut | string | Expected destination-side output in raw units |
quote.minOut | string | Minimum acceptable output after slippage |
quote.priceImpactBps | number | Estimated price impact in basis points |
quote.needsSwap | boolean | Whether the destination-side deposit requires a swap |
expiresAt | number | Unix timestamp after which the bundle should be rebuilt |
Notes
- The approval transaction is only included when current allowance is insufficient.
- For cross-chain buys, the router transaction still runs on the source chain.
- The returned calldata already includes the correct
fastTransfer/maxFeeparameters expected by the current router flow. - When
referralFeeBps > 0, the fee is deducted from the user’s USDC input before swap and deposit.referralWalletmust be a non-zero address. The router caps the referral fee at 500 bps (5%).
Build Sell Transaction
POST/transactions/sell
Build a transaction bundle that calls router sell() for a 1tx instrument.
Withdrawals are currently same-chain only.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
userAddress | string | Yes | Wallet address that will sign the transactions |
instrumentId | string | Yes | Instrument ID to withdraw from |
yieldTokenAmount | string | Yes | Human-readable yield token amount, e.g. "500.00" |
slippageBps | number | No | Slippage tolerance in basis points. Defaults to 50 |
referralFeeBps | number | No | Referral fee in basis points (0–500, i.e. up to 5%), applied on the stable output. Defaults to 0. Requires referralWallet. |
referralWallet | string | No | Address that receives the referral fee. Required when referralFeeBps > 0. |
Response
Get User Balances
GET/transactions/balances/:userAddress
Scan supported chains for the user’s USDC balance. This is useful when you want to show source-chain selection before calling POST /transactions/buy.
Response
Recommended Execution Flow
For same-chain buys:- Call
POST /transactions/buy. - Execute returned transactions in order.
- Call
POST /transactions/buy. - Execute returned transactions in order on
sourceChainId. - Wait for the source router transaction hash.
- Poll
GET /cctp/relay/tx/:sourceTxHashuntil the bridge job reaches a terminal state.
Legacy Endpoints
The following endpoints still exist for backwards compatibility with older clients, but are not part of the recommended integration path:POST /transactions/operations/:operationId/confirmGET /transactions/operations/:operationId