# FMCSA DOT & MC Trucking Leads Scraper (Insurance Triggers) (`vesper_studio/us-fmcsa-trucking-triggers`) Actor

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.

- **URL**: https://apify.com/vesper_studio/us-fmcsa-trucking-triggers.md
- **Developed by:** [Xavier Richard](https://apify.com/vesper_studio) (community)
- **Categories:** Lead generation, Business, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$15.00 / 1,000 fmcsa trucking trigger leads

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## US FMCSA Trucking Triggers (`us-fmcsa-trucking-triggers`)

Turn 4.5M+ raw U.S. DOT / FMCSA carrier records into **actionable commercial buying triggers** for **commercial truck insurance underwriters, freight factoring brokers, truck leasing/rental fleets, and telematics/ELD vendors**.

Raw scraping of FMCSA pages has zero moat. This Actor's value is the **streaming Polars join + trigger engine** across six official DOT Socrata Open Data feeds (`data.transportation.gov`), with zero proxies and a **512 MB memory footprint**.

***

### Why This Actor? (Commercial Buyer Signals)

| Trigger | How It Is Computed | Target Buyers |
| :--- | :--- | :--- |
| **`insurance_expiring_soon`** | Joins FMCSA L\&I **ActPendInsur** (`qh9u-swkp`) pending cancellation dates (`cancl_effective_date`), **BMC-35** cancellation notices, and **Motus Insur** (`c5y8-a4uz`) 12-month policy anniversaries (`effective_date + 1 yr`) within 15 / 30 / 60 days. | Commercial Truck Insurance Brokers, MGAs, Underwriters |
| **`new_authority_granted`** | Detects active (`status_code = A`) carriers added in the last 30 / 60 / 90 days (`add_date`) joined with **Motus Carrier Authority** (`inys-ebih`) and MC/MX/FF docket status. | Freight Factoring Brokers, Fuel Cards, Startup Insurance, Dispatch/ELD |
| **`fleet_growth`** | Detects **cross-run power unit increases** (`power_units > prev_power_units`) via Apify Key-Value Store snapshots, plus recent MCS-150 updates showing leased tractor expansion or driver hiring surplus. | Truck Leasing & Rental, Factoring Credit Line Expansion, Fleet Insurance |
| **`high_out_of_service_rate`** | Streaming Polars aggregation over **SMS Input Inspections** (`rbkj-cgst`) and **SMS Input Crashes** (`4wxs-vbns`) to flag elevated OOS %, crash rate (`>= 1.5`), or Conditional/Unsatisfactory safety ratings. | Telematics/Dashcam/ELD Vendors, Compliance & Safety SaaS, High-Risk Insurance |

Every output record also includes outreach readiness flags (**`has_email`**, **`has_phone`**, **`has_mc_docket`**), **`target_buyer_segments`**, and a composite **`signal_score` (0–100)**.

***

### Data Architecture (100% Official Socrata API + Streaming Polars)

1. **Server-Side SoQL Pushdown (`data.transportation.gov`)**: Filters by `phy_state`, `status_code`, `power_units::number` (`minPowerUnits` / `maxPowerUnits`), `email_address IS NOT NULL`, `phone`, `docket1`, and date cutoffs *before* downloading — with `max_concurrency=16` Socrata `$group` batch aggregation (~10s for 100 qualified carriers).
2. **Polars Streaming Engine (`engine="streaming"`)**: Ingests CSV slices with explicit string schemas (preserving leading zeros on USDOTs and ZIPs), aggregates millions of inspection/crash history rows per USDOT (including `last_inspection_date` and `last_crash_date`), and joins Census + Insurance + Authority + Safety in <512 MB RAM.
3. **Delta Mode (`onlyNew`) + Cross-Run Fleet Growth**: Stores compact carrier snapshots in a named Key-Value Store (`us-fmcsa-trucking-triggers-state`), skipping unchanged carriers while re-emitting carriers whose operating status, insurance policy, or fleet size changed.
4. **Pay-Per-Event (`carrier-trigger`)**: Batched event charging with strict `maxTotalChargeUsd` enforcement and graceful `ABORTING` flush & checkpointing.

#### Official DOT Open Data Sources Joined

- **Company Census File** (`az4n-8mr2`)
- **ActPendInsur - All With History** (`qh9u-swkp`)
- **Motus Insur - All With History** (`c5y8-a4uz`)
- **Motus Carrier - All With History** (`inys-ebih`)
- **SMS Input - Inspection** (`rbkj-cgst`)
- **SMS Input - Crash** (`4wxs-vbns`)

***

### Example Input

```json
{
    "triggerTypes": [
        "insurance_expiring_soon",
        "new_authority_granted",
        "fleet_growth",
        "high_out_of_service_rate"
    ],
    "states": ["TX", "FL", "IL"],
    "operatingStatuses": ["A"],
    "minPowerUnits": 3,
    "maxPowerUnits": 100,
    "insuranceWindowDays": 60,
    "newAuthorityMaxDays": 60,
    "minOosRatePct": 25,
    "requireEmail": true,
    "onlyNew": true,
    "maxItems": 200
}
```

### Example Output Record

```json
{
    "usdot_number": "4385941",
    "mc_mx_docket": "MC1721253",
    "docket_status": "A",
    "legal_name": "LONESTAR FREIGHT SYSTEMS LLC",
    "operating_status": "A",
    "phy_city": "HOUSTON",
    "phy_state": "TX",
    "phone": "(713) 555-0192",
    "email_address": "dispatch@lonestarfreight.example",
    "has_email": true,
    "has_phone": true,
    "has_mc_docket": true,
    "power_units": 8,
    "total_drivers": 9,
    "fleet_size_tier": "mid_6_25",
    "insurer_name": "BERKSHIRE HATHAWAY DIRECT INSURANCE COMPANY",
    "policy_number": "0073351-01-CA",
    "ins_form_code": "91X",
    "bipd_coverage_usd": 750000,
    "insurance_cancel_date": "2026-12-30",
    "days_until_insurance_event": 47,
    "insurance_trigger_basis": "pending_cancellation",
    "total_inspections": 6,
    "oos_inspections": 2,
    "oos_rate_pct": 33.33,
    "last_inspection_date": "2026-10-18",
    "last_crash_date": null,
    "triggers": ["insurance_expiring_soon", "high_out_of_service_rate"],
    "signal_score": 84,
    "target_buyer_segments": ["truck_insurance", "factoring", "telematics_eld"]
}
```

***

### Local Development & Tests

```bash
python -m venv .venv
.venv/Scripts/pip install -r requirements-dev.txt
.venv/Scripts/pytest -v
```

> **Note on Environment Variables**: `SOCRATA_APP_TOKEN` is optional. DOT Open Data endpoints work anonymously, though setting an app token raises Socrata throttling limits for high-volume `maxItems` runs.

# Actor input Schema

## `triggerTypes` (type: `array`):

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).

