# Authenticating using API keys when accessing API through fetch

**URL:** <https://meta.discourse.org/t/authenticating-using-api-keys-when-accessing-api-through-fetch/134149>\
**Category:** Development\
**Tags:** rest-api\
**Created:** [November 22, 2019, 12:32pm UTC](https://meta.discourse.org/t/authenticating-using-api-keys-when-accessing-api-through-fetch/134149 "2019-11-22T12:32:59Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)\
**Post date:** [November 22, 2019, 2:12pm UTC](https://meta.discourse.org/t/authenticating-using-api-keys-when-accessing-api-through-fetch/134149/2 "2019-11-22T14:12:48Z")

</div>

Have a look at the Authentication section that’s near the top of [https://docs.discourse.org/](https://docs.discourse.org/). It gives an example of how to set your API credentials in the request header. You need to use `Api-Key` and `Api-Username` in the header.

---

_[View the full topic](https://meta.discourse.org/t/authenticating-using-api-keys-when-accessing-api-through-fetch/134149)._
