Skip to main content

Exceptions & error

Find more about the common errors, exceptions, HTTP error codes and API Rate Limit.

The Firstock Connect error response consists of the "status" key indicates the overall status of the request, with a value of "Failed" indicating that the request was not successful. The "code" key provides a more specific error code, in this case an HTTP status code will be provided. The "name" key provides an additional error code that is specific to the API being used.

The "error" key provides further information about the error, including the field that caused the problem ("field" key with a value of the request response) and a description of the problem ("message" key with a value of the error).

Failed request

HTTP/1.1 500 Server error
Content-Type: application/json

{
"status": "Failed",
"code": "401",
"name": "INVALID_USERID",
"error": {
"field": "userid",
"message": "userid parameter is invalid"
}
}

Exceptions

ValueDescription
BAD_REQUESTUndefined or missing parameter in the request structure provides this exception.
SESSION_EXPIREDRepresents user account related errors
INVALID_[variable]Represents when variables is invalid, depends on the variable type in request response.
ORDER_NOT_FOUNDRepresents when Order not found to cancel
ORDERS_NOT_FOUNDRepresents when No data on the orders was found
PRODUCT_CONVERSIONRepresents when Product Conversions are disallowed after system square off
PRODUCT_USAGERepresents when Product Regular not enabled on exchange NSE
BASKET_DETAILSRepresents when Basket should contain orders of only 1 exch
EXCHANGE/TOKENRepresents when no data is available on the token or exchange
API_RATE_LIMITRepresents when the users exceed the rate limit.

Common HTTP error codes

CodesDescription
400Missing or bad request parameters or values
401Session expired or invalid input
404Request resource was not found
405Request method (GET, POST etc.) is not allowed on the requested endpoint
410Request resource is lost
429Too many requests to the API (rate limiting)
500Something unexpected went wrong
503Service is unavailable
504Gateway timeout; the API is unreachable

API Rate Limit

At Firstock, in an effort to manage potential risks, the request rate for APIs has been limited based on different segments. The following table provides information on the rate limits for various APIs.

End PointRate-Limit
Quote4 req/second
Historical Candle3 req/second
All other endpoints10 req/second
Order Placement200 req/minute