## `states` (type: `array`):

Server-side SoQL filter on physical state (phy_state), e.g., \['TX', 'CA', 'FL', 'IL', 'GA']. Leave empty to scan across all US states.

## `operatingStatuses` (type: `array`):

FMCSA Census status_code values pushed down via SoQL: A = Active, I = Inactive, P = Pending.

## `minPowerUnits` (type: `integer`):

Server-side SoQL filter on minimum fleet power units. Use 1 for owner-operators+, 5 for small/mid fleets, 20+ for mid-market fleets.

## `maxPowerUnits` (type: `integer`):

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.

## `newAuthorityMaxDays` (type: `integer`):

Maximum age (in days) of add_date / authority grant date to qualify for the new_authority_granted trigger (30, 60, or 90 days).

## `insuranceWindowDays` (type: `integer`):

Lookahead window (in days) for pending cancellation dates (cancl_effective_date) and 12-month policy renewal anniversaries (e.g., 15, 30, or 60 days).

## `minOosRatePct` (type: `number`):

Minimum vehicle/driver Out-of-Service (OOS) inspection percentage (with at least minInspectionsForOos inspections) to trigger high_out_of_service_rate.

## `minInspectionsForOos` (type: `integer`):

Minimum SMS inspections required before evaluating OOS percentage (avoids noisy 1-for-1 percentages).

## `censusUpdatedSinceDays` (type: `integer`):

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.

## `requireEmail` (type: `boolean`):

Push down email_address IS NOT NULL via SoQL so only carriers ready for immediate email outreach are delivered.

## `requirePhone` (type: `boolean`):

Require at least one phone or cell_phone number for immediate outbound calling.

## `requireMcDocket` (type: `boolean`):

