API Documentation
Complete guide to integrating with the Government Data Mirror API
Authentication
All API requests require authentication using an API key. Include your key in the Authorization header:
Authorization: Bearer gov_YOUR_API_KEY_HERE Getting Your API Key
- Sign up for an account at govdata.com
- Navigate to your dashboard
- Click "Create New Key"
- Copy your API key (it will only be shown once!)
Rate Limits
Rate limits are applied monthly based on your plan:
| Plan | Requests/Month |
|---|---|
| Free | 10,000 |
| Startup | 100,000 |
| Growth | 1,000,000 |
| Enterprise | Unlimited |
When you exceed your limit, you'll receive a 429 Too Many Requests response.
Census ACS Data
Get Full ACS Data
Retrieve complete American Community Survey data for a geography
GET /api/v1/census/acs/{geography}?year={year} Parameters
geography(required): Geography ID (e.g., "06001" for Alameda County, CA)year(optional): Year of data, default 2023
Example Response
{
"geography": "06001",
"year": 2023,
"data": {
"NAME": "Alameda County, California",
"B01001_001E": "1671329",
"B19013_001E": "107716"
},
"source": "api",
"status": "fresh"
} Get Population
GET /api/v1/census/acs/{geography}/population?year={year} Get Median Income
GET /api/v1/census/acs/{geography}/income?year={year} Data Sources
We provide access to data from multiple government agencies:
- Census ACS: American Community Survey (demographics, income, housing)
- Census Decennial: Official decennial census counts
- BLS: Bureau of Labor Statistics (employment, inflation)
- Congress.gov: Legislative information and voting records
Error Codes
| Code | Description |
|---|---|
| 400 | Bad Request - Invalid parameters |
| 401 | Unauthorized - Invalid or missing API key |
| 429 | Too Many Requests - Rate limit exceeded |
| 503 | Service Unavailable - Data temporarily unavailable |
Code Examples
Python
import requests
headers = {
"Authorization": "Bearer gov_YOUR_API_KEY"
}
response = requests.get(
"https://api.govdata.com/api/v1/census/acs/06001?year=2023",
headers=headers
)
data = response.json()
print(data["data"]["B01001_001E"]) # Population JavaScript
const response = await fetch(
'https://api.govdata.com/api/v1/census/acs/06001?year=2023',
{
headers: {
'Authorization': 'Bearer gov_YOUR_API_KEY'
}
}
);
const data = await response.json();
console.log(data.data.B01001_001E); # Population Interactive API Explorer
Explore the API using our interactive Swagger UI:
Open API Explorer