# How to programmatically generate user api key

**URL:** https://meta.discourse.org/t/how-to-programmatically-generate-user-api-key/151738
**Category:** Development
**Created:** [May 17, 2020, 7:20am UTC](https://meta.discourse.org/t/how-to-programmatically-generate-user-api-key/151738 "2020-05-17T07:20:40Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![jandres](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jandres/32/130933_2.png) [@jandres](https://meta.discourse.org/u/jandres)
#### Post date: [December 2, 2020, 9:11pm UTC](https://meta.discourse.org/t/how-to-programmatically-generate-user-api-key/151738/3 "2020-12-02T21:11:12Z")

</div>

Hi

According with the docs it may be possible to create an user api key from an admin user via the rest API  
[generate api key for a user from an admin user](https://docs.discourse.org/#tag/Admin/paths/~1admin~1api~1keys/post)

In previous versions it worked as “admin/users/‘+ user\_id +’/generate\_api\_key”. I don’t know why in latest version it changes.

Thank you for your help

---

_[View the full topic](https://meta.discourse.org/t/how-to-programmatically-generate-user-api-key/151738)._