Filter for for-hire carriers holding an active/assigned docket number (MC/MX/FF) rather than private USDOT-only fleets.

## `includeSafetyMetrics` (type: `boolean`):

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.

## `onlyNew` (type: `boolean`):

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.

## `maxItems` (type: `integer`):

Maximum number of carrier trigger leads to emit. Each delivered record bills one 'carrier-trigger' event (within maxTotalChargeUsd).

## Actor input object example

```json
{
  "triggerTypes": [
    "new_authority_granted",
    "insurance_expiring_soon",
    "fleet_growth",
    "high_out_of_service_rate"
  ],
  "states": [
    "TX",
    "FL"
  ],
  "operatingStatuses": [
    "A"
  ],
  "minPowerUnits": 1,
  "maxPowerUnits": 0,
  "newAuthorityMaxDays": 60,
  "insuranceWindowDays": 60,
  "minOosRatePct": 25,
  "minInspectionsForOos": 2,
  "censusUpdatedSinceDays": 0,
  "requireEmail": false,
  "requirePhone": false,
  "requireMcDocket": false,
  "includeSafetyMetrics": true,
  "onlyNew": false,
  "maxItems": 100
}
```

# Actor output Schema

## `triggers` (type: `string`):

Joined FMCSA Census + L\&I/Motus Insurance + SMS Safety records with commercial triggers (new_authority_granted, insurance_expiring_soon, fleet_growth, high_out_of_service_rate), contactability flags (has_email, has_phone), and composite signal_score. Append ?format=csv or ?format=xlsx for CRM import.

## `summary` (type: `string`):

Aggregated counts by trigger type, state distribution, contactability metrics, and billing summary.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "triggerTypes": [
        "new_authority_granted",
        "insurance_expiring_soon",
        "fleet_growth",
        "high_out_of_service_rate"
    ],
    "states": [
        "TX",
        "FL"
    ],
    "operatingStatuses": [
        "A"
    ],
    "minPowerUnits": 1,
    "maxPowerUnits": 0,
    "newAuthorityMaxDays": 60,
    "insuranceWindowDays": 60,
    "minOosRatePct": 25,
    "minInspectionsForOos": 2,
    "censusUpdatedSinceDays": 0,
    "requireEmail": false,
    "requirePhone": false,
    "requireMcDocket": false,
    "includeSafetyMetrics": true,
    "onlyNew": false,
    "maxItems": 100
};

// Run the Actor and wait for it to finish
const run = await client.actor("vesper_studio/us-fmcsa-trucking-triggers").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "triggerTypes": [
        "new_authority_granted",
        "insurance_expiring_soon",
        "fleet_growth",
        "high_out_of_service_rate",
    ],
    "states": [
        "TX",
        "FL",
    ],
    "operatingStatuses": ["A"],
    "minPowerUnits": 1,
    "maxPowerUnits": 0,
    "newAuthorityMaxDays": 60,
    "insuranceWindowDays": 60,
    "minOosRatePct": 25,
    "minInspectionsForOos": 2,
    "censusUpdatedSinceDays": 0,
    "requireEmail": False,
    "requirePhone": False,
    "requireMcDocket": False,
    "includeSafetyMetrics": True,
    "onlyNew": False,
    "maxItems": 100,
}

# Run the Actor and wait for it to finish
run = client.actor("vesper_studio/us-fmcsa-trucking-triggers").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "triggerTypes": [
    "new_authority_granted",
    "insurance_expiring_soon",
    "fleet_growth",
    "high_out_of_service_rate"
  ],
  "states": [
    "TX",
    "FL"
  ],
  "operatingStatuses": [
    "A"
  ],
  "minPowerUnits": 1,
  "maxPowerUnits": 0,
  "newAuthorityMaxDays": 60,
  "insuranceWindowDays": 60,
  "minOosRatePct": 25,
  "minInspectionsForOos": 2,
  "censusUpdatedSinceDays": 0,
  "requireEmail": false,
  "requirePhone": false,
  "requireMcDocket": false,
  "includeSafetyMetrics": true,
  "onlyNew": false,
  "maxItems": 100
}' |
apify call vesper_studio/us-fmcsa-trucking-triggers --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,vesper_studio/us-fmcsa-trucking-triggers"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/yFmfMQiLG7HaBauGa/builds/GzwmMqc3ofpleeoIS/openapi.json
