The official eService to look at is Vehicle Plate Numbers Ownership, run by the General Directorate of Traffic. It covers cancellation of a vehicle registration certificate, and its fee list includes number retention and number ownership.
The vehicle must have a valid registration and no legal restrictions such as a seizure or loan, and all traffic fines, contraventions and accident records must be cleared. You must also submit the vehicle ownership certificate and the metal licence plates. Confirm with the General Directorate of Traffic whether retention or ownership suits you before you decide.
Fees, documents and conditions can change, so check the official service page before you go.
Read the full guide: Selling your car and keeping the number
Sources