# eCourts Advocate Case Scraper (`codingfrontend/ecourts-advocate-case-scraper`) Actor

Search court cases by advocate name or bar code on Indian eCourts services. Supports fetching states, districts, complexes, and establishments.

- **URL**: https://apify.com/codingfrontend/ecourts-advocate-case-scraper.md
- **Developed by:** [Coding Frontned](https://apify.com/codingfrontend) (community)
- **Categories:** Automation, Developer tools, Other
- **Features:** Limited permissions
- **Stats:** 12 total users, 2 monthly users, 60.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.99 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

### What does eCourts Advocate Case Scraper do?

This Actor looks up state, district, court-complex, and establishment codes shown in the [eCourts Services public location selectors](https://services.ecourts.gov.in/ecourtindia_v6/). Its advocate-search mode submits the official search form using the configured W3Crawler CAPTCHA API and returns verified case rows.

Use the location modes to discover current codes before selecting a narrower location in another tool or in the eCourts website. Values in the examples below are illustrative and should be replaced with codes from a recent location lookup.

### Why use this Actor?

- Collect public location names and their matching codes from eCourts selectors.
- Move from a state lookup to district, court-complex, and establishment lookups.
- State lookups read the public HTML directly; narrower lookups use the website's interactive selectors.
- Use the dataset through the Apify Console or API, or schedule runs with the Apify platform.

### How to run it

1. Open the Actor in Apify Console and select **Input**.
2. Choose a mode. Start with `get_states`; use a code from its results for a narrower lookup.
3. Fill in the fields required for that mode, then click **Start**.
4. Open **Results** to inspect the location rows. Open **Output summary** to check the run status and saved-record count.

### Input options

The Actor accepts 14 fields. Only `mode` is required by the input schema. The other requirements below depend on the selected mode or search type. Text fields have no maximum length validation unless a format is listed.

| Field | Type | Required? | Default | What it does |
| --- | --- | --- | --- | --- |
| `mode` | Selection | Yes | `get_states` in the Input form | Choose `get_states`, `get_districts`, `get_complexes`, `get_establishments`, or `search`. A mode must be supplied in direct JSON input. |
| `searchType` | Selection | Optional | `name` in `search` mode | Search form type: `name`, `barcode`, or `caselist`. The selected form is submitted after CAPTCHA conversion. |
| `advocateName` | Text | Conditional | None | Required for `search` with `searchType: "name"`. No length limit is enforced. |
| `barState` | Text | Conditional | None | Required for `barcode` and `caselist` searches. Enter the bar-council state code. |
| `barCode` | Text | Conditional | None | Required for `barcode` and `caselist` searches. Enter the bar registration code. |
| `barYear` | Text | Conditional | None | Required for `barcode` and `caselist` searches. The Actor does not enforce a year range. |
| `searchDate` | Text | Conditional | None | Required for `caselist`. Must match `DD-MM-YYYY`; the Actor checks the format, not whether the date exists. |
| `stateCode` | Text | Conditional | None | Required for `get_districts`, `get_complexes`, and `get_establishments`. Optional as a search location filter. Use a current `state_code` from `get_states`. |
| `districtCode` | Text | Conditional | None | Required for `get_complexes` and `get_establishments`. Optional as a search location filter. Use a current `district_code` from `get_districts`. |
| `complexCode` | Text | Conditional | None | Required for `get_establishments`. Optional as a search location filter. Use `complex_code` or `complex_code_full` from `get_complexes`. |
| `estCode` | Text | Optional | None | Optional search location filter. Use an `est_code` from `get_establishments`. Location lookup modes do not use it. |
| `proxyConfiguration` | Object | Optional | Direct browser connection | Apify Proxy or custom proxy for browser modes. `get_states` reads direct public HTTP. |
| `maxCaptchaRetries` | Integer | Optional | `3` | CAPTCHA attempts per location, from 1 to 5. Developer option. |
| `caseStatus` | Selection | Optional | `Both` in `search` mode | Accepted values are `Both`, `Pending`, and `Disposed`. The selected filter is submitted to eCourts. |

#### Mode requirements

| Mode | Additional required fields |
| --- | --- |
| `get_states` | None |
| `get_districts` | `stateCode` |
| `get_complexes` | `stateCode`, `districtCode` |
| `get_establishments` | `stateCode`, `districtCode`, `complexCode` |
| `search` with `name` | `advocateName` |
| `search` with `barcode` | `barState`, `barCode`, `barYear` |
| `search` with `caselist` | `barState`, `barCode`, `barYear`, `searchDate` |

Search location filters are optional. When a location filter is omitted, the search workflow may expand to more live locations. Search mode returns the case rows provided by eCourts and deduplicates overlapping results across locations. There is no result-limit, sorting, or deduplication input.

#### Input examples

Start with the state list:

```json
{
  "mode": "get_states"
}
```

Get districts for a state. Replace `26` with a current code from the state results:

```json
{
  "mode": "get_districts",
  "stateCode": "26"
}
```

Get complexes for a district. Replace both codes with current values from earlier lookups:

```json
{
  "mode": "get_complexes",
  "stateCode": "26",
  "districtCode": "11"
}
```

Get establishments for a complex. `complexCode` may be the base or full code returned by `get_complexes`:

```json
{
  "mode": "get_establishments",
  "stateCode": "26",
  "districtCode": "11",
  "complexCode": "1260012@1,2,3,4@Y"
}
```

Configure an advocate-name search:

```json
{
  "mode": "search",
  "searchType": "name",
  "advocateName": "Example Advocate",
  "caseStatus": "Both"
}
```

Configure a bar-code search:

```json
{
  "mode": "search",
  "searchType": "barcode",
  "barState": "EX",
  "barCode": "12345",
  "barYear": "2020",
  "caseStatus": "Pending"
}
```

Configure a case-list search:

```json
{
  "mode": "search",
  "searchType": "caselist",
  "barState": "EX",
  "barCode": "12345",
  "barYear": "2020",
  "searchDate": "15-01-2025",
  "caseStatus": "Disposed"
}
```

Search examples show accepted input formats. Select a narrow court location for a short run; omitting filters can expand the search across many courts.

### Output

Location modes return one dataset row per public selector option. A run returns rows for the selected mode; the combined array below illustrates each row shape and is not a single-run result. Values are illustrative, not verified current eCourts results.

```json
[
  {
    "state_code": "26",
    "state_name": "Example State"
  },
  {
    "state_code": "26",
    "district_code": "11",
    "district_name": "Example District"
  },
  {
    "state_code": "26",
    "district_code": "11",
    "complex_code": "1260012",
    "complex_code_full": "1260012@1,2,3,4@Y",
    "complex_name": "Example Court Complex"
  },
  {
    "state_code": "26",
    "district_code": "11",
    "complex_code": "1260012@1,2,3,4@Y",
    "est_code": "1",
    "est_name": "Example Court Establishment"
  }
]
```

| Field | Type | Required? | Meaning |
| --- | --- | --- | --- |
| `state_code` | String | Optional, mode-dependent | Code of the state. |
| `state_name` | String | Optional, mode-dependent | State name from the public selector. |
| `district_code` | String | Optional, mode-dependent | Code of the district. |
| `district_name` | String | Optional, mode-dependent | District name from the public selector. |
| `complex_code` | String | Optional, mode-dependent | Court-complex code. In establishment rows it may contain the full code. |
| `complex_code_full` | String | Optional, mode-dependent | Full court-complex selector value, including its suffix segments. |
| `complex_name` | String | Optional, mode-dependent | Court-complex name from the public selector. |
| `est_code` | String | Optional, mode-dependent | Establishment code. |
| `est_name` | String | Optional, mode-dependent | Establishment name from the public selector. |

The dataset schema marks fields optional because each mode returns a different row shape. Within a mode, rows include the codes and names needed to identify that location type. Search mode emits case records, while location modes emit only location records. Case detail pages are not fetched. Optional values that are not available are left out.

You can download the dataset in various formats such as JSON, HTML, CSV, or Excel.

### Run status and output summary

The **Output summary** link opens the `OUTPUT_SUMMARY` record in the run's default **Key-value store**. It always contains exactly these fields:

| Field | Type | Required? | Meaning |
| --- | --- | --- | --- |
| `status` | String | Yes | `SUCCEEDED` when one or more valid case or location rows were saved; otherwise `FAILED`. |
| `itemsStored` | Nonnegative integer | Yes | Number of valid case or location rows whose dataset writes completed. |
| `isPartial` | Boolean | Yes | `true` when a failure stopped collection after at least one row was saved. |

Example completed run:

```json
{
  "status": "SUCCEEDED",
  "itemsStored": 4,
  "isPartial": false
}
```

A run with saved rows followed by a collection or storage failure remains successful with `isPartial: true`. A run that saves no valid case or location rows, including an access-challenge or empty result, fails. Failure details appear in the run log.

### Tips, access, and cost

- Run `get_states` first, then use codes from the latest results for narrower lookups.
- Search CAPTCHA images are converted through W3Crawler, with at most `maxCaptchaRetries` attempts per location. Login prompts, access denials, and unavailable sources still stop collection.
- Search results are summary case rows. Detailed case histories, orders, and PDFs are not fetched.
- State lookup uses HTTP requests; other modes use browser compute. Cost depends on run time and your Apify plan. Check the run's **Usage** details for actual charges; no Actor-specific price is stated here.
- For help, include the run ID and selected mode in the Actor's **Issues** tab. Use the **API** tab for programmatic runs.

The Actor reads public location selectors and is not affiliated with eCourts. Follow the source's access rules and use public information responsibly. State lookup was checked against the public HTML in a local run. This does not verify narrower location modes or advocate case extraction. Case identities, parties and advocate text are saved when supplied by the accepted search response; dates, orders and detailed histories are not extracted.

### W3Crawler CAPTCHA configuration

Search uses `https://api.w3crawler.com/api/captcha/solve` with model `bc3f0628-29ba-4555-9c27-ff26b4fdc179` (ECourts India Captcha). The dedicated key owned by `admin@w3crawler.com` is provided through the encrypted `CAPTCHA_API_KEY` Actor environment variable. It is not an input field and is never stored in source, logs, or dataset output. PNG, JPEG and WebP uploads retain their actual image format.

The key has no expiry or lifetime usage quota; the account has unlimited wallet credits. General CAPTCHA service request throttling still applies. Credentials or billing failures stop the search; explicit invalid predictions can obtain a fresh image within the configured attempt limit. Keep the key private and do not include it in scheduled-task input.

#### Advocate case output

Search rows contain the source fields that are available: `srNo`, `caseTypeNumberYear`, `petitioner`, `respondent`, `advocate`, `caseType`, `caseNumber`, `caseYear`, `cnrNumber`, and alternate-layout `parties`. `viewHistoryParams` contains case/court identifiers (`caseNo`, `cino`, `selCourtCode`, `stateCode`, `distCode`, `complexCode`). `_location` contains state, district, complex and establishment codes and names. Missing optional values are omitted. These identifiers do not mean that case history was retrieved.

#### Dataset charge limit

Apify may stop storing new dataset rows when the run's maximum total charge is reached. The Actor counts only stored rows, stops further dataset writes, and reports `isPartial: true` when that happens. A source result count is not a saved-record count. Check `OUTPUT_SUMMARY` and the dataset for the final stored count.

# Changelog

This Actor's version history is a separate document: https://apify.com/codingfrontend/ecourts-advocate-case-scraper/changelog.md

# Actor input Schema

## `mode` (type: `string`):

Choose a court location lookup or a CAPTCHA-assisted advocate case search.

## `searchType` (type: `string`):

Search by advocate name, bar registration code, or a dated advocate case list.

## `advocateName` (type: `string`):

Required in search mode when searchType is name. No length limit is enforced.

## `barState` (type: `string`):

Required in search mode for barcode and caselist. Enter the bar-council state code as text; no length limit is enforced.

## `barCode` (type: `string`):

Required in search mode for barcode and caselist. Enter the registration code as text; no length limit is enforced.

## `barYear` (type: `string`):

Required in search mode for barcode and caselist. Enter the registration year as text; the Actor does not enforce a year range.

## `searchDate` (type: `string`):

Required in search mode when searchType is caselist. Format must be DD-MM-YYYY; the Actor checks the format, not whether the date exists.

## `stateCode` (type: `string`):

Required for get_districts, get_complexes, and get_establishments. Optional as a search location filter. Use a current code returned by get_states.

## `districtCode` (type: `string`):

Required for get_complexes and get_establishments. Optional as a search location filter. Use a current code returned by get_districts.

## `complexCode` (type: `string`):

Required for get_establishments. Optional as a search location filter. Use the complex_code or complex_code_full value returned by get_complexes.

## `estCode` (type: `string`):

Optional search location filter. Use an est_code returned by get_establishments. Location lookup modes do not use this field.

## `caseStatus` (type: `string`):

Case-status filter submitted in search mode.

## `maxCaptchaRetries` (type: `integer`):

Maximum image-to-text and form attempts for one location.

## `proxyConfiguration` (type: `object`):

Optional Apify Proxy or custom proxy for browser-based search and location modes. The get_states HTTP lookup is direct.

## Actor input object example

```json
{
  "mode": "get_states",
  "searchType": "name",
  "caseStatus": "Both",
  "maxCaptchaRetries": 3,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `dataset` (type: `string`):

Dataset containing advocate cases or public location codes and names.

## `runSummary` (type: `string`):

Three-field run status record stored as OUTPUT_SUMMARY in the default key-value store.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "mode": "get_states"
};

// Run the Actor and wait for it to finish
const run = await client.actor("codingfrontend/ecourts-advocate-case-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "mode": "get_states" }

# Run the Actor and wait for it to finish
run = client.actor("codingfrontend/ecourts-advocate-case-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "mode": "get_states"
}' |
apify call codingfrontend/ecourts-advocate-case-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,codingfrontend/ecourts-advocate-case-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/dy39rDIIqmQQ4JdW9/builds/Eb5axiRadDpgohk3B/openapi.json
