from tmobile:
Unlock Eligibility for Monthly Phones and Tablets
The device must have been active on the T-Mobile network for at least 40 days on the requesting line.
If the device is financed using T-Mobiles Equipment Installment Plan (EIP), all payments must be satisfied and the device must be paid in full.
If the device is on an account that is under a service contract term, at least 18 consecutive monthly payments must have been made or the account has migrated to Simple Choice no contract rate plan.
If the device is associated with a canceled account, the account balance must be zero, including all pending charges
T-Mobile may request proof of purchase or additional information in its discretion and certain other exceptions may apply.