I'd recommend spending no less than two days in Baku. This will allow you to explore Baku attractions like the Flame Towers and Maiden's Tower at a leisurely pace. Moreover, since you will likely travel to Baku by plane, you need at least two days to justify the journey.