Skip to content

Agencies

Deprecated endpoint

This endpoint is deprecated. Use Organizations for the unified federal hierarchy. This endpoint will be removed in a future version.

Deprecated scoped contract endpoints

The /api/agencies/{code}/contracts/awarding/ and /api/agencies/{code}/contracts/funding/ endpoints are deprecated. Use /api/contracts/?awarding_agency={code} or /api/contracts/?funding_agency={code} instead.

Agencies are federal organizations exposed at /api/agencies/ (with a small amount of structure via department).

If you need the unified Federal Hierarchy model (departments/agencies/offices all as one tree), see Organizations. For field definitions, see the Organizations Data Dictionary.

Endpoints

  • GET /api/agencies/ (list)
  • GET /api/agencies/{code}/ (detail)

Agency-scoped contract lists (these behave like /api/contracts/, but scoped by agency code):

  • GET /api/agencies/{code}/contracts/awarding/
  • GET /api/agencies/{code}/contracts/funding/

Filtering

Param What it does
search Full-text search over agencies (best-effort, vector-backed).

Ordering

/api/agencies/ does not support ordering=....

Pagination

Agencies use standard page-number pagination:

  • page (default 1)
  • limit (max 100)

Response shaping

This endpoint supports response shaping via the shape query parameter.

  • Leaves: code, name, abbreviation
  • Expansions:
  • department(code,name,abbreviation,description,cgac,website,congressional_justification)

Default shape (no ?shape= param): code,name,abbreviation,department(name,code)

# Just codes and names
/api/agencies/?shape=code,name

# Include department info
/api/agencies/4700/?shape=code,name,department(name,code)

# All department fields
/api/agencies/4700/?shape=code,name,department(*)

SDK examples

List agencies

import os

from tango import TangoClient

client = TangoClient(api_key=os.environ["TANGO_API_KEY"])
resp = client.list_agencies(limit=25)

for a in resp.results:
    print(a.code, a.name)
import { TangoClient } from "@makegov/tango-node";

const client = new TangoClient({ apiKey: process.env.TANGO_API_KEY });
const resp = await client.listAgencies({ limit: 25 });

for (const a of resp.results) {
  console.log(a.code, a.name);
}

Awarding/funding contracts for an agency

The SDKs don’t yet expose a first-class method for these scoped endpoints. Use the contracts endpoint with awarding/funding agency filters, or call the scoped path directly.

import os

from tango import ShapeConfig, TangoClient

client = TangoClient(api_key=os.environ["TANGO_API_KEY"])

data = client._get(
    "/api/agencies/4700/contracts/awarding/",
    params={"limit": 10, "shape": ShapeConfig.CONTRACTS_MINIMAL},
)

print("count:", data.get("count"))
import { ShapeConfig, TangoClient } from "@makegov/tango-node";

const client = new TangoClient({ apiKey: process.env.TANGO_API_KEY });
const http = (client as any).http;

const data = await http.get("/api/agencies/4700/contracts/awarding/", {
  limit: 10,
  shape: ShapeConfig.CONTRACTS_MINIMAL,
});

console.log("count:", data.count);