The Gospel of James, also known as the Infancy Gospel of James or the Protoevangelium of James, is an apocryphal Gospel probably written about AD 145, which expands backward in time the infancy stories contained in the Gospels of Matthew and Luke, and presents a narrative concerning the birth and upbringing of Mary herself. It is the oldest source to assert the virginity of Mary not only prior to, but during (and after) the birth of Jesus. The ancient manuscripts that preserve the book have different titles, including "The Birth of Mary", "The Story of the Birth of Saint Mary, Mother of God," and "The Birth of Mary; The Revelation of James."
The document presents itself as written by James: "I, James, wrote this history in Jerusalem." The purported author is thus James, the brother of Jesus, but scholars have concluded that the work was not written by the person to whom it is attributed, but was composed some time in the 2nd century.
That conclusion is based on the style of the language and the fact that the author describes certain activities as contemporary Jewish customs that probably did not exist. For example, the work suggests there were consecrated temple virgins in Judaism, similar to the Vestal Virgins in pagan Rome, but that is never directly stated to have been a practice in mainstream Judaism. Conversely, some Eastern Orthodox Christians and Roman Catholics argue that the Old Testament shows that the idea of Mary being a consecrated virgin is plausible and claim the practice of consecrated virginity was within Judaism since the days of the prophet Samuel (1 Samuel 2:22), and until the time of the Maccabees (2 Macc 3:19-20). A similar claim is also made by a number of Rabbinic sources.
The consensus is that it was actually composed some time in the 2nd century. The first mention of it is by Origen of Alexandria in the early 3rd century, who says the text, like that of a Gospel of Peter, was of dubious, recent appearance and shared with that book the claim that the "brethren of the Lord" were sons of Joseph by a former wife.