Data.gov API

⭐ Beginner's Pick Government / API Key Intermediate HTTPS
Varies by plan (check documentation)

Overview

Data.gov is the central repository for open data published by U.S. federal agencies, covering topics from climate and agriculture to health and education. An API key is required and can be obtained for free from api.data.gov. With access to hundreds of agency APIs, it is an excellent hub for exploring U.S. government data.

💡

Beginner Tip

Register for a free API key at api.data.gov/signup and use it as the api_key query parameter—many agency APIs accessible through this hub share the same key.

Available Data

Use case: Integrate us government data data into web and mobile applications
Data.gov data via REST API
JSON-formatted response data
Requires API key authentication

Example Response

JSON Response
{
  "status": "success",
  "data": {
    "result": "Data from Data.gov",
    "description": "US Government Data",
    "timestamp": "2025-01-15T10:00:00Z"
  }
}

Field Reference

metadata Pagination and result count information for the response.
results Array of data records matching the query and field selection.
total Total number of records matching the query across all pages.
page Current page number in the paginated result set.
per_page Number of records returned per page in the response.

Implementation Example

const url = "https://api.data.gov/";
// Replace headers or query params with the values required by this API.
const response = await fetch(url, {
  headers: {
  "X-API-Key": "YOUR_API_KEY"
  }
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

Common Errors & Troubleshooting

403 Forbidden / API key invalid Using an incorrect, expired, or unregistered API key.
Verify your key at api.data.gov and ensure you are passing it as api_key in the query string.
400 Bad Request Invalid field names or filter parameters for the specific agency API.
Each agency API has its own field schema—check the specific API's documentation for valid field names.
Rate limit exceeded Exceeding the hourly request quota for your API key.
The default limit is 1,000 requests/hour. Add a delay between requests or request a limit increase from api.data.gov.

Matrix Score Breakdown

🌐 Reachability 30/30
⚡ Speed 10/20
🔒 Security 15/15
🛠 Developer XP 12/20
✓ Reliability 10/15

Partially tested on Apr 5, 2026

Technical Specifications

Auth API Key
HTTPS REQUIRED
CORS UNKNOWN
Category Government
Difficulty Intermediate
Verified: 2026-04-04

Similar APIs

View All →