# e-Stat Japan Statistics Scraper (`jungle_synthesizer/e-stat-japan-statistics-scraper`) Actor

Extract official Japanese government statistics from the e-Stat API (api.e-stat.go.jp). Search 6,000+ datasets covering population, GDP, trade, employment, and more. Returns bilingual JP/EN labels with automatic wareki-to-Gregorian date conversion. Requires a free appId from e-stat.go.jp/api/.

- **URL**: https://apify.com/jungle\_synthesizer/e-stat-japan-statistics-scraper.md
- **Developed by:** [BowTiedRaccoon](https://apify.com/jungle_synthesizer) (community)
- **Categories:** Business, Other
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## 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

## e-Stat Japan Statistics Scraper

Extract official Japanese government statistics from the e-Stat API. Search 6,000+ datasets covering population, GDP, trade, employment, and more. Returns bilingual JP/EN labels with automatic wareki-to-Gregorian date conversion.

### What is e-Stat?

[e-Stat](https://www.e-stat.go.jp/) is Japan's unified government statistics portal, operated by the Ministry of Internal Affairs and Communications. It aggregates statistical data from all major Japanese ministries and agencies. The [e-Stat API v3](https://api.e-stat.go.jp/rest/3.0/app/) provides programmatic access to 6,000+ survey tables covering:

- **Population**: Census, vital statistics, household surveys
- **Economy**: GDP, industrial production, corporate statistics
- **Labour**: Employment, wages, working hours
- **Agriculture**: Crop production, livestock, fisheries
- **Trade**: Import/export by commodity and country
- **Health & Education**: Medical facilities, school enrollment

### Getting Started

1. **Register for a free API key** at [https://www.e-stat.go.jp/api/](https://www.e-stat.go.jp/api/)
2. Enter your `appId` in the actor input
3. Choose a mode: `catalog` to search tables, `data` to fetch records

### Modes

#### Catalog Mode (`mode: "catalog"`)

Search the statistical table index by keyword, subject area, or publishing ministry. Returns metadata for matching tables — use this to discover `statsDataId` values for data mode.

**Input example:**
```json
{
  "appId": "YOUR_APP_ID",
  "mode": "catalog",
  "searchWord": "population",
  "lang": "E",
  "maxItems": 50
}
````

**Output fields:**
| Field | Description |
|-------|-------------|
| `stats_data_id` | Unique e-Stat table ID (use in data mode) |
| `stats_name` | Survey series name |
| `statistics_name` | Specific table name within the survey |
| `title` | Full table title |
| `government_org` | Publishing ministry or agency |
| `cycle` | Survey frequency (annual/monthly/etc.) |
| `survey_date` | Survey period code |
| `open_date` | Publication date (YYYY-MM-DD) |
| `small_area` | True if municipality-level data is available |
| `overall_total` | Total number of data cells in the table |

#### Data Mode (`mode: "data"`)

Fetch actual data cells from one or more specific table IDs. Supports multi-dimensional data with area, time, and category axes.

**Input example:**

```json
{
  "appId": "YOUR_APP_ID",
  "mode": "data",
  "statsDataIds": ["0003448237"],
  "lang": "E",
  "maxItems": 1000
}
```

**Output fields:**
| Field | Description |
|-------|-------------|
| `stats_data_id` | Source table ID |
| `area_code` | JIS prefecture/municipality code |
| `area_label` | Area name (Japanese) |
| `area_label_en` | Area name (English) |
| `time_code` | Time dimension code |
| `time_label` | Time label as reported (may include wareki) |
| `time_gregorian` | ISO 8601 normalized year (wareki converted) |
| `cat01_code` | Category dimension 1 code |
| `cat01_label` | Category dimension 1 label |
| `value` | Numeric data value |
| `unit` | Measurement unit |
| `annotation` | Suppression flag (\* or -) |

### Filtering Options

#### Catalog Mode Filters

| Input | Description | Example |
|-------|-------------|---------|
| `searchWord` | Keyword search across JP and EN metadata | `"population"` |
| `statsField` | Subject area code | `"02"` (Population) |
| `governmentOrg` | Ministry code | `"00200"` (Statistics Bureau) |
| `lang` | Label language: `"E"` (English) or `"J"` (Japanese) | `"E"` |

#### Common `statsField` Codes

| Code | Subject Area |
|------|-------------|
| `02` | Population / Households |
| `03` | Labour / Wages |
| `04` | Agriculture / Forestry / Fisheries |
| `05` | Mining / Industry / Construction |
| `07` | Trade |
| `08` | Finance / Insurance |
| `09` | Government Finance |
| `13` | Health / Social Security |
| `14` | Education / Culture |

### Wareki Date Conversion

Japanese government data frequently uses imperial era years (令和, 平成, 昭和, 大正). This actor automatically converts them to Gregorian years in the `time_gregorian` field:

| Japanese | Gregorian Offset | Example |
|----------|-----------------|---------|
| 令和 (Reiwa) | +2018 | 令和6 → 2024 |
| 平成 (Heisei) | +1988 | 平成30 → 2018 |
| 昭和 (Showa) | +1925 | 昭和50 → 1975 |
| 大正 (Taisho) | +1911 | 大正5 → 1916 |

### Rate Limits

The e-Stat API free tier allows up to **100,000 requests per day** with no monthly limit. The actor uses a conservative 200ms delay between requests to stay well within limits.

### Large Tables

Some e-Stat tables contain millions of data cells. Use `maxItems` to limit output:

- Catalog mode: up to 100,000 table entries per search
- Data mode: no hard per-table cap, but use `maxItems` for manageable runs

### Output Format

All records are flat JSON objects. Unused dimension fields (e.g. `cat02_*` when a table only has one category dimension) are omitted from output.

### Example Use Cases

- Track Japan's annual population by prefecture over time
- Monitor labour market statistics (unemployment, wages) by industry
- Analyze agricultural production trends
- Research bilateral trade flows by commodity
- Study historical demographic data with wareki-to-Gregorian conversion

# Actor input Schema

## `sp_intended_usage` (type: `string`):

Please describe how you plan to use the data extracted by this crawler.

## `sp_improvement_suggestions` (type: `string`):

Provide any feedback or suggestions for improvements.

## `sp_contact` (type: `string`):

Provide your email address so we can get in touch with you.

## `appId` (type: `string`):

Your free e-Stat API application ID. Register at https://www.e-stat.go.jp/api/ to get your own key. Required for all API calls.

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

Operation mode: "catalog" (search for statistical tables), "data" (fetch data cells for specific table IDs).

## `searchWord` (type: `string`):

Keyword to search for (used in catalog mode). Searches both Japanese and English metadata.

## `statsDataIds` (type: `array`):

One or more e-Stat table IDs (statsDataId) to fetch data cells for. Used in data mode. Example: \["0003448237"].

## `lang` (type: `string`):

Language for labels — "E" for English, "J" for Japanese.

## `statsField` (type: `string`):

Filter by subject area code (catalog mode only). E.g. "02" for Population/Households, "03" for Labour/Wages, "04" for Agriculture.

## `governmentOrg` (type: `string`):

Filter by publishing ministry code (catalog mode only). E.g. "00200" for Statistics Bureau.

## `maxItems` (type: `integer`):

Maximum number of records to return.

## Actor input object example

```json
{
  "sp_intended_usage": "Describe your intended use...",
  "sp_improvement_suggestions": "Share your suggestions here...",
  "sp_contact": "Share your email here...",
  "appId": "e58d90215db770e17b638605c0912b8ba0222b09",
  "mode": "catalog",
  "searchWord": "population",
  "statsDataIds": [
    "0003448237"
  ],
  "lang": "E",
  "maxItems": 10
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# 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 = {
    "sp_intended_usage": "Describe your intended use...",
    "sp_improvement_suggestions": "Share your suggestions here...",
    "sp_contact": "Share your email here...",
    "appId": "e58d90215db770e17b638605c0912b8ba0222b09",
    "mode": "catalog",
    "searchWord": "population",
    "statsDataIds": [
        "0003448237"
    ],
    "lang": "E",
    "maxItems": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("jungle_synthesizer/e-stat-japan-statistics-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 = {
    "sp_intended_usage": "Describe your intended use...",
    "sp_improvement_suggestions": "Share your suggestions here...",
    "sp_contact": "Share your email here...",
    "appId": "e58d90215db770e17b638605c0912b8ba0222b09",
    "mode": "catalog",
    "searchWord": "population",
    "statsDataIds": ["0003448237"],
    "lang": "E",
    "maxItems": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("jungle_synthesizer/e-stat-japan-statistics-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 '{
  "sp_intended_usage": "Describe your intended use...",
  "sp_improvement_suggestions": "Share your suggestions here...",
  "sp_contact": "Share your email here...",
  "appId": "e58d90215db770e17b638605c0912b8ba0222b09",
  "mode": "catalog",
  "searchWord": "population",
  "statsDataIds": [
    "0003448237"
  ],
  "lang": "E",
  "maxItems": 10
}' |
apify call jungle_synthesizer/e-stat-japan-statistics-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=jungle_synthesizer/e-stat-japan-statistics-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "e-Stat Japan Statistics Scraper",
        "description": "Extract official Japanese government statistics from the e-Stat API (api.e-stat.go.jp). Search 6,000+ datasets covering population, GDP, trade, employment, and more. Returns bilingual JP/EN labels with automatic wareki-to-Gregorian date conversion. Requires a free appId from e-stat.go.jp/api/.",
        "version": "0.1",
        "x-build-id": "qaiMb5Szqz6jdAwXW"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/jungle_synthesizer~e-stat-japan-statistics-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-jungle_synthesizer-e-stat-japan-statistics-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/jungle_synthesizer~e-stat-japan-statistics-scraper/runs": {
            "post": {
                "operationId": "runs-sync-jungle_synthesizer-e-stat-japan-statistics-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/jungle_synthesizer~e-stat-japan-statistics-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-jungle_synthesizer-e-stat-japan-statistics-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": [
                    "maxItems"
                ],
                "properties": {
                    "sp_intended_usage": {
                        "title": "What is the intended usage of this data?",
                        "minLength": 1,
                        "type": "string",
                        "description": "Please describe how you plan to use the data extracted by this crawler."
                    },
                    "sp_improvement_suggestions": {
                        "title": "How can we improve this crawler for you?",
                        "minLength": 1,
                        "type": "string",
                        "description": "Provide any feedback or suggestions for improvements."
                    },
                    "sp_contact": {
                        "title": "Contact Email",
                        "minLength": 1,
                        "type": "string",
                        "description": "Provide your email address so we can get in touch with you."
                    },
                    "appId": {
                        "title": "e-Stat Application ID",
                        "type": "string",
                        "description": "Your free e-Stat API application ID. Register at https://www.e-stat.go.jp/api/ to get your own key. Required for all API calls.\n"
                    },
                    "mode": {
                        "title": "Mode",
                        "enum": [
                            "catalog",
                            "data"
                        ],
                        "type": "string",
                        "description": "Operation mode: \"catalog\" (search for statistical tables), \"data\" (fetch data cells for specific table IDs).\n"
                    },
                    "searchWord": {
                        "title": "Search Keyword",
                        "type": "string",
                        "description": "Keyword to search for (used in catalog mode). Searches both Japanese and English metadata.\n"
                    },
                    "statsDataIds": {
                        "title": "Stats Data IDs",
                        "type": "array",
                        "description": "One or more e-Stat table IDs (statsDataId) to fetch data cells for. Used in data mode. Example: [\"0003448237\"].\n",
                        "items": {
                            "type": "string"
                        }
                    },
                    "lang": {
                        "title": "Language",
                        "enum": [
                            "E",
                            "J"
                        ],
                        "type": "string",
                        "description": "Language for labels — \"E\" for English, \"J\" for Japanese."
                    },
                    "statsField": {
                        "title": "Statistics Field Code",
                        "type": "string",
                        "description": "Filter by subject area code (catalog mode only). E.g. \"02\" for Population/Households, \"03\" for Labour/Wages, \"04\" for Agriculture.\n"
                    },
                    "governmentOrg": {
                        "title": "Government Organization Code",
                        "type": "string",
                        "description": "Filter by publishing ministry code (catalog mode only). E.g. \"00200\" for Statistics Bureau.\n"
                    },
                    "maxItems": {
                        "title": "Max Items",
                        "type": "integer",
                        "description": "Maximum number of records to return."
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
