# Incumbent Finder for SAM.gov Opportunities (USASpending) (`dennydevelops/sam-incumbent-finder`) Actor

For each open SAM.gov contract opportunity, find the likely incumbent: who holds the current contract, its value and end date, with a confidence score. Official SAM.gov and USASpending.gov data.

- **URL**: https://apify.com/dennydevelops/sam-incumbent-finder.md
- **Developed by:** [Musedenny](https://apify.com/dennydevelops) (community)
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event + usage

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

## Incumbent Finder for SAM.gov Opportunities

For each open federal contract opportunity on SAM.gov, this Actor finds the **likely incumbent**: the company holding the current contract, what it's worth, when it ends, and how confident the match is. It answers the first question in every bid/no-bid decision, *"who has it now and when does it expire?"*, from official government data.

### How it works

1. Reads the official SAM.gov Contract Opportunities extract (public, no API key) and keeps the opportunities that match your filters (NAICS, state, set-aside, notice type, keywords, posted date).
2. For each opportunity, searches USASpending.gov for contracts from the **same agency**, with the **same NAICS** and **place of performance**, over the last N years. It runs a second search on the title's key words.
3. Scores each candidate on description similarity, same PSC, same NAICS, same state, and an end date inside the recompete window. Returns the best match and runners-up.

### Input

| Field | Default | Meaning |
|---|---|---|
| `naicsCodes` | `["5415"]` | NAICS codes or prefixes |
| `states` | – | Place of performance |
| `setAsideCodes` | – | e.g. `SBA`, `8A`, `SDVOSBC`, `WOSB`, `HZC`, `NONE` |
| `noticeTypes` | Solicitations, presolicitations, sources sought | Which notices to enrich |
| `keywords` | – | Any word in the title or description |
| `postedWithinDays` | 7 | 1–30 |
| `maxOpportunities` | 25 | Cap on work and cost (max 500) |
| `lookbackYears` | 6 | How far back to look for the incumbent contract |
| `candidatesPerOpportunity` | 3 | Matches returned |

### Output (one item per opportunity)

```json
{
  "noticeId": "…", "title": "DA10--PowerScribe 360 and Upgrade - Three-Year…", "agency": "VETERANS AFFAIRS, DEPARTMENT OF",
  "naicsCode": "541519", "responseDeadline": "…", "link": "https://sam.gov/opp/…/view",
  "likelyIncumbent": {
    "recipient": "V3GATE, LLC", "amount": 1131718.81, "startDate": "…", "endDate": "2027-06-15",
    "description": "POWERSCRIBE ONE LICENSES FOR VA NATIONAL TELERADIOLOGY…",
    "matchScore": 46.0, "matchReasons": ["description overlap 18%", "same PSC", "same NAICS", "same state", "ends within the recompete window"],
    "url": "https://www.usaspending.gov/award/CONT_AWD_…"
  },
  "confidence": "medium",
  "otherCandidates": [ … ]
}
```

`confidence` is `high` (score ≥55), `medium` (≥35), `low` (≥30) or `none`. These are matches on public data, not a statement from the agency: always check the award link. A brand-new requirement has no incumbent, and some contracts are run under a different agency or a multi-agency vehicle.

### Pricing (pay per event)

$0.003 per run and **$0.01 per opportunity enriched**. A weekly run of 25 opportunities costs about $0.25.

### Data sources

[SAM.gov Contract Opportunities data extract](https://sam.gov/data-services) and the [USASpending.gov API](https://api.usaspending.gov), both official and public.

# Actor input Schema

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

2-6 digit codes or prefixes.

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

Place of performance (office if missing), two-letter codes.

## `setAsideCodes` (type: `array`):

e.g. SBA, 8A, SDVOSBC, WOSB, HZC; NONE for unrestricted.

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

Which opportunities to enrich.

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

Match in opportunity title or description.

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

Opportunities posted in the last N days.

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

Caps work and cost per run.

## `lookbackYears` (type: `integer`):

How far back to look for the incumbent contract.

## `candidatesPerOpportunity` (type: `integer`):

Top matches returned (best first).

## Actor input object example

```json
{
  "naicsCodes": [
    "5415"
  ],
  "noticeTypes": [
    "Solicitation",
    "Combined Synopsis/Solicitation",
    "Presolicitation",
    "Sources Sought"
  ],
  "postedWithinDays": 7,
  "maxOpportunities": 25,
  "lookbackYears": 6,
  "candidatesPerOpportunity": 3
}
```

# Actor output Schema

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

No description

## `summary` (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": [
        "5415"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("dennydevelops/sam-incumbent-finder").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": ["5415"] }

# Run the Actor and wait for it to finish
run = client.actor("dennydevelops/sam-incumbent-finder").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": [
    "5415"
  ]
}' |
apify call dennydevelops/sam-incumbent-finder --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,dennydevelops/sam-incumbent-finder"
        }
    }
}
```

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/nGdJZaQrqpxqelq2A/builds/cWFBHyXBwnKNAsDAS/openapi.json
