{
  "openapi": "3.0.1",
  "info": {
    "title": "FMCSA DOT & MC Trucking Leads Scraper (Insurance Triggers)",
    "description": "Stream and join 6 official US FMCSA Socrata open datasets (Company Census, L&I Insurance, Authority, SMS Inspections & Crashes) via Polars. Emits high-intent commercial triggers: expiring insurance, new DOT/MC authority, fleet growth & high OOS rates for insurers, factoring & telematics.",
    "version": "1.0",
    "x-build-id": "GzwmMqc3ofpleeoIS"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/vesper_studio~us-fmcsa-trucking-triggers/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-vesper_studio-us-fmcsa-trucking-triggers",
        "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/vesper_studio~us-fmcsa-trucking-triggers/runs": {
      "post": {
        "operationId": "runs-sync-vesper_studio-us-fmcsa-trucking-triggers",
        "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/vesper_studio~us-fmcsa-trucking-triggers/run-sync": {
      "post": {
        "operationId": "run-sync-vesper_studio-us-fmcsa-trucking-triggers",
        "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": {
          "triggerTypes": {
            "title": "Commercial triggers to detect",
            "type": "array",
            "description": "Select which commercial trigger signals to detect and emit. Leave all selected for full multi-signal scoring, or focus on specific triggers (e.g., insurance_expiring_soon for insurance brokers, new_authority_granted for factoring).",
            "items": {
              "type": "string",
              "enum": [
                "new_authority_granted",
                "insurance_expiring_soon",
                "fleet_growth",
                "high_out_of_service_rate"
              ],
              "enumTitles": [
                "New MC/DOT Authority Granted (<30/60/90 days)",
                "Insurance Expiring / Pending Cancellation (<15/30/60 days)",
                "Fleet Growth / Expansion (Delta Power Units or Recent MCS-150)",
                "High Out-of-Service (OOS) / Crash Risk Rate"
              ]
            },
            "default": [
              "new_authority_granted",
              "insurance_expiring_soon",
              "fleet_growth",
              "high_out_of_service_rate"
            ]
          },
          "states": {
            "title": "Target US/CA States (2-letter codes)",
            "type": "array",
            "description": "Server-side SoQL filter on physical state (phy_state), e.g., ['TX', 'CA', 'FL', 'IL', 'GA']. Leave empty to scan across all US states.",
            "items": {
              "type": "string"
            },
            "default": []
          },
          "operatingStatuses": {
            "title": "Carrier operating statuses",
            "type": "array",
            "description": "FMCSA Census status_code values pushed down via SoQL: A = Active, I = Inactive, P = Pending.",
            "items": {
              "type": "string",
              "enum": [
                "A",
                "P",
                "I"
              ],
              "enumTitles": [
                "Active (A)",
                "Pending (P)",
                "Inactive (I)"
              ]
            },
            "default": [
              "A"
            ]
          },
          "minPowerUnits": {
            "title": "Minimum power units (trucks/tractors)",
            "minimum": 0,
            "maximum": 100000,
            "type": "integer",
            "description": "Server-side SoQL filter on minimum fleet power units. Use 1 for owner-operators+, 5 for small/mid fleets, 20+ for mid-market fleets.",
            "default": 1
          },
          "maxPowerUnits": {
            "title": "Maximum power units (0 = unlimited)",
            "minimum": 0,
            "maximum": 1000000,
            "type": "integer",
            "description": "Optional upper bound on fleet power units (useful to exclude mega-fleets and target SMB carriers, e.g., 50 or 100). Set 0 for no upper limit.",
            "default": 0
          },
          "newAuthorityMaxDays": {
            "title": "New authority lookback window (days)",
            "minimum": 7,
            "maximum": 365,
            "type": "integer",
            "description": "Maximum age (in days) of add_date / authority grant date to qualify for the new_authority_granted trigger (30, 60, or 90 days).",
            "default": 60
          },
          "insuranceWindowDays": {
            "title": "Insurance expiration/renewal horizon (days)",
            "minimum": 7,
            "maximum": 180,
            "type": "integer",
            "description": "Lookahead window (in days) for pending cancellation dates (cancl_effective_date) and 12-month policy renewal anniversaries (e.g., 15, 30, or 60 days).",
            "default": 60
          },
          "minOosRatePct": {
            "title": "High OOS rate threshold (%)",
            "minimum": 1,
            "maximum": 100,
            "type": "number",
            "description": "Minimum vehicle/driver Out-of-Service (OOS) inspection percentage (with at least minInspectionsForOos inspections) to trigger high_out_of_service_rate.",
            "default": 25
          },
          "minInspectionsForOos": {
            "title": "Minimum inspections for OOS trigger",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "Minimum SMS inspections required before evaluating OOS percentage (avoids noisy 1-for-1 percentages).",
            "default": 2
          },
          "censusUpdatedSinceDays": {
            "title": "Census add/MCS-150 update lookback (days, 0 = auto)",
            "minimum": 0,
            "maximum": 1095,
            "type": "integer",
            "description": "Optional SoQL filter restricting Census rows to add_date or mcs150_date within the last N days. Leave 0 to auto-optimize based on selected triggers.",
            "default": 0
          },
          "requireEmail": {
            "title": "Require email address (has_email)",
            "type": "boolean",
            "description": "Push down email_address IS NOT NULL via SoQL so only carriers ready for immediate email outreach are delivered.",
            "default": false
          },
          "requirePhone": {
            "title": "Require phone number (has_phone)",
            "type": "boolean",
            "description": "Require at least one phone or cell_phone number for immediate outbound calling.",
            "default": false
          },
          "requireMcDocket": {
            "title": "Require MC/MX/FF Docket Authority",
            "type": "boolean",
            "description": "Filter for for-hire carriers holding an active/assigned docket number (MC/MX/FF) rather than private USDOT-only fleets.",
            "default": false
          },
          "includeSafetyMetrics": {
            "title": "Join SMS Inspections & Crashes",
            "type": "boolean",
            "description": "Join FMCSA SMS Input Inspection (rbkj-cgst) and Crash (4wxs-vbns) datasets via Polars for candidate USDOTs. Automatically enabled when high_out_of_service_rate is selected.",
            "default": true
          },
          "onlyNew": {
            "title": "Delta mode (onlyNew / changed carriers)",
            "type": "boolean",
            "description": "Use named Apify Key-Value Store ('us-fmcsa-trucking-triggers-state') to skip previously delivered carriers whose status, fleet size, and insurance policy have not changed, while detecting cross-run fleet_growth.",
            "default": false
          },
          "maxItems": {
            "title": "Maximum carrier trigger records",
            "minimum": 1,
            "maximum": 25000,
            "type": "integer",
            "description": "Maximum number of carrier trigger leads to emit. Each delivered record bills one 'carrier-trigger' event (within maxTotalChargeUsd).",
            "default": 100
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}