# SAM.gov Contract Opportunities API (`alxlin/samgov-opportunities`) Actor

Search US federal contract opportunities on SAM.gov (solicitations, sources sought, awards) with full detail - NAICS, set-aside, deadlines, POC emails/phones, place of performance, attachment links. No API key required.

- **URL**: https://apify.com/alxlin/samgov-opportunities.md
- **Developed by:** [Alex Lin](https://apify.com/alxlin) (community)
- **Categories:** Business, Lead generation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.60 / 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.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

**US federal contract opportunities from SAM.gov as clean JSON — search, full detail, and attachment
links in one run.** No API key required (SAM.gov's own internal search API is public and keyless), no
10-requests-a-day cap, and it fixes the "no results" problem the existing SAM.gov actors on the Store are
stuck with. Point it at a NAICS code, set-aside, or notice type and get solicitations, sources-sought,
special notices, and award notices back as flat JSON — ready for a bid-tracking sheet, a daily alert
schedule, an integration, or an MCP-connected agent.

### Sample output

One dataset item per opportunity. This is real output from a live run of this Actor (default input:
NAICS 541511, active only, details on):

```json
{
  "noticeId": "bb307f8a384045e88bd224d793709109",
  "solicitationNumber": "FA302026Q0087",
  "title": "82 FSS Automated Student System",
  "noticeTypeCode": "k",
  "noticeType": "Combined Synopsis/Solicitation",
  "active": true,
  "canceled": false,
  "postedAt": "2026-09-10T21:39:52+00:00",
  "modifiedAt": "2026-09-10T21:39:52+00:00",
  "responseDeadline": "2026-09-16T14:00:00-05:00",
  "responseTimeZone": "America/Chicago",
  "amendmentCount": 2,
  "agency": "DEPT OF DEFENSE",
  "subAgency": "DEPT OF THE AIR FORCE",
  "office": "FA3020  82 CONS LGC",
  "naicsCodes": ["541511"],
  "classificationCode": "7A21",
  "setAside": "SBA",
  "placeOfPerformance": { "city": "Sheppard AFB", "state": "TX", "stateName": "Texas", "zip": "76311", "country": "USA" },
  "descriptionText": "***AMENDMENT 1*** The purpose of this amendment is to update the NAICS code...",
  "pointsOfContact": [
    { "type": "primary", "name": "Mason Carl", "email": "mason.carl@us.af.mil", "phone": "9406761604" },
    { "type": "secondary", "name": "Steven Taylor", "email": "steven.taylor.63@us.af.mil", "phone": "9406765180" }
  ],
  "award": null,
  "attachments": [],
  "archiveDate": "2026-10-01",
  "url": "https://sam.gov/opp/bb307f8a384045e88bd224d793709109/view",
  "scrapedAt": "2026-09-13T19:52:10.730Z"
}
```

Award notices (`noticeTypeCode: "a"`) fill in `award` instead: `{ "date": "2026-09-09", "amount": "55892.10",
"number": "HE125426PE047", "awardeeName": "DOCOMO PACIFIC, INC.", "awardeeUei": "NENAMR865QN6",
"awardeeLocation": { "city": "Tamuning", "state": "GU", "country": "USA" } }`. Turn on **Include attachment
links** and each item also gets `attachments: [{ "name": "...", "url": "https://sam.gov/api/prod/opps/v3/...
/download", "mimeType": ".pdf", "size": 2861467 }]` — solicitation packages, SOWs, and amendments, ready to
download directly (see [Attachments](#attachments-are-links-not-files) below).

You can download any run's dataset as JSON, CSV, Excel, or HTML from the Storage tab or the API.

### Input

| Field | Type | Default | Notes |
|---|---|---|---|
| `query` | string | `""` | Free-text keyword search across titles/descriptions. |
| `naics` | array of strings | `["541511"]` | NAICS codes, OR'd together. Empty = all industries. |
| `setAside` | array of strings | `[]` | Set-aside codes, OR'd together (`SBA`, `WOSB`, `EDWOSB`, `SDVOSBC`, `HZC`, `8A`, ... see [table](#set-aside-codes) below). |
| `noticeTypes` | array of strings | `[]` | Notice type codes, OR'd together (see [table](#notice-type-codes) below). |
| `organizationIds` | array of strings | `[]` | SAM.gov internal agency org IDs (advanced - copy one from a result's output, e.g. `100000000` = Dept of Defense). |
| `popState` | string | `""` | Two-letter place-of-performance state, e.g. `TX`. |
| `activeOnly` | boolean | `true` | Only currently active (non-expired) opportunities. |
| `postedFrom` / `postedTo` | string (`YYYY-MM-DD`) | `""` | Filters by posted date. Applied **client-side** after fetching — see [limitations](#limitations). |
| `maxItems` | integer | `25` | Cap on opportunities returned. |
| `includeDetails` | boolean | `true` | Fetch full detail per item (NAICS, PSC, set-aside, deadlines, POCs, award info). One extra request + charge per item. |
| `includeAttachments` | boolean | `false` | Fetch attachment links per item. One extra request + one charge per attachment. |
| `maxConcurrency` | integer | `2` | How many opportunities to enrich in parallel. |
| `samApiKey` | string (secret) | — | Optional: your own `api.sam.gov` key, for real server-side date filtering via the official API instead of the internal one. Falls back to the internal API on any error. **Unverified** — see [limitations](#limitations). |

### Pricing

Pay-per-event, billed only for work actually done:

| Event | Price | When it's charged |
|---|---|---|
| Actor start | $0.005 | Once per run |
| Opportunity | $0.002 | Per opportunity returned (base search data) |
| Opportunity detail | $0.005 | Per opportunity where full detail was fetched (default: on) |
| Attachment link | $0.01 | Per attachment resolved (only if "Include attachment links" is on) |

**Worked examples:** 25 opportunities with details (the default input) ≈ 25 × ($0.002 + $0.005) + $0.005 ≈
**$0.18**. 200 opportunities, details on, no attachments ≈ **$1.41**. 200 opportunities with details and
attachments (avg. 3 attachments each) ≈ 200 × ($0.002 + $0.005 + 3 × $0.01) + $0.005 ≈ **$7.40**. Turn off
"Include full detail" for a cheap, search-only feed at $0.002/opportunity.

### Why this Actor

The existing SAM.gov actors on the Store are in bad shape: the top one by users (161 users) is rated **1.0
stars** with an open issue reporting "No results are shown"; the runner-up has an open issue that a core
filter field ("opportunityTypes") doesn't work at all. This Actor:

- Needs **no API key** and has no daily-request ceiling — it uses SAM.gov's own public internal search API
  (the one the sam.gov website itself calls), which is unauthenticated and has a max page size of 100.
  The *official* `api.sam.gov` API, by contrast, requires a key that's capped at roughly 10 requests/day for
  personal accounts — the likely root cause of "no results" on the broken incumbents.
- Returns **full detail in the same run**: NAICS, PSC, set-aside, response deadlines, place of performance,
  and named points of contact with direct email/phone — not just the search-result summary.
- Handles **award notices** as a distinct, correctly-shaped case (amount, date, awardee, awardee location) —
  most competitors only handle open solicitations.
- Gives you a **stable attachment link** per document (solicitation packages, SOWs, amendments) instead of
  nothing.
- Ships with a **safe default input** (NAICS 541511, active only, max 25 items) that reliably returns real
  results in seconds, so it stays off `UNDER_MAINTENANCE`.

### Notice type codes

| Code | Meaning |
|---|---|
| `o` | Solicitation |
| `p` | Presolicitation |
| `k` | Combined Synopsis/Solicitation |
| `r` | Sources Sought |
| `a` | Award Notice |
| `s` | Special Notice |
| `g` | Sale of Surplus Property |
| `i` | Intent to Bundle Requirements |
| `u` | Justification (J\&A) |

`o`, `k`, `a`, and `s` were confirmed against live SAM.gov responses while building this Actor; the rest are
SAM.gov's standard published codes.

### Set-aside codes

Common codes accepted by `setAside` (per SAM.gov's own documentation — `SBA` and `WOSB` were also confirmed
live): `SBA` (Total Small Business), `WOSB` (Women-Owned Small Business), `EDWOSB` (Economically Disadvantaged
WOSB), `SDVOSBC` (Service-Disabled Veteran-Owned Small Business), `HZC` (HUBZone Small Business), `8A` (8(a)
Sole Source/Competitive). SAM.gov adds new codes occasionally — any code SAM.gov accepts will work here even
if it's not in this list.

### Attachments are links, not files

When "Include attachment links" is on, each attachment gets a `url` pointing at SAM.gov's own redirect
endpoint (`.../opportunities/resources/files/{id}/download`). That endpoint is permanent and always resolves
to a fresh, working download — but the underlying signed S3 URL it redirects to expires in **seconds**, so
this Actor does not fetch, cache, or re-host the file bytes. You get a link that works whenever you (or your
script) follow it, at a fraction of the cost and time of proxying every PDF through this Actor.

### Limitations

- SAM.gov's internal search API has **no working server-side date-range filter** (every parameter name we
  tried for it either 400s or is silently ignored) — `postedFrom`/`postedTo` are applied client-side after
  fetching, so they narrow the results but don't reduce SAM.gov API calls. Supplying `samApiKey` switches to
  the official API, which does support real date filtering, but that code path could not be tested against a
  real key while building this Actor — please open an issue if you hit a problem with it.
- `organizationIds` requires a SAM.gov internal org ID, not an agency name — the easiest way to find one is to
  run once without it and copy `organizationId` from a result in the agency you want.
- Point-of-contact emails/phones and awardee names are published by the government for vendor outreach and
  are not personal data in the GDPR sense; this Actor does not add, infer, or store anything beyond what
  SAM.gov itself publishes.
- Not affiliated with, endorsed by, or officially connected to SAM.gov or the U.S. General Services
  Administration.

### Support

Found a bug or a SAM.gov API change that broke something? Open an issue on this Actor's Issues tab — reports
are read regularly and the fixes tend to be small (this Actor is a thin, honest wrapper around SAM.gov's own
JSON, not a scraped/reverse-engineered HTML page).

# Actor input Schema

## `query` (type: `string`):

Free-text search across opportunity titles/descriptions. Leave blank to match all.

## `naics` (type: `array`):

Filter to these NAICS codes (OR'd together). Leave empty for all industries. Default is 541511 (Custom Computer Programming Services) so the actor has a fast, reliable default run.

## `setAside` (type: `array`):

Filter to these set-aside codes (OR'd together), e.g. SBA (total small business), WOSB, EDWOSB, SDVOSBC, HZC, 8A. Leave empty for all. See README for the full code table.

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

Filter to these notice type codes (OR'd together): o=Solicitation, p=Presolicitation, k=Combined Synopsis/Solicitation, r=Sources Sought, a=Award Notice, s=Special Notice, g=Sale of Surplus Property, i=Intent to Bundle, u=Justification (J\&A). Leave empty for all.

## `organizationIds` (type: `array`):

Filter to these SAM.gov internal organization IDs (the organizationId of any level in a result's organizationHierarchy, e.g. "100000000" = Dept of Defense). Advanced/optional - leave empty for all agencies.

## `popState` (type: `string`):

Two-letter US state code for place of performance, e.g. TX. Leave blank for all states.

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

Only return currently active (not archived/expired) opportunities.

## `postedFrom` (type: `string`):

Only include opportunities posted on or after this date. Applied client-side after fetching (SAM.gov's internal search API has no working server-side date filter). Leave blank for no lower bound.

## `postedTo` (type: `string`):

Only include opportunities posted on or before this date. Leave blank for no upper bound.

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

Maximum number of opportunities to return. Kept small by default so the daily automated test run finishes in well under 5 minutes.

## `includeDetails` (type: `boolean`):

Fetch the opportunity-detail page for each result: full NAICS/PSC/set-aside, response deadline, place of performance, points of contact (name/email/phone), and award info for award notices. Costs one extra request per item (charged event: opportunity-detail).

## `includeAttachments` (type: `boolean`):

Fetch the list of attachments (solicitation documents, SOWs, amendments) for each result and include a stable download URL per attachment. Costs one extra request per item plus one charged event per attachment (attachment-download).

## `maxConcurrency` (type: `integer`):

How many opportunities to enrich (detail/attachments) in parallel. Kept low by default to be a polite, unobtrusive API citizen.

## `samApiKey` (type: `string`):

Optional: your own api.sam.gov key. When supplied, search uses the official api.sam.gov/opportunities/v2/search endpoint (real server-side date filtering) instead of the keyless internal API, falling back to the internal API on any error. This code path is unverified against a real key as of actor build time - please report issues. Leave blank to use the default keyless search.

## Actor input object example

```json
{
  "query": "",
  "naics": [
    "541511"
  ],
  "setAside": [],
  "noticeTypes": [],
  "organizationIds": [],
  "popState": "",
  "activeOnly": true,
  "postedFrom": "",
  "postedTo": "",
  "maxItems": 25,
  "includeDetails": true,
  "includeAttachments": false,
  "maxConcurrency": 2
}
```

# Actor output Schema

## `opportunities` (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 = {
    "naics": [
        "541511"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("alxlin/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 = { "naics": ["541511"] }

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

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,alxlin/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/RTgDFEJFMmZxNK3ob/builds/47Xxqnet8yw0x4eyj/openapi.json
