# USASpending Federal Contracts & B2G Awards Scraper (`perceptive_city_af7/usaspending-gov-contracts-scraper`) Actor

Official USASpending.gov API scraper for US federal prime contract awards, defense & agency spend, NAICS/PSC codes, contractor names & award amounts. Clean JSON for B2G sales lead gen & market intel. No API key.

- **URL**: https://apify.com/perceptive_city_af7/usaspending-gov-contracts-scraper.md
- **Developed by:** [fall Rainy](https://apify.com/perceptive_city_af7) (community)
- **Categories:** Lead generation, Automation, AI
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 usaspending federal award records

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

## USASpending Federal Contracts & Grants (美国联邦政府合同与拨款)

**Zero-Playwright pure-REST Actor** for the official **U.S. Treasury USAspending.gov API v2** (`https://api.usaspending.gov/api/v2/search/spending_by_award/`). Authoritative **U.S. Government Public Domain (17 U.S.C. § 105)** — explicit commercial reuse allowed, **zero API key**, **zero login**, **zero PII**.

**Zero-Playwright 纯 REST Actor**，直连 **美国财政部 USAspending.gov 官方 API v2**。数据为 **美国政府公有领域（17 U.S.C. § 105）**，**明确允许商业复用**，**无需 API Key**，**无需登录**，**零 PII**。

***

### Keywords / 关键词

`美国联邦政府合同` · `政府采购` · `联邦拨款` · `军工合同` · `GovCon` · `USASpending` · `DoD Contracts` · `Federal Grants` · `IDV` · `NAICS` · `B2B Sales Intelligence`

***

### What It Does / 功能简介

Pull authoritative U.S. federal contract, grant, and IDV award data from the Treasury's DATA Act source — no scraping, no headless browser, no login. Every record is a clean, 18-field schema ready for GovCon pipelines, B2B sales intelligence, financial research, and LLM/RAG.

从美国财政部 DATA Act 官方数据源抓取权威的联邦合同、拨款和 IDV 授予数据——无需爬取、无需浏览器、无需登录。每条记录均为干净的 18 字段规范结构，可直接用于 GovCon 流程、B2B 销售情报、金融研究与 LLM/RAG。

**Why teams use it / 为什么选择它**

- ⚡ **Fast pure REST** — direct API call, no Playwright, no browser overhead / 纯 REST 直连 API，无 Playwright、无浏览器开销
- 🏛️ **Authoritative Treasury DATA Act source** — the same records behind USAspending.gov / 财政部 DATA Act 权威源，与 USAspending.gov 同源
- ✅ **Commercial-safe public domain** — 17 U.S.C. § 105, reuse freely in commercial products / 公有领域，可自由商用
- 🔒 **Zero PII** — only award-level public records, no personal data / 仅公开授予级记录，绝无个人隐私数据
- 🔑 **No API key, no login** — just run it / 无需 API Key，无需登录，开箱即用
- 🧱 **Clean 18-field schema** — purpose-built for GovCon, B2B sales intelligence, financial research, and LLM/RAG ingestion / 为 GovCon、B2B 销售情报、金融研究与 LLM/RAG 量身打造的规范结构

***

### Input Parameters / 输入参数

| Field | Type | Default | Description / 说明 |
|---|---|---|---|
| `keyword` | string | `""` | Full-text keyword to search award descriptions / 全文关键词搜索 |
| `awardCategory` | string enum | `"contracts"` | `"contracts"` | `"grants"` | `"idvs"` — award type filter / 授予类型筛选 |
| `startDate` | string | `"2025-01-01"` | Award start date, `YYYY-MM-DD` / 起始日期 |
| `endDate` | string | `"2026-12-31"` | Award end date, `YYYY-MM-DD` / 结束日期 |
| `awardingAgency` | string | `""` | Awarding agency name filter, e.g. `"Department of Defense"` / 授予机构名称 |
| `minAwardAmount` | number | — | Minimum award amount (USD, optional) / 最低授予金额（美元，可选） |
| `naicsCode` | string | `""` | NAICS industry code, e.g. `"541511"` / NAICS 行业代码 |
| `sortOrder` | string enum | `"desc"` | `"desc"` | `"asc"` — sort by award amount / 按授予金额排序 |
| `maxItems` | integer | `10` | Max records to return, range `1–5000` / 最多返回条数，1–5000 |

***

### Example Inputs / 输入示例

**1) AI contracts at DoD / 国防部 AI 合同**

