devgan APIdevgan.in ↗
Access Indian legal acts (IPC, BNS, CrPC, and more) via API. Browse chapters, retrieve section text, classification data, and IPC–BNS cross-references.
What is the devgan API?
The devgan.in API exposes 9 endpoints covering nine Indian bare acts including IPC, BNS, CrPC, CPC, and HMA. You can retrieve full section text and HTML, chapter listings, classification details (offence type, bail, cognizance, triable_by), and IPC-to-BNS cross-references. The get_section endpoint returns the most granular data, including a classification object, composition field, and linked cross_references array for any supported act and section number.
No input parameters required.
curl -X GET 'https://api.parse.bot/scraper/329dad50-19e1-4420-82c2-d39a09736dc4/list_acts' \ -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 devgan-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: Devgan Bare Acts API — bounded, re-runnable; every call capped."""
from parse_apis.devgan_bare_acts_api import Devgan, ActAbbreviation, ActNotFound
devgan = Devgan()
# List all available Indian legal acts
for act in devgan.acts.list(limit=5):
print(act.abbreviation, act.full_name)
# Construct an Act by abbreviation and browse its chapters
ipc = devgan.act(abbreviation="ipc")
for chapter in ipc.chapters.list(limit=5):
print(chapter.chapter_number, chapter.title, chapter.url)
# Get full chapter content (sections with text and HTML)
chapter_content = ipc.chapters.get(chapter_num="01")
print(chapter_content.chapter_number, chapter_content.act)
for sec in chapter_content.sections[:2]:
print(sec.section_number, sec.title, sec.text[:80])
# Search for sections by number within the act
result = ipc.sections.search(query="302", limit=1).first()
if result:
print(result.section_number, result.title)
print(result.description)
# Get cross-references between IPC and BNS for a section
xref = ipc.sections.crossreference(section_num="302")
print(xref.section_number)
for ref in xref.cross_references:
print(ref.text, ref.url)
# Navigate to adjacent sections
nav = ipc.sections.navigate(section_num="302")
print(nav.prev, nav.next, nav.index)
# Typed error handling: catch invalid act abbreviation
try:
bad_act = devgan.act(abbreviation="xyz")
for ch in bad_act.chapters.list(limit=1):
print(ch.title)
except ActNotFound as exc:
print(f"Act not found: {exc}")
print("exercised: acts.list / chapters.list / chapters.get / sections.search / crossreference / navigate / error handling")
List all available Indian legal acts on the site. Returns a static list of supported acts with their abbreviations, full names, and internal IDs. No parameters required.
No input parameters required.
{
"type": "object",
"fields": {
"acts": "array of act objects with abbreviation, full_name, and act_id"
},
"sample": {
"data": {
"acts": [
{
"act_id": "1",
"full_name": "Indian Penal Code, 1860",
"abbreviation": "IPC"
},
{
"act_id": "10",
"full_name": "Bharatiya Nyaya Sanhita, 2023",
"abbreviation": "BNS"
},
{
"act_id": "2",
"full_name": "Code of Criminal Procedure, 1973",
"abbreviation": "CRPC"
}
]
},
"status": "success"
}
}About the devgan API
Acts and Coverage
The API covers nine Indian statutes: BNS (Bharatiya Nyaya Sanhita), CPC (Code of Civil Procedure), CrPC (Code of Criminal Procedure), HMA (Hindu Marriage Act), IDA (Indian Divorce Act), IEA (Indian Evidence Act), IPC (Indian Penal Code), MVA (Motor Vehicles Act), and NIA (Negotiable Instruments Act). The list_acts endpoint returns the full list with each act's abbreviation, full_name, and act_id. The get_act_details endpoint adds header_info (act number and year) and a meta_description string for any of the nine supported act abbreviations.
Sections and Classification
get_section is the most detailed endpoint. For a given act and section_num (e.g., ipc / 302), it returns title, full description text, a classification object (containing an offences array, cognizance, bail, and triable_by fields), a composition string for compoundability information, and a cross_references array of linked related sections. Classification data may be null for acts or sections where it is not published on the source. Navigation within an act is available via the navigation object (prev, next, index) embedded in the response, or separately through navigate_section.
Chapters and Section Lists
list_chapters returns chapter-level metadata including chapter_number (which may contain letters such as 05a), title, slug, and url. get_chapter fetches all sections within a chapter, returning each section's section_number, title, plain text, and html. list_all_sections produces a flat index of all section numbers and URLs for an act; note that title may be empty for acts that do not publish titles in their section index.
Search and Cross-References
search_act queries by section number (e.g., 302) rather than keyword text, returning a results array and a matches_found count string. get_ipc_bns_crossreference isolates the cross-reference links for a given section, making it straightforward to map equivalent provisions between the IPC and BNS without parsing the full section response.
The devgan API is a managed, monitored endpoint for devgan.in — not a raw scraper you maintain. Every endpoint is automatically health-checked on a schedule, and when devgan.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 devgan.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 legal reference app that displays IPC or BNS section text alongside classification (bail, cognizance, triable_by) for lawyers and students.
- Map equivalent provisions between IPC and BNS using
get_ipc_bns_crossreferenceto track legislative changes after the 2023 reform. - Generate a structured dataset of all CrPC or CPC chapters and their sections using
list_chaptersandget_chapter. - Power a chatbot that answers 'what does section 420 IPC say' by calling
get_sectionand returning thedescriptionandclassificationfields. - Create a navigation-aware section browser using
navigate_sectionto provide prev/next links within any supported act. - Audit compoundability across IPC sections by extracting the
compositionfield fromget_sectionfor every section in the act. - Bulk-index all section numbers and URLs for a given act via
list_all_sectionsto build a search index or sitemap.
| 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 devgan.in have an official developer API?+
What does the `get_section` endpoint return beyond the section text?+
classification object with offences, cognizance, bail, and triable_by fields; a composition string covering compoundability; a cross_references array with linked related sections; and a navigation object with prev, next, and index pointers. Classification may be null for sections or acts where that data is not available.Does `search_act` support full-text or keyword search within section content?+
search_act matches by section number only (e.g., querying 302 returns sections numbered 302). Keyword or phrase search across section text is not supported. The API covers section-number lookup and full section retrieval. You can fork it on Parse and revise to add a text-search endpoint if needed.Is case law, judicial commentary, or amendment history available through this API?+
Are all nine acts equally complete in terms of chapter and classification data?+
title field in list_all_sections may be empty for acts that do not publish titles in their section index, and the classification object in get_section may be null for acts outside the IPC/BNS criminal law scope where offence classification is not applicable.