aggregate_contracts
Group USASpending federal contract awards by agency, recipient, NAICS, PSC, month, or set-aside to get obligation totals or award counts. Answers spending questions without pulling individual rows.
Instructions
Aggregate federal contract awards from USASpending without pulling rows: group by awarding_agency, awarding_subagency, recipient, naics, psc, month, or set_aside, with metric 'obligations' (dollars) or 'count' (prime awards). This is the tool for questions like 'how many 8(a) sole source awards per agency in Aug-Sep 2025'. Counts state their unit and the date filter states its date_type. group_by=set_aside issues one upstream query per code (~4s each due to rate pacing); metric 'count' is supported for group_by set_aside only (USASpending exposes counts per filter, not per category).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| psc | No | PSC codes | |
| limit | No | Max groups to return for category group_bys (default 25, max 100) | |
| naics | No | NAICS codes | |
| agency | No | Awarding toptier agency NAME as USASpending knows it (e.g. 'Department of Veterans Affairs') | |
| metric | No | 'obligations' (default; aggregated dollars) or 'count' (prime award count; only with group_by=set_aside) | |
| date_to | Yes | End date YYYY-MM-DD (required) | |
| group_by | Yes | One of: awarding_agency, awarding_subagency, recipient, naics, psc, month, set_aside | |
| date_from | Yes | Start date YYYY-MM-DD (required) | |
| date_type | No | Which award date the window filters on: 'action_date' (default), 'date_signed', or 'new_awards_only'. Different choices produce materially different totals — the response echoes this as date_field. | |
| set_aside | No | FPDS set-aside code(s), validated (e.g. ['8AN','SDVOSBS']). Required when group_by=set_aside. | |
| sub_agency | No | Awarding subtier agency name (requires agency) | |
| award_type_codes | No | Award type codes (default ['A','B','C','D'] = contract prime awards; see lookup_reference_code domain award_type) | |
| recipient_search | No | Recipient name or UEI text filter |