USAspending API ReferenceIndependent
Try the API

Awarding Agency and Office Autocomplete

POST/api/v2/autocomplete/awarding_agency_office/

This endpoint can be used to autocomplete Awarding Agency and Office searches on the Advanced Search page. It will return any agencies, sub-agencies, and offices that match the search text. Additionally, any matching agencies will include associated offices and sub-agencies, any matching sub-agencies will include associated agencies and offices, and any matching offices will include associated agencies and sub-agencies.

This route sends a request to the backend to retrieve awarding agencies and offices matching the specified search text.

Request

curl -X POST 'https://api.usaspending.gov/api/v2/autocomplete/awarding_agency_office/' \
  -H 'Content-Type: application/json' \
  -d '{
  "search_text": "Defense"
}'

Request body

  • limitnumber

    Number of results to return (min: 1, max: 500)

    Default 10

  • search_textstringRequired

    Search text can be an office or agency name, or it can be an agency abbreviation. For example, try searching for DoD and Department of Defence.

Try it

Runs against the live API. Responses are real data.

POST/api/v2/autocomplete/awarding_agency_office/

Response · 200

  • resultsarray of AwardingAgencyOfficeMatchObjectRequired3 fields
    • toptier_agencyobjectRequired5 fields
      • abbreviationstringRequiredNullable
      • codestringRequired
      • namestringRequired
      • subtier_agenciesarray of SubAgenciesChildObjectRequired3 fields
        • abbreviationstringRequiredNullable
        • codestringRequiredNullable
        • namestringRequired
      • officesarray of OfficesChildObjectRequired2 fields
        • codestringRequired
        • namestringRequired
    • subtier_agencyobjectRequired5 fields
      • abbreviationstringRequiredNullable
      • codestringRequired
      • namestringRequired
      • toptier_agencyobject · AgenciesChildObjectRequired3 fields
        • abbreviationstringRequiredNullable
        • codestringRequired
        • namestringRequired
      • officesarray of OfficesChildObjectRequired2 fields
        • codestringRequired
        • namestringRequired
    • officeobjectRequired4 fields
      • codestringRequiredNullable
      • namestringRequired
      • toptier_agencyobject · AgenciesChildObjectRequired3 fields
        • abbreviationstringRequiredNullable
        • codestringRequired
        • namestringRequired
      • subtier_agencyobject · SubAgenciesChildObjectRequired3 fields
        • abbreviationstringRequiredNullable
        • codestringRequiredNullable
        • namestringRequired
  • messagesarray of stringRequired

    An array of warnings or instructional directives to aid consumers of this endpoint with development and debugging.

Example response
{
  "results": [
    {
      "toptier_agency": {
        "abbreviation": null,
        "code": "",
        "name": "",
        "subtier_agencies": [
          {
            "abbreviation": null,
            "code": null,
            "name": ""
          }
        ],
        "offices": [
          {
            "code": "",
            "name": ""
          }
        ]
      },
      "subtier_agency": {
        "abbreviation": null,
        "code": "",
        "name": "",
        "toptier_agency": {
          "abbreviation": null,
          "code": "",
          "name": ""
        },
        "offices": [
          {
            "code": "",
            "name": ""
          }
        ]
      },
      "office": {
        "code": null,
        "name": "",
        "toptier_agency": {
          "abbreviation": null,
          "code": "",
          "name": ""
        },
        "subtier_agency": {
          "abbreviation": null,
          "code": null,
          "name": ""
        }
      }
    }
  ],
  "messages": []
}

Recent changes

Generated from contracts/v2/autocomplete/awarding_agency_office.md in the USAspending API repo.

Loading…