The first thing you need to make the fact of purchase/sale of the apartment in registration chamber. You will be given the relevant document (certificate) that certifies that the property really belongs to you.
Then you take the appropriate forms in your tax authority (or fill out electronically and print out) and write an application to receive tax deductions. These documents you need to file in the tax office you belong to in accordance with the registration.
If you buy apartment in a mortgage, the rule about returning a property tax deduction applies to you in the same way. Moreover, there is an additional plus.
In the case of apartment purchase in a mortgage you can not only return the money for the apartment itself, but also to obtain reimbursement of same 13% interest rate on a mortgage loan, and, moreover, the amount of the credit on interest rates is not limited.