# Public Surplus Scraper (`crawlerbros/public-surplus-scraper`) Actor

Scrape Public Surplus - government and municipal surplus auctions. Search by keyword, browse by category/region, filter by price and closing window, or fetch full auction details by ID.

- **URL**: https://apify.com/crawlerbros/public-surplus-scraper.md
- **Developed by:** [Crawler Bros](https://apify.com/crawlerbros) (community)
- **Categories:** Automation, E-commerce, Lead generation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#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

## Public Surplus Scraper

Scrape [Public Surplus](https://www.publicsurplus.com) — an online marketplace where U.S. and Canadian government agencies (cities, counties, school districts, state agencies) sell surplus vehicles, equipment, real estate, and other property at public auction. Search by keyword, browse by category or region, filter by price range and closing window, or fetch full details for specific auctions by ID. HTTP-only, no login, no API key.

### What this actor does

- **Two modes:** `search` (keyword / category / region / price / time-window browsing) and `byAuctionIds` (direct lookup of specific auctions)
- **Full filter surface:** 28 categories, 65 regions (US states/territories + Canadian provinces), price range, ending-window, starting-window, and server-side sorting
- **Rich auction detail:** agency, pickup location, current bid, bid count, auction close time, and a `specifications` map covering category-specific attributes (VIN, mileage, condition, year/make/model for vehicles; different attribute sets for other categories)
- **Empty fields are omitted**

### Output per auction

#### Listing records (`mode=search`)

- `auctionId`, `title`, `currentPrice`, `state`
- `endTime` (ISO 8601), `timeLeftLabel` (human-readable, e.g. `"2 mins"`)
- `thumbnailUrl`, `sourceUrl`
- `recordType: "auctionListing"`, `scrapedAt`

#### Detail records (`mode=byAuctionIds`)

- `auctionId`, `title`, `currentPrice`, `numberOfBids`
- `agencyName`, `agencyUrl` — the selling government agency
- `pickupLocationName`, `pickupLocationAddress`
- `auctionEndsAt` (ISO 8601)
- `condition`, `specifications` — category-specific attribute map (e.g. `VIN`, `Mileage`, `Year`, `Make`, `Model` for vehicles)
- `termsUrl` — link to the auction's terms & conditions
- `sourceUrl`
- `recordType: "auctionDetail"`, `scrapedAt`

Invalid or expired auction IDs (mode=`byAuctionIds`) are skipped entirely — no placeholder/error record is ever added to the dataset, so every row you get back is a real auction.

### Input

| Field | Type | Default | Description |
|---|---|---|---|
| `mode` | select | `search` | `search` / `byAuctionIds` |
| `keyword` | string | – | Free-text keyword (mode=search); leave blank to browse by filters only |
| `category` | select | Any | One of 28 categories (Computers, Electronics, Motor Pool, Real Estate, …) |
| `region` | select | Any | US state/territory or Canadian province |
| `endingWithinHours` | select | No limit | `1 hour` / `6 hours` / `1 day` / `5 days` / `10 days` |
| `startedWithinHours` | select | All | `the last hour` / `day` / `2 days` / `week` |
| `minPrice` / `maxPrice` | int | – | Current-price range in USD |
| `sortBy` | select | Default | `id` / `title` / `timeLeft` / `price` |
| `sortDescending` | bool | `false` | Reverse the sort order |
| `auctionIds` | array | – | Numeric auction IDs (mode=byAuctionIds) |
| `maxItems` | int | `50` | Hard cap (1–2000) |
| `proxyConfiguration` | proxy | off | Optional — the site is reachable from Apify datacenter IPs without a proxy |

#### Example: browse Real Estate auctions in Texas ending within 5 days

```json
{
  "mode": "search",
  "category": "15",
  "region": "tx",
  "endingWithinHours": "120",
  "maxItems": 50
}
```

#### Example: fetch specific auctions by ID

```json
{
  "mode": "byAuctionIds",
  "auctionIds": ["4057251", "4053912"]
}
```

### Use cases

- **Fleet & asset buyers** — monitor government vehicle and heavy-equipment auctions across states
- **Government-surplus resellers** — track listings by category to source inventory
- **Real estate investors** — browse municipal real-estate surplus sales by region
- **Market research** — analyze government asset-disposal pricing trends over time
- **Procurement/compliance teams** — audit agency surplus-sale activity

### FAQ

**Do I need an account or cookies?**  No. All search, browse, and detail data is public. Bidding itself requires a Public Surplus login, but this actor only reads public listing data.

**What's the `specifications` field?**  Public Surplus auctions span many categories (vehicles, electronics, furniture, real estate…) each with different attributes. Rather than hard-coding one schema, the actor captures every labeled attribute on the auction page (e.g. `VIN`, `Mileage`, `Condition`, `Year`, `Make`, `Model` for a vehicle) into a flat key-value map so no category-specific data is lost.

**Why do listing records only have `state`, but detail records have full `pickupLocationAddress`?**  The search/browse results page shows a compact 2-letter state code per card; full pickup address and agency info require visiting the individual auction page (`mode=byAuctionIds`).

**What happens if an auction ID is invalid or expired?**  The actor skips it and moves on to the next ID — it never adds a placeholder/error row to the dataset, so you can safely assume every returned record is a genuine, currently-listed auction.

**How current is the price?**  `currentPrice` reflects the live current bid at scrape time — it will change as bidding continues.

**Can I combine keyword search with category/region filters?**  Yes — all `search`-mode filters (`keyword`, `category`, `region`, price range, time windows, sort) combine via server-side query parameters.

# Actor input Schema

## `mode` (type: `string`):

What to fetch.

## `keyword` (type: `string`):

Free-text keyword to search auction titles/descriptions (mode=search). Leave blank to browse by category/region/time filters only.

## `category` (type: `string`):

Restrict results to one category (mode=search).

## `region` (type: `string`):

Restrict results to auctions located in one US state / territory / Canadian province (mode=search).

## `endingWithinHours` (type: `string`):

Only include auctions closing within this window (mode=search).

## `startedWithinHours` (type: `string`):

Only include auctions that opened within this window (mode=search).

## `minPrice` (type: `integer`):

Drop auctions with a current price below this amount.

## `maxPrice` (type: `integer`):

Drop auctions with a current price above this amount.

## `sortBy` (type: `string`):

Server-side sort order for results (mode=search).

## `sortDescending` (type: `boolean`):

Reverse the sort order (only applies when Sort by is set).

## `auctionIds` (type: `array`):

Numeric Public Surplus auction IDs, e.g. `4057251` (from an auction URL `?auc=4057251`).

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

Hard cap on emitted records.

## `proxyConfiguration` (type: `object`):

Optional. Public Surplus is reachable from Apify datacenter IPs without a proxy; enable only if you experience blocking.

## Actor input object example

```json
{
  "mode": "search",
  "keyword": "truck",
  "category": "",
  "region": "",
  "endingWithinHours": "-1",
  "startedWithinHours": "-1",
  "sortBy": "",
  "sortDescending": false,
  "auctionIds": [],
  "maxItems": 50,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `auctions` (type: `string`):

Dataset containing all scraped Public Surplus auction records.

# 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 = {
    "mode": "search",
    "keyword": "truck",
    "category": "",
    "region": "",
    "endingWithinHours": "-1",
    "startedWithinHours": "-1",
    "sortBy": "",
    "sortDescending": false,
    "auctionIds": [],
    "maxItems": 50
};

// Run the Actor and wait for it to finish
const run = await client.actor("crawlerbros/public-surplus-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 = {
    "mode": "search",
    "keyword": "truck",
    "category": "",
    "region": "",
    "endingWithinHours": "-1",
    "startedWithinHours": "-1",
    "sortBy": "",
    "sortDescending": False,
    "auctionIds": [],
    "maxItems": 50,
}

# Run the Actor and wait for it to finish
run = client.actor("crawlerbros/public-surplus-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 '{
  "mode": "search",
  "keyword": "truck",
  "category": "",
  "region": "",
  "endingWithinHours": "-1",
  "startedWithinHours": "-1",
  "sortBy": "",
  "sortDescending": false,
  "auctionIds": [],
  "maxItems": 50
}' |
apify call crawlerbros/public-surplus-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,crawlerbros/public-surplus-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/gkwc8KI87zmv1Xgdm/builds/crx7vwvwBS1PMrwpu/openapi.json
