Place basket and multi-leg orders safely
Basket and multi-leg workflows involve several related orders. The Guide focuses on preparation, validation, execution sequence and post-order verification.
Before you begin
Step-by-step workflow
Define the complete set of legs
List every leg with its instrument, side, quantity, order type and role in the overall trade.
Validate instrument, side, quantity and order details
Validate each symbol and confirm that all quantities and sides match the intended strategy before submitting any order.
Choose basket or multi-leg execution
Use the supported basket or multi-leg workflow that matches the required execution behaviour. Review any differences in validation and response handling.
Submit the request
Submit the complete request once and retain the response for every leg.
Check each leg result
Review each leg independently. A successful request does not guarantee that every leg has the same final status.
Handle partial or failed execution
Define the action for partial fills or failed legs before execution. Recheck live order and position state before placing corrective orders.
Verify the result
Check the relevant API response and account or market-data state to confirm that the workflow completed successfully. If the result is partial or unsuccessful, review the returned status and message before deciding whether to retry or take another action.
Common issues
Authentication or permission failure401 Unauthorized
The access token is missing, expired, or the app does not have the required permission. Generate a fresh token and retry the request.
HTTP/1.1 401 Unauthorized
{"s":"error","code":-8,"message":"Could not authenticate the user"}View Authentication →Incorrect request inputs400 Bad Request
A required field is missing or invalid (symbol, quantity, side, or product type). Read the response message, correct the payload, then retry.
HTTP/1.1 400 Bad Request
{"s":"error","code":-50,"message":"Please provide valid order parameters"}View Error Code Reference →Plan or rate-limit restriction429 Too Many Requests
The request exceeded the plan’s rate limit or an entitlement. Back off before retrying and confirm the Standard vs Prime limits for the API you are calling.
HTTP/1.1 429 Too Many Requests
Retry-After: 1
{"s":"error","message":"Rate limit exceeded"}Learn exponential backoff →Temporary network or socket interruptionTimeout
The connection dropped before a response arrived. Check the latest order, position, or socket state before sending the same request again.
Error: socket hang up
ECONNRESETView WebSocket Overview →Prefer a guided AI workflow?
Prefer to automate without maintaining code? Explore FYERS Automate for supported no-code strategy workflows.
Related API reference
Submit multiple orders together
View API →Submit multi-leg orders
View API →Verify order status
View API →Read open positions
View API →