# Using API Keys with USGS Water Data APIs
Canonical URL: https://api.waterdata.usgs.gov/docs/ogcapi/keys/
> Pass an API key through the api_key query parameter or the X-Api-Key header to raise your USGS water data rate limits.


# Using API Keys with USGS water data APIs

These APIs use API keys managed by [api.data.gov](https://api.data.gov/). Providing your own key means you can make more requests per hour before getting rate limited -- that is, before getting 429 "Too Many Requests" error responses. You can generate a key from [our signup page](https://api.waterdata.usgs.gov/signup); the key will be sent to the email address you provide.

To use your API key, you can pass it to the `api_key` query parameter:

```
https://api.waterdata.usgs.gov/ogcapi/v1/collections/daily/items?limit=1&api_key=DEMO_KEY
```

Replace "DEMO_KEY" in that example with your own API key.

If you prefer, you can instead pass your API Key using the `X-Api-Key` header.  For instance, using [curl's -H flag to add the header](https://curl.se/docs/manpage.html#-H):

```
curl -H 'X-Api-Key: DEMO_KEY' 'https://api.waterdata.usgs.gov/ogcapi/v1/collections/daily/items?limit=1'
```

Either of these approaches will attach your API key to your requests and give you access to higher rate limits.

Information on the rate limits for a given endpoint, and how many requests you can make before being rate limited, are provided in the `X-RateLimit-Limit` and `X-RateLimit-Remaining` headers attached to the responses from each endpoint:

```
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 998
```

API rate limits are used to enable users downloading the data they need without negatively impacting the download experience of other users. If you need assistance structuring your downloads to stay within rate limits, or are building an application that you think will require custom rate limits, please reach out at [wdfn@usgs.gov](mailto:wdfn@usgs.gov).
