The DiscourseClient python library is designed to work with an Admin API key (Admin → API).
What you generate from generate_api_key
is a Client API key.
You need to pass API-User-Key
and API-User-Username
headers instead.
For example:
curl https://forum.example.com/t/95783.json -H 'Api-User-Key: 388b79103056fede1d3223dae032df99' -H 'Api-User-Username: tflidd'`