```json
{
  "keyword": "artificial intelligence",
  "awardCategory": "contracts",
  "awardingAgency": "Department of Defense",
  "startDate": "2025-01-01",
  "endDate": "2026-12-31",
  "maxItems": 100
}
```

**2) Software NAICS 541511 ≥ $1M / 软件行业 NAICS 541511 不低于 100 万美元**

```json
{
  "awardCategory": "contracts",
  "naicsCode": "541511",
  "minAwardAmount": 1000000,
  "sortOrder": "desc",
  "maxItems": 200
}
```

**3) HHS healthcare grants / 卫生部医疗拨款**

```json
{
  "keyword": "healthcare",
  "awardCategory": "grants",
  "awardingAgency": "Department of Health and Human Services",
  "startDate": "2025-01-01",
  "endDate": "2026-12-31",
  "maxItems": 500
}
```

**4) NASA IDV vehicles / NASA IDV 采购工具**

```json
{
  "awardCategory": "idvs",
  "awardingAgency": "National Aeronautics and Space Administration",
  "startDate": "2024-01-01",
  "endDate": "2026-12-31",
  "sortOrder": "desc",
  "maxItems": 50
}
```

***

### Output Fields / 输出字段 (18)

| Field | Type | Description / 说明 |
|---|---|---|
| `generatedInternalId` | string | Internal unique record ID / 内部唯一记录 ID |
| `awardId` | string | Official award / contract number / 官方授予编号 |
| `awardCategory` | string | `contracts` | `grants` | `idvs` / 授予类别 |
| `recipientName` | string | Award recipient (company/institution) / 获奖方（企业/机构） |
| `awardAmount` | number | Award amount in USD / 授予金额（美元） |
| `startDate` | string | Award start date / 起始日期 |
| `endDate` | string | Award end date / 结束日期 |
| `awardingAgency` | string | Top-level awarding agency / 授予机构 |
| `awardingSubAgency` | string | Sub-agency / office / 下级机构 |
| `awardType` | string | Contract or grant type code / 合同或拨款类型 |
| `description` | string | Award description / 授予描述 |
| `placeOfPerformanceCityCode` | string | City code of performance / 履约城市代码 |
| `placeOfPerformanceStateCode` | string | State code of performance / 履约州代码 |
| `placeOfPerformanceCountryCode` | string | Country code of performance / 履约国家代码 |
| `naicsCode` | string | NAICS industry code / NAICS 行业代码 |
| `naicsDescription` | string | NAICS industry description / NAICS 行业描述 |
| `awardUrl` | string | Direct link to award on USAspending.gov / 官方授予页面链接 |
| `attribution` | string | Source/legal attribution string / 来源与许可声明 |

***

### Sample Output / 输出示例

```json
{
  "generatedInternalId": "CONT_AWD_W911NF25C0123_9700_-NONE-_-NONE-",
  "awardId": "W911NF-25-C-0123",
  "awardCategory": "contracts",
  "recipientName": "PALANTIR TECHNOLOGIES INC.",
  "awardAmount": 18525000.0,
  "startDate": "2025-03-01",
  "endDate": "2027-02-28",
  "awardingAgency": "Department of Defense",
  "awardingSubAgency": "Department of the Army",
  "awardType": "DEFINITIVE CONTRACT",
  "description": "ARTIFICIAL INTELLIGENCE DATA FUSION PLATFORM SUPPORT SERVICES",
  "placeOfPerformanceCityCode": "80325",
  "placeOfPerformanceStateCode": "VA",
  "placeOfPerformanceCountryCode": "USA",
  "naicsCode": "541511",
  "naicsDescription": "CUSTOM COMPUTER PROGRAMMING SERVICES",
  "awardUrl": "https://www.usaspending.gov/award/CONT_AWD_W911NF25C0123_9700_-NONE-_-NONE-",
  "attribution": "Source: USAspending.gov Official Public API v2 (https://api.usaspending.gov/) — U.S. Government Public Domain (17 U.S.C. § 105), accessed 2026-01-15."
}
```

