Unlocking the bootloader erases the phone. Back up first.
1. Sign in to a Mi (Xiaomi) account on the phone and add a SIM card with mobile data.
2. Settings, then About phone, tap MIUI or HyperOS version 7 times to enable Developer options.
3. Settings, then Additional settings, then Developer options: turn on OEM unlocking, then open Mi Unlock status and tap "Add account and device".
4. Newer HyperOS phones may also require you to apply in the Xiaomi Community app first.
5. Wait the required period (often 7 days or more). The phone must stay signed in.
6. Download Mi Unlock from Xiaomi's official site, sign in with the same account, put the phone in Fastboot mode (Volume Down and Power), connect it and click Unlock.
Never pay for "instant unlock" services that use stolen accounts.