# US Government Contracts Scraper — Federal Awards (`hichemdev/govcontracts-scraper`) Actor

Scrape US federal contracts and grants from USAspending: award ID, recipient, amount, awarding agency, period of performance and NAICS code. Filter by keyword, agency, recipient, state or NAICS. No API key.

- **URL**: https://apify.com/hichemdev/govcontracts-scraper.md
- **Developed by:** [Hichem Ben Moussa](https://apify.com/hichemdev) (community)
- **Categories:** Business, Lead generation, News
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.00 / 1,000 awards

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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

## US Government Contracts Scraper — Federal Awards

Scrape **US federal contracts and grants** from the official **USAspending** database — **award ID, recipient, dollar amount, awarding agency, period of performance, NAICS industry code and description**. No API key.

### What you can do with it

- 🏛️ **GovCon business development** — find who's winning work in your NAICS
- 🕵️ **Competitor intelligence** — track a rival contractor's awards and agencies
- 🤝 **Teaming & subcontracting** — identify primes to partner with
- 📊 **Market sizing** — total spend by agency, industry or state
- 🔔 **Award monitoring** — schedule it and diff for new awards

### Input

| Field | Type | Description |
|-------|------|-------------|
| `keyword` | string | Free-text across descriptions, e.g. `cybersecurity`, `construction`. |
| `recipientName` | string | A specific contractor, e.g. `Lockheed Martin`. |
| `agencyName` | string | Awarding agency, e.g. `Department of Defense`. |
| `awardTypes` | array | Contract types (A–D) and/or grant types (02–05). |
| `stateCode` | string | Place-of-performance state, e.g. `VA`. |
| `naicsCodes` | array | Industry codes, e.g. `541511`. |
| `startDate` / `endDate` | string | `YYYY-MM-DD` award period window. |
| `minAmount` | integer | Only awards at or above this amount. |
| `maxResults` | integer | Max awards to scrape. |

#### Example

```json
{ "keyword": "cybersecurity", "agencyName": "Department of Defense", "startDate": "2025-01-01", "minAmount": 1000000, "maxResults": 500 }
```

### Output

```json
{
  "awardId": "HT940216C0001",
  "recipientName": "LOCKHEED MARTIN CORPORATION",
  "amount": 666315749,
  "awardingAgency": "Department of Defense",
  "awardingSubAgency": "Defense Health Agency",
  "startDate": "2025-03-01",
  "endDate": "2029-02-28",
  "description": "CYBERSECURITY SUPPORT SERVICES",
  "performanceState": "VA",
  "naicsCode": "541512",
  "naicsDescription": "Computer Systems Design Services",
  "url": "https://www.usaspending.gov/award/..."
}
```

Export to JSON, CSV, Excel, or pull live via the Apify API.

### Notes

- Sourced from **USAspending.gov**, the official federal spending database — authoritative and updated continuously.
- Results are sorted by award amount (largest first).
- Grants and cooperative agreements are available too — set `awardTypes` to the `02`–`05` codes.

# Actor input Schema

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

Free-text search across award descriptions, e.g. "cybersecurity", "construction", "software".

## `recipientName` (type: `string`):

Search awards for a specific contractor, e.g. "Lockheed Martin", "Deloitte".

## `agencyName` (type: `string`):

Top-tier awarding agency, e.g. "Department of Defense", "Department of Health and Human Services".

## `awardTypes` (type: `array`):

Contract types (A-D) or grants (02-05). Default covers all contract types.

## `stateCode` (type: `string`):

Two-letter US state code where the work is performed, e.g. CA, VA, TX.

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

Industry codes to include, e.g. "541511" (custom programming), "236220" (commercial construction).

## `startDate` (type: `string`):

Award period start, format YYYY-MM-DD.

## `endDate` (type: `string`):

Award period end, format YYYY-MM-DD. Defaults to today.

## `minAmount` (type: `integer`):

Only include awards at or above this dollar amount.

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

Maximum number of awards to scrape.

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

Optional. The USAspending API is public and works without a proxy.

## Actor input object example

```json
{
  "keyword": "cybersecurity",
  "awardTypes": [
    "A",
    "B",
    "C",
    "D"
  ],
  "naicsCodes": [],
  "startDate": "2025-01-01",
  "maxResults": 30,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `results` (type: `string`):

All scraped items as JSON.

## `overview` (type: `string`):

Browse results in the Apify Console.

# 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 = {
    "keyword": "cybersecurity",
    "recipientName": "",
    "agencyName": "",
    "awardTypes": [
        "A",
        "B",
        "C",
        "D"
    ],
    "stateCode": "",
    "naicsCodes": [],
    "startDate": "2025-01-01",
    "endDate": "",
    "maxResults": 30
};

// Run the Actor and wait for it to finish
const run = await client.actor("hichemdev/govcontracts-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 = {
    "keyword": "cybersecurity",
    "recipientName": "",
    "agencyName": "",
    "awardTypes": [
        "A",
        "B",
        "C",
        "D",
    ],
    "stateCode": "",
    "naicsCodes": [],
    "startDate": "2025-01-01",
    "endDate": "",
    "maxResults": 30,
}

# Run the Actor and wait for it to finish
run = client.actor("hichemdev/govcontracts-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 '{
  "keyword": "cybersecurity",
  "recipientName": "",
  "agencyName": "",
  "awardTypes": [
    "A",
    "B",
    "C",
    "D"
  ],
  "stateCode": "",
  "naicsCodes": [],
  "startDate": "2025-01-01",
  "endDate": "",
  "maxResults": 30
}' |
apify call hichemdev/govcontracts-scraper --silent --output-dataset

```

## MCP server setup

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