Turkish residents and tourists having a trip in Turkey need a HES code.
To get HES code you must have access to a mobile phone registered on a Turkish operator(Turkcell, Turk Telekom, Vodafone).
You have to send an SMS to 2023. SMS format must be as below. All information below must be same with the passport that you used while entering Turkey.
[HES] [NATIONALITY] [PASSPORT NUMBER] [YEAR OF BIRTH] [YOUR SURNAME]
Example: HES UKR P12345678 1989 REBROV
You can reach 3 characters nationality list from the link: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3