# India Government Data (data.gov.in) — Trade, Prices & More (`themineworks/india-data-gov-scraper`) Actor

Pull any Indian government open dataset from data.gov.in via the official OGD API: foreign trade (export/import), mandi prices, census, and thousands more. Filter, paginate, structured JSON. No anti-bot.

- **URL**: https://apify.com/themineworks/india-data-gov-scraper.md
- **Developed by:** [The Mine Works](https://apify.com/themineworks) (community)
- **Categories:** Business, Developer tools
- **Stats:** 2 total users, 0 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## India Government Data (data.gov.in) — Trade, Prices, Census & More

Pull **any Indian government open dataset** from **data.gov.in** — the official Open Government Data platform — as clean, structured JSON, through the official OGD API. **Foreign trade (export/import), mandi commodity prices, census, agriculture, health, energy** and thousands more. Filter, paginate, and stream straight into your pipeline. No anti-bot, no scraping fragility — this is the government's own API.

**Keywords:** data.gov.in API, India open data, OGD platform, India foreign trade data, export import India, mandi prices API, Indian government datasets, India statistics API.

---

### Why this actor

India publishes a vast amount of open data through data.gov.in — but the OGD API is per-dataset, returns inconsistent envelopes, paginates by offset, and needs an API key. This actor wraps all of that into a single, reliable tool: **give it a dataset's resource ID and it streams the whole dataset (or your filtered slice) as flat records.**

- **Any dataset** — trade, prices, census, agriculture, health, transport, energy. If it's on data.gov.in, this pulls it.
- **Server-side filters** — narrow by any field the dataset exposes (state, commodity, year…).
- **Full pagination** — pull a sample or the entire dataset.
- **Official API, no anti-bot** — this is the government's own endpoint, so it's stable and legitimate.
- **Bring your own free key** — use the shared sample key for testing, your own free data.gov.in key for production.

---

### Featured use case: India foreign trade (export / import)

India's **DGCIS / DGFT foreign-trade statistics** — exports and imports by principal commodity and by country — are published on data.gov.in. Find the dataset you want on data.gov.in (search "foreign trade" or "export import"), copy its resource ID, and this actor pulls it: commodity, country, year, value — structured and ready for analysis. The same actor also gives you mandi prices, census, and the rest of the catalog.

---

### How to find a resource ID

1. Go to **data.gov.in** and search for your dataset (e.g. "foreign trade", "export", "mandi price").
2. Open the dataset and click its **API** tab (or look at the resource URL).
3. Copy the **resource ID** — a UUID like `9ef84268-d588-465a-a308-a864a43d0070`.
4. Paste it into `resourceId`.

---

### Input

| Field | Type | Description |
|---|---|---|
| `resourceId` | string | The data.gov.in dataset resource ID. **Required.** |
| `apiKey` | string | Your free data.gov.in API key. Blank = shared sample key (rate-limited; testing only). |
| `filters` | string[] | `field=value` filters (e.g. `state=Maharashtra`, `commodity=Onion`). Combined with AND. |
| `maxResults` | integer | Max records to return (default 1000). |

#### Example input

```json
{
  "resourceId": "9ef84268-d588-465a-a308-a864a43d0070",
  "filters": ["state=Maharashtra", "commodity=Onion"],
  "maxResults": 500,
  "apiKey": "your-free-data-gov-in-key"
}
````

***

### Output

Each record is returned exactly as the dataset defines it (schemas vary by dataset), plus `_resource_id` and `_scraped_at`. For the mandi-price dataset, for example:

```json
{
  "state": "Maharashtra",
  "district": "Mumbai",
  "market": "Mumbai-Onion & Potato Market APMC",
  "commodity": "Onion",
  "variety": "Red",
  "arrival_date": "11/06/2026",
  "min_price": 1000,
  "max_price": 1600,
  "modal_price": 1350,
  "_resource_id": "9ef84268-d588-465a-a308-a864a43d0070",
  "_scraped_at": "2026-06-11T13:00:00.000Z"
}
```

A final `{"_type": "summary"}` record reports the dataset title, how many records were returned, and the total available.

***

### Pricing

**Your first 25 records are free — every Apify account, no card, no trial clock.** After that it is a flat **$0.001 per record**.

- First 25 records free per account (lifetime), then $0.001/record ($1 per 1,000)
- **Zero charge on empty runs**
- No monthly minimum, no rental

***

### FAQ

**Do I need an API key?** A free data.gov.in key is recommended for production (instant signup at data.gov.in → My Account). The actor falls back to a shared sample key for testing, but it's heavily rate-limited.

**Can I get India's export/import data?** Yes — the DGCIS/DGFT foreign-trade datasets are on data.gov.in. Find the resource ID and pass it in.

**Which datasets are supported?** All of them — data.gov.in hosts hundreds of thousands of resources across every ministry. This actor works against any of them.

**Is this legal / reliable?** Yes — it uses the government's own official OGD API. No scraping of rendered pages, no anti-bot circumvention.

# Actor input Schema

## `resourceId` (type: `string`):

The data.gov.in dataset resource ID. Find it by browsing data.gov.in, opening a dataset, and copying the resource ID from its URL or API tab. Example (mandi prices): 9ef84268-d588-465a-a308-a864a43d0070

## `apiKey` (type: `string`):

Your free data.gov.in API key (get one in seconds at data.gov.in → My Account → API key). Leave blank to use the shared public sample key, which is heavily rate-limited — fine for testing, get your own for production.

## `filters` (type: `array`):

Optional filters as field=value strings, matching the dataset's fields (e.g. state=Maharashtra, commodity=Onion). Combined with AND.

## `maxResults` (type: `integer`):

Maximum number of records to return.

## Actor input object example

```json
{
  "resourceId": "9ef84268-d588-465a-a308-a864a43d0070",
  "apiKey": "",
  "maxResults": 50
}
```

# 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 = {
    "resourceId": "9ef84268-d588-465a-a308-a864a43d0070",
    "maxResults": 50
};

// Run the Actor and wait for it to finish
const run = await client.actor("themineworks/india-data-gov-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 = {
    "resourceId": "9ef84268-d588-465a-a308-a864a43d0070",
    "maxResults": 50,
}

# Run the Actor and wait for it to finish
run = client.actor("themineworks/india-data-gov-scraper").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "resourceId": "9ef84268-d588-465a-a308-a864a43d0070",
  "maxResults": 50
}' |
apify call themineworks/india-data-gov-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=themineworks/india-data-gov-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "India Government Data (data.gov.in) — Trade, Prices & More",
        "description": "Pull any Indian government open dataset from data.gov.in via the official OGD API: foreign trade (export/import), mandi prices, census, and thousands more. Filter, paginate, structured JSON. No anti-bot.",
        "version": "0.1",
        "x-build-id": "HJsN41Nv1UQc9GX1F"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/themineworks~india-data-gov-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-themineworks-india-data-gov-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/themineworks~india-data-gov-scraper/runs": {
            "post": {
                "operationId": "runs-sync-themineworks-india-data-gov-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/themineworks~india-data-gov-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-themineworks-india-data-gov-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "resourceId"
                ],
                "properties": {
                    "resourceId": {
                        "title": "Resource ID",
                        "type": "string",
                        "description": "The data.gov.in dataset resource ID. Find it by browsing data.gov.in, opening a dataset, and copying the resource ID from its URL or API tab. Example (mandi prices): 9ef84268-d588-465a-a308-a864a43d0070"
                    },
                    "apiKey": {
                        "title": "data.gov.in API key (optional)",
                        "type": "string",
                        "description": "Your free data.gov.in API key (get one in seconds at data.gov.in → My Account → API key). Leave blank to use the shared public sample key, which is heavily rate-limited — fine for testing, get your own for production.",
                        "default": ""
                    },
                    "filters": {
                        "title": "Filters (field=value)",
                        "type": "array",
                        "description": "Optional filters as field=value strings, matching the dataset's fields (e.g. state=Maharashtra, commodity=Onion). Combined with AND.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxResults": {
                        "title": "Max records",
                        "minimum": 1,
                        "maximum": 100000,
                        "type": "integer",
                        "description": "Maximum number of records to return.",
                        "default": 1000
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
