Skip to main content

Response structure

Find about the common response and data types used across Firstock.

The API response structure for the Firstock Connect platform typically consists of a header and a body. The header contains information about the status of the API request, including the HTTP status code. The body of the API response contains the data returned by the API in response to the request.

Common code table

ExchangesProductsPrice typesTransaction types
BSE - BSE EquityC - Cash & Carry for equityMKT - Market OrderB - Buy
NSE - NSE EquityI - IntradayLMT - Limit OrderS - Sell
NFO - NSE Future and OptionsM – RegularSL-LMT - Stop Loss Limit Order
BFO - BSE Futures and options

Successful request

HTTP/1.1 200 OK
Content-Type: application/json

{
"Status": "Success",
"data": {}
}

All responses from the API server are JSON with the content-type application/json unless explicitly stated otherwise. A successful 200 OK response always has a JSON response body with a status key with the value success. The data key contains the full response payload.

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"
}
}

This JSON structure provides a standardized way of communicating error information from an API, allowing developers to easily understand and handle errors that occur when making API requests. By having a consistent format for error responses, developers can write code to handle errors in a consistent and efficient manner, regardless of the API they are using. 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)

Data types

In the JSON response format, the values can be of several different data types, including string, integer, floating-point, or boolean. The specific data type of a value is determined by the context in which it is used and the type of data it represents.

Timestamp string in the request is in the format dd/mm/YYYY hh:mm:ss, set under the Indian timezone (IST) – UTC +5.5 hours.

Timestamp string in the response is in the format , set under the Indian timezone (IST) – UTC +5.5 hours.