Olympian Ryan Lochte was suspended Monday for 14 months for getting an intravenous infusion, which broke anti-doping rules -- and authorities first learned about the infusion when Lochte posted a photo of it to social media.

Lochte, 33, was not using a banned substance, but was using intravenous infusions in a volume greater than 100 mL within a 12-hour period, U.S. officials said. Athletes can only receive IVs through hospital treatment under anti-doping regulations.

“A subsequent investigation by USADA, with which Lochte fully cooperated, revealed that Lochte received an intravenous infusion of permitted substances at an infusion clinic in a volume greater than 100 mL in a 12-hour period without a Therapeutic Use Exemption TUE,” the U.S. Anti-Doping Agency said in a press release.

The 12-time Olympic medalist posted a photo of himself getting the IV in May, which prompted the investigation. Lochte was set to race in four events this week at the national championships in California.

The photo has since-been deleted.

Lochte’s suspension began on May 24, 2018 and he'll be eligible to return to the water in July 2019.

It is the swimmer’s second suspension since the Rio Olympics. He was banned for 10 months after claiming he and three other American swimmers were robbed at gunpoint at the 2016 Games.

The Associated Press contributed to this report.