Searches for the prebiotically-relevant cyanamide ( NH _ { 2 } CN ) towards solar-type protostars have not been reported in the literature . We here present the first detection of this species in the warm gas surrounding two solar-type protostars , using data from the Atacama Large Millimeter/Submillimeter Array Protostellar Interferometric Line Survey ( PILS ) of IRAS 16293–2422 B and observations from the IRAM Plateau de Bure Interferometer of NGC1333 IRAS2A . We furthermore detect the deuterated and ^ { 13 } C isotopologues of NH _ { 2 } CN towards IRAS 16293–2422 B . This is the first detection of NHDCN in the interstellar medium . Based on a local thermodynamic equilibrium analysis , we find that the deuteration of cyanamide ( \sim 1.7 % ) is similar to that of formamide ( NH _ { 2 } CHO ) , which may suggest that these two molecules share NH _ { 2 } as a common precursor . The NH _ { 2 } CN/NH _ { 2 } CHO abundance ratio is about 0.2 for IRAS 16293–2422 B and 0.02 for IRAS2A , which is comparable to the range of values found for Sgr B2 . We explored the possible formation of NH _ { 2 } CN on grains through the NH _ { 2 } + CN reaction using the chemical model MAGICKAL . Grain-surface chemistry appears capable of reproducing the gas-phase abundance of NH _ { 2 } CN with the correct choice of physical parameters .