Twenty-fifth Amendment to the United States Constitution
Section 3 says that a President can declare themselves "unable to discharge the powers and duties of their office" (unable to do their job).  He or she must say this in a written letter to both the President pro tempore of the Senate and the Speaker of the House of Representatives. Once the President does this, the Vice President becomes Acting President. The President can take back the Presidency at any time by sending letters to the President pro tempore and the Speaker of the House, saying he or she is able to discharge the powers and duties of the Presidency again.