A user, dsclrsr, seeks guidance on obtaining an API key for programmatically creating topics on a Discourse instance using Python. Despite having admin panel access, they cannot generate the key, as the /admin/api/keys page is restricted. JammyDodger clarifies that access to this page requires a full Admin (system admin) role, not just a moderator role, and provides a link to Discourse’s role documentation 35171. The user confirms the issue was resolved by the hoster, who granted the necessary permissions. Another user, Robert_Mercado, then asks for clarification on the API request parameters, particularly the scopes field, and requests example code.
you will need to create an API Key from the admin panel
I have searched/looked in the admin panel, but I cannot find where I can generate this API key.
Unfortunately I have lost quite a bit of time already looking how to generate a key I can use as the Api-Key header. Should be simple? Where can I generate it?
Ok turns out I am not a real admin, even though I can visit the admin panel over at /admin/ I cannot visit /admin/api/keys, I asked the hoster who setup the forum and he was able to create me a key at this location.
Seems to be a distinction between ‘admin’ (like a moderator) and ‘admin’ (like a system admin).
Ah yes. Moderator and Admin are distinct roles in Discourse. A Moderator has quite a lot of high level functions for user and content moderation, but an Admin (or Sysadmin) has access to far more settings and functions to do with setting up the forum itself. You can read more info about those roles in Understanding user statuses, roles, and permissions