# SAM.gov Opportunities & USAspending Awards Scraper (`thisisb3/sam-gov-contracts-scraper`) Actor

Find federal contract opportunities from SAM.gov (solicitations, RFIs, set-asides, deadlines, contracting officer contacts) and contract awards from USAspending.gov (winners, amounts, competition). Filter by keyword, NAICS, PSC, agency, set-aside and state. No API key.

- **URL**: https://apify.com/thisisb3/sam-gov-contracts-scraper.md
- **Developed by:** [ThisIsB3](https://apify.com/thisisb3) (community)
- **Categories:** 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 contract 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?

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 Opportunities & USAspending Awards Scraper

Find **US federal contract opportunities** from SAM.gov and **contract awards** from USAspending.gov in one run. Get solicitations, RFIs and sources-sought notices with **deadlines, set-asides, NAICS and PSC codes, places of performance and contracting officer contacts**, plus signed contracts with **winners, amounts, dates and competition details** (offers received, extent competed, set-aside, potential value, parent IDIQ/GWAC). Filter both by keyword, NAICS, PSC, agency, set-aside and state. **No SAM.gov API key, no login, no browser.** Export to JSON, CSV or Excel, or use it through the Apify API.

### What does it do?

It reads two official, public US government data sources:

- **Contract opportunities from SAM.gov.** The Actor downloads SAM.gov's own public "Contract Opportunities" data file, which SAM.gov publishes every day for bulk use (SAM.gov Data Services and data.gov). It never scrapes the SAM.gov website and never needs an API key. The file is sorted newest first, so the Actor reads only the part your date window needs and stops.
- **Contract awards from USAspending.gov.** The Actor uses the official USAspending.gov API, the government's record of federal spending. It covers prime contract awards: definitive contracts, purchase orders, delivery and task orders, and BPA calls, from fiscal year 2008 on.

Every row has a `type` field, `opportunity` or `award`, so one run can return both. The dataset has an **Opportunities** view and an **Awards** view.

### Who is it for?

- **Small businesses looking for bids.** Get every new solicitation in your NAICS codes and set-aside category (8(a), HUBZone, SDVOSB, WOSB...) with the deadline and the contracting officer's email. Schedule it daily with "Posted in the last (days)" set to 1 for a bid alert in your inbox, Slack or Google Sheet.
- **Government contracting consultants and capture managers.** Build opportunity pipelines for several clients at once, and pull the sources-sought and presolicitation notices that come before the RFP.
- **Competitor and incumbent research.** See who wins in your market: recipient, amount, agency, contract type, end date and, with competition details, how many offers were received, whether it was competed, which set-aside was used and which IDIQ or GSA schedule the order went through. Search by company name or UEI to see a competitor's or teaming partner's contracts.
- **Market sizing.** Pull a fiscal year of awards for a NAICS code, agency or state, sorted by size, and add up the money. "Any activity" date mode includes older contracts that are still spending.
- **Recompete planning.** Awards come with `endDate` and `potentialEndDate`, so you can find contracts that expire soon and prepare before the follow-on is announced.

It is built to be reliable: official data only (nothing that breaks when a website changes), automatic slowdown when a server asks for it, a resumable download, and an automated test every day.

### How to use it

1. Click **Try for free**.
2. Pick the sources (opportunities, awards or both) and add filters: keywords, NAICS codes, PSC codes, agencies, set-asides, states. All filters are optional.
3. Set the date windows and limits for each source.
4. Click **Start**. Most runs finish in seconds.

You can also call it from the Apify API or an AI agent (MCP), schedule it, or connect it to Make, Zapier, Google Sheets, Slack and other integrations.

### How much does it cost?

You pay only for the rows you receive. There is no monthly fee and no charge per run.

| Row                                                                                         | Event            | Price                                             |
| ------------------------------------------------------------------------------------------- | ---------------- | ------------------------------------------------- |
| Contract opportunity (SAM.gov notice with contacts and description)                         | `opportunity`    | **$2.00 per 1,000**                               |
| Contract award (USAspending: recipient, amount, dates, agency, codes, place of performance) | `award`          | **$1.50 per 1,000**                               |
| Contract award with competition details ("Include competition details" on)                  | `award-detailed` | **$4.00 per 1,000**, charged *instead of* `award` |

Examples:

- A daily bid alert for two NAICS codes that finds about 20 new notices a day costs about $0.04 a day, roughly $1.20 a month.
- 500 opportunities plus 500 awards with competition details cost $1.00 + $2.00 = $3.00.
- A fiscal year of 10,000 awards for market sizing costs $15.

Apify's free plan includes monthly platform credit, enough for thousands of rows every month. Larger Apify plans get automatic discounts. Set a maximum cost per run in the run options and the Actor stops exactly at that budget.

### Input

All fields are optional. Within one filter, values are combined with OR; different filters are combined with AND.

| Field                                   | Applies to    | Description                                                                                                                                          |
| --------------------------------------- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| Sources                                 | both          | `opportunities`, `awards` or both (default: both).                                                                                                   |
| Keywords                                | both          | Words or phrases. Opportunities: whole-word match in title, description and solicitation number. Awards: USAspending keyword search (3+ characters). |
| NAICS codes                             | both          | 2 to 6 digits; `5415` covers every code that starts with it.                                                                                         |
| Product or service codes (PSC)          | both          | Exact 4-character codes, e.g. `D302`, `R499`.                                                                                                        |
| Agencies                                | both          | Codes such as `DOD`, `VA`, `GSA`, `HHS`, `DHS` (46 agencies in the form).                                                                            |
| Set-asides                              | both          | `SBA`, `8A`, `HZC`, `SDVOSBC`, `WOSB`, `EDWOSB`, `VSA`, ... (19 types in the form).                                                                  |
| Place of performance (states)           | both          | Two-letter state or territory codes.                                                                                                                 |
| Notice types                            | opportunities | Solicitation, Combined Synopsis/Solicitation, Presolicitation, Sources Sought, Special Notice, Award Notice, ...                                     |
| Posted in the last (days)               | opportunities | Default 14. Use 1 for a daily alert; 0 reads every active notice.                                                                                    |
| Skip notices whose deadline has passed  | opportunities | Default on. Notices without a deadline are kept.                                                                                                     |
| Include the notice description          | opportunities | Default on (up to about 32,000 characters per notice, as SAM.gov publishes it).                                                                      |
| Max opportunities                       | opportunities | Default 100; 0 = no limit.                                                                                                                           |
| Awards signed in the last (days)        | awards        | Default 365. Ignored when you set the dates below.                                                                                                   |
| Award date from / to                    | awards        | An explicit range (YYYY-MM-DD), e.g. a fiscal year. Earliest 2007-10-01.                                                                             |
| Which awards count as in the date range | awards        | `new` (first signed in the range, default) or `activity` (any transaction in the range).                                                             |
| Minimum / maximum award amount          | awards        | Obligated amount in USD.                                                                                                                             |
| Recipients                              | awards        | Company names or UEIs.                                                                                                                               |
| Award order                             | awards        | `newest` (default) or `largest`.                                                                                                                     |
| Include competition details             | awards        | Adds offers received, extent competed, set-aside, pricing type, potential value and end date, parent contract, contracting office, parent company.   |
| Max awards                              | awards        | Default 100; 0 = no limit.                                                                                                                           |
| Maximum results                         | both          | Stop after this many rows in total (default 1,000; 0 = no limit).                                                                                    |
| Max concurrency                         | awards        | Parallel USAspending requests (default 3).                                                                                                           |

Example input: IT services opportunities for SDVOSB firms, plus last fiscal year's largest VA awards in the same codes, with competition details.

```json
{
    "sources": ["opportunities", "awards"],
    "naicsCodes": ["541512", "541519"],
    "setAsides": ["SDVOSBC"],
    "noticeTypes": ["solicitation", "combined", "presolicitation", "sources-sought"],
    "postedWithinDays": 30,
    "agencies": ["VA"],
    "awardDateFrom": "2025-10-01",
    "awardDateTo": "2026-09-30",
    "awardsSortBy": "largest",
    "includeAwardDetails": true,
    "maxOpportunities": 200,
    "maxAwards": 200
}
```

### Output

#### Opportunity rows (`type: "opportunity"`)

| Field                                                                                         | Description                                                                        |
| --------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
| `noticeId`, `title`, `solicitationNumber`, `url`                                              | The notice and its page on SAM.gov.                                                |
| `noticeType`, `baseNoticeType`                                                                | Solicitation, Combined Synopsis/Solicitation, Sources Sought, Award Notice, ...    |
| `postedDate`, `responseDeadline`, `archiveDate`                                               | Dates; the deadline keeps the agency's time zone offset.                           |
| `setAsideCode`, `setAside`                                                                    | Set-aside code and description.                                                    |
| `naicsCode`, `pscCode`                                                                        | Industry and product or service codes.                                             |
| `agency`, `agencyCode`, `subAgency`, `office`, `officeCode`, `officeCity` ... `officeCountry` | The buying department, sub-agency and contracting office.                          |
| `popAddress`, `popCity`, `popState`, `popZip`, `popCountry`                                   | Place of performance, when the notice lists one.                                   |
| `awardId`, `awardDate`, `awardAmount`, `awardee`                                              | On award and justification notices.                                                |
| `primaryContactName`, `primaryContactTitle`, `primaryContactEmail`, `primaryContactPhone`     | The government point of contact listed on the notice (also `secondaryContact...`). |
| `description`                                                                                 | The notice text, when "Include the notice description" is on.                      |

A real opportunity row (description shortened):

```json
{
    "type": "opportunity",
    "noticeId": "9ca676975d1142ef94affba1452edc04",
    "title": "Snow Removal Washington ARTCC & Potomac TRACON/FAA Command Center",
    "solicitationNumber": "697DCK26R00029",
    "noticeType": "Solicitation",
    "baseNoticeType": "Solicitation",
    "postedDate": "2026-10-06",
    "responseDeadline": "2026-10-07T15:00:00-04:00",
    "archiveDate": "2026-10-22",
    "setAsideCode": "SDVOSBC",
    "setAside": "Service-Disabled Veteran-Owned Small Business (SDVOSB) Set-Aside (FAR 19.14)",
    "naicsCode": "561730",
    "pscCode": "S218",
    "agency": "TRANSPORTATION, DEPARTMENT OF",
    "agencyCode": "DOT",
    "subAgency": "FEDERAL AVIATION ADMINISTRATION",
    "office": "697DCK REGIONAL ACQUISITIONS SVCS",
    "officeCode": "697DCK",
    "officeCity": "FORT WORTH",
    "officeState": "TX",
    "officeZip": "76177",
    "officeCountry": "USA",
    "popAddress": null,
    "popCity": "Leesburg",
    "popState": "VA",
    "popZip": "20176",
    "popCountry": "USA",
    "awardId": null,
    "awardDate": null,
    "awardAmount": null,
    "awardee": null,
    "primaryContactName": "Jennifer Walker-Gomez",
    "primaryContactTitle": null,
    "primaryContactEmail": "aaq530proposals@faa.gov",
    "primaryContactPhone": null,
    "secondaryContactName": null,
    "secondaryContactTitle": null,
    "secondaryContactEmail": null,
    "secondaryContactPhone": null,
    "description": "Amendment 0002 -Reponse to submitted questions The Federal Aviation Administration (FAA), Eastern Acquisitions, College Park, GA, is issuing Screening Information Request (SIR) Number 697DCK…",
    "url": "https://sam.gov/opp/9ca676975d1142ef94affba1452edc04/view",
    "scrapedAt": "2026-10-07T12:00:00.000Z"
}
```

#### Award rows (`type: "award"`)

| Field                                                                                                                                              | Description                                                                                       |
| -------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
| `awardId`, `usaspendingId`, `url`                                                                                                                  | Contract number (PIID) and the award's page on USAspending.gov.                                   |
| `description`, `contractType`                                                                                                                      | What was bought; definitive contract, purchase order, delivery order or BPA call.                 |
| `awardAmount`, `totalOutlays`                                                                                                                      | Obligated amount and money paid out (USD).                                                        |
| `awardDate`, `startDate`, `endDate`, `lastModifiedDate`                                                                                            | Signed, period of performance, last update.                                                       |
| `agency`, `agencyCode`, `subAgency`, `fundingAgency`, `fundingSubAgency`                                                                           | Awarding and funding agencies.                                                                    |
| `recipientName`, `recipientUei`, `recipientCity`, `recipientState`, `recipientZip`, `recipientCountry`, `recipientUrl`                             | The winning company and its USAspending profile.                                                  |
| `naicsCode`, `naicsDescription`, `pscCode`, `pscDescription`                                                                                       | Industry and product or service codes.                                                            |
| `popCity`, `popState`, `popZip`, `popCountry`, `popCounty`, `popCongressionalDistrict`                                                             | Place of performance.                                                                             |
| `detailsIncluded`                                                                                                                                  | True when the competition details below were fetched.                                             |
| `numberOfOffers`, `extentCompeted`, `setAsideCode`, `setAside`, `pricingType`, `solicitationId`, `solicitationProcedures`                          | Competition details.                                                                              |
| `currentValue`, `potentialValue`, `potentialEndDate`                                                                                               | Value with exercised options, value with all options, and the last possible end date.             |
| `parentAwardId`, `parentAwardType`, `office`, `recipientParentName`, `recipientParentUei`, `subawardCount`, `subawardAmount`, `businessCategories` | Parent IDIQ/GWAC/schedule, contracting office, parent company, subawards and business categories. |

Without competition details these detail fields are `null`. A real award row with competition details:

```json
{
    "type": "award",
    "awardId": "36C10B23F0346",
    "usaspendingId": "CONT_AWD_36C10B23F0346_3600_47QSWA18D008Q_4732",
    "description": "VA CYBERSECURITY OPERATIONS CENTER NEXT GENERATION II (CSOC NG II) SUPPORT",
    "contractType": "DELIVERY ORDER",
    "awardAmount": 219083824.48,
    "totalOutlays": 147432546.43,
    "awardDate": "2023-09-28",
    "startDate": "2023-09-29",
    "endDate": "2027-09-28",
    "lastModifiedDate": "2026-09-25",
    "agency": "Department of Veterans Affairs",
    "agencyCode": "VA",
    "subAgency": "Department of Veterans Affairs",
    "office": "TECHNOLOGY ACQUISITION CENTER NJ (36C10B)",
    "fundingAgency": "Department of Veterans Affairs",
    "fundingSubAgency": "Department of Veterans Affairs",
    "recipientName": "MAVERIS LLC",
    "recipientUei": "NEKWPBM5VT33",
    "recipientParentName": "MAVERIS LLC",
    "recipientParentUei": "NEKWPBM5VT33",
    "recipientCity": "MCLEAN",
    "recipientState": "VA",
    "recipientZip": "22102",
    "recipientCountry": "USA",
    "naicsCode": "541511",
    "naicsDescription": "CUSTOM COMPUTER PROGRAMMING SERVICES",
    "pscCode": "R499",
    "pscDescription": "SUPPORT- PROFESSIONAL: OTHER",
    "popCity": "MARTINSBURG",
    "popState": "WV",
    "popZip": "25401",
    "popCountry": "USA",
    "popCounty": "BERKELEY",
    "popCongressionalDistrict": "WV-02",
    "detailsIncluded": true,
    "currentValue": 219083824.48,
    "potentialValue": 331158125.88,
    "potentialEndDate": "2028-12-28",
    "numberOfOffers": 3,
    "extentCompeted": "FULL AND OPEN COMPETITION",
    "setAsideCode": "SDVOSBC",
    "setAside": "SERVICE DISABLED VETERAN OWNED SMALL BUSINESS SET-ASIDE",
    "pricingType": "FIRM FIXED PRICE",
    "solicitationId": null,
    "solicitationProcedures": "SUBJECT TO MULTIPLE AWARD FAIR OPPORTUNITY",
    "parentAwardId": "47QSWA18D008Q",
    "parentAwardType": "FSS",
    "subawardCount": 25,
    "subawardAmount": 76546267.95,
    "businessCategories": [
        "Category Business",
        "Corporate Entity Not Tax Exempt",
        "Limited Liability Corporation",
        "Not Designated a Small Business",
        "Special Designations",
        "U.S.-Owned Business"
    ],
    "url": "https://www.usaspending.gov/award/CONT_AWD_36C10B23F0346_3600_47QSWA18D008Q_4732",
    "recipientUrl": "https://www.usaspending.gov/recipient/28acf7d6-a03e-98b2-ae85-d99bbd8c3f6c-C/latest",
    "scrapedAt": "2026-10-07T19:31:01.614Z"
}
```

### Tips

- **Daily bid alert:** set "Posted in the last (days)" to 1, pick your NAICS codes and set-asides, choose only the `opportunities` source, and schedule the Actor every morning. Connect the dataset to email, Slack or Google Sheets.
- **Biddable notices only:** pick the notice types Solicitation, Combined Synopsis/Solicitation, Presolicitation and Sources Sought, and keep "Skip notices whose deadline has passed" on.
- **Incumbent research:** search awards with the same NAICS code and agency as an opportunity, sorted by largest, with competition details on. `endDate` and `potentialEndDate` show when a contract runs out.
- **Competitor tracking:** put company names or UEIs in Recipients and schedule a weekly run with "Awards signed in the last (days)" set to 7.
- **Fiscal years:** the federal fiscal year runs from October 1 to September 30. FY2026 is `2025-10-01` to `2026-09-30`.
- **Smaller exports:** turn off "Include the notice description" for compact opportunity rows; keywords still search the description.

### FAQ

**Is this legal? Does it scrape SAM.gov?**
It does not scrape the SAM.gov website. SAM.gov's terms prohibit automated scraping of the site, so the Actor uses only the channels the government provides for bulk use: the public Contract Opportunities data file that SAM.gov publishes for download (SAM.gov Data Services and data.gov, public access), and the official USAspending.gov API. Both are free public data and need no login or API key. Federal procurement records are public information, and works of the US federal government are not protected by copyright in the United States. You are responsible for how you use the data and for following the laws that apply to you.

**Why are there names, emails and phone numbers in the opportunity rows?**
They are the government points of contact that agencies list on their public notices, usually the contracting officer or contract specialist, so that vendors can ask questions and submit offers. They are federal employees acting in their official role, and contacting them about the notice is exactly what they are listed for. The Actor does not collect any other personal data: award rows contain company information only (recipient city, state and ZIP, no street address), and the executive compensation that USAspending lists for some companies is deliberately left out.

**How fresh is the data?**
SAM.gov refreshes its public opportunities file once a day (around midnight US Eastern time), so notices posted today appear in tomorrow's runs. Notices that SAM.gov has archived or deleted are not in the file. USAspending updates awards daily, but agencies report with a delay, and **Department of Defense awards appear about 90 days after signing** (a DoD reporting delay).

**Why does the state filter return few opportunities?**
Many SAM.gov notices do not list a place of performance, and the state filter only keeps notices that do. Filter by agency, NAICS code or keyword instead, or leave the state filter empty and check `officeState` and `popState` in the results.

**Can I get bid documents (attachments)?**
The public data file does not include attachments. Each row has a `url` to the notice on SAM.gov, where the attachments can be downloaded.

**Do I need a SAM.gov API key?**
No. The official SAM.gov API needs a personal key and allows only 10 requests a day without a registered entity role. This Actor needs neither.

**Why did an opportunities run read many megabytes?**
SAM.gov publishes all active notices in one file, newest first. The Actor reads only as far as your "Posted in the last (days)" window and stops as soon as it has "Max opportunities" rows. A long window with very narrow filters has to read more of the file before it finds matches. Setting 0 reads every active notice (about 75,000 notices).

**Does it include grants or subcontracts?**
Not yet: it covers prime contract awards. Open an issue on the **Issues** tab if you need grants or subawards.

**The run returned fewer results than expected.**
Remove one filter at a time; each filter narrows the results. Check that keywords are spelled as notices write them (e.g. "cybersecurity" and "cyber security" are different words), and that NAICS codes have 2 to 6 digits. If something looks wrong, open an issue on the **Issues** tab and it will be looked at quickly.

# Actor input Schema

## `sources` (type: `array`):

What to get. Opportunities are open and recent notices from SAM.gov (solicitations, RFIs, presolicitations, award notices). Awards are signed contracts from USAspending.gov (who won, how much, from which agency). Each row has a `type` field: `opportunity` or `award`.

## `keywords` (type: `array`):

Words or phrases, e.g. `cybersecurity`, `janitorial services`, `cloud migration`. Opportunities match when a keyword appears as a whole word (plurals included) in the title, description or solicitation number. Awards use USAspending's keyword search, which needs at least 3 characters per keyword.

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

Industry codes, 2 to 6 digits, e.g. `541512` (Computer Systems Design Services). A shorter code matches every code that starts with it: `5415` covers 541511 to 541519.

## `pscCodes` (type: `array`):

Exact 4-character product or service codes, e.g. `D302` (IT systems development) or `R499` (other professional support).

## `agencies` (type: `array`):

Federal departments and agencies. Opportunities match the posting department; awards match the awarding agency.

## `setAsides` (type: `array`):

Small business set-aside types, e.g. SDVOSB, 8(a), HUBZone or WOSB. For awards this is the set-aside recorded on the contract.

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

US states or territories where the work is done. Many SAM.gov notices leave the place of performance empty; they are left out when this filter is set.

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

Only these kinds of notices. For bids you can respond to, pick Solicitation, Combined Synopsis/Solicitation, Presolicitation and Sources Sought. Empty = all types.

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

Only notices posted in the last N days, newest first. Use 1 for a daily alert, 14 to 60 for a first look. 0 = every active notice (the whole file, slower).

## `excludePastDeadlines` (type: `boolean`):

Leaves out notices whose response deadline is already over. Notices without a deadline (e.g. award and special notices) are kept.

## `includeDescription` (type: `boolean`):

Adds the full notice text (up to about 32,000 characters, as SAM.gov publishes it). Turn off for smaller exports; keywords still search it.

## `maxOpportunities` (type: `integer`):

Stop after this many opportunity rows. 0 = no limit.

## `awardsWithinDays` (type: `integer`):

Award date window, counted back from today. Ignored when you set the dates below. USAspending shows Department of Defense awards about 90 days after signing.

## `awardDateFrom` (type: `string`):

Start of the award date range (YYYY-MM-DD), e.g. 2024-10-01 for fiscal year 2025. Earliest: 2007-10-01.

## `awardDateTo` (type: `string`):

End of the award date range (YYYY-MM-DD). Empty = today.

## `awardDateType` (type: `string`):

New awards: contracts first signed in the range. Any activity: contracts with any transaction (modification, new money) in the range, which also catches older contracts that are still active.

## `minAwardAmount` (type: `integer`):

Only awards with at least this much obligated.

## `maxAwardAmount` (type: `integer`):

Only awards with at most this much obligated.

## `recipients` (type: `array`):

Company names or UEIs, e.g. `Booz Allen` or `NEKWPBM5VT33`, to research a competitor's or teaming partner's contracts.

## `awardsSortBy` (type: `string`):

Newest first (by signing date) or largest first (by obligated amount).

## `includeAwardDetails` (type: `boolean`):

Adds number of offers received, extent competed, set-aside, contract pricing type, potential value with options, potential end date, parent contract (IDIQ/GWAC/schedule), contracting office and the recipient's parent company. One extra request per award; rows are billed as "award with details".

## `maxAwards` (type: `integer`):

Stop after this many award rows. 0 = no limit.

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

Stop after this many rows in total (opportunities plus awards). 0 = no limit. You are only charged for rows you receive.

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

Parallel requests to USAspending, also the most started per second. The default is deliberately polite, and the Actor slows down automatically if asked to.

## Actor input object example

```json
{
  "sources": [
    "opportunities",
    "awards"
  ],
  "naicsCodes": [
    "541512",
    "541511"
  ],
  "postedWithinDays": 14,
  "excludePastDeadlines": true,
  "includeDescription": true,
  "maxOpportunities": 20,
  "awardsWithinDays": 365,
  "awardDateType": "new",
  "awardsSortBy": "newest",
  "includeAwardDetails": false,
  "maxAwards": 20,
  "maxItems": 1000,
  "maxConcurrency": 3
}
```

# 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 = {
    "naicsCodes": [
        "541512",
        "541511"
    ],
    "maxOpportunities": 20,
    "maxAwards": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("thisisb3/sam-gov-contracts-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 = {
    "naicsCodes": [
        "541512",
        "541511",
    ],
    "maxOpportunities": 20,
    "maxAwards": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("thisisb3/sam-gov-contracts-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 '{
  "naicsCodes": [
    "541512",
    "541511"
  ],
  "maxOpportunities": 20,
  "maxAwards": 20
}' |
apify call thisisb3/sam-gov-contracts-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,thisisb3/sam-gov-contracts-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/P04JRQKnQKwrnotoa/builds/Od26uSSt5x4y2or9R/openapi.json
