While I was looking around at different prayers to Saint Joseph in the Josephology, the theological study of Joseph, and found this one which many have said is the oldest prayer to Joseph that we have.
This old postscript is commonly included with this prayer:
This prayer was found in the 50th year of our Lord and Savior Jesus Christ. In 1505, it was sent from the pope to Emperor Charles when he was going into battle. Whoever shall read this prayer or hear it or keep it about themselves, shall never die a sudden death or be drowned, nor shall poison take effect on them; neither shall they fall into the hands of the enemy or be burned in any fire or be overpowered in battle. Say for nine mornings for anything you desire. It has never been known to fail.
Oh, St. Joseph, whose protection is so great, so strong, so prompt before the throne of God, I place in you all my interest and desires.
Oh, St. Joseph, do assist me by your powerful intercession, and obtain for me from your divine Son all spiritual blessings, through Jesus Christ, our Lord. So that, having engaged here below your heavenly power, I may offer my thanksgiving and homage to the most loving of Fathers.
Oh, St. Joseph, I never weary contemplating you, and Jesus asleep in your arms; I dare not approach while He reposes near your heart. Press Him close in my name and kiss His fine head for me and ask Him to return the kiss when I draw my dying breath. St. Joseph, patron of departing souls, pray for me. Amen.