Blood Test???

Hello ladies, I have read a few times on here about a bllod test you can ask your doctor for to know the gender of your baby? I would love to know more about these, since I had never heard about it. How early can you have it done? Do you just ask your doctor even if you dont need it? And how accurate is it?  Would appreciate all the information I can get.