Japan Government Statistics API (e-Stat) avatar

Japan Government Statistics API (e-Stat)

Pricing

from $5.00 / 1,000 results

Go to Apify Store
Japan Government Statistics API (e-Stat)

Japan Government Statistics API (e-Stat)

Search and download official Japanese government statistics from e-Stat (population, census, CPI, labour and more) as flat JSON/CSV rows with labels for every dimension. Published CSV mode works without an API key.

Pricing

from $5.00 / 1,000 results

Rating

0.0

(0)

Developer

panda studio

panda studio

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

2 days ago

Last modified

Share

Japan Government Statistics API (e-Stat) — Search & Download as Clean JSON/CSV

Download official Japanese government statistics from e-Stat (政府統計の総合窓口) — population, census, consumer prices (CPI), labour, industry, household spending and thousands of other tables — as flat, labelled JSON/CSV rows. Search the table catalogue, fetch a table by ID, or download a published CSV with no API key at all.

What does the e-Stat Connector do?

e-Stat is Japan's official portal for government statistics. Its data is rich but awkward to use:

  • the API's getStatsData puts numbers in DATA_INF.VALUE and the meaning of each number (area, period, category) in a separate CLASS_INF, joined only by bare codes such as "@area": "13000"
  • published CSVs are served as Shift_JIS/CP932 while the HTTP header says UTF-8, with notes and footnotes mixed into the rows

This Actor handles both and returns one tidy row per value (Table mode) or one clean row per CSV line (File mode), every row carrying the e-Stat attribution.

Who is it for?

  • Analysts and data scientists who need Japanese official statistics in pandas, BigQuery, Excel or a BI tool
  • Market researchers and consultants sizing Japanese markets by prefecture or year
  • Journalists and academics who need citable, sourced figures
  • Developers and AI agents who want Japan statistics through a simple API or MCP tool instead of learning the e-Stat API

Why use this Actor?

  • Works without registration in File mode: paste a published file ID and get the data
  • Labels, not just codes in Table mode: each dimension comes as <dim>_code + <dim>_name
  • Robust against real e-Stat quirks: wrong charset headers, header-row detection, trailing footnotes (moved to sourceNotes), single-element objects that should be arrays
  • Official sources only: e-Stat's REST API and its published file download; no scraping of HTML pages
  • Clear errors for a missing or invalid appId, unknown IDs and documented e-Stat status codes
  • Small and fast: Python standard library only; the 20-row demo runs in about 1.5 s

Three modes (picked from your input)

ModeInputAPI key (appId)Output
FilefileId (statInfId)Not neededOne row per CSV data row, with the file's own column names
TablestatsDataIdNeeded (free)One row per value, each dimension with code and label
SearchsearchWordNeeded (free)One row per matching table, including its statsDataId

Priority if several are set: fileId > statsDataId > searchWord. With no input at all, the Actor runs a 20-row demo of file 000031524010 (population by prefecture) instead of failing.

What data do you get?

FieldModeDescription
CSV columns (e.g. 都道府県名, 西暦(年), 人口(総数))FileThe table's own headers and values as published
_sourceFileId, _sourceUrlFileWhich e-Stat file the row came from
<dim>_code, <dim>_name, <dim>_label, <dim>_unit, time_yearTableEvery dimension of the table (area, time, categories) as code + label, the dimension's name, its unit where given, and the year parsed from the time code
value, valueRaw, unit, valueNoteTableNumeric value, original string, unit, and a note for placeholders such as *** or -
statsDataId, statName, tableTitle, cycleTableAdded when includeTableMeta is on
attributionalle-Stat credit line required by the terms of use

A RUN_SUMMARY record in the key-value store holds the mode, row count, fetch time, source, request echo and any sourceNotes (footnotes).

How much does it cost?

Pay per event: $0.005 per row plus $0.00005 per run start. Platform usage is included. maxRows (default 1,000) caps the rows, and therefore the cost, of each run.

ScenarioRowsCost
Demo (no input)20about $0.10
First 100 rows of a table (the prefilled maxRows)100about $0.50
Population by prefecture, 1920–2015 (file 000031524010, full)980about $4.90
A filtered table (e.g. Tokyo only, 5 years)tens of rowswell under $1

Use the cdArea / cdTime / cdCat01 filters in Table mode to download only the slice you need. If you set a maximum cost per run, the Actor returns only as many rows as fit under it and marks truncatedByMaxCharge in RUN_SUMMARY.

How to use it

Without an API key (File mode)

  1. Open any table page on e-Stat and find its CSV download link, e.g. .../file-download?statInfId=000031524010&fileKind=1.
  2. Put the statInfId value into Published file ID.
  3. Click Start and download the dataset as JSON, CSV or Excel.

