Historical Data NFO
This guide walks you through making your first request to the Historical Market Data API.
Base URL
https://algo.pocketful.in
Replace
https://algo.pocketful.inwith your production API endpoint.
Authentication
Every request must include a valid API token in the Authorization header.
Authorization: Bearer YOUR_ACCESS_TOKEN
or
Authorization: YOUR_ACCESS_TOKEN
Supported Product Types
| Product Type | Description |
|---|---|
futures | Futures Contracts |
options | Options Contracts |
Supported Intervals
| Interval |
|---|
1minute |
3minute |
5minute |
10minute |
15minute |
30minute |
60minute |
1day |
Example 1 — Fetch Futures Historical Data
Endpoint
POST /api/data/v1/historical
Request Body
{
"symbol": "BANKNIFTY",
"product_type": "futures",
"expiry_date": "2025-01-29",
"interval": "1minute",
"from_date": "2025-01-01T09:15:00",
"to_date": "2025-01-01T15:30:00"
}
CURL
curl --location 'https://algo.pocketful.in/api/data/v1/historical' \
--header 'Authorization: Bearer <your_access_token>' \
--header 'Content-Type: application/json' \
--data '{
"symbol": "BANKNIFTY",
"product_type": "futures",
"expiry_date": "2025-01-29",
"interval": "1minute",
"from_date": "2025-01-01T09:15:00",
"to_date": "2025-01-01T15:30:00"
}'
Example 2 — Fetch Call Option Historical Data
Endpoint
POST /api/data/v1/historical
Request Body
{
"symbol": "BANKNIFTY",
"product_type": "options",
"type": "CE",
"strike_price": 51000,
"expiry_date": "2025-01-29",
"interval": "1minute",
"from_date": "2025-01-01T09:15:00",
"to_date": "2025-01-01T15:30:00"
}
CURL
curl --location 'https://algo.pocketful.in/api/data/v1/historical' \
--header 'Authorization: Bearer <your_access_token>' \
--header 'Content-Type: application/json' \
--data '{
"symbol": "BANKNIFTY",
"product_type": "options",
"type": "CE",
"strike_price": 51000,
"expiry_date": "2025-01-29",
"interval": "1minute",
"from_date": "2025-01-01T09:15:00",
"to_date": "2025-01-01T15:30:00"
}'
Example 3 — Fetch Put Option Historical Data
Endpoint
POST /api/data/v1/historical
Request Body
{
"symbol": "BANKNIFTY",
"product_type": "options",
"type": "PE",
"strike_price": 51000,
"expiry_date": "2025-01-29",
"interval": "1minute",
"from_date": "2025-01-01T09:15:00",
"to_date": "2025-01-01T15:30:00"
}
CURL
curl --location 'https://algo.pocketful.in/api/data/v1/historical' \
--header 'Authorization: Bearer <your_access_token>' \
--header 'Content-Type: application/json' \
--data '{
"symbol": "BANKNIFTY",
"product_type": "options",
"type": "PE",
"strike_price": 51000,
"expiry_date": "2025-01-29",
"interval": "1minute",
"from_date": "2025-01-01T09:15:00",
"to_date": "2025-01-01T15:30:00"
}'
Successful Response
The API returns an optimized lightweight response containing a candles array where each record is formatted as [timestamp, open, high, low, close, volume, open_interest].
{
"status": "success",
"data": {
"candles": [
[
"2025-01-01T09:15:00+0530",
51160,
51318.75,
51160,
51272.85,
2253300,
8805
],
[
"2025-01-01T09:16:00+0530",
51256.75,
51266.8,
51100,
51126,
2253300,
16725
]
]
}
}
Candle Data Structure
Each item in the candles array is an ordered array representing [timestamp, open, high, low, close, volume, open_interest]:
| Index | Field Name | Data Type | Description |
|---|---|---|---|
[0] | timestamp | String | Timestamp of the candle interval with timezone offset (e.g. 2025-01-01T09:15:00+0530). |
[1] | open | Float / Number | Opening price for the candle interval. |
[2] | high | Float / Number | Highest price recorded during the candle interval. |
[3] | low | Float / Number | Lowest price recorded during the candle interval. |
[4] | close | Float / Number | Closing price of the candle interval. |
[5] | volume | Integer | Total traded volume (contracts/shares) during the candle interval. |
[6] | open_interest | Integer | Open Interest (OI) at the end of the candle interval. |
Response Parameters
| Key | Data Type | Description |
|---|---|---|
status | String | Status of the API request (success or error). |
data | Object | Response container object holding the candles array. |
candles | Array | Chronologically ordered array of candlestick records. |
Required Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
symbol | String | ✅ | Trading symbol (e.g. NIFTY, BANKNIFTY) |
product_type | String | ✅ | futures or options |
type | String | Required for Options | CE (Call) or PE (Put) |
expiry_date | Date | ✅ | Contract expiry date |
strike_price | Number | Required for Options | Strike price for options contracts |
interval | String | ✅ | Candle interval |
from_date | DateTime | ✅ | Start date and time |
to_date | DateTime | ✅ | End date and time |
!!! note
The `strike_price` and `type` fields are **required only** when `product_type` is `options`. They are **not required** for `futures`.
Next Steps
- Read the Authentication guide.
- Explore the Historical Data API Reference.
- Learn about the Export API for large historical data requests.
- Review the Error Codes and Troubleshooting sections.
Check Export Status
Retrieve the current status of an asynchronous export job. Once the export is complete, the API returns a pre-signed download URL for the generated CSV file.
Endpoint
GET /api/data/v1/status/:job_id
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
job_id | UUID | Yes | The unique identifier returned when the export job was created. |
Example Request
curl --request GET \
--url https://algo.pocketful.in/api/data/v1/status/9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d \
--header "Authorization: Bearer YOUR_API_TOKEN"
Response (Processing)
{
"status": "success",
"job": {
"job_id": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
"status": "processing",
"request": {
"...": "..."
},
"created_at": "2026-06-29T09:49:10Z"
}
}
Response (Completed)
{
"status": "success",
"job": {
"job_id": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
"status": "completed",
"request": {
"...": "..."
},
"file_url": "https://pktl-market-data.s3.ap-south-1.amazonaws.com/exports/9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d.csv?...",
"created_at": "2026-06-29T09:49:10Z",
"completed_at": "2026-06-29T09:49:15Z"
}
}
!!! success “Export Completed”
When the job status becomes **`completed`**, the `file_url` field contains a pre-signed Amazon S3 URL that can be used to download the exported CSV file.
- The URL is valid for **24 hours**.
- Download the file directly using any browser or HTTP client.
- No additional authentication is required while the pre-signed URL is valid.
Possible Job Statuses
| Status | Description |
|---|---|
processing | The export job is currently running. |
completed | The export has finished successfully and the download URL is available. |
failed | The export could not be completed. Check the error message and retry if necessary. |
!!! tip
For large historical data requests, poll this endpoint periodically (for example, every **5–10 seconds**) until the job status changes to **`completed`**.