# Create and configure an API key

**URL:** https://meta.discourse.org/t/create-and-configure-an-api-key/230124
**Category:** Integrations
**Tags:** rest-api, how-to
**Created:** [June 15, 2022, 10:09pm UTC](https://meta.discourse.org/t/create-and-configure-an-api-key/230124 "2022-06-15T22:09:59Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Discourse](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/discourse/32/148734_2.png) [@Discourse](https://meta.discourse.org/u/Discourse)
#### Post date: [June 15, 2022, 10:09pm UTC](https://meta.discourse.org/t/create-and-configure-an-api-key/230124/1 "2022-06-15T22:09:59Z")

</div>

API keys are generated from the Admin / API page. Go to Admin-Advanced-API Keys:

 ![Left Menu > Admin > API keys](https://global.discourse-cdn.com/meta/original/4X/2/9/7/29783fd31cf07de9c349a2fcef3e241d67322529.png)

 ![Admin > API keys](https://global.discourse-cdn.com/meta/original/4X/a/2/0/a20515147e2f287ce92c7f74c50e3739efe05ab4.png)

After clicking the “Add API key” button, you will be taken to a page to configure the key:

 ![New API key](https://global.discourse-cdn.com/meta/original/4X/3/6/b/36b4b29b494e153167abd8f9382b495038c5443e.png)

Every API key needs a description, a user level, and a scope.

#### Description

The description can be anything that you choose.

#### User Level

The User Level drop down allows you to select either “All Users” or “Single User.” If “All Users” is selected, the key can be used on behalf of any user. This is done by setting the user on whose behalf you are making the request for as the `Api-Username` in the request headers. (See the Authentication example in the [API docs](https://docs.discourse.org/) for details about how to set the request headers.)

If “Single User” is selected, a user field will appear on the form. Enter the username of the user you are generating the API key for into that field:

 ![Single User API key](https://global.discourse-cdn.com/meta/original/4X/f/3/5/f3530ba17fff6e2855ab391038df6ca0e57c1a8b.png)

#### Scope

The Scope drop down allows you to select either “Global”, “Read-only”, or “Granular” as the scope.

If “Global” is selected as the scope, the key can be used for _any requests_ that the user who the key was generated for, or the username that’s entered as the request’s `Api-Username` has permission to perform.

If “Read-only” is selected as the scope, the API key will only be able to be used to make `GET` requests. The key will be able to make any `GET` requests that the user who the key was generated for, or the username that’s entered as the request’s `Api-Username` has permission to perform.

If “Granular” is selected as the scope, a form that allows you to select from the available scopes will be opened. Hover over a scope’s question mark icon to see a description of the scope. Click the scope’s link icon to see a list of paths and request methods that the scope supports. Note that many of the scopes allow you to enter an additional parameter to limit what paths on the site the scope will allow access to:

 ![Granular Scopes](https://global.discourse-cdn.com/meta/original/4X/a/3/8/a384f9712795436d2d59330b0a59d799d411ba8a.png)

After configuring the API key and clicking the Save button, the full API key will be shown to you once. Be sure to copy the key as there is no way to view the full key again.

> ℹ API scopes in Discourse can only _restrict_ what actions an API key can perform relative to the user’s existing permissions. They cannot _grant_ additional permissions beyond what the associated user already has.

> ℹ API keys that have not been used for 180 days are automatically revoked. This is controlled by the `revoke_api_keys_unused_days` site setting.

#### Additional reading

Details about the rate limits that Discourse applies to API keys: [Global rate limits and throttling in Discourse](https://meta.discourse.org/t/global-rate-limits-and-throttling-in-discourse/78612).

Discourse API docs: [https://docs.discourse.org/](https://docs.discourse.org/).

A helpful guide for figuring out how to structure API requests: [How to reverse engineer the Discourse API](https://meta.discourse.org/t/how-to-reverse-engineer-the-discourse-api/20576).

> Last edited by @yigit 2025-12-08T12:47:53Z
> 
> > **Check document**
> >
> > Perform check on document:

---

<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: [October 23, 2023, 8:14pm UTC](https://meta.discourse.org/t/create-and-configure-an-api-key/230124/2 "2023-10-23T20:14:04Z")

</div>

This topic could use an update. I can do that soon if no one gets to it before me.

> [@simon](#):
>
> Hover over a scope’s question mark icon to see a description of the scope.

Testing this with the latest Chrome browser on Ubuntu, both on a local dev site and a hosted Discourse site, a tool tip is no longer being displayed when I hover over the ❓ icon.

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [October 23, 2023, 8:44pm UTC](https://meta.discourse.org/t/create-and-configure-an-api-key/230124/3 "2023-10-23T20:44:54Z")

</div>

Serendipitously, this was actually picked up earlier today. I believe there’s a fix in the works for it 🤞

[https://github.com/discourse/discourse/pull/24062](https://github.com/discourse/discourse/pull/24062)

---

<div class="post-metadata">

### Author: ![Architect](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/architect/32/520575_2.png) [@Architect](https://meta.discourse.org/u/Architect)
#### Post date: [May 10, 2024, 5:44pm UTC](https://meta.discourse.org/t/create-and-configure-an-api-key/230124/4 "2024-05-10T17:44:40Z")

</div>

The first two images of how to generate api key aren’t loading!

With the changes to the admin settings layout can’t find where to generate this.

---

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [May 10, 2024, 5:47pm UTC](https://meta.discourse.org/t/create-and-configure-an-api-key/230124/5 "2024-05-10T17:47:05Z")

</div>

> [@Architect](#):
>
> The first two images of how to generate api key aren’t loading!

This was already mentioned at [Missing images at Meta.discourse.org - #6 by Lilly](https://meta.discourse.org/t/missing-images-at-meta-discourse-org/302963/6)

I think you can see them here [Create and configure an API key - admins - Discourse Meta](https://web.archive.org/web/20221205183753/https://meta.discourse.org/t/create-and-configure-an-api-key/230124)

---

<div class="post-metadata">

### Author: ![Architect](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/architect/32/520575_2.png) [@Architect](https://meta.discourse.org/u/Architect)
#### Post date: [May 10, 2024, 6:18pm UTC](https://meta.discourse.org/t/create-and-configure-an-api-key/230124/6 "2024-05-10T18:18:12Z")

</div>

Found location for new dashboard is in admin settings drop down menu - advanced - API keys

 ![API key](https://global.discourse-cdn.com/meta/original/4X/c/9/d/c9db3350076610eebbac42d80240bf29504dc56b.png)

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [May 10, 2024, 6:46pm UTC](https://meta.discourse.org/t/create-and-configure-an-api-key/230124/7 "2024-05-10T18:46:41Z")

</div>

fixed. also added screenshot of new admin menu location.

thanks @Moin
