# US Federal Spending & Contracts - USAspending API (`channel_l/us-federal-spending-contracts`) Actor

- **URL**: https://apify.com/channel\_l/us-federal-spending-contracts.md
- **Developed by:** [Channel L](https://apify.com/channel_l) (community)
- **Categories:** Travel
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$1.00 / 1,000 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?

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 Spending & Contracts (USAspending API)

Get **US federal contract/award data** — contracts, grants, loans, direct payments — from the public [USAspending](https://www.usaspending.gov) API. **No API key required.**

Search by keyword (recipient, agency, description), award type, and sort by amount/outlays. Great for market research, contractor discovery, bid intelligence, and government-spending tracking.

### What you get per award

- Award ID, type, recipient, amount & outlays
- Awarding agency + sub-agency
- Description, NAICS code
- Start/end dates, locations

### Why it

- Official US open-data source (transparent spending)
- No API key, no login
- Use cases: contractor lead gen, market intelligence, compliance, journalism, financial analytics

### Input

| Field | Type | Description |
|---|---|---|
| searchText | string | Keyword (recipient/agency/description) |
| awardType | select | contracts / grants / loans / direct\_payment / all |
| limit | integer | Max results (1–5000) |
| sortBy | select | Total Outlays / Award Amount / dates |

### Example

Input `searchText:"construction", awardType:"contracts", limit:10` → 10 largest construction contracts with recipient, amount, agency.

### Fair use

Data from USAspending.gov, US federal open data, public domain.

# Actor input Schema

## `searchText` (type: `string`):

Keyword to search across awards (recipient, agency, description, award ID). E.g. "construction", "NASA", a company name.

## `awardType` (type: `string`):

Type of federal award to fetch.

## `limit` (type: `integer`):

Maximum number of awards to return (1-5000).

## `sortBy` (type: `string`):

Sort awards by this field.

## Actor input object example

```json
{
  "searchText": "construction",
  "awardType": "contracts",
  "limit": 100,
  "sortBy": "Total Outlays"
}
```

# Actor output Schema

## `datasetJson` (type: `string`):

Link to the full contracts dataset in JSON.

## `datasetCsv` (type: `string`):

Download contracts as CSV.

## `totalAwards` (type: `string`):

Number of award records in the dataset.

# 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 = {
    "searchText": "construction",
    "awardType": "contracts",
    "sortBy": "Total Outlays"
};

// Run the Actor and wait for it to finish
const run = await client.actor("channel_l/us-federal-spending-contracts").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 = {
    "searchText": "construction",
    "awardType": "contracts",
    "sortBy": "Total Outlays",
}

# Run the Actor and wait for it to finish
run = client.actor("channel_l/us-federal-spending-contracts").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 '{
  "searchText": "construction",
  "awardType": "contracts",
  "sortBy": "Total Outlays"
}' |
apify call channel_l/us-federal-spending-contracts --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,channel_l/us-federal-spending-contracts"
        }
    }
}

```

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/i3a83NBfibi8hZQPf/builds/ibU24PlRtko1oLOdt/openapi.json
