The officers have left Yemen, Marie Harf, a spokeswoman for the State Department, said in a statement. No other details were provided.
Citing unidentified U.S. officials, The New York Times reported that the Americans were a CIA officer and a lieutenant colonel with the elite Joint Special Operations Command who were visiting a barber shop in an upscale district in Yemen's capital.
Within days of the shooting, both Americans left Yemen with the approval of the Yemeni government, the newspaper reported. It said the shooting occurred on April 24.
Earlier this week, the U.S. Embassy in Sanaa closed temporarily because of attacks on Westerners. A day before Tuesday's closure, gunmen opened fire on three French security guards working with the European Union mission in the Yemeni capital, killing one and wounding another.
The U.S. has waged a heavy campaign of drone strikes in Yemen against the group al-Qaida in the Arabian Peninsula. This month, the Yemeni government has been waging an offensive against the militant group, and violence around the country has been on an upswing.
On Friday, gunmen believed to be al-Qaida militants ambushed the motorcade of Yemen's defense minister in the Mahfad region, officials said. The assassination attempt failed.
Later in the day, a security checkpoint near the presidential palace in Sanaa came under attack, and at least two policemen died.