A residence permit is a document providing a foreigner the rights to reside in the Republic of Latvia for a definite period of time (a temporary residence permit) or permanently (a permanent residence permit).
A residence permit is necessary if you are willing to reside in the Republic of Latvia for a period of time exceeding 90 days within half a year counting from the first day of entrance.