Indian Stock Corporate Actions API: Separate No Records from Failed Requests

Published October 26, 2026

splits.msg said, “Infosys has not announced any stock split for the last few years.” That sentence appeared inside a successful HTTP 200 JSON response, alongside usable board-meeting, dividend and bonus tables. Retrying the entire request because the split table was absent would confuse an ordinary research result with an execution problem.

The Indian Stock Exchange API has a read-only corporate-actions operation for this workflow. Its one required query input is stock_name; the observed successful request used infosys. The useful artifact is not a single success flag. It is five section states plus the original tables, so a portfolio research interface can show dividends while honestly labeling an unavailable or explicitly absent split history.

Read a splits.msg before deciding whether the request failed

The saved response used board_meetings, dividends, splits, bonus and rights as separate objects. Every observed section had title and msg strings. In this sample, populated sections had an empty message; the split and rights messages reported no announcements for the last few years and omitted their tables.

This is evidence about one response, not proof that a company has never split, never issued rights or never will. Preserve the message verbatim in the research record. Do not turn its relative phrase “last few years” into a precise start date. Likewise, an HTTP success alone does not establish exchange freshness, complete historical coverage or investment suitability.

When sending a request explicitly, the public route is:

https://api.opendata-api.com/api/project/indian-stock-exchange-api/corporate-actions?key=YOUR_API_KEY&stock_name=infosys

Replace the platform-key placeholder only in an authorized environment. Query keys can enter URL logs, shell history and monitoring tools; redact them before sharing. Opening a guide, navigating between pages or copying this example must not send a data request.

Keep all five corporate-action sections intact

A single has_events flag loses information. A company can have dividend records, bonus records and no reported rights announcements in the same result. Store a state per section, retaining the original title and message. Missing sections should be unknown, not automatically no_records.

Check HTTP status before decoding a successful JSON body, then check the gateway's code, message and data business result. Gateway business code 200 is distinct from HTTP 200. Only after that layer succeeds should the corporate-action object enter the section classifier. Never add an imaginary success envelope to an already extracted raw body.

The classifier below deliberately takes that extracted raw object. Its input file is a local saved JSON document, so running it does not perform a network request. Keep transport errors and gateway business failures outside this parser; they need their own operational classification.

Check headers and data without assuming identical row layouts

The observed key is header, singular, not headers. It contains column-name strings, while data contains rows of strings. Board meetings used Date and Agenda. Dividends used Record Date, Ex-Date, Dividend Percentage and Details. Bonus rows used Record Date, Ex-Date and Ratio.

Read each row against its own section header. Never apply dividend column positions to a meeting agenda or bonus ratio. Preserve raw cells until date conventions and percentage meanings are verified. A dividend percentage is not automatically a cash amount; a bonus ratio does not by itself provide an adjusted price series.

Populated split and rights columns were not observed in this sample. The parser validates generic string tables but does not invent their columns. A mismatched row width is flagged for review while the raw table remains available. Avoid silently dropping cells with an unchecked zip(header, row) conversion.

Label records, reported absence, unknown results and actual failures

Use four distinct outcomes. records means a structurally usable nonempty table, not a claim of data accuracy. reported_absence means an allowlisted section message explicitly reports no events and there are no rows. unknown covers missing sections, empty tables without an explicit absence statement, and unfamiliar messages. invalid covers malformed types, partial tables, inconsistent absence-with-rows and row-width problems.

Only the two observed absence sentences are recognized here. This narrow allowlist is intentional: a generic search for “not” could misclassify a service failure. Add other messages only after review. An unrecognized message stays unknown, even if a developer suspects it means no events. The stored raw section lets a later parser version revisit that decision without another request.

Keep no-split and no-rights results out of the retry queue

A normal no-announcement section should never trigger an automatic retry. An unknown or invalid section also does not justify a blind loop; inspect the contract and capture diagnostics first. If some sections remain usable, retain them rather than discarding the whole result.

Actual request failures belong to a separate policy: stop on invalid authorization or inputs, respect rate-limit instructions, and use bounded retries only for eligible temporary transport or service failures. Do not retry because prices look old, a list is short, or an event seems unexpected. Those are data-quality questions, not evidence that execution failed. Keep capture time separate from event dates and use the exact saved response when testing parser changes.

Return section states and raw tables in one reusable classifier

Save the extracted corporate-action JSON as actions.json, then run python classify_actions.py actions.json. The complete script reports all five states, retains raw sections and tables, and explicitly keeps ordinary absence out of request retries. It never fetches data or prints credentials.

import json
import sys

SECTIONS = ("board_meetings", "dividends", "splits", "bonus", "rights")
ABSENCE = {
    "splits": "Infosys has not announced any stock split for the last few years.",
    "rights": "Infosys has not announced any rights for the last few years.",
}


def classify_section(name, section):
    result = {"state": "unknown", "retry_request": False, "raw": section}
    if section is None:
        result["reason"] = "section missing or null"
        return result
    if not isinstance(section, dict):
        return {**result, "state": "invalid", "reason": "section is not an object"}
    title, message = section.get("title"), section.get("msg")
    if not isinstance(title, str) or not isinstance(message, str):
        return {**result, "state": "invalid", "reason": "title/msg type mismatch"}
    result.update(title=title, message=message)
    has_header, has_data = "header" in section, "data" in section
    absence = name in ABSENCE and message == ABSENCE[name]
    if has_header != has_data:
        return {**result, "state": "invalid", "reason": "partial table"}
    if not has_header:
        return {**result, "state": "reported_absence" if absence else "unknown"}
    header, rows = section["header"], section["data"]
    result.update(header=header, data=rows)
    valid = (
        isinstance(header, list) and all(isinstance(x, str) for x in header)
        and isinstance(rows, list)
        and all(isinstance(row, list) and all(isinstance(x, str) for x in row)
                for row in rows)
    )
    if not valid:
        return {**result, "state": "invalid", "reason": "table type mismatch"}
    if any(len(row) != len(header) for row in rows) or (rows and not header):
        return {**result, "state": "invalid", "reason": "row/header width mismatch"}
    if absence and rows:
        return {**result, "state": "invalid", "reason": "absence conflicts with rows"}
    state = "records" if rows else "reported_absence" if absence else "unknown"
    return {**result, "state": state}


def classify_actions(body):
    if not isinstance(body, dict):
        raise ValueError("Expected an extracted corporate-action object")
    if "error" in body or not any(name in body for name in SECTIONS):
        raise ValueError("Not a recognized corporate-action result")
    return {name: classify_section(name, body.get(name)) for name in SECTIONS}


if __name__ == "__main__":
    with open(sys.argv[1], encoding="utf-8") as handle:
        body = json.load(handle)
    print(json.dumps(classify_actions(body), ensure_ascii=False, indent=2))