API
How to Use Your API Key
To successfully access the Data.FERC.gov API, your API key must be included with every request you make.
Important: Keep your API key private and secure. Sharing your key or exposing it in public repositories can compromise your account and may result in service disruption or throttling.
There are two supported methods to do so:
Using an HTTP Header
This is the recommended method for passing your API key, as it keeps your key out of the URL and helps maintain better security and logging practices. You include a custom header named X-Api-Key in your API request, with the value set to your API key.
Example request (GET) using curl:
curl -X GET "https://api.data.ferc.gov/v1/dataset/0/details/" -H "X-Api-key:[YOUR_API_KEY]"- Replace [YOUR_API_KEY] with your actual API key.
- https://api.data.ferc.gov/v1/dataset/0/details/ is the endpoint you are accessing in this example, and it will be different based on the information you’re looking for.
- The -X GET flag specifies a GET request (which is the default for curl, but included here for clarity).
- The -H flag add the API key header.
Using a GET Query Parameter:
Alternatively, you can include your API key as a parameter appended directly to the API endpoint URL using standard HTTP parameters in the query string. This method may be useful for quick testing but is less secure as the key becomes visible in URLs and logs.
How it works: Appending “?api_key=[YOUR_API_KEY] “to the resource URL.
Example request (GET) using curl using a query parameter:
curl -X GET "https://api.data.ferc.gov/v1/dataset/0/details/?api_key=[YOUR-API-KEY]"- Replace [YOUR_API_KEY] with your actual API key.
- Use environment variables or secured storage for our key in production systems.
Web Service Rate Limits
FERC imposes limits on the number of API requests you are allowed to make with your API key. The default rate limit for each user is 1,000 requests per hour and is reset on a rolling basis. Exceeding these limits will lead to your FERC API key being temporarily blocked from making further requests. If you need higher rate limits, please contact support.
You can programmatically check your current rate limit and usage details by inspecting the X-RateLimit-Limit and X-RateLimit-Remaining HTTP response headers. For example, since the API has the default hourly limit of 1,000 requests, after making 2 requests, you will receive these HTTP headers in response to the second request:
X-Ratelimit-Limit: 1000X-Ratelimit-Limit: 998