API Guide
This is a technical guide for the portfolio of Grants.gov RESTful Application Programming Interface (API). The target audience are developers who wish to access Grants.gov using available RESTful APIs. This guide will be updated as new RESTful APIs become available.
To interact with the API, some will require an API key from Grants.gov. To get a Grants.gov API key, you will need to open a ticket with the Help Desk.
When you receive your API key, treat it like any other credential:
Don't share your key with other users.
Don't commit your key into a repository alongside your code.
Don't store your key in a shared drive where other users have access.
Don't share your key in helpdesk requests or any other communication.
The Grants.gov Staging environment is available to test your implementation.
For the complete portfolio of APIs available using the SOAP protocol see https://www.grants.gov/system-to-system.
Environments
Endpoints for the production and training environments are as follows:
Environment | Environment URL |
---|---|
Production | https://api.grants.gov |
Staging | https://api.staging.grants.gov |
How to test the APIs
Using Postman
The following steps assume knowledges of Postman and cURL.
Instructions:
Open Postman
Import Collection (in Appendix A): Integrate the supplied Postman collection into your workspace.
Select the API call to test.
Send Request: Click “Send.” Successful executions will return values.
Using cURL in Linux
This example uses Unix cURL, the developer should be able to build their cURL call for the operating system they are using.
Execute the provided cURL commands to interact with the API endpoints. For example:
curl --location 'https://api.www.grants.gov/v1/api/search2' \
--header 'Content-Type: application/json' \
--data '{"keyword": "health"}'
Authentication and Authorization
Authentication and authorization are not required for the following APIs:
Endpoint: search2
Endpoint: fetchOpportunity
API Calls
The endpoint allows you to search for opportunities based on specific search parameters.
Postman Setup
The below instructions are high-level guidance to set up your Postman application and connect to Grants.gov:
Create an account and install the Postman application from the following URL: https://www.postman.com
Open Postman.
Under My Workspace, select Add a New Collection.
Expand the New Collection and select add Request to start working.
Give your request a name. We recommend choosing a name that’s descriptive, like “Flood Prevention Grants Search.”
Change the URL file from GET to POST.
Enter the Grants.gov URL and environment you would like to test.
Select the Body menu. From the pulldown menu, select “raw” and JSON as the type.
In the body, enter the following:
{
"keyword": "the keyword you want to search for goes here"
}
Key Features
Unrestricted Access
Endpoint Structure: The primary endpoint, v1/api/search2, is designed to be accessible without user authentication (in other words, no login or authentication key required). This endpoint democratizes information access, allowing the public and developers alike to conduct thorough searches.
Public: The focus on unrestricted access enables users from all backgrounds to retrieve vital information efficiently, catering to a diverse audience.
Flexible Querying: Variety of keys: The API offers a range of query keys. This rich set of parameters allows for specific searches.
Customizable Searches: Users can creatively combine these keys in various combinations to tailor search results to their unique needs. This flexibility is crucial for both novice and experienced developers, ensuring precise and relevant data extraction.
Enhanced User Experience
Ease of Use: The Grants.gov API's design prioritizes user-friendliness, making it simple for developers to find exactly what they need.
Practical Application: The RESTful nature of the API underscores its utility in real-world scenarios,
providing a seamless and effective search experience.
Endpoint Descriptions
A cornerstone of API integration is a thorough understanding of the various endpoints available for interaction. Below, you’ll find detailed descriptions of each endpoint, including crucial aspects such as expected request headers, required request body formats, potential status codes, and more. This knowledge facilitates seamless and efficient integration with the Grants.gov APIs.
API Versioning
Read our change management policy for updating the API.
Status Codes
Learn more about Grants.gov API Status Codes.