{
  "openapi": "3.0.1",
  "info": {
    "title": "Zefix Company Register Scraper (Switzerland: Zefix, SHAB)",
    "description": "Search the Zefix federal commercial register by company name, or pull newly published SHAB commercial register notices (new registrations, mutations, deletions) from amtsblattportal.ch.",
    "version": "0.2",
    "x-build-id": "e5KXhOBOKMOn4lwJr"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/swissalpinedata~swiss-company-register-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-swissalpinedata-swiss-company-register-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/swissalpinedata~swiss-company-register-scraper/runs": {
      "post": {
        "operationId": "runs-sync-swissalpinedata-swiss-company-register-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/swissalpinedata~swiss-company-register-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-swissalpinedata-swiss-company-register-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",
        "required": [
          "mode"
        ],
        "properties": {
          "mode": {
            "title": "Mode",
            "enum": [
              "new-companies",
              "search"
            ],
            "type": "string",
            "description": "Search Zefix (the federal commercial register index) by company name, or list commercial register notices (new registrations, mutations, deletions) published in SHAB via amtsblattportal.ch for a date range.",
            "default": "new-companies"
          },
          "name": {
            "title": "Company name (search mode)",
            "type": "string",
            "description": "Company name or part of it to look up in Zefix. Required in search mode, ignored in new-companies mode. Zefix returns at most 2000 matches per search."
          },
          "legalForms": {
            "title": "Legal forms (search mode)",
            "type": "array",
            "description": "Optional legal form filter for the Zefix search. Leave empty for all legal forms.",
            "items": {
              "type": "string",
              "enum": [
                "1",
                "2",
                "3",
                "4",
                "5",
                "6",
                "7",
                "8",
                "9",
                "10",
                "11",
                "12"
              ],
              "enumTitles": [
                "Einzelunternehmen (sole proprietorship)",
                "Kollektivgesellschaft (general partnership)",
                "Aktiengesellschaft (AG, SA)",
                "GmbH (Sarl, Sagl)",
                "Genossenschaft (cooperative)",
                "Verein (association)",
                "Stiftung (foundation)",
                "Institut des oeffentlichen Rechts (public law institution)",
                "Zweigniederlassung (branch of a Swiss company)",
                "Kommanditgesellschaft (limited partnership)",
                "Zweigniederlassung einer ausl. Gesellschaft (branch of a foreign company)",
                "Kommanditaktiengesellschaft"
              ]
            },
            "default": []
          },
          "activeOnly": {
            "title": "Active companies only (search mode)",
            "type": "boolean",
            "description": "Only return companies that still exist in the register. Untick to include deleted companies (status geloescht).",
            "default": true
          },
          "subRubrics": {
            "title": "Publication types (new-companies mode)",
            "type": "array",
            "description": "Which SHAB commercial register notices to return. HR01 = new registration, HR02 = mutation (change), HR03 = deletion.",
            "items": {
              "type": "string",
              "enum": [
                "HR01",
                "HR02",
                "HR03"
              ],
              "enumTitles": [
                "HR01 New registration",
                "HR02 Mutation",
                "HR03 Deletion"
              ]
            },
            "default": [
              "HR01"
            ]
          },
          "cantons": {
            "title": "Cantons",
            "type": "array",
            "description": "Optional list of 2-letter canton codes (ZH, BE, GE, VD, ...). Applies to both modes. Leave empty for all of Switzerland.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "dateFrom": {
            "title": "Date from (new-companies mode)",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
            "type": "string",
            "description": "Start of the publication date range, format YYYY-MM-DD. Defaults to 7 days before today."
          },
          "dateTo": {
            "title": "Date to (new-companies mode)",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
            "type": "string",
            "description": "End of the publication date range, format YYYY-MM-DD. Defaults to today."
          },
          "fetchDetails": {
            "title": "Fetch details",
            "type": "boolean",
            "description": "Search mode: fetch the Zefix detail record for each company (address, purpose). New-companies mode: fetch and parse the publication XML for each notice (company name, UID, seat, legal form, address, purpose, capital, persons, full text). One extra request per record, so slower but much richer.",
            "default": true
          },
          "maxItems": {
            "title": "Max items",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Maximum number of records to output, at most 5000 per run. You pay per record, so this also caps the cost of a run.",
            "default": 100
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "amtsblattportal.ch (new-companies mode) blocks direct connections from the Apify platform's IP range, so a proxy is needed there; the default Apify datacenter proxy works. Zefix (search mode) works with or without a proxy.",
            "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
                  },
                  "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}