Extract host names from last 90 days till now using API?

Want to extract the details of host names from last 90 days till current date using API, can I do it?

yes you can via the Environment API.

I have some hosts, where one agent stopped working, so would I not be able to extract that hosts?

Sure they are still receivable through the API, just use a past timeframe where OneAgent was running back then.