# ImportYeti US Customs BOL Scraper (`barefoot_grade/importyeti-bol-scraper`) Actor

Search US customs bill-of-lading records by company to map suppliers, shipments and trading partners. Structured records with shipment details and source URLs.

- **URL**: https://apify.com/barefoot\_grade/importyeti-bol-scraper.md
- **Developed by:** [Philip Kirkbride](https://apify.com/barefoot_grade) (community)
- **Stats:** 2 total users, 1 monthly users, 66.7% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.40 / 1,000 results

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?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — 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

## importyeti-bol-scraper

Apify Actor for ImportYeti US customs bill-of-lading data: recent sea
shipments (who ships what to whom) for any US importer, straight from
the `/company/{slug}` page over plain HTTP with a `curl_cffi`
chrome131 TLS profile — no browser, no proxy, no key (see
`docs/FINDINGS.md` for the lane probe, including the paid-key verdict
on the internal `data.importyeti.com/v1.0` API).

### Input

```json
{"companies": ["apple"]}
{"companies": ["apple", "tesla"], "maxResults": 30, "includePartners": true}
{"companies": ["https://www.importyeti.com/company/walmart"]}
```

- `companies` (default `["apple"]`): 1–50 ImportYeti slugs (the
  `/company/<slug>` path); bare URLs tolerated, deduped,
  case-insensitive. Omitted/empty input scrapes the default so the
  Store's daily empty-input auto-test survives (issue #188).
- `maxResults` (1–200, default 50): cap on BOL records per company —
  the page's "Most Recent Sea Shipments" table carries at most 50.
- `includePartners` (default false): detail mode — also emits one
  summary record per row of the company's Suppliers table.
- `requestDelaySecs` (0.5–10, default 1): pause between companies.

### Output

One dataset item per bill-of-lading row (`recordType: "bol"`):
`recordKey` (`www.importyeti.com:bol:{slug}:{bolNumber}`),
`companyName`/`companySlug`, `role` (`importer` — /company/ pages are
US importers of record), `date` (ISO), `bolNumber` (house) +
`bolMasterNumber`, `isFreeBol`, `carrier` (from the tracking-link
logo: ZIM, Maersk, HMM…), `supplierName`/`supplierSlug`/`supplierCity`
/`supplierCountry`, `weightKg`, `quantity` + `quantityUnit`,
`containerCount`, `lane` (`Eu -> US Transatlantic`),
`estimatedFreightCost` + `freightCurrency` (USD), company context
(`companyTotalShipments`, `companyTopOriginCountry`, `companyAddress`),
`sourceUrl`, `sourceQuery`, `source`, `scrapedAt`.

Detail mode adds `recordType: "partner"` records keyed
`www.importyeti.com:partner:{slug}:{supplier-slug}` with
`totalShipments`, `activityStart`/`activityEnd` (YYYY-MM window) and
`productDescriptions` (ImportYeti's category legend), BOL-only fields
null. Supplier names the source prints as "Missing in source
document" normalize to null (country/flag kept). Company-level data
only — no individual PII (the page's contact "unlock" table is not
scraped).

### How it works

1. `GET https://www.importyeti.com/company/{slug}` through
   `curl_cffi` `AsyncSession(impersonate="chrome131")` — the chrome131
   TLS fingerprint passes the site's Cloudflare check where plain
   HTTP clients get 403 (verified 2026-09-04; lane origin: a
   competitor README, see FINDINGS).
2. On 403/429/503 or a challenge page: one retry through the Apify
   RESIDENTIAL proxy (fallback lane, billed) before failing.
3. Next.js SSR HTML is parsed with regexes (tables are stable):
   JSON-LD for company identity, the "Most Recent Sea Shipments"
   table for BOL rows, the Suppliers table + per-country tables for
   detail mode and totals.

### Run tests

```bash
PYTHONPATH=src python3 -m unittest discover -s tests -v
```

Fixtures under `tests/fixtures/` are live captures from 2026-09-04
(apple, tesla). `ruff check` + `ruff format` clean.

### Cost

One ~750 KB HTML fetch per company, no proxy on the default lane:
2 companies + detail mode = 74 records in ~3 s — ≈ **$0.0003/run**
datacenter egress. Cloudflare rotating the chrome131 profile is the
documented kill criterion (issue #35); the residential fallback keeps
the Actor alive at higher COGS if that happens.

# Actor input Schema

## `companies` (type: `array`):

ImportYeti company slugs (the /company/<slug> path), 1-50 per run, e.g. \['apple', 'tesla']. Bare URLs are tolerated ('https://www.importyeti.com/company/apple'). Defaults to \['apple'] when omitted (issue #188: empty-input auto-test).

## `maxResults` (type: `integer`):

Stop after this many recent bill-of-lading records per company (the page carries at most 50).

## `includePartners` (type: `boolean`):

Also emit one summary record per supplier from the company's Suppliers table (total shipments, activity window, product categories).

## `requestDelaySecs` (type: `number`):

Pause between company fetches.

## Actor input object example

```json
{
  "companies": [
    "apple"
  ],
  "maxResults": 50,
  "includePartners": false,
  "requestDelaySecs": 1
}
```

# Actor output Schema

## `results` (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 = {
    "companies": [
        "apple"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("barefoot_grade/importyeti-bol-scraper").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 = { "companies": ["apple"] }

# Run the Actor and wait for it to finish
run = client.actor("barefoot_grade/importyeti-bol-scraper").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 '{
  "companies": [
    "apple"
  ]
}' |
apify call barefoot_grade/importyeti-bol-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,barefoot_grade/importyeti-bol-scraper"
        }
    }
}
```

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/LbACIacSGVdvp2I16/builds/lzWOJ5WJv1rc80fcp/openapi.json
