Download Count
/api/v2/download/count/These endpoints support the advanced search page and allow for complex filtering for specific subsets of spending data.
Returns the number of transactions that would be included in a download request for the given filter set.
Request
curl -X POST 'https://api.usaspending.gov/api/v2/download/count/' \
-H 'Content-Type: application/json' \
-d '{
"filters": {
"keywords": [
"cheese"
],
"time_period": [
{
"start_date": "2019-10-01",
"end_date": "2020-09-30"
},
{
"start_date": "2010-10-01",
"end_date": "2011-09-30"
}
],
"recipient_type_names": [
"higher_education"
],
"place_of_performance_locations": [
{
"country": "USA",
"state": "WI"
}
],
"psc_codes": {
"require": [
[
"Product",
"10",
"1035"
]
]
}
},
"spending_level": "awards"
}'Request body
The filters object is shared by every search endpoint. The filter object explains each filter with examples.
filtersobject · AdvancedFilterObjectRequired21 fieldskeywordsarray of stringtime_periodarray of TimePeriodObjectSee the Transaction Search category defined in TransactionSearchTimePeriodObject
place_of_performance_scopeenum (string)domesticforeign
place_of_performance_locationsarray of LocationObjectThese fields are defined in the StandardLocationObject
agenciesarray of AgencyObject4 fieldstypeenum (string)Requiredawardingfunding
tierenum (string)Requiredtoptiersubtier
namestringRequiredtoptier_namestringOnly applicable when
tierissubtier. Ignored whentieristoptier. Provides a means by which to scope subtiers with common names to a specific toptier. For example, several agencies have an "Office of Inspector General". If not provided, subtiers may span more than one toptier.
recipient_search_textarray of stringrecipient_idstringA hash of recipient UEI, DUNS, name, and level. A unique identifier for recipients, used for profile page urls. This filter is not supported by subawards.
recipient_scopeenum (string)domesticforeign
recipient_locationsarray of LocationObjectThese fields are defined in the StandardLocationObject
recipient_type_namesarray of stringaward_type_codesarrayList of filterable award types
award_idsarray of stringAward IDs surrounded by double quotes (e.g.
"SPE30018FLJFN") will perform exact matches as opposed to the default, fuzzier full text matches. Useful for Award IDs that contain spaces or other word delimiters.award_amountsarray of AwardAmounts2 fieldslower_boundnumberupper_boundnumber
program_numbersarray of stringnaics_codesobject · NAICSCodeObject2 fieldsrequirearray of stringexcludearray of string
psc_codesenum (PSCCodeObject)Supports new PSCCodeObject or legacy array of codes.
contract_pricing_type_codesarray of stringset_aside_type_codesarray of stringextent_competed_type_codesarray of stringtas_codesarray of TASCodeObject2 fieldsrequirearray of stringexcludearray of string
treasury_account_componentsarray of TreasuryAccountComponentsObject7 fieldsatastringNullableAllocation Transfer Agency Identifier - three characters
aidstringRequiredAgency Identifier - three characters
bpoastringNullableBeginning Period of Availability - four digits
epoastringNullableEnding Period of Availability - four digits
astringNullableAvailability Type Code - X or null
mainstringRequiredMain Account Code - four digits
substringNullableSub-Account Code - three digits
spending_levelenum (string)subawardstransactionsawards
Try it
Runs against the live API. Responses are real data.
/api/v2/download/count/Response · 200
calculated_transaction_countnumberRequiredThe calculated count of all transactions which would be included in the download files.
maximum_transaction_limitnumberRequiredThe current allowed maximum number of transactions in a row-limited download. Visit https://www.usaspending.gov/download_center/custom_award_data to download larger volumes of data.
transaction_rows_gt_limitbooleanRequiredA boolean returning whether the transaction count is over the maximum row limit.
calculated_countnumberRequiredThe calculated count of Awards, Transactions, or Subawards included in the download files.
spending_levelstringRequiredThe spending_level provided by the user or the default value of transactions.
maximum_limitnumberRequiredThe current allowed maximum number of Awards, Transactions, or Subawards in a row-limited download. Visit https://www.usaspending.gov/download_center/custom_award_data to download larger volumes of data.
rows_gt_limitbooleanRequiredA boolean returning whether the Awards, Transactions, or Subawards count is over the maximum row limit.
messagesarray of stringAn array of warnings or instructional directives to aid consumers of this endpoint with development and debugging.
{
"calculated_transaction_count": 87343,
"maximum_transaction_limit": 500000,
"transaction_rows_gt_limit": false,
"calculated_count": 87343,
"spending_level": "awards",
"maximum_limit": 500000,
"rows_gt_limit": false,
"messages": [
"For searches, time period start and end dates are currently limited to an earliest date of 2007-10-01. For data going back to 2000-10-01, use either the Custom Award Download feature on the website or one of our download or bulk_download API endpoints as listed on https://api.usaspending.gov/docs/endpoints."
]
}Recent changes
- DEV-11927: Update recipient_id description on API contracts where present
- Mentioned in the October 8, 2024 release notes
- Updated api contract
- Mentioned in the August 07, 2020 release notes
- Mentioned in the November 1, 2017 release notes
Generated from contracts/v2/download/count.md in the USAspending API repo.