There are a multitude of online pinyin to Hanzi converters as well as several pinyin-based IMEs that do what you want but not in a way that you can include them in your own program.
Over on the Chinese Language Stack Exchange they suggest using the Google Translate API. This would allow you to integrate it with you own program but won't give you a list of all possible Hanzi characters, like you request.
I can't seem to find an out-of-the-box solution that does everything you need but depending on your programming ability, you may be able to build your own rudimentary pinyin-to-Hanzi converter using available resources. Looking into several Hanzi-to-pinyin converters, I've noticed that most simply perform a dictionary look-up and that they store the actual Hanzi-to-pinyin conversions as plain text files. You could easily read those files yourself, strip out the tonal information, and build a reverse mapping where each valid pinyin syllable maps to a list of Hanzi characters.