# API key creation

**URL:** https://meta.discourse.org/t/api-key-creation/257074
**Category:** Development
**Tags:** rest-api
**Created:** [March 4, 2023, 7:13pm UTC](https://meta.discourse.org/t/api-key-creation/257074 "2023-03-04T19:13:56Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![manojm321](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/manojm321/32/199669_2.png) [@manojm321](https://meta.discourse.org/u/manojm321)
#### Post date: [March 4, 2023, 7:13pm UTC](https://meta.discourse.org/t/api-key-creation/257074/1 "2023-03-04T19:13:57Z")

</div>

IIUC, today only ADMINs can create API key, I don’t see a reason why I shouldn’t allow user to do it for themselves for their corresponding trust\_level. is there a setting I can toggle?

---

<div class="post-metadata">

### Author: ![not-ethan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/not-ethan/32/282617_2.png) [@not-ethan](https://meta.discourse.org/u/not-ethan)
#### Post date: [March 4, 2023, 8:25pm UTC](https://meta.discourse.org/t/api-key-creation/257074/2 "2023-03-04T20:25:57Z")

</div>

Unfotently there is no setting to allow users to make API keys.

---

<div class="post-metadata">

### Author: ![ClawdiaWolf](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/clawdiawolf/32/262518_2.png) [@ClawdiaWolf](https://meta.discourse.org/u/ClawdiaWolf)
#### Post date: [March 5, 2023, 9:21pm UTC](https://meta.discourse.org/t/api-key-creation/257074/3 "2023-03-05T21:21:51Z")

</div>

Actually, there is, and they’re enabled for TL1 users and higher, but the process is a little complicated.

Assuming an admin hasn’t changed any settings, then [User API keys](https://meta.discourse.org/t/user-api-keys-specification/48536) are possible to generate mostly automatically if you can hijack the protocol used by the DiscourseHub app to generate a key.

There is a slightly more complicated manner for it as well.

@Falco posted a sample Ruby script [here](https://meta.discourse.org/t/generate-user-api-keys-for-testing/145744) that shows an alternate way of generating them.

On my instance that has a lot of devs who use the API heavily we did modify the settings to allow the callback URL to be [http://localhost:56399/discourse](http://localhost:56399/discourse) so the original method would work for us running local servers but that’s not necessary if you use the method in @Falco’s post.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [April 29, 2023, 3:34pm UTC](https://meta.discourse.org/t/api-key-creation/257074/4 "2023-04-29T15:34:49Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
