USAspending API ReferenceIndependent
Try the API

How an agency profile is built

Budgetary resources, obligations by award type, recipients, and sub-agencies for one agency and fiscal year.

An agency profile shows one agency for one fiscal year. Almost every call on the page is a GET on /api/v2/agency/{toptier_code}/… with fiscal_year as a query parameter, which makes it one of the easiest pages to rebuild.

Getting the code

Profile URLs use a readable slug, such as department-of-energy. The site maps the slug to a toptier_code with references/toptier_agencies, which lists every agency with its code, current budget authority, and obligations. Start there, then keep the code for every call that follows.

Account data first

The top of the page is account data: budgetary resources and obligations from the agency's Treasury accounts. Award data comes after, broken down by award type and sub-agency. The Award and account data page explains the difference.

The calls, in order

  1. On the agency list and to resolve the URL slug to a toptier code

    GETToptier Agency Profile/api/v2/references/toptier_agencies/
  2. On load

    GETAgency Overview/api/v2/agency/{toptier_code}/

    Name, mission, website, and the fiscal years available.

  3. For the Total Budgetary Resources section

    GETAgency Overview/api/v2/agency/{toptier_code}/budgetary_resources/
  4. For the Award Obligations chart

    GETFederal Obligations/api/v2/agency/{toptier_code}/obligations_by_award_category/
  5. For the Award Spending section counts

    GETSub-Agency Count/api/v2/agency/{toptier_code}/sub_agency/count/
  6. For the sub-agency table

    GETList Federal Accounts/api/v2/agency/{toptier_code}/sub_agency/

    Filtered by award type with award_type_codes.

  7. For the award summary tiles

    GETAgency Awards/api/v2/agency/{toptier_code}/awards/
  8. For the new awards count

    GETOverview of new awards for Agency/api/v2/agency/{toptier_code}/awards/new/count
  9. For Status of Funds, by bureau

    GETList Sub-Components/api/v2/agency/{toptier_code}/sub_components/

Calls without a contract

/api/v2/agency/{toptier_code}/recipients/

The site calls this for the recipient distribution chart, but the API repo has no contract for it, so it has no reference page here.

Sources

Traced from these files in the public usaspending-website repo:

Next: How a recipient profile is built

Loading…