Query the SAM.gov Federal Hierarchy Public API to retrieve federal department, agency, and sub-tier organization data for routing grant or contract records
domain: api.sam.gov · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗
Steps
Register a SAM.gov account and generate a Public API key from the Account Details page; re-entering your account password is required to view or generate the key.
Call GET https://api.sam.gov/prod/federalorganizations/v1/orgs with your api_key and optional filters such as fhorgname, fhorgtype (Department/Ind. Agency or Sub-Tier), status, or agencycode to search organizations.
Use the limit and offset parameters to page through results — the API defaults to 10 records per page with a maximum of 100.
To drill into an organization's children, call GET .../org/hierarchy?fhorgid=<id>&api_key=<key>, which returns the immediate next-level hierarchy; this endpoint returns a 400 if the organization has no children.
Parse the response's fhfullparentpathid and fhfullparentpathname fields if you need the full department-to-sub-tier lineage rather than just the immediate parent.
Test against the staging environment (api-alpha.sam.gov/prodlike) with an alpha.sam.gov-issued key before pointing production traffic at the prod endpoint.
Known gotchas
Rate limits differ sharply by account type: 1,000 requests/day for verified federal users vs. only 10 requests/day for non-federal users — plan caching accordingly since most integrators fall in the low-limit tier.
This Public API only returns the top two hierarchy levels (Department/Independent Agency and Sub-Tier) by default; office-level detail requires the separate FOUO API, which is restricted to U.S. Government users.
Production and staging use separate API keys and base domains (api.sam.gov vs. api-alpha.sam.gov/alpha.sam.gov) — a production key will not authenticate against the staging URL.
Give your agent this knowledge — and 15,500+ more routes
One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp
Need this verified for your stack — or a route we don't have yet?