It sounds like you are dealing with laryngitis, which is an inflammation of the vocal cords. There are two basic types of laryngitis. The first is laryngitis from an infection of the vocal cords. This is usually caused by a common viral infection, such as the common cold, and it typically will begin with a scratchy throat and then proceed to hoarseness
as in your case. The second type of laryngitis is from mechanical strain of the vocal cords, and is most common in people who sing or otherwise use their voice for a living.
Neither type of laryngitis is usually very serious, and most of the time all that is needed is a bit of rest before things return back to normal. However, it is never a bad idea to go see your primary care doctor
about the issue. They can make sure that there is nothing more worrisome going on, such as a more serious infection requiring antibiotics. They can also prescribe medications to help associated symptoms such as cough and sore throat
Assuming your doctor doesn't find anything concerning on your exam, you should be starting to feel better and have return of your voice within a few more days.