Carlo Broschi, better known as Farinelli, arrived in Madrid on 7 August 1737. King Philip V and his wife Elisabeth Farnese were deeply impressed by his vocal qualities and invited him to remain in their service, on extremely rewarding terms. Although few sources concerning his first months in Spain are available, a newly discovered libretto, L'ombra di Luigi XIV il Grande, sheds light on his position at the Spanish court and his response to the privileged situation he enjoyed. The work is a short solo cantata commissioned by Farinelli and offered to Philip V for his name day in 1738. The title-page indicates Francesco Feo as the composer, but no sources for the musical setting have yet been located, nor any information about a performance of the work. This article examines the content of the cantata's text and situates it within what is known about the life of Farinelli. It also reconstructs in detail the literary career of the author of the text, Giuseppe di Rosa, who was also a magistrate and historian. Additionally, it links the genesis of this encomiastic piece with the activity of Giovanni Battista Filomarino, Neapolitan ambassador at the court of Madrid.