https://docs.moodle.org/dev/Tag_API - and look for uses of that API in the question folder in the Moodle code.
General developer forum
How to find tag id if question id is given
This discussion has been locked so you can no longer reply to it.