Nic APIindiacode.nic.in ↗
Search and retrieve Indian Acts, sections, and subordinate legislation from indiacode.nic.in. Browse central and state acts by handle ID or keyword.
What is the Nic API?
The India Code API provides access to Indian legislation via 6 endpoints covering central acts, state acts, and section-level content. Use search_acts to run full-text keyword searches across Acts, Sections, or Subordinate Legislations, or use get_act_details to retrieve a complete act's chapter structure, metadata, and subordinate rules. Each act response includes fields like ministry, enactment_date, short_title, and a full sections array with IDs for individual text retrieval.
curl -X GET 'https://api.parse.bot/scraper/e9bac3eb-7736-4209-8c66-c21f50945510/search_acts?rpp=3&type=acts&query=Data+Protection&start=0' \ -H 'X-API-Key: $PARSE_API_KEY'
Typed, relational, agent-ready
A generated client with real types, enums, and the links between objects — the structure a flat JSON response can't carry. Autocompletes in your editor and reads cleanly to coding agents.
- Fully typed · autocompletes
- Objects link to objects
- Typed errors & pagination
Typed Python client. Set up the SDK in your uv project, then pull this API’s typed client:
uv add parse-sdk uv run parse init uv run parse add --marketplace indiacode-nic-in-api
uv run parse add --marketplace pulls a pinned snapshot of this canonical API — it won’t change underneath you. To customize it, subscribe and swap to your own copy.
"""Walkthrough: India Code SDK — search, browse, and drill into legislation."""
from parse_apis.india_code_api import IndiaCode, SearchType, ActNotFound
client = IndiaCode()
# Search for acts by keyword, limiting total items fetched.
for act in client.actsummaries.search(query="Data Protection", type=SearchType.ACTS, limit=3):
print(act.title, act.act_no, act.date)
# Take the first result and drill into full details.
summary = client.actsummaries.search(query="Aadhaar", limit=1).first()
if summary:
act = summary.details()
print(act.title, act.metadata.ministry)
# Fetch section content via the sub-resource.
for section in act.sections[:2]:
detail = act.section_details.get(section_id=section.section_id)
print(section.title, detail.content_text[:80])
# Browse state-level legislation.
for state_act in client.stateacts.list(handle_id="2454", limit=3):
print(state_act.title, state_act.act_no)
# Typed error handling when an act doesn't exist.
try:
client.acts.get(handle_id="9999999")
except ActNotFound as exc:
print(f"Act not found: handle_id={exc.handle_id}")
print("exercised: search / details / section_details.get / stateacts.list / acts.get")
Full-text search across Indian legislation by keyword. Returns matching Acts, Sections, or Subordinate Legislations depending on search type. Results are paginated with offset-based navigation. Each result includes handle_id for drilling into act details via get_act_details.
| Param | Type | Description |
|---|---|---|
| rpp | integer | Results per page |
| type | string | Search type: 'acts' for Acts, 'section' for Sections, or 'subordinate' for Subordinate Legislations |
| queryrequired | string | Search keyword to find matching legislation |
| start | integer | Pagination offset (0-based) |
{
"type": "object",
"fields": {
"rpp": "integer results per page",
"start": "integer current pagination offset",
"results": "array of matching acts with title, act_no, date, handle_id, and url",
"total_results": "integer total number of matching results"
},
"sample": {
"data": {
"rpp": 10,
"start": 0,
"results": [
{
"url": "https://www.indiacode.nic.in/handle/123456789/22037?view_type=search&col=123456789/1362",
"date": "11-Aug-2023",
"title": "The Digital PersonalDataProtectionAct, 2023.",
"act_no": "22",
"handle_id": "22037"
}
],
"total_results": 17
},
"status": "success"
}
}About the Nic API
Searching and Browsing Legislation
The search_acts endpoint accepts a query string and an optional type parameter (acts, section, or subordinate) to scope results. Pagination is offset-based via start and rpp. Each result in the results array includes title, act_no, date, handle_id, and url. The handle_id field is the key identifier used across all other endpoints. browse_central_acts provides an alphabetical catalog of all Central Acts — useful for enumerating the full corpus without a search query.
Act Details and Section Content
get_act_details takes a handle_id and returns act metadata (act_number, enactment_date, ministry, enforcement_date, hindi_title, long_title), a sections array where each entry carries section_id, act_id, section_number, and title, plus a subordinate_legislation object keyed by type (rules, regulations, notifications, orders). To fetch the actual legislative text, pass the act_id and section_id from that array into get_section_detail, which returns content_html, content_text, footnote_html, and footnote_text.
Bulk Extraction and State Acts
scrape_act_full_structured combines act metadata retrieval with section-level content fetching in a single call. The optional limit parameter caps how many sections are returned with full text, which is useful when working with large acts. The response includes sections_scraped and total_sections_in_act so callers can track coverage. For state and union territory legislation, get_state_acts accepts a state-specific handle_id (for example, 2454 for Andaman & Nicobar Islands) and returns a paginated list of that jurisdiction's acts in the same result shape as central act browsing.
The Nic API is a managed, monitored endpoint for indiacode.nic.in — not a raw scraper you maintain. Every endpoint is automatically health-checked on a schedule, and when indiacode.nic.in changes and a check fails, the API is automatically queued for repair and re-verified. It is built to keep working as the site underneath it changes.
This isn't an official indiacode.nic.in API — it's an independent, maintained REST wrapper over public data. Where the source has no official API (or only a limited one), Parse gives you a stable contract over a source that never promised one, and keeps it current. Need a new endpoint or field? You can revise it yourself in plain English and the agent rebuilds it against the live site in minutes — contributing the change back to the shared API is free.
Will this API break when the source site changes?+
Is this an official API from the source site?+
Can I fix or extend this API myself if I need a new endpoint or field?+
What happens if I call an endpoint that has an issue?+
- Build a full-text legal search tool over Indian central and state acts using
search_actswith thequeryparameter - Extract complete structured text of a specific Act including footnotes via
scrape_act_full_structuredfor document analysis pipelines - Enumerate all Central Acts alphabetically using
browse_central_actsto build a legislation index or database - Look up subordinate legislation (rules, regulations, notifications) attached to a parent Act via
get_act_detailssubordinate_legislationfield - Retrieve section-level plain text and HTML for any Act section using
get_section_detailfor citation or annotation tools - Aggregate and compare state-specific legislation across Indian states using
get_state_actswith different state handle IDs - Monitor ministry-wise legislation by filtering
get_act_detailsmetadata on theministryfield across a corpus of acts
| Tier | Price | Credits/month | Rate limit |
|---|---|---|---|
| Free | $0/mo | 100 | 5 req/min |
| Hobby | $30/mo | 1,000 | 20 req/min |
| Developer | $100/mo | 5,000 | 100 req/min |
One credit = one API call regardless of which marketplace API you call. Exceeding the rate limit returns a 429 response. Authenticate with the X-API-Key header.
Does indiacode.nic.in have an official developer API?+
What does `get_act_details` return beyond basic act metadata?+
metadata object with fields including act_number, enactment_date, act_year, short_title, hindi_title, long_title, ministry, enforcement_date, and last_updated. It also returns the full sections array with each section's section_id and act_id (needed for get_section_detail), and a subordinate_legislation object that groups associated rules, regulations, notifications, and orders by type.How do I get the full text of an entire Act rather than one section at a time?+
scrape_act_full_structured fetches act metadata and iterates through sections to return their text in a single response. Use the limit parameter to cap how many sections are fetched. The response includes sections_scraped and total_sections_in_act so you can page through a large act in batches by making multiple calls with increasing offsets.Does the API cover amendments, bill history, or gazette notifications linked to an Act?+
get_act_details. Amendment history and bill progression data are not exposed as structured fields. You can fork this API on Parse and revise it to add an endpoint targeting those views.What are the known coverage limitations for state acts?+
handle_id, and there is no built-in endpoint to list all available state handle IDs. You can fork this API on Parse and add a state directory endpoint to address that gap.