In my post on the invasion executive order, I wrote "I think it pretty clear that the President can declare an invasion." A reader opined that because Congress has the power to declare war, the President cannot unilaterally declare an invasion. Relatedly, a reporter asked me if a President has ever before declared an invasion.
I think the general consensus view is that for the President to use military power abroad as part of a war, Congress must declare war. (There is some debate about whether a declaration is needed for something less than a war, such as "hostilities," but I'll table that issue for now.) I also think the general consensus view is that the President does not need a declaration of war to repel an invasion. That is, if the United States is under attack, the President can act to secure the homeland before seeking authorization from Congress. And if the President can repel an invasion, then he necessarily has the power to declare when such an invasion is occurring.
Thankfully, the United States has suffered very few invasions. Our conflicts generally have been fought abroad. A few of the more prominent invasions would be the War of 1812 and Pearl Harbor. In both conflicts, Congress issued declarations of war against Great Britain and Japan, respectively. On short notice, I could not find anything from President Madison that is relevant for the War of 1812. But I find relevant President Franklin D. Roosevelt's "Day of Infamy" speech, delivered on December 8, 1841. This speech asked that Congress declare war between the United States and Japan. Yet, FDR had already determined that Japan invaded the United States. He spoke to the invasion directly: