Number of awards for each type
/api/v2/search/spending_by_award_count/These endpoints support the advanced search page and allow for complex filtering for specific subsets of spending data.
This endpoint takes award filters, and returns the number of awards in each award type (Contracts, Loans, Direct Payments, Grants, Other and IDVs).
Request
curl -X POST 'https://api.usaspending.gov/api/v2/search/spending_by_award_count/' \
-H 'Content-Type: application/json' \
-d '{
"filters": {
"keywords": [
"Filter is required"
]
}
}'Request body
The filters object is shared by every search endpoint. The filter object explains each filter with examples.
filtersobject · AdvancedFilterObjectRequired26 fieldskeywordsarray of stringdescriptionstringtime_periodarray of TimePeriodObjectThis TimePeriodObject can fall into different categories based on the request.
-
if
subawardstrueSee the Subaward Search category defined in SubawardSearchTimePeriodObject
-
otherwise
See the Award Search category defined in AwardSearchTimePeriodObject
-
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_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
tas_codesarray of TASCodeObject2 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 stringtreasury_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
object_classarray of stringprogram_activityarray of numberprogram_activitiesarray of ProgramActivityObjectA filter option that supports filtering by a program activity name or code. Please note that if this filter is used at least one of the members of the object, ProgramActivityObject, need to be provided.
object_classesarray of stringA filter option that supports filtering by object class codes (not names). Only for 'awards'
def_codesarray of DEFCIf the
def_codesprovided are in the COVID-19 group and the subaward flag is set toFalse, the query will only return prime awards that have at least one File C record with the supplied DEFC and also have non-zero COVID-19 related obligations or outlays. If thedef_codesprovided are in the COVID-19 or IIJA group and the subaward parameter is set toTrue, the query will only return results that have a sub_action_date on or after the enactment date of the public law associated with that disaster code.
spending_levelenum (string)Group the spending by level. This also determines what data source is used for the totals.
awardssubawards
subawardsbooleanTrue when you want to group by Subawards instead of Awards. Defaulted to False unless spending_level is set to
subawards, then the default is True.
Try it
Runs against the live API. Responses are real data.
/api/v2/search/spending_by_award_count/Response · 200
resultsobject · AwardTypeResult6 fieldsgrantsnumberRequiredloansnumberRequiredcontractsnumberRequireddirect_paymentsnumberRequiredothernumberRequiredidvsnumberRequired
spending_levelenum (string)RequiredSpending level value that was provided in the request.
awardssubawards
messagesarray of stringAn array of warnings or instructional directives to aid consumers of this endpoint with development and debugging.
{
"results": {
"grants": 0,
"loans": 0,
"contracts": 0,
"direct_payments": 0,
"other": 0,
"idvs": 0
},
"spending_level": "awards",
"messages": []
}Recent changes
- DEV-15071: Add-object-classes-initial
- DEV-10281: Add object_class back for unmentioned contracts in slack thread
- DEV-10821: Remove object_class from search endpoint api contracts
- DEV-12349: Add spending_level to the response
- DEV-12349: Add spending_level filter
Generated from contracts/v2/search/spending_by_award_count.md in the USAspending API repo.