# SAM.gov API

> SAM.gov returns federal contract notices and related details as a workflow and API.

SAM.gov returns federal contract notices through Search contract opportunities, which requires keywords. Optional inputs filter by agency, state, set-aside, notice type, and posting period. Results include notice details such as agency, industry, posting date, deadline, and performance location; award notices are included when selected.

- Page: https://fous.com/tools/sam-gov
- Handle: `@sam-gov`
- Category: [Government](https://fous.com/tools/category/government)
- Source website: https://sam.gov
- Last verified: Sep 29, 2026

## Methods

### Search contract opportunities

Operation `search_contract_opportunities`, version 1. 1 credit per completed call. Failed calls without a completed billing receipt are free; completed work can remain charged if delivery is interrupted.

Find active federal contract notices matching keywords, agency, place of performance, set-aside, notice type, and posting period. Results include award notices when selected; fields not published on a notice are null.

**Input**

| Field | Type | Required | Example | Description |
|---|---|---|---|---|
| `state` | string | no | `"TX"` | Place-of-performance state, such as Texas or TX. |
| `agency` | string | no | `"Department of Veterans Affairs"` | Federal agency name, such as Department of Veterans Affairs. |
| `keywords` | string | yes | `"janitorial services"` | Words to search for, such as janitorial services. |
| `set_aside` | string | no | `"hubzone"` | Business preference, such as hubzone. |
| `max_results` | integer | no | `5` | Maximum notices to return, such as 25. |
| `notice_type` | string | no | `"solicitation"` | Kind of notice, such as solicitation. |
| `posted_within_days` | integer | no |  | Only notices posted within this many days, such as 30. |

**Input schema**

```json
{
  "type": "object",
  "required": [
    "keywords"
  ],
  "properties": {
    "state": {
      "type": "string",
      "description": "Place-of-performance state, such as Texas or TX.",
      "examples": [
        "TX"
      ]
    },
    "agency": {
      "type": "string",
      "description": "Federal agency name, such as Department of Veterans Affairs.",
      "examples": [
        "Department of Veterans Affairs"
      ]
    },
    "keywords": {
      "type": "string",
      "minLength": 1,
      "description": "Words to search for, such as janitorial services.",
      "examples": [
        "janitorial services",
        "cybersecurity"
      ]
    },
    "set_aside": {
      "enum": [
        "any",
        "small_business",
        "women_owned",
        "veteran_owned",
        "service_disabled_veteran_owned",
        "hubzone",
        "8a"
      ],
      "type": "string",
      "default": "any",
      "description": "Business preference, such as hubzone.",
      "examples": [
        "hubzone"
      ]
    },
    "max_results": {
      "type": "integer",
      "default": 25,
      "maximum": 100,
      "minimum": 1,
      "description": "Maximum notices to return, such as 25.",
      "x-fous-developer": true,
      "examples": [
        5,
        3
      ]
    },
    "notice_type": {
      "enum": [
        "any",
        "solicitation",
        "presolicitation",
        "sources_sought",
        "combined_synopsis",
        "award_notice"
      ],
      "type": "string",
      "default": "any",
      "description": "Kind of notice, such as solicitation.",
      "examples": [
        "solicitation"
      ]
    },
    "posted_within_days": {
      "type": "integer",
      "default": 30,
      "maximum": 365,
      "minimum": 1,
      "description": "Only notices posted within this many days, such as 30.",
      "x-fous-developer": true
    }
  },
  "additionalProperties": false,
  "examples": [
    {
      "state": "TX",
      "keywords": "janitorial services",
      "set_aside": "hubzone",
      "max_results": 5,
      "notice_type": "solicitation"
    },
    {
      "keywords": "janitorial services"
    },
    {
      "agency": "Department of Veterans Affairs",
      "keywords": "janitorial services",
      "max_results": 5
    }
  ]
}
```

**Output**

| Field | Type | Example | Description |
|---|---|---|---|
| `opportunities` | array |  |  |
| `opportunities[].link` | string or null | `"https://sam.gov/workspace/contract/opp/68a0912bb79e4c43b3bb5085e50aff3b/view"` | SAM.gov notice page |
| `opportunities[].title` | string or null | `"Fort Hood Installation Custodial Services"` | Notice title |
| `opportunities[].agency` | string or null | `"DEPT OF DEFENSE"` | Federal agency |
| `opportunities[].office` | string or null | `"W6QM MICC-FDO FT CAVAZOS"` | Contracting office |
| `opportunities[].industry` | string or null | `"Janitorial Services"` | Industry name |
| `opportunities[].notice_id` | string or null | `"68a0912bb79e4c43b3bb5085e50aff3b"` | SAM.gov notice ID |
| `opportunities[].set_aside` | string or null | `"HUBZone Set Aside"` | Business set-aside name |
| `opportunities[].naics_code` | string or null | `"561720"` | NAICS code |
| `opportunities[].notice_type` | string or null | `"Solicitation"` | Notice type |
| `opportunities[].posted_date` | string or null | `"2026-09-25"` | Posting date in YYYY-MM-DD |
| `opportunities[].response_deadline` | string or null | `"2026-10-07T10:00:00-05:00"` | Response deadline with time zone |
| `opportunities[].solicitation_number` | string or null | `"W91151-26-R-A004"` | Solicitation number |
| `opportunities[].place_of_performance` | string or null | `"Fort Hood, Texas, UNITED STATES"` | Performance location |

**Example input**

```json
{
  "state": "TX",
  "keywords": "janitorial services",
  "set_aside": "hubzone",
  "max_results": 5,
  "notice_type": "solicitation"
}
```

**Example output**

```json
{
  "opportunities": [
    {
      "link": "https://sam.gov/workspace/contract/opp/68a0912bb79e4c43b3bb5085e50aff3b/view",
      "title": "Fort Hood Installation Custodial Services",
      "agency": "DEPT OF DEFENSE",
      "office": "W6QM MICC-FDO FT CAVAZOS",
      "industry": "Janitorial Services",
      "notice_id": "68a0912bb79e4c43b3bb5085e50aff3b",
      "set_aside": "HUBZone Set Aside",
      "naics_code": "561720",
      "notice_type": "Solicitation",
      "posted_date": "2026-09-25",
      "response_deadline": "2026-10-07T10:00:00-05:00",
      "solicitation_number": "W91151-26-R-A004",
      "place_of_performance": "Fort Hood, Texas, UNITED STATES"
    }
  ]
}
```

## Quick start

Replace `YOUR_API_KEY` with a Fous API key. To create one, open Developers at the bottom of Fous Studio, turn on Developer mode, then go to API keys (https://app.fous.com/keys). Change the values in `input` to run the same tool on new data.

```bash
curl 'https://api.fous.com/v1/query' \
  --fail-with-body --silent --show-error --max-time 180 \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "api": "@sam-gov",
  "visibility": "public",
  "operation": "search_contract_opportunities",
  "version": 1,
  "input": {
    "state": "TX",
    "keywords": "janitorial services",
    "set_aside": "hubzone",
    "max_results": 5,
    "notice_type": "solicitation"
  },
  "response": {
    "format": "json"
  }
}'
```

```python
# Save as fous.py and run with python3 fous.py. No packages needed.
import json
import urllib.error
import urllib.request

api_key = "YOUR_API_KEY"

body = json.loads("{\n  \"api\": \"@sam-gov\",\n  \"visibility\": \"public\",\n  \"operation\": \"search_contract_opportunities\",\n  \"version\": 1,\n  \"input\": {\n    \"state\": \"TX\",\n    \"keywords\": \"janitorial services\",\n    \"set_aside\": \"hubzone\",\n    \"max_results\": 5,\n    \"notice_type\": \"solicitation\"\n  },\n  \"response\": {\n    \"format\": \"json\"\n  }\n}")
request = urllib.request.Request(
    "https://api.fous.com/v1/query",
    data=json.dumps(body).encode("utf-8"),
    headers={
        "Authorization": f"Bearer {api_key}",
        "Content-Type": "application/json",
    },
    method="POST",
)
try:
    with urllib.request.urlopen(request, timeout=180) as response:
        result = json.load(response)
except urllib.error.HTTPError as error:
    raise RuntimeError(f"HTTP {error.code}: {error.read().decode('utf-8', errors='replace')}") from error
if result.get("success") is False:
    raise RuntimeError(result.get("error", {}).get("message", "Request failed"))
print(json.dumps(result["data"]["output"], indent=2))
```

```typescript
// Save as fous.mts and run with npx tsx fous.mts.
const apiKey = "YOUR_API_KEY";

const response = await fetch("https://api.fous.com/v1/query", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${apiKey}`,
    "Content-Type": "application/json",
  },
  signal: AbortSignal.timeout(180_000),
  body: JSON.stringify({
  "api": "@sam-gov",
  "visibility": "public",
  "operation": "search_contract_opportunities",
  "version": 1,
  "input": {
    "state": "TX",
    "keywords": "janitorial services",
    "set_aside": "hubzone",
    "max_results": 5,
    "notice_type": "solicitation"
  },
  "response": {
    "format": "json"
  }
}),
});
type ApiResult = { success: boolean; data?: { output: unknown }; error?: { message: string } };
const result: ApiResult = await response.json();
if (!response.ok || result.success === false) {
  throw new Error(result.error?.message ?? `HTTP ${response.status}`);
}
if (!result.data) throw new Error("Missing API response data");
console.log(result.data.output);
```

## Use from an AI assistant

Connect this tool to Claude Code, Claude Desktop, Cursor, VS Code, Codex and any MCP client as its own MCP server. Each method is a typed tool whose arguments are the method’s input.

- Server URL: `https://api.fous.com/mcp/tools/sam-gov`
- Authorization: `Authorization: Bearer <Fous API key>`

