# SAM.gov Contract Opportunities Scraper (`green_trousers/samgov-opportunities`) Actor

Fast, reliable feed of US federal contract opportunities from SAM.gov: solicitations, sources sought and award notices with NAICS, set-aside, deadline, place of performance and full description. No API key needed.

- **URL**: https://apify.com/green_trousers/samgov-opportunities.md
- **Developed by:** [Omar Prime](https://apify.com/green_trousers) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 opportunities

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

## SAM.gov Contract Opportunities Scraper

Pull fresh US federal contract opportunities from SAM.gov into a clean spreadsheet or JSON feed. **No SAM.gov API key needed**, no 10-requests-a-day limit, and runs that actually finish.

### What you get for each opportunity

Title, notice type, solicitation number, department / agency / office, posted date, **response deadline**, NAICS codes, PSC code, **set-aside** (SBA, 8(a), WOSB, SDVOSB, HUBZone…), place of performance, awardee and amount (for award notices), the **full description text**, and a link to the notice. Optionally, the contracting officer contacts listed on the notice.

### Who uses it

- Small businesses and GovCon consultants who want a daily list of new bids in their NAICS codes
- Proposal writers and capture teams tracking sources-sought and presolicitations early
- Sales teams building lists of agencies buying what they sell
- Analysts tracking who wins federal awards

### Input

| Field | Example | Notes |
|---|---|---|
| Keywords | `cybersecurity` | Free-text search; empty = everything |
| Posted within (days) | `1` | Run daily with `1` to get only what's new |
| Notice types | Solicitation, Sources sought | Empty = all |
| NAICS codes | `5415`, `561720` | Prefix match |
| States | `TX`, `VA` | Place of performance |
| Set-asides only | `true` | Small-business reserved work only |
| Include contacts | `false` | Adds listed contracting officer name, email, phone |
| Max results | `100` | |

### Tip: daily bid alerts

Create an Apify **Schedule** that runs every morning with *Posted within = 1* and your NAICS codes, then connect the dataset to Google Sheets, Slack or email through Apify integrations.

### Pricing

Pay per result: **$0.003 per opportunity** plus $0.005 per run. 1,000 opportunities cost about $3.

### Output example

```json
{
  "title": "Retail Space for Lease in Los Angeles",
  "noticeType": "Solicitation",
  "department": "DEPT OF DEFENSE",
  "agency": "DEPT OF THE ARMY",
  "responseDeadline": "2026-10-27T17:00:00-04:00",
  "naicsCodes": ["531120"],
  "setAside": null,
  "placeOfPerformance": { "city": "Los Angeles", "state": "CA", "zip": "90024", "country": "USA" },
  "url": "https://sam.gov/opp/886bcda9cc8b46c7b1b5c4fbb8aec692/view"
}
```

### Notes

Data comes from SAM.gov's public opportunity search, a US government website. This Actor is not affiliated with GSA or SAM.gov. Requests are rate-limited politely.

# Actor input Schema

## `keywords` (type: `string`):

Free-text search across SAM.gov contract opportunities. Leave empty for all.

## `postedWithinDays` (type: `integer`):

Only notices posted in the last N days. 0 = no limit.

## `noticeTypes` (type: `array`):

Leave empty for all types.

## `naicsCodes` (type: `array`):

Keep only notices whose NAICS starts with one of these (e.g. 5415, 561720).

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

Two-letter state codes, e.g. CA, TX.

## `setAsideOnly` (type: `boolean`):

Only notices reserved for small business, 8(a), WOSB, SDVOSB, HUBZone, etc.

## `activeOnly` (type: `boolean`):

Skip archived and inactive notices.

## `includeContacts` (type: `boolean`):

Add the listed government point-of-contact names, emails and phones.

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

Stop after this many opportunities.

## Actor input object example

```json
{
  "keywords": "janitorial",
  "postedWithinDays": 7,
  "noticeTypes": [],
  "naicsCodes": [],
  "states": [],
  "setAsideOnly": false,
  "activeOnly": true,
  "includeContacts": false,
  "maxItems": 100
}
```

# 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 = {
    "keywords": "janitorial"
};

// Run the Actor and wait for it to finish
const run = await client.actor("green_trousers/samgov-opportunities").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 = { "keywords": "janitorial" }

# Run the Actor and wait for it to finish
run = client.actor("green_trousers/samgov-opportunities").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 '{
  "keywords": "janitorial"
}' |
apify call green_trousers/samgov-opportunities --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,green_trousers/samgov-opportunities"
        }
    }
}
```

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/03qTAOoF0TGJ824Hp/builds/IrWSDjZvacYlm1ytG/openapi.json
