SAM.gov API Guide: Complete Developer Tutorial
Everything you need to know to integrate with SAM.gov's API for federal contract opportunities: registration, authentication, rate limits, and working code examples.
Quick Reference: SAM.gov provides free API access to federal contract opportunities. Public access allows 10 requests/day; registered entities get 1,000/day. Plan for 1-4 weeks total for registration and API access approval.
Need Decision Maker Contacts?
Found opportunities on SAM.gov? Get verified contact info for agency contracting officers and program managers. Try GovCon Contacts →
What is SAM.gov?
The System for Award Management (SAM.gov) is the official U.S. government registry for entities doing business with the federal government. It consolidates multiple systems and provides APIs for accessing federal contracting opportunities.
SAM.gov provides access to:
- Contract Opportunities - Active solicitations and awards
- Entity Registration - Vendor registration and validation
- Federal Hierarchy - Agency and sub-agency data
- Exclusions Database - Debarred entities
SAM.gov API Registration Process
API Key Required (Basic Account - Instant)
Create free SAM.gov account → Generate key → 10 requests/day:
curl "https://api.sam.gov/prod/opportunities/v2/search?api_key=your_sam_key&limit=1&postedFrom=01/01/2026&postedTo=01/28/2026"
Entity Registration for 1,000/day (~2-3 weeks)
Time Required: Up to 10 business days + role approval
- Register your business entity in SAM.gov
- Obtain Unique Entity ID (UEI) - DUNS is no longer used
- Complete entity validation process
- Wait for approval
Step 2: API Access Request
Time Required: Additional 1-2 weeks
- Submit role request for "Data Entry" role
- Provide justification for API access
- Wait for role approval
- Generate API key through SAM.gov interface
Tip: Be specific in your justification. Explain your use case clearly (e.g., "Building internal tool to monitor contract opportunities in NAICS 541511").
SAM.gov API Rate Limits
Rate Limits by Access Level
| Access Level |
Requests Per Day |
How to Get It |
| Public (no auth) |
10 |
No registration required |
| Entity User |
1,000 |
Complete entity registration |
| Federal System User |
10,000 |
Government .gov/.mil email + system account |
Note: The 1,000/day limit works for most small-scale applications. For high-volume needs, consider caching responses or using bulk data downloads.
API Data Coverage
What the API Returns
- Opportunity metadata - Title, agency, posted date, deadline
- Solicitation numbers - Contract identifiers
- Set-aside information - Small business designations
- Contact information - Point of contact (when available)
- Place of performance - Location data
- NAICS/PSC codes - Industry classifications
What Requires Additional Steps
- Full descriptions - Available via separate document download
- Attachments - Require individual file requests
- Award data - Often requires separate Award Notice lookup
Code Example: SAM.gov API
import requests
import json
# SAM.gov API endpoint
SAM_API_URL = "https://api.sam.gov/prod/opportunities/v2/search"
API_KEY = "your_sam_gov_api_key" # Get from sam.gov after registration
def get_sam_opportunities():
headers = {
'Accept': 'application/json'
}
params = {
'api_key': API_KEY, # API key goes in query params
'limit': 25,
'postedFrom': '01/01/2026',
'postedTo': '01/31/2026',
'ptype': 'o' # Solicitations only
}
response = requests.get(SAM_API_URL, headers=headers, params=params)
response.raise_for_status()
data = response.json()
opportunities = data.get('opportunitiesData', [])
for opp in opportunities:
print(f"Title: {opp.get('title')}")
print(f"Agency: {opp.get('fullParentPathName')}")
print(f"Posted: {opp.get('postedDate')}")
print(f"Deadline: {opp.get('responseDeadLine')}")
print(f"Type: {opp.get('type')}")
# Contact info is in an array
contacts = opp.get('pointOfContact', [])
if contacts:
print(f"Contact: {contacts[0].get('email', 'N/A')}")
print("---")
get_sam_opportunities()
Important: Pagination
The API returns paginated results. Use offset to retrieve subsequent pages:
- First page:
offset=0 (default)
- Second page:
offset=25 (if limit=25)
- Continue until
offset >= totalRecords
Check totalRecords in the response to know when you've retrieved everything.
Key Parameters
limit - Results per page (max 1000)
postedFrom/postedTo - Date range (MM/DD/YYYY format)
ptype - Notice type: o (opportunities), s (solicitation), a (award)
solnum - Solicitation number search
ncode - NAICS code filter
Common Issues and Solutions
1. Registration Takes Too Long
Issue: Entity registration can take up to 10 business days.
Solution: Start with the public 10 requests/day while waiting. Use caching to make the most of limited calls.
2. Rate Limit Exceeded
Issue: Hit the daily limit during development.
Solution: Cache responses locally. The opportunities data doesn't change frequently, so a 1-hour cache is usually fine.
3. Need Full Descriptions
Issue: API returns metadata but not the full contract description.
Solution: Use the resourceLinks field to download attached documents, or use SAM.gov's bulk data downloads.
4. Need Award Data
Issue: Want to see who won similar contracts.
Solution: Search for "Award Notice" types in SAM.gov matching the solicitation number.
When SAM.gov API Works Well
Good fit for:
- Internal tools checking specific opportunities
- Low-volume monitoring (under 100 checks/day)
- Government agencies (10,000 requests/day with federal account)
- Projects that can wait for registration
- When you only need metadata, not full descriptions
When to Consider Alternatives
Consider other options if you need:
- More than 1,000 requests per day
- Full contract descriptions included in API response
- Award data (who won, for how much) integrated
- Faster setup (same-day API access)
- Simpler JSON structure
Alternative: GovCon API
GovCon API provides SAM.gov data with some differences:
- Instant access - No registration wait
- Higher limits - 1,000 requests/hour
- Descriptions included - Full text in API response
- Award data - Integrated award fields included
- Flat JSON - Simpler structure, easier parsing
Free tier: 25 requests/day. Developer plan: $19/month.
import requests
# GovCon API example
GOVCON_API_URL = "https://govconapi.com/api/v1/opportunities/search"
API_KEY = "your_govcon_api_key"
def get_opportunities():
headers = {'Authorization': f'Bearer {API_KEY}'}
params = {'naics': '541330', 'limit': 50}
response = requests.get(GOVCON_API_URL, headers=headers, params=params)
data = response.json()
for opp in data.get('data', []):
print(f"Title: {opp.get('title')}")
print(f"Agency: {opp.get('agency')}")
print(f"Description: {opp.get('description_text', '')[:200]}...")
print("---")
get_opportunities()
Summary
SAM.gov's API is the official source for federal contract data. It's free, authoritative, and works well for low-volume use cases. The main tradeoffs are the registration wait time and rate limits.
For higher-volume needs or faster setup, third-party APIs like GovCon API provide alternatives with different tradeoffs (cost vs. convenience).
Related Guides
Official Resources
Last Updated: January 2026 | Questions? [email protected]