# USAspending Search ## Overview | Property | Value | |----------|-------| | **Status** | active | | **Method** | `GET` | | **Endpoint** | `/v2/usaspending/search` | | **Base URL** | `https://api.piloterr.com` | | **Credit Cost** | 1 credit per call | | **Documentation** | https://www.piloterr.com/library/usaspending-search | ## Description Search US federal awards by keyword. award_type selects one group: contract (default), grant, idv, or loan. Amounts are a number plus a display string. ## Authentication - **Key Name:** `x-api-key` - **Location:** HTTP Header - **Get an API key:** https://app.piloterr.com/register ## Example Request ```bash curl --location --request GET 'https://api.piloterr.com/v2/usaspending/search' \ --header 'Content-Type: application/json' \ --header 'x-api-key: YOUR_API_KEY' ``` ## Example Response ### software contracts ```json { "results": [ { "url": "https://www.usaspending.gov/award/CONT_AWD_GSFC0198106DNAS526555_8000_-NONE-_-NONE-/", "city": null, "state": null, "award_id": "GSFC0198106DNAS526555", "end_date": "2026-10-31", "psc_code": null, "award_type": null, "naics_code": null, "start_date": "1987-09-15", "description": "THE PRIMARY ACTIVITIES COVERED BY THIS EFFORT INCLUDE THE FINAL SERVICING MISSION AND SUBSEQUENT OPERATIONS THROUGH END-OF-MISSION. THESE ACTIVITIES INCLUDE: A. SCIENCE PROGRAM IMPLEMENTATION INCLUDING: MISSION PLANNING SUPPORT, SCIENCE PROGRAM DEFINITION SUPPORT, MANAGEMENT OF THE PROPOSAL SELECTION, TIME ALLOCATION, AND GRANT AWARD COMMITTEE PROCESSES, AND SCIENCE COMMUNITY OUTREACH. B. ROUTINE SCIENCE OPERATIONS INCLUDING: PROPOSAL GENERATION AND RECEIPT, OBSERVATION PLANNING AND SCHEDULING, UPDATING INSTRUMENT HANDBOOKS, OBSERVING AND USER SUPPORT, DATA PROCESSING AND PRODUCT GENERATION, ARCHIVAL AND DATA DISTRIBUTION SERVICES, CALIBRATION ASSISTANCE AND DATA ANALYSIS, ANOMALY INVESTIGATION SUPPORT, USER GRANT ADMINISTRATION, OBSERVER ASSISTANCE AND ENGINEERING OPERATIONS SUPPORT. C.", "award_amount": 2533788480, "amount_display": "$2,533,788,480.00", "funding_agency": "National Aeronautics and Space Administration", "recipient_name": "ASSOCIATION OF UNIVERSITIES FOR RESEARCH IN ASTRONOMY, INC.", "awarding_agency": "National Aeronautics and Space Administration", "awarding_sub_agency": "National Aeronautics and Space Administration", "generated_internal_id": "CONT_AWD_GSFC0198106DNAS526555_8000_-NONE-_-NONE-" } ], "pagination": { "next": "https://www.usaspending.gov/search/?keywords=software&page=2", "page": 1, "per_page": 10, "total_pages": null, "total_results": null } } ``` ## Documentation ## Overview Search US federal awards. `query` is a keyword or a `usaspending.gov/search` URL. `award_type` selects one group: `contract` (the default when you omit it), `grant`, `idv`, or `loan`. An award URL returns 400. Use the award endpoint with `generated_internal_id` from a result. `award_amount` is a number and `amount_display` is the same amount as dollar text, for example `2533788480` and `$2,533,788,480.00`. This search does not publish a total, so `total_results` and `total_pages` are null. Follow `pagination.next` instead. ## Quickstart ``` curl -sS -H "x-api-key: YOUR_API_KEY" "https://api.piloterr.com/v2/usaspending/search?query=software" curl -sS -H "x-api-key: YOUR_API_KEY" "https://api.piloterr.com/v2/usaspending/search?query=software&page=2" curl -sS -H "x-api-key: YOUR_API_KEY" "https://api.piloterr.com/v2/usaspending/search?query=education&award_type=grant" ``` ## Parameters | Name | Detail | |---|---| | query | Required string. Keyword or a usaspending.gov search URL. Example: `software`. An award URL returns 400. | | award_type | Optional string. One group: `contract` (default), `grant`, `idv`, or `loan`. Example: `grant`. | | page | Optional integer from 1. Example: `2`. Defaults to 1. | ## Response fields | Name | Detail | |---|---| | results[].award_id | String or null. PIID or FAIN shown as Award ID. | | results[].generated_internal_id | String or null. Pass this to the award endpoint. Example: `CONT_AWD_GSFC0198106DNAS526555_8000_-NONE-_-NONE-`. | | results[].recipient_name | String or null. | | results[].award_amount | Number or null. Obligation in dollars, not a formatted string. | | results[].amount_display | String or null. Same amount with a dollar sign and thousands separators. | | results[].description | String or null. | | results[].awarding_agency | String or null. | | results[].awarding_sub_agency | String or null. | | results[].funding_agency | String or null. | | results[].start_date | String or null. `YYYY-MM-DD`. | | results[].end_date | String or null. | | results[].award_type | String or null. Often null on the search card. The award endpoint fills the type description. | | results[].city | String or null. Place of performance. | | results[].state | String or null. | | results[].naics_code | String or null. | | results[].psc_code | String or null. | | results[].url | String or null. Award page. | | pagination.page | Integer. | | pagination.per_page | Integer. Always 10. | | pagination.total_results | Null. This search does not return a match count. | | pagination.total_pages | Null. | | pagination.next | String or null. Next search URL when another page exists, for example `https://www.usaspending.gov/search/?keywords=software&page=2`. | ## Pagination 10 awards per page, largest amount first within the selected group. `total_results` and `total_pages` stay null even when more pages exist. `next` is a URL when USAspending reports another page, and null on the last page. Call `page=2` to continue. Award ids do not repeat between pages. Do not mix groups in one call. `award_type=grant` searches grants only. Omit it for contracts. ## Use cases - A reporter pages federal software contracts and compares `award_amount` with `amount_display`. - A grant writer searches `education` with `award_type=grant` and keeps `generated_internal_id` for the award endpoint. - A procurement desk lists IDVs with `award_type=idv` and reads `recipient_name` plus the performance dates. ## Error codes | Name | Detail | |---|---| | 400 | Missing `query`, a non-usaspending host, an award URL sent to search, or an `award_type` outside contract, grant, idv, and loan. | | 404 | No awards on that page. | | 401 | Missing API key. | | 500 | The USAspending request failed. | ## Related endpoints - [USAspending Award](https://www.piloterr.com/library/usaspending-award)