Spending by Award
/api/v2/search/spending_by_award/This endpoints supports the advanced search page and allow for complex filtering for specific subsets of spending data.
This endpoint takes award filters and fields, and returns the fields of the filtered awards.
Request
curl -X POST 'https://api.usaspending.gov/api/v2/search/spending_by_award/' \
-H 'Content-Type: application/json' \
-d '{
"subawards": false,
"limit": 10,
"page": 1,
"filters": {
"award_type_codes": [
"A",
"B",
"C"
],
"time_period": [
{
"start_date": "2018-10-01",
"end_date": "2019-09-30"
}
]
},
"fields": [
"Award ID",
"Recipient Name",
"Start Date",
"End Date",
"Award Amount",
"Awarding Agency",
"Awarding Sub Agency",
"Contract Award Type",
"Award Type",
"Funding Agency",
"Funding Sub Agency"
]
}'Request body
The filters object is shared by every search endpoint. The filter object explains each filter with examples.
filtersobject · AdvancedFilterObjectRequired25 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_codesarrayRequiredList 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_codesenum (NAICSCodeObject)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
program_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 or IIJA 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 or IIJA 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.- Example: Providing the
ZDEF code and setting the subaward parameter toTruewill only return results where thesub_action_dateis on or after11/15/2021since this is the enactment date of the public law associated with disaster codeZ.
- Example: Providing the
award_unique_idstring
fieldsarrayRequiredThe SpendingByAward API can accept any of the following fields based on whether awards or subawards are being searched. Awards are searched by default, however the subawards can be searched by setting the subawards field to "True".
limitnumberHow many results are returned. If no limit is specified, the limit is set to 10.
orderenum (string)Indicates what direction results should be sorted by. Valid options include asc for ascending order or desc for descending order.
descasc
pagenumberThe page number that is currently returned.
sortstringOptional parameter indicating what value results should be sorted by. Valid options are any of the fields in the JSON objects in the response. Defaults to the first field provided.
subawardsbooleanTrue when you want to group by Subawards instead of Awards.
last_record_unique_idnumberThe unique id of the last record in the results set. Used in the experimental Elasticsearch API functionality.
last_record_sort_valuestringThe value of the last record that is being sorted on. Used in the experimental Elasticsearch API functionality.
spending_levelenum (string)Group the spending by level. This also determines what data source is used for the totals.
awardssubawards
Try it
Runs against the live API. Responses are real data.
/api/v2/search/spending_by_award/Response · 200
spending_levelenum (string)RequiredGroup the spending by level. This also determines what data source is used for the totals.
awardssubawards
limitnumberRequiredresultsarray of SpendingByAwardResponseRequired52 fieldsinternal_idnumberRequiredAward AmountnumberTotal OutlaysnumberAward IDstringAward TypestringNullableAwarding Agency CodestringNullableAwarding AgencystringNullableawarding_agency_idnumberNullableAwarding Sub Agency CodestringNullableAwarding Sub AgencystringNullableBase Obligation DatestringCFDA NumberstringNullableAssistance awards only
Contract Award TypestringProcurement awards only
DescriptionstringNullableEnd DatestringFunding Agency CodestringNullableFunding AgencystringNullableFunding Sub Agency CodestringNullableFunding Sub AgencystringNullablegenerated_internal_idstringIssued DatestringNullableLast Date to OrderstringNullableProcurement IDVs only
Last Modified DatestringLoan ValuenumberAssistance awards only
Period of Performance Current End DatestringNullablePeriod of Performance Start DatestringPlace of Performance City CodenumberPlace of Performance Country CodestringNullablePlace of Performance State CodenumberNullablePlace of Performance Zip5numberCOVID-19 OutlaysnumberCOVID-19 ObligationsnumberInfrastructure OutlaysnumberInfrastructure Obligationsnumberdef_codesarray of stringPrime Award IDstringNullableSub-Awards only, returns the ID (piid/fain/uri) of the prime award.
Prime Recipient NamestringNullableSub-Awards only, returns the name of the prime award's recipient.
prime_award_recipient_idstringNullableSub-Awards only, return the recipient id of the prime award's recipient.
prime_award_internal_idstringNullableSub-Awards only, return the award id of the prime award.
prime_award_generated_internal_idstringSub-Awards only, return the generated unique award id of the prime award.
Recipient DUNS NumberstringNullableRecipient NamestringNullablerecipient_idstringNullableA unique identifier for the recipient which includes the recipient hash and level.
SAI NumberstringNullableAssistance awards only
Start DatestringSub-Award AmountstringSub-Awards only
Sub-Award DatestringSub-Awards only
Sub-Award IDstringSub-Awards only
Sub-Award TypestringSub-Awards only
Sub-Awardee NamestringSub-Awards only
Subsidy CostnumberAssistance awards only
agency_slugstringNullableReturns with "Awarding Agency", is null when the agency does not have an agency profile page
page_metadataobject · PageMetadataObject4 fieldspagenumberRequiredhasNextbooleanRequiredlast_record_unique_idnumberlast_record_sort_valuestring
messagesarray of stringAn array of warnings or instructional directives to aid consumers of this endpoint with development and debugging.
{
"spending_level": "awards",
"limit": 0,
"results": [
{
"internal_id": 0,
"def_codes": []
}
],
"page_metadata": {
"page": 0,
"hasNext": false
},
"messages": []
}Recent changes
- DEV-15071: Add-object-classes-initial
- DEV-14618: Update NAICS filter to allow a list of strings
- DEV-14570: Add new TAS data structure
- DEV-14570: Update failing tests and remove program_activity
- DEV-14570: Add Pydantic filters to view
Generated from contracts/v2/search/spending_by_award.md in the USAspending API repo.