USASpending.gov API
usaspending.gov · Government
Search all US federal government spending — contracts, grants, loans, and other financial assistance. Filter by agency, recipient, location, NAICS code, or date range. Official source for federal procurement and grant data under the DATA Act.
Authentication
Sample Requests
Returns federal contracts matching keyword and filters. Useful for finding government contractors in specific industries.
Hover any highlighted part to learn what it does
| Content-Type | application/json |
{
"limit": 10,
"fields": [
"Award ID",
"Recipient Name",
"Award Amount",
"Awarding Agency"
],
"filters": {
"keywords": [
"workers compensation"
],
"award_type_codes": [
"A",
"B",
"C",
"D"
]
}
}
curl -X POST "https://api.usaspending.gov/api/v2/search/spending_by_award" \
-H "Content-Type: application/json" \
-H "Content-Type: application/json" \
-d '{"limit":10,"fields":["Award ID","Recipient Name","Award Amount","Awarding Agency"],"filters":{"keywords":["workers compensation"],"award_type_codes":["A","B","C","D"]}}'import requests
headers = {
"Content-Type": "application/json"
}
data = {
"limit": 10,
"fields": [
"Award ID",
"Recipient Name",
"Award Amount",
"Awarding Agency"
],
"filters": {
"keywords": [
"workers compensation"
],
"award_type_codes": [
"A",
"B",
"C",
"D"
]
}
}
response = requests.post(
"https://api.usaspending.gov/api/v2/search/spending_by_award",
headers=headers,
json=data,
)
print(response.json())const url = 'https://api.usaspending.gov/api/v2/search/spending_by_award';
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
"limit": 10,
"fields": [
"Award ID",
"Recipient Name",
"Award Amount",
"Awarding Agency"
],
"filters": {
"keywords": [
"workers compensation"
],
"award_type_codes": [
"A",
"B",
"C",
"D"
]
}
}),
});
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"bytes"
"encoding/json"
)
func main() {
targetURL := "https://api.usaspending.gov/api/v2/search/spending_by_award"
jsonData, _ := json.Marshal({"limit":10,"fields":["Award ID","Recipient Name","Award Amount","Awarding Agency"],"filters":{"keywords":["workers compensation"],"award_type_codes":["A","B","C","D"]}})
req, _ := http.NewRequest("POST", targetURL, bytes.NewBuffer(jsonData))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://api.usaspending.gov/api/v2/search/spending_by_award")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Post.new(uri)
req["Content-Type"] = "application/json"
req["Content-Type"] = "application/json"
req.body = "{\"limit\":10,\"fields\":[\"Award ID\",\"Recipient Name\",\"Award Amount\",\"Awarding Agency\"],\"filters\":{\"keywords\":[\"workers compensation\"],\"award_type_codes\":[\"A\",\"B\",\"C\",\"D\"]}}"
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://api.usaspending.gov/api/v2/search/spending_by_award";
$opts = ["http" => [
"method" => "POST",
"header" => implode("\r\n", [
"Content-Type: application/json",
"Content-Type: application/json"
]),
"content" => json_encode({"limit":10,"fields":["Award ID","Recipient Name","Award Amount","Awarding Agency"],"filters":{"keywords":["workers compensation"],"award_type_codes":["A","B","C","D"]}}),
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));Returns budgetary resources for an agency by CGAC code. 012 = Department of Labor.
Hover any highlighted part to learn what it does
curl -X GET "https://api.usaspending.gov/api/v2/agency/012/budgetary_resources"
import requests
response = requests.get(
"https://api.usaspending.gov/api/v2/agency/012/budgetary_resources",
)
print(response.json())const url = 'https://api.usaspending.gov/api/v2/agency/012/budgetary_resources'; const response = await fetch(url); const data = await response.json(); console.log(data);
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
targetURL := "https://api.usaspending.gov/api/v2/agency/012/budgetary_resources"
req, _ := http.NewRequest("GET", targetURL, nil)
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://api.usaspending.gov/api/v2/agency/012/budgetary_resources")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://api.usaspending.gov/api/v2/agency/012/budgetary_resources";
$opts = ["http" => [
"method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));Postman Setup Guide
- No API key needed — fully open
- In Postman, POST to https://api.usaspending.gov/api/v2/search/spending_by_award
- Set Content-Type: application/json in headers
- filters.award_type_codes: A/B/C/D = contracts, 02/03/04/05 = grants
- Use filters.naics_codes array to filter by industry (e.g. 524126 = workers comp insurance)
- Use filters.agencies array to filter by federal agency
- Paginate using page parameter in the request body
What can you build with USASpending.gov API?
USASpending.gov API is a Government API. Developers commonly use government APIs for:
- surfacing public datasets in citizen-facing apps
- building transparency and civic engagement tools
- accessing legislation, court records, and official data
- powering research and journalism tools
- creating compliance and regulatory monitoring dashboards
No authentication required. This API is open — no signup or key needed. Ideal for quick prototypes and public-facing features. USASpending.gov API is free to use, making it a low-risk choice to experiment with.
New to APIs? Read our beginner's guide · Learn about API keys · What is REST?