{
  "openapi": "3.0.1",
  "info": {
    "title": "Texas Contractor Directory & Leads Scraper (TDLR)",
    "description": "Export the TDLR contractor directory by Texas county and license type, or look a contractor up by license number, business or owner name: returns license number, type, expiry, owner, plus address and phone on the license types TDLR publishes them for. $0.002 per record; a no-match is free.",
    "version": "0.0",
    "x-build-id": "oDvPZtVJG9AWutGn9"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/scrapebench~texas-contractor-directory-leads-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-scrapebench-texas-contractor-directory-leads-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/scrapebench~texas-contractor-directory-leads-scraper/runs": {
      "post": {
        "operationId": "runs-sync-scrapebench-texas-contractor-directory-leads-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/scrapebench~texas-contractor-directory-leads-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-scrapebench-texas-contractor-directory-leads-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": {
          "mode": {
            "title": "Mode",
            "enum": [
              "auto",
              "lookup",
              "export"
            ],
            "type": "string",
            "description": "auto (default): licence numbers or names below run a lookup; a county alone runs the county directory; any export filter (licence types, city, ZIP, expiry, exclude expired) runs the statewide export. lookup: names / numbers only. export: the statewide export, names ignored.",
            "default": "auto"
          },
          "county": {
            "title": "County",
            "minLength": 1,
            "type": "string",
            "description": "Texas county name to browse (e.g. TRAVIS, 'Harris County', DALLAS). Case, spacing and a trailing 'County' do not matter. If it is missing or is not a Texas county, the run returns the free county list instead of failing, so you can see the exact names."
          },
          "counties": {
            "title": "County (batch)",
            "type": "array",
            "description": "Prefer this over `county`: several Texas counties in ONE run instead of a run per county. Combined with `county` if you fill both, and duplicates are removed. You are charged per record returned, not per county submitted.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "licenseType": {
            "title": "License type filter",
            "type": "string",
            "description": "Optional substring filter on TDLR's license-type text, e.g. 'Electrical Contractor', 'A/C Contractor', 'Establishment'. For phone numbers and addresses pick a company type: 'Electrical Contractor', 'Appliance Installation Contractor', 'Water Well Driller', 'Full Service Establishment' and ~35 others carry them on effectively every row. Individually held licences (A/C Contractor, A/C Technician, electrician grades) return those columns null. Blank = every type."
          },
          "maxResults": {
            "title": "Maximum results",
            "minimum": 1,
            "maximum": 250000,
            "type": "integer",
            "description": "Cap on the number of records returned PER ENTRY, not per run, so a batch cannot silently return only the first 500 rows overall and read as 'the rest don't exist'. Every record returned is billed. Raise it to pull an entire county roster (the biggest, Harris, holds 160,000+ rows across all trades). Unset: 500 per county or per export run; 50 per lookup value."
          },
          "query": {
            "title": "Search query",
            "minLength": 1,
            "type": "string",
            "description": "A Texas TDLR license number, business name, or owner name. Searches all three: exact license number, business-name substring, and owner-name substring — results are unioned and deduped by license #. TDLR keeps owner and business as separate columns and they disagree on 19,000+ of its 900,000+ records, so an owner search finds people a business-name search cannot. Leave this and the batch list empty to run a statewide export by licence type instead (see the statewide fields below)."
          },
          "queries": {
            "title": "Search query (batch)",
            "type": "array",
            "description": "Prefer this over `query`: look up many in ONE run instead of starting a run per lookup. Each entry is a TDLR license number, business name or owner name. Combined with `query` if you fill both, and duplicates are removed. You are charged per record returned, not per entry submitted.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "licenseTypes": {
            "title": "Licence types (statewide export, list)",
            "type": "array",
            "description": "Several TDLR licence types in one export. Combined with 'Licence type'. Note: TDLR publishes address, city, ZIP and phone only for company/establishment types — Electrical Contractor, Appliance Installation Contractor, Electrical Sign Contractor and Elevator Contractor have them on ~99.8% of rows; A/C Contractor and every individually held licence (A/C Technician, Master Electrician, ...) have none.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "city": {
            "title": "City (statewide export)",
            "type": "string",
            "description": "Statewide mode only: keep licences whose business city is this, e.g. 'Austin'. Only company/establishment types carry a city, so A/C Contractor rows never match."
          },
          "cities": {
            "title": "Cities (statewide export, list)",
            "type": "array",
            "description": "Statewide mode only: several cities (OR). Combined with 'City'.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "zip": {
            "title": "ZIP (statewide export)",
            "type": "string",
            "description": "Statewide mode only: 5-digit business ZIP, e.g. '78701'. Same coverage caveat as City."
          },
          "zips": {
            "title": "ZIPs (statewide export, list)",
            "type": "array",
            "description": "Statewide mode only: several ZIPs (OR). Combined with 'ZIP'. Values that are not 5 digits are dropped with a log line.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "excludeExpired": {
            "title": "Exclude expired licences",
            "type": "boolean",
            "description": "Statewide mode only: keep only licences whose expiration date is today or later. TDLR publishes no status column, so expiry is the only currency signal."
          },
          "expiresAfter": {
            "title": "Expires on or after (YYYY-MM-DD)",
            "type": "string",
            "description": "Statewide mode only: keep licences expiring on or after this date."
          },
          "expiresBefore": {
            "title": "Expires on or before (YYYY-MM-DD)",
            "type": "string",
            "description": "Statewide mode only: keep licences expiring on or before this date — with 'Expires on or after' this gives a renewal-window list."
          },
          "extraRegisters": {
            "title": "Extra Texas registers (opt-in)",
            "type": "array",
            "description": "Opt-in, empty by default (the run is then the TDLR run described here). 'fire' adds Texas State Fire Marshal fire alarm, sprinkler, extinguisher and fireworks companies (~3,150, phone ~98%, no e-mail). 'dallas' adds the City of Dallas contractor register (current licences, phone, e-mail). Queries search them; with none, they are exported (City, ZIP, Maximum results apply). Alone, only they are read; add Mode lookup or export, a county or licence types to read TDLR too.",
            "items": {
              "type": "string",
              "enum": [
                "fire",
                "dallas"
              ]
            },
            "default": []
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Optional. The Texas TDLR open-data API is reachable directly; a proxy is not needed.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}