What is the historical origin of the US debt ceiling?

I appreciate that there’s a lot of politics about the debt ceiling, but I’m hoping we can keep this as a factual issue:

When did the debt ceiling get created, and what was its purpose at that time?

Someone will come along with a synopsis, but I remember finding this audio segment from Planet Money useful:

There’s an extensive account of the legislative history in the Wikipedia article.

United States debt ceiling - Wikipedia

History of the United States debt ceiling - Wikipedia

A longer article despite the title, Brief history of US debt limits before 1939, has a good summary of early federal debt practices.