{
  "openapi": "3.0.1",
  "info": {
    "title": "Japan Government Statistics API (e-Stat)",
    "description": "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.",
    "version": "0.1",
    "x-build-id": "v0SlVPnZodPegiwvb"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/panda_studio~estat-connector/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-panda_studio-estat-connector",
        "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/panda_studio~estat-connector/runs": {
      "post": {
        "operationId": "runs-sync-panda_studio-estat-connector",
        "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/panda_studio~estat-connector/run-sync": {
      "post": {
        "operationId": "run-sync-panda_studio-estat-connector",
        "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",
        "properties": {
          "appId": {
            "title": "e-Stat application ID (appId)",
            "type": "string",
            "description": "Your free e-Stat API key. Register at <a href='https://www.e-stat.go.jp/api/' target='_blank'>e-stat.go.jp/api</a> (ユーザ登録 → マイページ → API機能), it is issued instantly and costs nothing. Required for <b>Search</b> and <b>Table ID</b> modes. <b>Not needed</b> if you only use 'Published file ID' below. Can also be supplied via the ESTAT_APP_ID environment variable."
          },
          "searchWord": {
            "title": "Search keyword (finds tables)",
            "type": "string",
            "description": "Keyword to search e-Stat's table catalogue, e.g. <code>消費者物価指数</code> (consumer price index), <code>人口推計</code> (population estimates). Returns one row per matching table including its <code>statsDataId</code>, which you then feed back in below. Requires appId."
          },
          "statsDataId": {
            "title": "Statistical table ID (statsDataId)",
            "type": "string",
            "description": "Fetch and flatten one statistical table. Get the ID from a Search run, or from an e-Stat table URL. Requires appId. Takes priority over the search keyword."
          },
          "fileId": {
            "title": "Published file ID (statInfId) — no API key needed",
            "type": "string",
            "description": "Download a published e-Stat CSV directly. <b>This mode works without an appId.</b> Find the ID in the CSV download link on any e-Stat table page (<code>file-download?statInfId=<b>000031524010</b></code>). Verified example: <code>000031524010</code> = population by prefecture, 1920 onwards. Takes priority over the two options above."
          },
          "cdArea": {
            "title": "Filter: area codes",
            "type": "array",
            "description": "Restrict to specific area codes, e.g. <code>13000</code> (Tokyo). Leave empty for all areas. Applies to Table ID mode.",
            "items": {
              "type": "string"
            }
          },
          "cdTime": {
            "title": "Filter: time codes",
            "type": "array",
            "description": "Restrict to specific e-Stat time-axis codes, e.g. <code>2020000101</code>. Leave empty for all periods. Applies to Table ID mode.",
            "items": {
              "type": "string"
            }
          },
          "cdCat01": {
            "title": "Filter: category codes (cat01)",
            "type": "array",
            "description": "Restrict to specific category codes of the table's first classification axis. Leave empty for all. Applies to Table ID mode.",
            "items": {
              "type": "string"
            }
          },
          "surveyYears": {
            "title": "Filter: survey years",
            "type": "string",
            "description": "Narrow a search by survey period: <code>2020</code> (year), <code>202001</code> (year+month), or <code>202001-202012</code> (range). Applies to Search mode."
          },
          "maxRows": {
            "title": "Max rows",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "Safety cap on rows returned in one run. Large tables are paginated automatically until this cap is reached.",
            "default": 1000
          },
          "includeTableMeta": {
            "title": "Include table metadata on every row",
            "type": "boolean",
            "description": "Add the table ID, statistic name, table title and publication cycle to each output row. Handy for CSV exports; turn off for a leaner dataset.",
            "default": true
          },
          "lang": {
            "title": "Language",
            "enum": [
              "J",
              "E"
            ],
            "type": "string",
            "description": "Language of labels returned by the e-Stat API.",
            "default": "J"
          },
          "requestIntervalSecs": {
            "title": "Request interval (seconds)",
            "minimum": 1,
            "maximum": 30,
            "type": "integer",
            "description": "Pause between paginated requests to e-Stat. A minimum of 0.5 s is enforced internally to keep the load on the government server polite.",
            "default": 1
          }
        }
      },
      "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
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "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
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}