The ionization of the circumstellar medium of SN 1987A by hard radiation following the supernova outburst is analyzed. Particular emphasis is placed on circumstellar UV and optical emission lines from the supernova. The observations are well modeled by a circumstellar shell, ionized by the strong soft X-ray burst during the first hours after the explosion. After the initial nearly complete ionization, the shell recombines into the observed ionization stages. At the breakout, the shell is heated to ∼10 5 K, subsequently cooling to ∼5×10 4 K in ∼300 days, in agreement with optical observations