Spending By State Territory
/api/v2/search/spending_by_category/state_territory/This endpoint supports the state profile page and allow for complex filtering for specific subsets of spending data.
This endpoint returns a list of the top results of State Territories sorted by the total amounts in descending order.
Request
curl -X POST 'https://api.usaspending.gov/api/v2/search/spending_by_category/state_territory/' \
-H 'Content-Type: application/json' \
-d '{
"filters": {
"recipient_id": "1c3edaaa-611b-840c-bf2b-fd34df49f21f-P",
"time_period": [
{
"start_date": "2019-09-28",
"end_date": "2020-09-28"
}
]
},
"category": "state_territory",
"limit": 5,
"page": 1,
"spending_level": "transactions"
}'Request body
The filters object is shared by every search endpoint. The filter object explains each filter with examples.
filtersobject · FilterObjectRequired23 fieldsThe filters to find with said category
keywordsarray 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 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 AgencyObject3 fieldstypeenum (string)Requiredawardingfunding
tierenum (string)Requiredtoptiersubtier
namestringRequired
recipient_search_textarray of stringrecipient_idstringA unique identifier for the recipient which includes the recipient hash and level. 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
def_codesarray of DEFCIf the
def_codesprovided are in the COVID-19 or IIJA group, the query will only return results of transactions where theaction_dateis on or after the enactment date of the public law associated with that disaster code.
limitnumberThe number of results to include per page
pagenumberThe page of results to return based on the limit
spending_levelenum (string)Group the spending by level. This also determines what data source is used for the totals.
transactionsawardssubawards
subawardsbooleanDetermines whether Prime Awards or Sub Awards are searched. This field will be depreciated soon.
Try it
Runs against the live API. Responses are real data.
/api/v2/search/spending_by_category/state_territory/Response · 200
categorystringRequiredspending_levelenum (string)RequiredSpending level value that was provided in the request.
transactionsawardssubawards
resultsarray of CategoryResultRequired5 fieldsidnumberRequiredThe id is the database key.
namestringRequiredNullablecodestringRequiredNullablecodeis a user-displayable code (such as a program activity or NAICS code, but not a database ID). When no such code is relevant, return anull.amountnumberRequiredtotal_outlaysnumberRequiredNullable
limitnumberRequiredpage_metadataobject · PageMetadataObject2 fieldspagenumberRequiredhasNextbooleanRequired
messagesarray of stringAn array of warnings or instructional directives to aid consumers of this endpoint with development and debugging.
{
"category": "state_territory",
"spending_level": "transactions",
"limit": 10,
"page_metadata": {
"page": 1,
"next": 2,
"previous": null,
"hasNext": false,
"hasPrevious": false
},
"results": [
{
"amount": 31470304471.74,
"code": "USA",
"id": null,
"name": "UNITED STATES",
"total_outlays": null,
},
{
"amount": 20912107.43,
"code": "ZAF",
"id": null,
"name": "SOUTH AFRICA",
"total_outlays": null,
}
],
"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
- DEV-11522: Update API documentation
- DEV-11398: Updating contracts to remove spaces
- DEV-11398: Updating Contracts and spending by category view
- DEV-11551: Update API Contracts
Generated from contracts/v2/search/spending_by_category/state_territory.md in the USAspending API repo.