The New York City Triathlon was canceled on Thursday, a day after Mayor de Blasio urged race directors not to hold the event as scheduled on Sunday, when severe heat is expected. Life Time, the company that runs the triathlon, said in a statement that it had made the decision with guidance from city officials and that all registered participants would receive a full refund. It cost $338 for the first 1,000 entries and as much as $399 for the rest.This is the first cancellation of the triathlon, which was founded in 2001. \u201cThis difficult decision was made following a comprehensive review and, ultimately, with the goal of prioritizing the safety of everyone participating in or otherwise involved with the execution of the event,\u201d the Life Time statement said.Temperatures are expected to be as high as 98 degrees on Sunday, and an excessive heat warning is in effect for the city from noon Friday to 8 p.m. Sunday. Mr. de Blasio altered his presidential campaign itinerary so he could be in the city this weekend after receiving heavy criticism on social media for being in Iowa last weekend when a power failure in Manhattan left 73,000 people in the dark.\u201cThis weekend is projected to be our hottest in almost 10 years \u2014 posing great risk to triathlon participants,\u201d said Freddi Goldstein, the mayor\u2019s spokeswoman. \u201cThe health and safety of New Yorkers is our top priority, and as such, we urged organizers to cancel the race.\u201dOrganizers estimated that 4,000 people had registered for the race. \u201cI\u2019m shocked, absolutely shocked,\u201d said Alison Kreideweis, the founder of the Empire Triathlon Club, based in New York City. The club had 60 members signed up to race on Sunday. \u201cGenerally speaking I would assume if anything they would shorten the run course or turn off the clocks and have it be a fun, noncompetitive event.\u201dOrganizers shortened the run portion in the middle of the event last year because of extreme heat, decreasing the distance to one mile from 10 kilometers (6.2 miles). The hydration stations set up for this year\u2019s race will still be open along the course, with the event\u2019s staff distributing water and Gatorade to the public. The 1,500-meter swim was to be held in the Hudson River, followed by a 40-kilometer bike ride on the Upper West Side, starting in Riverside Park, and then the 10-kilometer run through Riverside Park and Central Park.Race organizers said they would provide additional information on Friday at a joint news conference with city officials.The New York Road Runners also canceled their 10-mile New York City Marathon Training Series race, which was scheduled for Saturday. The triathlon is expected to undergo drastic changes next year, because the city will be doing construction around the 79th Street Boat Basin. Organizers must alter the course and, as a result, the maximum number of participants will drop to 2,500 from 4,000. Jacey Fortin contributed reporting.