{
  "openapi": "3.0.1",
  "info": {
    "title": "Polish REGON Scraper - GUS Business Registry (no API key)",
    "description": "Scrape Poland's REGON (GUS) registry anonymously: look up by NIP/REGON/KRS, discover companies by address + PKD, and get local units (jednostki lokalne) as separate rows. No API key required.",
    "version": "1.0",
    "x-build-id": "LPDzCfJLJzIoxg9YL"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/regdata~polish-regon-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-regdata-polish-regon-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/regdata~polish-regon-scraper/runs": {
      "post": {
        "operationId": "runs-sync-regdata-polish-regon-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/regdata~polish-regon-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-regdata-polish-regon-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",
        "properties": {
          "searchMode": {
            "title": "Search mode",
            "enum": [
              "byAddress",
              "nip",
              "regon",
              "krs"
            ],
            "type": "string",
            "description": "How to search: discover all entities at an address (with optional PKD), or look up specific NIP / REGON / KRS numbers.",
            "default": "byAddress"
          },
          "identifiers": {
            "title": "Identifiers (NIP / REGON / KRS)",
            "type": "array",
            "description": "List of identifiers to look up. Only used when search mode is nip / regon / krs.",
            "items": {
              "type": "string"
            }
          },
          "voivodeship": {
            "title": "Województwo (voivodeship)",
            "type": "string",
            "description": "Region name (e.g. \"Łódzkie\") or TERYT code. Required for address search. Diacritics optional."
          },
          "county": {
            "title": "Powiat (county)",
            "type": "string",
            "description": "County name or TERYT code within the voivodeship."
          },
          "municipality": {
            "title": "Gmina (municipality)",
            "type": "string",
            "description": "Municipality name or TERYT code within the county."
          },
          "city": {
            "title": "Miejscowość (city)",
            "type": "string",
            "description": "City/town name or TERYT code within the municipality."
          },
          "street": {
            "title": "Ulica (street, optional)",
            "type": "string",
            "description": "Optional street name or code to narrow the address search."
          },
          "nameFragment": {
            "title": "Name fragment (optional)",
            "type": "string",
            "description": "Optional company-name fragment filter for address search."
          },
          "pkd": {
            "title": "PKD code (optional)",
            "type": "string",
            "description": "Optional PKD activity code to filter the address search server-side (e.g. \"62.01.Z\")."
          },
          "pkdSections": {
            "title": "Filter - PKD sections (A-U)",
            "type": "array",
            "description": "Keep only records with a PKD code in these PKD 2007 sections. C=Manufacturing, G=Trade, H=Transport, etc. Requires fetchPkd.",
            "items": {
              "type": "string"
            }
          },
          "pkdCodes": {
            "title": "Filter - PKD code prefixes",
            "type": "array",
            "description": "Keep only records whose PKD code starts with one of these (e.g. \"10\", \"62.01\"). Requires fetchPkd.",
            "items": {
              "type": "string"
            }
          },
          "pkdMatch": {
            "title": "PKD match mode",
            "enum": [
              "any",
              "main"
            ],
            "type": "string",
            "description": "'main' = only the main (przeważająca) PKD must match; 'any' = any reported PKD may match.",
            "default": "any"
          },
          "legalForms": {
            "title": "Filter - legal form",
            "type": "array",
            "description": "Keep only entities whose legal form contains one of these phrases (e.g. \"spółka z ograniczoną\", \"spółka akcyjna\").",
            "items": {
              "type": "string"
            }
          },
          "fetchFullReport": {
            "title": "Fetch full report",
            "type": "boolean",
            "description": "Fetch each entity's full REGON report (legal form, ownership, dates, contact, full address). Adds one request per record.",
            "default": true
          },
          "fetchPkd": {
            "title": "Fetch PKD codes",
            "type": "boolean",
            "description": "Additionally fetch each entity's PKD activity codes (main + secondary).",
            "default": true
          },
          "includeLocalUnits": {
            "title": "Include local units (jednostki lokalne)",
            "type": "boolean",
            "description": "Include local units as separate rows (recordType=LOCAL_UNIT, with parentRegon). Address search returns these natively; identifier search expands them.",
            "default": true
          },
          "maxResults": {
            "title": "Max results",
            "minimum": 0,
            "type": "integer",
            "description": "Maximum records to emit (0 = unlimited). Bounds cost on large regions.",
            "default": 0
          },
          "minIntervalMs": {
            "title": "Min interval between requests (ms)",
            "minimum": 0,
            "type": "integer",
            "description": "Politeness delay between requests. The site allows ~3/s; keep >= 350ms to avoid the conditional CAPTCHA.",
            "default": 350
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Proxy settings. Residential PL proxies recommended for large/volume runs to avoid the conditional CAPTCHA.",
            "default": {
              "useApifyProxy": true
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}