It is possible to drive in Brazil with your foreign driver's licence for up to 6 months. After 6 months you must request a Brazilian driver's licence. It is not possible to request the Brazilian licence before the 6 months have gone by, they are very strict about this, and they will check your passport to see the date you entered the country.
There are basically two paths you can follow when requesting the Brazilian licence. If your country has an agreement with Brazil regarding driver's licences then you will only need to take a psychological and visual exam, do some paperwork and pay. If your country does not have such an agreement, then unfortunately you will need to do a longer process which includes taking a driving test as well. I was unable to find a list of which countries have agreements with Brazil, but they definitely have it at DETRAN and they will check once you are there.
In my case, my country did have an agreement, and the process I followed in July 2022 was the following: First you must make an appointment online at the DETRAN DF website. Foreigners can only request a Brazilian licence at the DETRAN located at Nuhab I Shopping Popular.
When I made my appointment, I had to wait about a month and a half, so I suggest you plan ahead and make your appointment a few months in advance but keeping in mind you must have been in Brazil for 6 months before going to this first appointment. Count the days because they will do so at DETRAN. For this first appointment you must have: Passport, CPF, original foreign driver's licence, translated foreign driver's licence. (The driver's licence must be translated by an official translator from the Junta Comercial. You can look them up online and choose the one you like best.)
If you have all your paperwork in order, they will proceed to take your photo and your fingerprints. After that, they will give you a long list of clinics where you can go to and take your psychological and visual exam. There are many options all over Brasilia, so you can choose the one that's better for you. Call and make an appointment at the clinic you prefer.
I went to the one at Gilberto Salomão Shopping. They were very kind and helpful and had an opening the next day. I had to fill out a form with some basic personal information. The psychological exam took about 30 minutes and consisted of answering a few questions and solving a few puzzles. After that, a doctor asked me a few questions related to my health and then proceeded with the visual exam.
If you pass both exams, they will give you a form signed and stamped by the psychologist and doctor who evaluated you. They will also give you 2 boletos for you to pay. I paid mine online at Banco do Brasil. (I do not remember the amounts)
The final step is going back to DETRAN at Nuhab I Shopping Popular to turn in the signed forms they gave you at the clinic and proof that you paid your boletos. You do not need to make an appointment for this, just show up and tell them you are there to turn in those documents.
The driver's licence will arrive via mail in about 1 month, but it will be available a few weeks earlier in the app Carteira Digital de Transito.
That was my experience requesting my Brazilian driver's licence. I hope you find this information useful. Have a great day.