Nine years, from 1836 to 1845.
It began with the Texas Revolution and the declaration of independence in 1836, and ended when Texas was annexed by the United States and became the 28th state in December 1845.
Annexation was contentious at the time, largely because it reopened the question of slavery and worsened tensions with Mexico, which never fully recognised the independence in the first place.