pocketful logo light
pocketful logo light

Historical Data NFO

This guide walks you through making your first request to the Historical Market Data API.


Supported Product Types

Product TypeDescription
futuresFutures Contracts
optionsOptions Contracts

Supported Intervals

Interval
1minute

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 --request POST \
--url https://algo.pocketful.in/api/data/v1/historical \
--header "Authorization: Bearer YOUR_API_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 --request POST \
--url https://algo.pocketful.in/api/data/v1/historical \
--header "Authorization: Bearer YOUR_API_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 --request POST \
--url https://algo.pocketful.in/api/data/v1/historical \
--header "Authorization: Bearer YOUR_API_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

{
    "status": "success",
    "data": [
        {
            "timestamp": "2025-01-01T09:15:00Z",
            "open": 51200.50,
            "high": 51350.25,
            "low": 51180.00,
            "close": 51300.10,
            "volume": 125400,
            "open_interest": 10842000
        }
    ]
}

Required Parameters

ParameterTypeRequiredDescription
symbolStringRequired for Both Futures & OptionsTrading symbol (e.g. NIFTY, BANKNIFTY)
product_typeStringAs per requirement of userfutures or options
typeStringRequired for OptionsCE (Call) or PE (Put)
expiry_dateDateRequired for Both Futures & OptionsContract expiry date
strike_priceNumberRequired for OptionsStrike price for options contracts
intervalStringRequired for Both Futures & OptionsCandle interval
from_dateDateTimeRequired for Both Futures & OptionsStart date and time
to_dateDateTimeRequired for Both Futures & OptionsEnd 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.

3. 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

ParameterTypeRequiredDescription
job_idUUIDYesThe 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 is when “Export Completed”

When the job status becomes `completed`, the `file_url` field contains a pre-signed 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

StatusDescription
processingThe export job is currently running.
completedThe export has finished successfully and the download URL is available.
failedThe 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`.