Overview
People think in names: Pune, Delhi High Court, Negotiable Instruments Act. The case search API needs exact codes, and a near miss returns zero results. The Search Facet Catalog API bridges the two. It searches an in-memory catalog of every filter value, so an app or an AI agent can resolve a user's words to codes in milliseconds before running the real search.
GET /api/partner/v2/facets/search takes q and optional field, stateCode, districtCode, courtLevel and limit, and returns groups by field with options. Each option has a value, a label, parents such as stateCode or courtLevel and, where values repeat, a unique key such as MH/25. A companion endpoint, /api/partner/v2/facets/full, returns the whole catalog with an ETag, so you can download it once and refresh only when it changes.
- Input
- q (1 to 100 characters); optional field, stateCode, districtCode, courtLevel, limit
- Returns
- Matching filter options grouped by field, with value, label, parents and key
- Coverage
- Every Case Search filter field: courts, states, districts, case types, acts and more
- Freshness
- Catalog carries a version; the full download is cacheable for an hour via ETag
- Auth
- Bearer API key or OAuth via the MCP server
- Register
- eCourtsIndia (ecourtsindia.com)
- MCP tool
get_search_capabilities- Data source
- Public court records published by the Supreme Court, High Courts, district courts and tribunals, harvested daily and refreshed on demand.
What it returns
catalogVersionVersion of the catalog that answered
groups[].fieldFilter field the options belong to, such as courtCode or districtCode
groups[].labelReadable name of the field, such as District
groups[].totalNumber of matching options in that field
options[].valueThe exact value to pass to Case Search
options[].labelReadable name of the option, such as Pune
options[].keyUnique key where values repeat, for example MH/25 for a district
options[].parentsContext such as stateCode or courtLevel
facets[].filterParam (full catalog)Name of the Case Search parameter that takes this field's values
Use cases
Natural-language search box
A legal app lets users type cheque bounce cases in Pune. It sends pune to the facet search, finds district 25 in state MH, and then calls Case Search with stateCodes=MH, districtCodes=25 and a free-text query. The user never sees a code.
AI agent grounding
An AI agent asked about NCLT Mumbai looks up the court in the facet catalog before searching, gets the exact bench code with its parent court level, and only then calls search. This avoids the silent zero results a guessed tribunal code would give.
Offline filter catalog
A data team downloads the full catalog once with its ETag, stores it, and refreshes with If-None-Match each hour. Most refreshes return 304 Not Modified, so their internal tools always have current filter values without repeated large downloads, and a changed ETag tells them exactly when to reload.
How to use it
- Call GET /api/partner/v2/facets/search?q=<name> with your Bearer API key; add field to restrict to one facet.
- Pick the right option; for districts use the key or send the parent stateCode as well.
- Pass the option value to the Case Search parameter named by the facet's filterParam.
- For a local copy, fetch /api/partner/v2/facets/full once and refresh with If-None-Match.
Parameters
q required query Name to look for. Example: pune field query Restrict to one facet field. Example: districtCode Example
Request
curl "https://webapi.ecourtsindia.com/api/partner/v2/facets/search?q=pune&field=districtCode" \
-H "Authorization: Bearer eci_live_YOUR_KEY" Response (illustrative)
// GET /api/partner/v2/facets/search?q=pune&field=districtCode
{
"q": "pune",
"catalogVersion": "3f9a1c2e",
"groups": [
{
"field": "districtCode",
"label": "District",
"total": 1,
"options": [
{
"value": "25",
"label": "Pune",
"key": "MH/25",
"parents": { "stateCode": "MH" }
}
]
}
]
}
// Then: GET /api/partner/v2/search?query=cheque%20bounce&stateCodes=MH&districtCodes=25&courtLevels=DC Authenticate with Authorization: Bearer eci_live_…. Every response field is documented in the eCourtsIndia API documentation. Assistants can also call this through the eCourtsIndia MCP server as the get_search_capabilities tool.
Glossary
- Facet
- A field you can filter and count search results by, such as court, state, district, case type, filing year or act. The facet catalog lists the valid values for each, so a filter can be built from a name.
- ETag
- A version tag a server sends with a response. Sending it back in an If-None-Match header asks whether anything changed; if not, the server answers 304 Not Modified and you keep your cached copy.
- Court level
- The tier of a court in filters: SC for the Supreme Court, HC for High Courts, DC for district courts and TRIBUNAL for tribunals. Filtering by court level keeps, for example, High Court records out of a district search.
Good to know
- Returns 503 while the catalog is not ready; retry shortly.
- The full catalog is several MB; use ETag and If-None-Match to avoid repeat downloads.
Frequently asked questions
How do I find the right court code for a case search?
Send the court name to GET /api/partner/v2/facets/search with field=courtCode, for example q=delhi. The response lists matching courts with their exact value, such as DLHC01 for the Delhi High Court, and parents such as court level and state. Pass that value to courtCodes in Case Search.
Why do districts have a key as well as a value?
District codes repeat across states, so a value such as 25 is not unique. The key, for example MH/25, combines state and district. When you search, send both stateCodes and districtCodes so the filter points to the right district. Adding courtLevels=DC keeps High Court and tribunal records out.
What is the difference between facets/search and facets/full?
facets/search finds options matching a name and is fast because it searches in memory. facets/full returns the entire catalog, several megabytes, with an ETag and a one-hour cache header, for teams that want a local copy and refresh it only when the ETag changes.
Is this easier than looking up codes on the eCourts portal?
The portal shows courts and districts in dropdowns but gives no searchable code list for filters. This API answers a name with the exact filter value and its context in one call, which suits search boxes, data pipelines and agents that start from plain words.
Can AI assistants use the facet catalog?
Yes. On the eCourtsIndia MCP server, find_filter_values turns a district, court, case type or act name into the exact search_cases filter value, and get_search_capabilities describes what search accepts. Claude or ChatGPT can resolve names this way before searching, which keeps an assistant from guessing a code and missing results.
What errors can the facet search return?
An invalid q, field or limit returns 400; q must be 1 to 100 characters and limit 1 to 50. If the catalog is still loading, the API returns 503 and you should retry shortly. An unknown field name also returns 400.