**Tools**

- `search_contract_opportunities`: Search contract opportunities. 1 credit per completed call. Failed calls without a completed billing receipt are free; completed work can remain charged if delivery is interrupted.
- `fous_get_run`: the result of a run that was still going, by its `request_id`. Free.

Claude Code:

```bash
claude mcp add --scope user --transport http fous-sam-gov https://api.fous.com/mcp/tools/sam-gov --header "Authorization: Bearer ${FOUS_API_KEY:?Set FOUS_API_KEY to your Fous API key}"
```

To give the assistant every tool, connect `https://api.fous.com/mcp`: it finds one with `fous_search_tools` and runs it with `fous_run_tool`. Setup for other clients: https://fous.com/llms-full.txt.

## Use cases

- Find notices matching a service or product keyword
- Identify opportunities from a specific federal agency
- Track response deadlines and solicitation numbers
- Review notices by set-aside or industry
- Locate contract opportunities by place of performance

## FAQ

### Can I run it with my own inputs?

Yes. Change the inputs in Studio and press Run, or send new inputs from your code, or ask a connected AI assistant.

### Can I call this SAM.gov tool as an API?

Yes. Send a POST request to /v1/query with your Fous API key and the inputs, and get JSON back.

### How much does it cost?

Each completed run costs 1 credit. Failed runs without a completed receipt are free; completed work can remain charged if delivery is interrupted. With pay as you go, a credit costs 1¢. Monthly plans cost less per credit.

