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
On the agency list and to resolve the URL slug to a toptier code
On load
Name, mission, website, and the fiscal years available.
For the Total Budgetary Resources section
For the Award Obligations chart
For the Award Spending section counts
For the sub-agency table
Filtered by award type with award_type_codes.
For the award summary tiles
For the new awards count
For Status of Funds, by bureau
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: