API - How to revoke badge from a user

This took a moment to research, but it’s not that hard actually:

  • GET to /user-badges/<username>.json
  • In the result, inspect user_badges and find the entry you want to delete. You can identify the badge by its badge_id, which will be defined in the badges property of the answer.
  • Look at the id property of the entry you want to delete, and DELETE /user_badges/<id>.

Interestingly, the response to /user-badges/<username>.json also contains a few badges the have not been granted to this user – maybe a :discourse: team member can explain why :slight_smile: