Generated Filter Hash for URL
POST
/api/v2/references/filter/These endpoints support the advanced search page and allow for complex filtering for specific subsets of spending data. Primarily used when user shares or saves a url from an Advanced Search results page.
Generates a hash for URL, based on selected filter criteria.
Request Size Limit: The request body must not exceed 512KB. Requests larger than this limit will be rejected with a 413 status code.
Request
curl -X POST 'https://api.usaspending.gov/api/v2/references/filter/' \
-H 'Content-Type: application/json' \
-d '{
"filters": {
"keyword": {},
"timePeriodType": "fy",
"timePeriodFY": [
"2020"
],
"timePeriodStart": null,
"timePeriodEnd": null,
"selectedLocations": {
"USA_AZ": {
"identifier": "USA_AZ",
"filter": {
"country": "USA",
"state": "AZ"
},
"display": {
"entity": "State",
"standalone": "Arizona",
"title": "Arizona"
}
}
},
"locationDomesticForeign": "all",
"selectedFundingAgencies": {},
"selectedAwardingAgencies": {
"806_toptier": {
"id": 806,
"toptier_flag": true,
"toptier_agency": {
"id": 68,
"toptier_code": "075",
"abbreviation": "HHS",
"name": "Department of Health and Human Services"
},
"subtier_agency": {
"abbreviation": "HHS",
"name": "Department of Health and Human Services"
},
"agencyType": "toptier"
}
},
"selectedRecipients": [],
"recipientDomesticForeign": "all",
"recipientType": [],
"selectedRecipientLocations": {},
"awardType": [
"IDV_D",
"IDV_B_A",
"IDV_E",
"IDV_B_B",
"IDV_B_C",
"07",
"08",
"IDV_A",
"IDV_B",
"IDV_C"
],
"selectedAwardIDs": {},
"awardAmounts": {
"range-1": [
1000000,
25000000
]
},
"selectedCFDA": {},
"selectedNAICS": {},
"selectedPSC": {},
"pricingType": [],
"setAside": [],
"extentCompeted": [],
"federalAccounts": {},
"treasuryAccounts": {}
},
"version": "2019-07-26"
}'Request body
The filters object is shared by every search endpoint. The filter object explains each filter with examples.
filtersobject22 fieldsawardAmountsobjectRequiredawardTypearray of stringRequiredextentCompetedarray of stringRequiredkeywordobjectRequiredlocationDomesticForeignstringRequiredpricingTypearray of stringRequiredrecipientDomesticForeignstringRequiredrecipientTypearray of stringRequiredselectedAwardIDsobjectRequiredselectedAwardingAgenciesobjectRequiredselectedCFDAobjectRequiredselectedFundingAgenciesobjectRequiredselectedLocationsobjectRequiredselectedNAICSobjectRequiredselectedPSCobjectRequiredselectedRecipientLocationsobjectRequiredselectedRecipientsarray of stringRequiredsetAsidearray of stringRequiredtimePeriodEndstringRequiredNullabletimePeriodFYarray of stringRequiredtimePeriodStartstringRequiredNullabletimePeriodTypestringRequired
versionstring
Try it
Runs against the live API. Responses are real data.
POST
/api/v2/references/filter/Response · 200
hashstringRequired
{
"hash": "3ef42b40bda7dd723e1ffcd542a7d9c7"
}Recent changes
- DEV-15524: Updated Filter and Hash endpoints to use Pydantic validation, added size limit on request, and updated filter and hash contracts.
- Mentioned in the October 19, 2020 release notes
Generated from contracts/v2/references/filter.md in the USAspending API repo.