### Do I need a SAM.gov account?

No. You only need a Fous account.

### How current is the data?

Fous gets the data from sam.gov when you run it. Some results are reused for up to 24 hours, and results that use your account or key are never reused. It was last verified on Sep 29, 2026.

### Which federal notices match my keywords?

Search contract opportunities finds active federal contract notices matching the required keywords and any filters you provide.

### When is a notice response due?

Search contract opportunities returns the response deadline when it is published on the notice.

### Where will the work take place?

Search contract opportunities returns the place of performance when it is published on the notice.

## Related

- [Grants.gov API](https://fous.com/tools/grants-gov.md): U.S. federal grant opportunities and application information.
- [USAspending API](https://fous.com/tools/usaspending.md): USAspending provides official federal spending data and searchable awards from October 1, 2007 onward; figures and agency account reports may be revised or lag published award updates.
- [USAJOBS API](https://fous.com/tools/usajobs.md): Federal government job listings and announcements.
- [Find a Tender API](https://fous.com/tools/find-a-tender.md): UK government public procurement notices and tenders.
- [Tenders Electronic Daily API](https://fous.com/tools/tenders-electronic-daily.md): Tenders Electronic Daily provides recently published EU procurement notices, open tenders with future deadlines, and newest-first contract awards; values and deadlines may be absent.
- [Federal Register API](https://fous.com/tools/federal-register.md): Search United States federal rules, proposed rules, notices, and presidential documents.
- [FBI API](https://fous.com/tools/fbi.md): Federal Bureau of Investigation wanted notices and public safety information.
- [Congress.gov API](https://fous.com/tools/congress-gov.md): Congress.gov returns federal bills and resolutions matching topic, Congress, status, or chamber, and provides an individual bill’s status, summary, titles, actions, and related bills; summaries may be unavailable.
- [All Government tools](https://fous.com/tools/category/government)
