Orders API
Manage orders and check order status
Orders API
The Orders API provides functionality for creating orders and checking order status.
Access
Methods
getOrder
Get an order quote and transaction for execution.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
inputMint | string | Yes | Input token mint address |
outputMint | string | Yes | Output token mint address |
amount | number | Yes | Amount in smallest units |
slippageBps | number | No | Slippage tolerance in basis points |
userPublicKey | string | Yes | User's wallet public key |
platformFeeBps | number | No | Platform fee in basis points |
platformFeeAccount | string | No | Account to receive platform fees |
Returns:
getOrderStatus
Check the status of an order by transaction signature.
Returns:
Status meanings:
| Status | Description |
|---|---|
open | Order is still processing |
closed | Order completed successfully |
failed | Order failed to execute |
pendingClose | Order is being finalized |
Examples
Create and Execute an Order
Poll for Order Completion
Add Platform Fees
Platform fees allow you to monetize trades through your application. The fee is deducted from the trade and sent to your specified account.