***

### Pricing — Pay-per-event (PPE) / 按事件计费

| Event | Price | Notes / 说明 |
|---|---|---|
| `apify-actor-start` | **$0.00005** | Includes first 5s compute free / 含前 5 秒免费计算 |
| `apify-default-dataset-item` | **$0.005** per record | **$5.00 per 1,000 records** / 每 1,000 条 5 美元 |

**Cost examples / 费用示例**

| Records | Total cost / 总费用 |
|---|---|
| 10 | **$0.05005** |
| 100 | **$0.50005** |
| 1,000 | **$5.00005** |

***

### Data License & Zero PII / 数据许可与零 PII

- **Public domain:** U.S. federal government works are not subject to copyright under **17 U.S.C. § 105** — free for **commercial reuse**, redistribution, and derivative work. / 根据 **17 U.S.C. § 105**，美国联邦政府作品不受版权保护，可**自由商用**、再分发与二次创作。
- **DATA Act source:** Records originate from the Treasury's **DATA Act** reporting via USAspending.gov API v2. / 数据源自财政部 DATA Act 上报体系，经 USAspending.gov API v2 提供。
- **Zero PII:** Only award-level public records are returned; no personal or individual data is collected or stored. / 仅返回授予级公开记录，不采集、不存储任何个人隐私数据。
- **Attribution:** An `attribution` field is embedded in every record for full source transparency. / 每条记录均内嵌 `attribution` 字段，确保来源完整可追溯。

***

### Notes & Limits / 说明与限制

- **Zero Playwright:** Pure HTTP REST against the official API — fast and stable. / 纯 HTTP REST 调用官方 API，快速稳定。
- **Pagination:** Automatically pages through the API until `maxItems` is reached. / 自动分页直至达到 `maxItems`。
- **5000 cap:** Hard maximum of **5,000 records per run** (`maxItems` 1–5000); split into multiple runs for larger pulls. / 单次运行最多 **5,000 条**，更大规模请拆分多次运行。
- **NAICS / agency tips:** Use exact agency names (`Department of Defense`) and 6-digit NAICS codes for best precision. / 建议使用准确机构名称与 6 位 NAICS 代码以提升精度。
- **Empty results:** A run may return 0 records if filters are too narrow — broaden dates, keyword, or agency. / 过滤条件过窄可能返回 0 条，请放宽条件。
- **Not legal/financial advice:** Data is provided as-is for research and intelligence purposes only. / 数据按“原样”提供，仅供研究与情报用途，不构成法律或财务建议。

# Actor input Schema

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

Optional free-text search keyword to filter awards (e.g., 'cybersecurity', 'construction').

## `awardCategory` (type: `string`):

Select the type of federal award to retrieve.

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

Start date for award action date in YYYY-MM-DD format.

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

End date for award action date in YYYY-MM-DD format.

## `awardingAgency` (type: `string`):

Optional awarding agency name filter, e.g., 'Department of Defense'. Leave empty for all agencies.

## `minAwardAmount` (type: `number`):

Optional minimum federal award amount in USD. Only awards with amount >= this value are returned.

## `naicsCode` (type: `string`):

Optional NAICS code filter, e.g., '541511' for custom computer programming services.

## `sortOrder` (type: `string`):

Sort awards by federal award amount.

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

Maximum number of award records to retrieve (1-5000).

## Actor input object example

```json
{
  "keyword": "",
  "awardCategory": "contracts",
  "startDate": "2025-01-01",
  "endDate": "2026-12-31",
  "awardingAgency": "",
  "naicsCode": "",
  "sortOrder": "desc",
  "maxItems": 10
}
```

# Actor output Schema

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

Deduplicated U.S. federal contracts, grants, and IDV awards with U.S. Government Public Domain attribution.

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("perceptive_city_af7/usaspending-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 = {}

# Run the Actor and wait for it to finish
run = client.actor("perceptive_city_af7/usaspending-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 '{}' |
apify call perceptive_city_af7/usaspending-gov-contracts-scraper --silent --output-dataset

```

## MCP server setup

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