With a free API key (Search and Table modes)

  1. Register at e-stat.go.jp/api (ユーザ登録 → マイページ → API機能). The application ID is issued immediately and is free.
  2. Enter it as appId (stored as a secret), or set the ESTAT_APP_ID environment variable.
  3. Run Search with a keyword such as 消費者物価指数 or 人口推計 to find the statsDataId, then run Table with that ID and optional filters.

Input

FieldTypeDefaultDescription
appIdstring (secret)—e-Stat application ID (Table and Search modes)
searchWordstring—Keyword for the table catalogue
statsDataIdstring—Table ID to fetch and flatten
fileIdstring—Published file ID (statInfId); no key needed
cdArea, cdTime, cdCat01array—Filters by area, time and first category codes (Table mode)
surveyYearsstring—2020, 202001 or 202001-202012 (Search mode)
maxRowsinteger1000Row cap per run (max 100,000); large tables are paginated
includeTableMetabooleantrueAdd table ID, statistic name, title and cycle to each row
langstringJLabel language from the API: J or E
requestIntervalSecsinteger1Pause between paginated requests (minimum 0.5 s)
{
"fileId": "000031524010",
"maxRows": 100
}

Output example

Real output (File mode, fileId: 000031524010, fetched 2026-09-24). The file has 980 data rows; this is the Tokyo row for 2015:

{
"都道府県コード": "13",
"都道府県名": "東京都",
"元号": "平成",
"和暦(年)": "27",
"西暦(年)": "2015",
"注": "",
"人口(総数)": "13515271",
"人口(男)": "6666690",
"人口(女)": "6848581",
"_sourceFileId": "000031524010",
"_sourceUrl": "https://www.e-stat.go.jp/stat-search/file-download?statInfId=000031524010&fileKind=1",
"attribution": "出典:政府統計の総合窓口(e-Stat)(https://www.e-stat.go.jp/) / Source: Portal Site of Official Statistics of Japan (e-Stat)"
}

The file's footnotes are not mixed into the rows; they go to RUN_SUMMARY.sourceNotes, for example "1) 沖縄県は調査されなかったため,含まれていない。".

File mode keeps values exactly as published (strings). Table mode adds a numeric value next to the original valueRaw.

Tips

  • Try File mode first: it needs no key and shows you the data before you register.
  • In Table mode, start with a small maxRows and the cdArea / cdTime filters, then widen.
  • lang: "E" returns English labels where e-Stat provides them (many tables are Japanese only).
  • Keep the attribution column when you publish or share the data.

Integrations and API

Python

from apify_client import ApifyClient
client = ApifyClient("YOUR_API_TOKEN")
run = client.actor("panda_studio/estat-connector").call(run_input={"fileId": "000031524010", "maxRows": 100})
rows = client.dataset(run["defaultDatasetId"]).list_items().items

Node.js

import { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: 'YOUR_API_TOKEN' });
const run = await client.actor('panda_studio/estat-connector').call({ fileId: '000031524010', maxRows: 100 });
const { items } = await client.dataset(run.defaultDatasetId).listItems();

cURL (CSV straight back)

curl -X POST "https://api.apify.com/v2/acts/panda_studio~estat-connector/run-sync-get-dataset-items?token=YOUR_API_TOKEN&format=csv" \
-H "Content-Type: application/json" -d '{"fileId":"000031524010","maxRows":100}'

MCP (Claude, Cursor, VS Code): https://mcp.apify.com?tools=panda_studio/estat-connector

Data source, terms and attribution

  • Source: Portal Site of Official Statistics of Japan (e-Stat), https://www.e-stat.go.jp/
  • The e-Stat terms of use allow commercial use, reproduction, translation and adaptation on condition that the source is credited and any processing is stated. Every row includes an attribution field.
  • Not affiliated with or endorsed by the Statistics Bureau of Japan or e-Stat. No personal data is processed.

FAQ

Do I need an e-Stat API key? Only for Search and Table modes. File mode works without one. The key is free and issued immediately.

Where do I find a file ID? In the CSV download link on an e-Stat table page: the value after statInfId=.

Why is my value a string? File mode keeps the published CSV as is. Table mode gives a numeric value plus the original valueRaw.

What happens with *** or - in the data? In Table mode, value is null and the placeholder is explained in valueNote.

Can I get English labels? Set lang to E. e-Stat returns English labels only for tables that have them.

How big can a download be? Up to 100,000 rows per run (maxRows). The Actor paginates e-Stat automatically.

What if I run it with an empty input? It runs a 20-row demo (population by prefecture) instead of failing.

Changelog

  • 2026-09-24 — Empty input now runs a 20-row key-free demo instead of failing. Respects your maximum cost per run. Default memory lowered to 512 MB. README rewritten with real output and cost examples.
  • 2026-09-23 — Output schema and README added; published on Apify Store.