This thesis presents a study of the magnetism of surface supported atoms performed principally with XMCD spectroscopy and multiplet calculations. The objective of the research was twofold: first, to study the underlying interactions and conditions governing the magnetization stability of surface supported atoms, with the aim of achieving long magnetic lifetimes, and second, to assemble single atom magnets in an ordered pattern. Through our study of $4f$ lanthanide atoms on supporting substrates, we established that their magnetic stability is governed by their quantum level structure, in particular their ground $J_z$ state and the height of the energy barrier for thermally assisted magnetization reversal. These features are ruled through the crystal field interaction with their supporting surface. The adsorption site of adatoms governs the symmetry of the crystal field and, consequently, the coupling between the different $J_z$ levels. This in turn enables magnetization reversal either through quantum tunneling between $J_z$ states or via scattering with the electrons and phonons of the substrate. To reduce the scattering events, it is necessary to decouple the adatoms from the metal substrate by using decoupling layers. Here we show that a single layer of graphene is sufficient to decouple Dy atoms from the underlying Ir(111) substrate, resulting in a magnetic lifetime of about 1000~s at 2.5~K. In addition, we show that the moiré pattern of the graphene/Ir(111) surface can be used as a template for the self-assembly of these single atom magnets into well ordered superlattices. Further, by studying multiple graphene/metal substrates we show that the interaction of graphene with the supporting substrate greatly influences the magnetization stability of adsorbed atoms. Finally, we show that replacing graphene with an insulating layer does not result in a stable magnetization of adsorbed atoms if its superior decoupling is not accompanied with an adequate crystal field symmetry.