On the annexation of the Punjab he was appointed deputy-commissioner at Gujarat in April 1849, and in November under-secretary to the government of India in the foreign department, under Sir Henry Elliot.
In September 1857 he was ordered to Allahabad, where he served as an under-secretary in Sir John Peter Grant's provisional government, and held various posts in that city during the next eighteen months.
In 1859 he was appointed judge in the Fatehgarh Sahib district, and, after serving in a judicial capacity at Lucknow and Agra, was called to Calcutta by Lord Canning in May 1861, to fill the post of foreign secretary pending the arrival of Sir Henry Marion Durand.
[2] Bayley's leisure was spent in the study of the history and antiquities of India, and he published some fifteen papers in the Journal of the Bengal Asiatic Society, mainly on Indian inscriptions, sculptures, and coins, which he collected.
[1] He also contributed to the Journal of the Royal Asiatic Society of London (1882–83) some articles on the 'Genealogy of Modern Numerals,' and to the Numismatic Chronicle (1882) a paper on 'Certain Dates on the Coins of the Hindu kings of Kabul.'