In 1702 Scarlatti left Naples and went to Florence where he composed operas for Ferdinando de' Medici and for Cardinal Ottoboni, who made him his "maestro di cappella". In 1703 he also got a similar job in Rome at the Basilica di Santa Maria Maggiore.