# BTS Border Crossing Traffic Data Monitor (`defenestrator/bts-border-crossings-monitor`) Actor

Fetch U.S. BTS/DOT border-crossing volume rows from the official Socrata dataset. Unofficial and not affiliated with BTS or DOT.

- **URL**: https://apify.com/defenestrator/bts-border-crossings-monitor.md
- **Developed by:** [Defenestrator](https://apify.com/defenestrator) (community)
- **Categories:** Business, News
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 bts border crossing rows

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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## BTS Border Crossings Monitor

Fetches inbound land-border crossing statistics from the U.S. Bureau of Transportation Statistics (BTS) Socrata open-data portal and outputs one structured dataset row per source record, filtered by border, measure, state, port name, date range, and a configurable row limit.

This Actor is intended for trade-activity monitoring, logistics trend analysis, border-congestion research, economic dashboards, and alerting workflows that need source-linked rows from the BTS Border Crossing Entry Data without manually querying the Socrata API.

### Source

- BTS / DOT Socrata dataset: https://data.bts.gov/id/keg4-3bc2
- Direct JSON API: https://data.transportation.gov/resource/keg4-3bc2.json
- The dataset covers inbound crossings at U.S.-Canada and U.S.-Mexico land-border ports for trucks, trains, containers, buses, vehicles, passengers, and pedestrians.

Cloud source canary: 10 rows returned from Apify Cloud; sample `Columbus — Personal Vehicle Passengers`, sample key `2406@2026-05-01T00:00:00.000`, sample value `80444`.

### Inputs

| Parameter | Type | Default | Description |
| --- | --- | --- | --- |
| `maxItems` | integer | `100` | Maximum rows to return. Min 1, max 1000. |
| `border` | string | `all` | Filter by border. Accepted values: `all`, `US-Canada Border`, `US-Mexico Border`. |
| `measure` | string | empty | Filter by crossing measure. Examples: `Trucks`, `Personal Vehicles`, `Personal Vehicle Passengers`, `Truck Containers Loaded`, `Pedestrians`, `Bus Passengers`. |
| `state` | string | empty | Case-insensitive exact match on state name. |
| `portName` | string | empty | Case-insensitive substring match on port name. |
| `startDate` | string (ISO date) | empty | Inclusive start date, `YYYY-MM-DD`. |
| `endDate` | string (ISO date) | empty | Inclusive end date, `YYYY-MM-DD`. |
| `includeRaw` | boolean | `false` | When true, include the full raw Socrata row in the output under the `raw` field. |

### Output Fields

Each dataset item corresponds to one filtered BTS source record:

- `portName`
- `state`
- `portCode`
- `border`
- `date`
- `measure`
- `value` — numeric, parsed from the source when possible
- `latitude`
- `longitude`
- `sourceUrl`
- `raw` — only present when `includeRaw=true`
- `collectedAt` — ISO-8601 UTC timestamp

### Use Cases

- Monitor monthly/annual border-crossing volumes by border, state, or specific port.
- Track trends in truck container loads for supply-chain capacity planning.
- Identify congestion or volume anomalies at individual border ports.
- Feed economic dashboards that need public, source-linked border-trade statistics.
- Feed a downstream alerting workflow when a port's crossing value drops below or exceeds a threshold.

### Limitations

- The Actor uses the Socrata `$limit` parameter; it does **not** paginate beyond `maxItems`. Larger data sets require manual re-runs with different date ranges or filters.
- The BTS Socrata portal redirect (`data.transportation.gov` -> `data.bts.gov`) may change without notice.
- BTS periodically revises historical data; past snapshots in the Actor output may differ from what the live portal shows today.
- Measure name values, state names, and port names may evolve as BTS updates the catalog.
- Date values in the source use the format `YYYY-MM-DDTHH:MM:SS.sss`; the Actor outputs them as-is.
- The raw Socrata response may include additional metadata fields (e.g., `: @computed_region_*`) that are not mapped in the output schema.
- Rate limits on the Socrata API are not enforced by the Actor; large `maxItems` values or rapid re-runs could trigger throttling.

### Disclaimers

This Actor is **unofficial** and is **not affiliated with, endorsed by, or connected to** the U.S. Bureau of Transportation Statistics (BTS), the U.S. Department of Transportation (DOT), the U.S. Customs and Border Protection (CBP), or any other government agency.

The data provided is public statistics only. Public BTS data may lag behind the latest official figures, may be revised after initial publication, and may not reflect the most current border-crossing volumes. Users should **verify important decisions against the official BTS source** before relying on this data for any material purpose.

This Actor does **not** provide trade, legal, regulatory, or compliance advice. Nothing in the output constitutes legal, financial, or business guidance.

### Pricing

**From $1.00 per 1,000 BTS rows**, plus the `$0.00005` Actor-start event.

Pay per event: one dataset-row event per output row (`$0.001`) plus the small Actor-start event (`$0.00005`). A default 100-row run costs up to `$0.10005` in Actor events; the 1,000-row maximum costs up to `$1.00005`.

# Actor input Schema

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

Maximum number of border crossing records to retrieve from the Socrata API.
## `border` (type: `string`):

Filter by border. Options: 'all' (default), 'US-Canada Border', 'US-Mexico Border'.
## `measure` (type: `string`):

Optional filter by measure type. Examples: 'Trucks', 'Personal Vehicles', 'Personal Vehicle Passengers', 'Truck Containers Loaded', 'Pedestrians', 'Bus Passengers'.
## `state` (type: `string`):

Optional case-insensitive exact state name filter.
## `portName` (type: `string`):

Optional case-insensitive contains filter for port name.
## `startDate` (type: `string`):

Optional inclusive start date in YYYY-MM-DD format.
## `endDate` (type: `string`):

Optional inclusive end date in YYYY-MM-DD format.
## `includeRaw` (type: `boolean`):

When true, include the raw Socrata row as the 'raw' field in output.

## Actor input object example

```json
{
  "maxItems": 100,
  "border": "all",
  "measure": "",
  "state": "",
  "portName": "",
  "startDate": "",
  "endDate": "",
  "includeRaw": false
}
````

# Actor output Schema

## `results` (type: `string`):

No description

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

No description

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("defenestrator/bts-border-crossings-monitor").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("defenestrator/bts-border-crossings-monitor").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{}' |
apify call defenestrator/bts-border-crossings-monitor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=defenestrator/bts-border-crossings-monitor",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "BTS Border Crossing Traffic Data Monitor",
        "description": "Fetch U.S. BTS/DOT border-crossing volume rows from the official Socrata dataset. Unofficial and not affiliated with BTS or DOT.",
        "version": "0.0",
        "x-build-id": "FnL8w5CmUr0ckhikk"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/defenestrator~bts-border-crossings-monitor/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-defenestrator-bts-border-crossings-monitor",
                "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/defenestrator~bts-border-crossings-monitor/runs": {
            "post": {
                "operationId": "runs-sync-defenestrator-bts-border-crossings-monitor",
                "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/defenestrator~bts-border-crossings-monitor/run-sync": {
            "post": {
                "operationId": "run-sync-defenestrator-bts-border-crossings-monitor",
                "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": {
                    "maxItems": {
                        "title": "Maximum items",
                        "minimum": 1,
                        "maximum": 1000,
                        "type": "integer",
                        "description": "Maximum number of border crossing records to retrieve from the Socrata API.",
                        "default": 100
                    },
                    "border": {
                        "title": "Border",
                        "type": "string",
                        "description": "Filter by border. Options: 'all' (default), 'US-Canada Border', 'US-Mexico Border'.",
                        "default": "all"
                    },
                    "measure": {
                        "title": "Measure",
                        "type": "string",
                        "description": "Optional filter by measure type. Examples: 'Trucks', 'Personal Vehicles', 'Personal Vehicle Passengers', 'Truck Containers Loaded', 'Pedestrians', 'Bus Passengers'.",
                        "default": ""
                    },
                    "state": {
                        "title": "State",
                        "type": "string",
                        "description": "Optional case-insensitive exact state name filter.",
                        "default": ""
                    },
                    "portName": {
                        "title": "Port name",
                        "type": "string",
                        "description": "Optional case-insensitive contains filter for port name.",
                        "default": ""
                    },
                    "startDate": {
                        "title": "Start date",
                        "type": "string",
                        "description": "Optional inclusive start date in YYYY-MM-DD format.",
                        "default": ""
                    },
                    "endDate": {
                        "title": "End date",
                        "type": "string",
                        "description": "Optional inclusive end date in YYYY-MM-DD format.",
                        "default": ""
                    },
                    "includeRaw": {
                        "title": "Include raw row",
                        "type": "boolean",
                        "description": "When true, include the raw Socrata row as the 'raw' field in output.",
                        "default": 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
                                    }
                                }
                            },
                            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
