Skip to content

Latest commit

 

History

History
223 lines (175 loc) · 13.2 KB

api-docs-links.md

File metadata and controls

223 lines (175 loc) · 13.2 KB

USASpending.gov API Documentation Links

Core API Documentation

Key Endpoints Used in This Project

Use web fetch to access the following official API documentation links for key endpoints utilized in this project. These documentation links provide detailed information about request parameters, response structures, and usage examples.

Award Search

Award Search Count

Spending by State/Territory

Spending by Congressional District

Spending by Recipient

Award Details

Recipient Details

Recipient Search Count

Award transactions

Award Transaction Count

Award funding history

Award Federal Accounts

Subawards

Award Subaward Count

Agency Overview

  • Endpoint: /api/v2/agency/{toptier_code}/
  • Method: GET
  • Documentation: https://api.usaspending.gov/docs/endpoints
  • Purpose: Return overview information for a given federal agency by top-tier agency code
  • Corresponding Query Builder: src/usaspending/queries/agency_query.py
  • Note: The repository markdown contract for /api/v2/references/agency/{id}/ documents a different endpoint keyed by agency_id that returns a nested results object. AgencyQuery does not use that endpoint.

Agency Award Summary

  • Endpoint: /api/v2/agency/{toptier_code}/awards/
  • Method: GET
  • Documentation: https://api.usaspending.gov/docs/endpoints
  • Purpose: Return transaction-count and obligation summary information for a given top-tier agency
  • Corresponding Query Builder: src/usaspending/queries/agency_award_summary.py

Agency Subagencies

  • Endpoint: /api/v2/agency/{toptier_code}/sub_agency/
  • Method: GET
  • Documentation: https://api.usaspending.gov/docs/endpoints
  • Purpose: Return sub-agencies and offices for a given top-tier agency
  • Corresponding Query Builder: src/usaspending/queries/sub_agency_query.py

Funding Agencies Search

Awarding Agencies Search

Download Award Data

Search Download

  • Endpoint: /api/v2/download/search/
  • Method: POST
  • Documentation: https://raw.githubusercontent.com/fedspendingtransparency/usaspending-api/refs/heads/master/usaspending_api/api_contracts/contracts/v2/download/search.md
  • Purpose: Create a download job combining award, transaction, and subaward data matching a set of search filters into a single zip archive.
  • Corresponding Resource: src/usaspending/resources/download_resource.py
  • Key Parameters:
    • filters: (required, object) The standard search filters object (the same one used by /api/v2/search/spending_by_award/)
    • file_format: (optional, enum[string]) The format of the file(s) in the zip archive (csv, tsv, pstxt)
    • spending_level: (optional, array[enum[string]]) Datasets to include: awards, transactions, subawards; defaults to all three
    • columns: (optional, array[string]) Specific columns to include; defaults to the full column set
    • limit: (optional, number) Maximum number of records to include
  • Response: JSON object with the same shape as the other download endpoints (status_url, file_name, file_url, download_request)

Download Status

  • Endpoint: /api/v2/download/status
  • Method: GET
  • Documentation: https://raw.githubusercontent.com/fedspendingtransparency/usaspending-api/refs/heads/master/usaspending_api/api_contracts/contracts/v2/download/status.md
  • Purpose: Gets the current status of a download job.
  • Corresponding Resource: src/usaspending/resources/download_resource.py
  • Key Parameter: file_name (required, string) Taken from the file_name field of a download endpoint response.
  • Response: JSON object with the following parameters:
    • file_name (required, string): Name of the generated zip file
    • message (required, string, nullable): Human-readable error message if the status is failed, otherwise null
    • seconds_elapsed (required, string, nullable): Time spent generating the file so far, or total generation time once complete
    • status (required, enum[string]): Current state of the CSV generation request (failed, finished, ready, running)
    • total_columns (required, number, nullable): Number of columns in the CSV, or null if not finished
    • total_rows (required, number, nullable): Number of rows in the CSV, or null if not finished
    • total_size (required, number, nullable): Estimated CSV size in kilobytes, or null if not finished
    • file_url (required, string): URL for the generated file