{
  "openapi": "3.0.1",
  "info": {
    "title": "China Administrative Division Codes API (行政区划代码)",
    "description": "Official PRC administrative division codes (行政区划代码, MCA) for 34 provinces, 333 prefectures, 2,847 counties and 38,699 townships. Look up and validate codes, search by Chinese or pinyin, list children or export with English names. No proxy, no personal data.",
    "version": "0.1",
    "x-build-id": "5IvMwXeaP6QGsgO6S"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/awake_froghopper~china-administrative-divisions/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-awake_froghopper-china-administrative-divisions",
        "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/awake_froghopper~china-administrative-divisions/runs": {
      "post": {
        "operationId": "runs-sync-awake_froghopper-china-administrative-divisions",
        "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/awake_froghopper~china-administrative-divisions/run-sync": {
      "post": {
        "operationId": "run-sync-awake_froghopper-china-administrative-divisions",
        "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": {
          "operation": {
            "title": "Operation",
            "enum": [
              "lookup",
              "search",
              "children",
              "list",
              "stats"
            ],
            "type": "string",
            "description": "lookup = look up / validate codes (6-digit county+ codes, 9-digit township codes, 2/4-digit prefixes or 12-digit NBS-style codes); search = find divisions by Chinese name or pinyin; children = direct (or all) sub-divisions of a code; list = export a whole level, optionally inside one province/city; stats = counts per level and type.",
            "default": "lookup"
          },
          "codes": {
            "title": "Codes (lookup)",
            "type": "array",
            "description": "Administrative division codes, up to 1000 per run, e.g. 110105 (Chaoyang District, Beijing), 440106 (Tianhe District, Guangzhou), 441900003 (a township). Unknown and abolished codes come back with a status instead of failing the run.",
            "default": [
              "440106",
              "500157",
              "500105"
            ],
            "items": {
              "type": "string"
            }
          },
          "query": {
            "title": "Search text (search)",
            "type": "string",
            "description": "Chinese name (朝阳, 天河区) or toneless pinyin (chaoyang, tianhe). Exact matches rank first."
          },
          "limit": {
            "title": "Max search results (search)",
            "minimum": 1,
            "maximum": 200,
            "type": "integer",
            "description": "1-200. Each returned row is one billed result.",
            "default": 20
          },
          "code": {
            "title": "Parent code (children)",
            "type": "string",
            "description": "Code whose sub-divisions you want, e.g. 440000 (Guangdong) or 440100 (Guangzhou). Leave empty for the 34 provinces."
          },
          "recursive": {
            "title": "Include all descendants (children)",
            "type": "boolean",
            "description": "If true, returns the whole subtree (limited by maxLevel and maxResults), not only direct children.",
            "default": false
          },
          "maxLevel": {
            "title": "Deepest level (children)",
            "minimum": 1,
            "maximum": 4,
            "type": "integer",
            "description": "1 = province, 2 = prefecture, 3 = county, 4 = township.",
            "default": 4
          },
          "levels": {
            "title": "Levels (search / list)",
            "type": "array",
            "description": "Restrict to these levels: province, prefecture, county, township. Empty = all levels.",
            "items": {
              "type": "string"
            }
          },
          "within": {
            "title": "Inside division (search / list)",
            "type": "string",
            "description": "Only return divisions inside this code, e.g. 440000 for Guangdong."
          },
          "maxResults": {
            "title": "Max results (children / list)",
            "minimum": 1,
            "maximum": 50000,
            "type": "integer",
            "description": "Safety cap; each row is one billed result. The whole dataset is 41,913 rows.",
            "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
                  },
                  "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}