{
  "openapi": "3.0.1",
  "info": {
    "title": "REGON Scraper - Polish Business Registry (GUS)",
    "description": "Extract business data from Poland's REGON registry (GUS). Look up companies by NIP, REGON, KRS, or discover entities by address. Returns company name, REGON, NIP, legal form, address, PKD codes, and registration dates. Great for B2B leads, KYB compliance, and business intelligence.",
    "version": "2.0",
    "x-build-id": "N4fQPaleZXh1JaXSF"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/trev0n~regon-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-trev0n-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/trev0n~regon-scraper/runs": {
      "post": {
        "operationId": "runs-sync-trev0n-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/trev0n~regon-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-trev0n-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": [
              "nip",
              "regon",
              "krs",
              "byAddress"
            ],
            "type": "string",
            "description": "How to search: by NIP, REGON, KRS number, or by address to discover all entities in a given location.",
            "default": "byAddress"
          },
          "identifiers": {
            "title": "Identifiers",
            "type": "array",
            "description": "List of NIP, REGON, or KRS numbers to look up (one per line). Not needed for address search mode.",
            "items": {
              "type": "string"
            },
            "default": [
              "5261040567"
            ]
          },
          "voivodeship": {
            "title": "Województwo (Voivodeship)",
            "enum": [
              "DOLNOŚLĄSKIE",
              "KUJAWSKO-POMORSKIE",
              "LUBELSKIE",
              "LUBUSKIE",
              "ŁÓDZKIE",
              "MAŁOPOLSKIE",
              "MAZOWIECKIE",
              "OPOLSKIE",
              "PODKARPACKIE",
              "PODLASKIE",
              "POMORSKIE",
              "ŚLĄSKIE",
              "ŚWIĘTOKRZYSKIE",
              "WARMIŃSKO-MAZURSKIE",
              "WIELKOPOLSKIE",
              "ZACHODNIOPOMORSKIE"
            ],
            "type": "string",
            "description": "Province to search in. Required for address search mode.",
            "default": "MAZOWIECKIE"
          },
          "county": {
            "title": "Powiat (County)",
            "type": "string",
            "description": "County within the selected voivodeship. Required for address search mode. Must match the exact name from the GUS dropdown.",
            "default": "warszawski zachodni"
          },
          "municipality": {
            "title": "Gmina (Municipality)",
            "type": "string",
            "description": "Municipality within the selected county. Required for address search mode. Must match the exact name from the GUS dropdown.",
            "default": "Łomianki"
          },
          "city": {
            "title": "Miejscowość (City)",
            "type": "string",
            "description": "City or town within the selected municipality. Required for address search mode. Must match the exact name from the GUS dropdown.",
            "default": "Łomianki"
          },
          "street": {
            "title": "Ulica (Street)",
            "type": "string",
            "description": "Optional street name to narrow down address search results."
          },
          "nameFragment": {
            "title": "Name Fragment",
            "type": "string",
            "description": "Optional text to filter results by company name (partial match)."
          },
          "fetchFullReport": {
            "title": "Fetch Full Report",
            "type": "boolean",
            "description": "Click into the detail page for each entity to extract extended data (address, legal form, registration dates, PKD codes, contact info).",
            "default": true
          },
          "fetchPkd": {
            "title": "Fetch PKD Codes",
            "type": "boolean",
            "description": "Additionally extract PKD (business activity classification) codes from the detail page.",
            "default": true
          },
          "includeBranches": {
            "title": "Include Branch Addresses (Jednostki Lokalne)",
            "type": "boolean",
            "description": "For every legal person matched, additionally fetch its registered local units (oddziały) and emit each as a separate record with recordType=BRANCH and parentRegon set to the HQ. Significantly increases run time — each branch costs one extra detail-page click.",
            "default": false
          },
          "legalFormFilter": {
            "title": "Filter — Legal Form (Forma Prawna)",
            "type": "array",
            "description": "Optional. Keep only entities whose detailed or basic legal form contains one of these phrases (case-insensitive substring match). Example: 'spółka z ograniczoną odpowiedzialnością', 'spółka akcyjna'. Leave empty to disable.",
            "items": {
              "type": "string"
            }
          },
          "pkdSectionFilter": {
            "title": "Filter — PKD Section (A–U)",
            "type": "array",
            "description": "Optional. Keep only entities whose PKD code falls into one of these PKD 2007 sections (single letters). Common: A=Agriculture, C=Manufacturing, F=Construction, G=Trade, H=Transport, I=Hospitality, J=ICT, K=Finance, M=Professional, N=Admin services, P=Education, Q=Health. Requires fetchPkd=true.",
            "items": {
              "type": "string"
            }
          },
          "pkdSectionMatch": {
            "title": "PKD Section Match Mode",
            "enum": [
              "any",
              "main"
            ],
            "type": "string",
            "description": "How to evaluate pkdSectionFilter: 'main' = only the main (przeważająca) PKD must match; 'any' = any reported PKD may match.",
            "default": "any"
          },
          "maxResults": {
            "title": "Max Results",
            "minimum": 0,
            "type": "integer",
            "description": "Maximum number of results to extract (0 = unlimited).",
            "default": 0
          },
          "maxConcurrency": {
            "title": "Max Concurrency",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "Maximum number of concurrent browser pages. Keep low (1-3) to avoid CAPTCHA on the GUS website.",
            "default": 3
          },
          "requestsPerProxy": {
            "title": "Requests Per Proxy IP",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "How many requests to make before rotating to a new proxy IP. Lower values reduce CAPTCHA risk but use more proxy traffic.",
            "default": 15
          },
          "proxyConfiguration": {
            "title": "Proxy Configuration",
            "type": "object",
            "description": "Proxy settings. Residential proxies are strongly recommended to avoid 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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}