{
  "openapi": "3.0.1",
  "info": {
    "title": "Ontario Electrical Contractors Scraper - ESA Licence Register",
    "description": "From $4 per 1,000 contractors, no start fee. Ontario's ESA electrical contractor licence register: business phone on 99.7%, cellphone, website, address, coordinates, licence number and status, work types (residential, commercial, HVAC, pole line, high voltage) and penalty or conviction records.",
    "version": "0.1",
    "x-build-id": "KD5uqvluixAnT92xB"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/scrapersdelight~esa-ontario-electrical-contractors-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-scrapersdelight-esa-ontario-electrical-contractors-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/scrapersdelight~esa-ontario-electrical-contractors-scraper/runs": {
      "post": {
        "operationId": "runs-sync-scrapersdelight-esa-ontario-electrical-contractors-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/scrapersdelight~esa-ontario-electrical-contractors-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-scrapersdelight-esa-ontario-electrical-contractors-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": {
          "licenceStatuses": {
            "title": "Licence statuses",
            "type": "array",
            "description": "Which ESA licence statuses to return. Valid = currently licensed to do electrical work for hire in Ontario (10,425 on 2026-09-22). Expired, Closed, Suspended and Revoked are former licensees; Unlicenced follows ESA's own rule (no status or no licence number). Empty = every status.",
            "items": {
              "type": "string",
              "enum": [
                "Valid",
                "Expired",
                "Closed",
                "Suspended",
                "Revoked",
                "Unlicenced"
              ],
              "enumTitles": [
                "Valid (licensed now)",
                "Expired",
                "Closed",
                "Suspended",
                "Revoked",
                "Unlicenced"
              ]
            },
            "default": [
              "Valid"
            ]
          },
          "workTypes": {
            "title": "Work types",
            "type": "array",
            "description": "Keep contractors registered for ANY of these types of electrical work (ESA's own categories, matched the way ESA's locator matches them). Empty = all.",
            "items": {
              "type": "string",
              "enum": [
                "residential",
                "commercial-industrial",
                "pole-line",
                "hvac",
                "high-voltage-substation"
              ],
              "enumTitles": [
                "Residential",
                "Commercial & Industrial",
                "Pole Line",
                "HVAC",
                "High Voltage & Sub Station"
              ]
            },
            "default": []
          },
          "preAuthEligibleOnly": {
            "title": "Pre-authorization eligible only",
            "type": "boolean",
            "description": "Keep only contractors ESA marks Pre-Auth Eligible for at least one work type - they receive pre-authorized service reconnections for certain electrical work.",
            "default": false
          },
          "convictions": {
            "title": "Penalties & convictions",
            "enum": [
              "any",
              "only",
              "exclude"
            ],
            "type": "string",
            "description": "ESA flags contractors that have a penalty or conviction - 11 real contractors on 2026-09-22, only 1 of them still holding a Valid licence. 'only' returns just those, 'exclude' drops them, 'any' ignores the flag. To see all 11, also clear Licence statuses (empty = every status).",
            "default": "any"
          },
          "includeConvictionDetails": {
            "title": "Include penalty & conviction details",
            "type": "boolean",
            "description": "For each flagged contractor you receive, also read the date, offence, action type, fine, licence status at the time and location from their ESA profile page. One extra request per flagged contractor, no extra charge.",
            "default": true
          },
          "cities": {
            "title": "Cities",
            "type": "array",
            "description": "Exact city names as ESA writes them, e.g. Toronto, Mississauga, Ottawa, London, Hamilton. Case is ignored. Note ESA records Scarborough, Etobicoke and North York separately from Toronto. Empty = all.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "nameContains": {
            "title": "Name contains",
            "type": "array",
            "description": "Keep contractors whose business name contains ANY of these words, e.g. solar, EV, generator. Case is ignored. Empty = all.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "licenceNumbers": {
            "title": "Licence numbers",
            "type": "array",
            "description": "Look up specific ESA licence numbers (e.g. 7012635) - useful for verifying a list of contractors. Empty = all.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "requirePhone": {
            "title": "Require a phone number",
            "type": "boolean",
            "description": "Keep only contractors with a business phone or cellphone. 99.7% of licensed contractors have one, so this changes little.",
            "default": false
          },
          "requireWebsite": {
            "title": "Require a website",
            "type": "boolean",
            "description": "Keep only contractors with a usable website (13% of licensed contractors publish one).",
            "default": false
          },
          "maxResults": {
            "title": "Max contractors",
            "minimum": 0,
            "type": "integer",
            "description": "Cap on contractors delivered - and charged. Contractors excluded by your filters are never delivered and never charged. 0 means no cap (all 10,425 licensed contractors, or the whole register if you select every status).",
            "default": 80
          },
          "tryDirectFirst": {
            "title": "Try a direct connection first",
            "type": "boolean",
            "description": "When a proxy is configured below, request the register directly first. Measured on Apify: 14 of 14 direct downloads arrived whole in under a second. Every download is still checked byte for byte and parsed strictly, and any failure falls through to the proxy. Turn off to use only the proxy.",
            "default": true
          },
          "proxyConfiguration": {
            "title": "Proxy",
            "type": "object",
            "description": "Off by default: ESA runs no anti-bot and the register downloads whole over a direct connection (measured 14 of 14 on Apify). Turn on Apify Proxy (e.g. Residential, Canada) only if your direct downloads start failing; it is then used after the direct attempt, or alone if you turn 'Try a direct connection first' off. Every copy is checked against ESA's declared byte count.",
            "default": {
              "useApifyProxy": false
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}