{
  "openapi": "3.0.1",
  "info": {
    "title": "Contractor License Leads (New Licenses and Insurance Renewals)",
    "description": "Newly licensed contractors in Washington, Oregon, Connecticut and New York City, plus Washington and Oregon contractors whose insurance ends soon, with the insurer on file. Read from official state and city open data APIs. Phone numbers where published, one clean schema, only-new mode for schedules.",
    "version": "0.0",
    "x-build-id": "bGOvAG00NPbkha77S"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/benenjoyscoding~contractor-license-leads/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-benenjoyscoding-contractor-license-leads",
        "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/benenjoyscoding~contractor-license-leads/runs": {
      "post": {
        "operationId": "runs-sync-benenjoyscoding-contractor-license-leads",
        "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/benenjoyscoding~contractor-license-leads/run-sync": {
      "post": {
        "operationId": "run-sync-benenjoyscoding-contractor-license-leads",
        "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": {
          "sources": {
            "title": "Sources",
            "type": "array",
            "description": "Which state and city licensing offices to read. Leave empty for all of them.",
            "items": {
              "type": "string",
              "enum": [
                "washington",
                "oregon",
                "connecticut",
                "new-york-city"
              ],
              "enumTitles": [
                "Washington (L&I contractor licenses)",
                "Oregon (Construction Contractors Board)",
                "Connecticut (Department of Consumer Protection)",
                "New York City (home improvement contractors)"
              ]
            }
          },
          "leadTypes": {
            "title": "Lead types",
            "type": "array",
            "description": "New licenses: contractors licensed in the date range. Insurance ending soon: licensed contractors whose insurance on file ends in the next days you choose (Washington and Oregon). Leave empty for new licenses only.",
            "items": {
              "type": "string",
              "enum": [
                "new-license",
                "insurance-expiring"
              ],
              "enumTitles": [
                "New licenses",
                "Insurance ending soon"
              ]
            }
          },
          "daysBack": {
            "title": "New licenses: days back",
            "minimum": 1,
            "maximum": 3650,
            "type": "integer",
            "description": "Contractors licensed in the last this many days, counting today. Ignored when you set an issued-from date.",
            "default": 7
          },
          "issuedFrom": {
            "title": "New licenses: issued from (YYYY-MM-DD)",
            "type": "string",
            "description": "Optional. Start of a fixed date range, inclusive."
          },
          "issuedTo": {
            "title": "New licenses: issued to (YYYY-MM-DD)",
            "type": "string",
            "description": "Optional. End of a fixed date range, inclusive. Defaults to today."
          },
          "expiringWithinDays": {
            "title": "Insurance ending within (days)",
            "minimum": 1,
            "maximum": 365,
            "type": "integer",
            "description": "For insurance leads: insurance that ends between today and this many days from now.",
            "default": 30
          },
          "keywords": {
            "title": "Keywords",
            "type": "array",
            "description": "Keep contractors whose name, license class or specialty contains any of these words, for example roofing, electrical or plumbing.",
            "items": {
              "type": "string"
            }
          },
          "cities": {
            "title": "Cities",
            "type": "array",
            "description": "Keep contractors in these cities only.",
            "items": {
              "type": "string"
            }
          },
          "zipCodes": {
            "title": "ZIP codes",
            "type": "array",
            "description": "Keep contractors in these 5-digit ZIP codes only.",
            "items": {
              "type": "string"
            }
          },
          "counties": {
            "title": "Counties",
            "type": "array",
            "description": "Oregon counties and New York City boroughs. Other sources do not publish a county.",
            "items": {
              "type": "string"
            }
          },
          "requirePhone": {
            "title": "Only contractors with a phone",
            "type": "boolean",
            "description": "Washington, Oregon and New York City publish phones. Connecticut will return nothing when this is on.",
            "default": false
          },
          "onlyNew": {
            "title": "Only new leads (for scheduled runs)",
            "type": "boolean",
            "description": "Remember which leads earlier runs delivered and skip them. Turn this on for a daily or weekly schedule so you only pay for fresh leads.",
            "default": false
          },
          "stateStoreName": {
            "title": "Memory name for only-new mode",
            "type": "string",
            "description": "Use a different name per saved task if you run several schedules with different filters.",
            "default": "contractor-license-leads-state"
          },
          "maxResults": {
            "title": "Max leads per run",
            "minimum": 1,
            "type": "integer",
            "description": "Stop after this many leads in total. You pay per lead.",
            "default": 5000
          },
          "maxResultsPerSource": {
            "title": "Max leads per source",
            "minimum": 1,
            "type": "integer",
            "description": "Stop reading a source after this many leads.",
            "default": 2000
          },
          "socrataAppToken": {
            "title": "Socrata app token (optional)",
            "type": "string",
            "description": "A free app token from any Socrata open data portal raises the request rate. Not needed for normal runs."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}