You need to call the Azerbaijan consulate in Los Angeles (Santa Monica actually) and ask. It is only open and taking calls Monday, Wed, Fri from 10 am until around 2 pm. However, when we talked to our man there last February he said you could have a transit visa for several days BUT you cannot leave the airport. The consulate was the ONLY source that was reliable. Trust me on that one. Save yourself grief and bite the bullet on the real visa. Get the double entry for the same price in case you decide that you needed to spend more time and go back. I suggest no less than 3 days or you will see nothing and there is a lot to do there. Outside the city are petroglyphs and we missed them because of the rainy weather (whole place turns to mud). The government has put together around 20 museums. Old Town is very cool with some really interesting local restaurants. Read my comments on what to see which are on Trip Advisor. We were there in late March and it was cold. Recommend late April or May. It is windy all the time and summer is hot and humid. Afar Magazine captioned its photo of Baku as "Blown away by Baku"! Little tongue in cheek humor.
Tell the manager, Martin Kleinman, of JW Marriott that Karen sent you! You will not be sorry you stayed there. Best of everything - location, view, service and food. Have a great time and don't miss the supermarket in the mansion.