How to programmatically generate user api key

I want to generate API KEY for single user programmatically and I tried something like the following

curl -X POST '<root url>/admin/api/keys' --data 'key%5Bdescription%5D=XXX&key%5Busername%5D=XXX' 

and many other things that I tried.
I got error like this in server log:

Started POST "/admin/api/keys" for at 2020-05-17 06:40:46 +0000
ActionController::RoutingError (No route matches [POST] "/admin/api/keys")

I cannot find any useful document how to do this. Please help.

1 Like

You can follow my example at Generating User API Keys for testing