You can generate an API key for a user with this API call:
Request URL:http://localhost:3000/admin/users/4/generate_api_key
Request Method:POST
Request Body:
api_key,
api_username
The response json will look like:
{
"api_key": {
"id": 2,
"key": "630f51d28da39e969eaf26060687449df5ba443b517167a7ae393549a168bdb3",
"user": {
"id": 4,
"username": "discourse2",
"avatar_template": "/letter_avatar_proxy/v2/letter/d/4af34b/{size}.png"
}
}
}