N-Amination of 3-amino-5-tert-butylpyrazole 11 with hydroxylamine-O-sulfonic acid gave the 1,5-diaminopyrazole 12 with good regiochemical control. The reactions of 12 with certain electrophiles (e.g. acetic anhydride, DMF acetal, aromatic aldehydes, methoxymethylene Meldrum's acid) took place at one (or both) of the amino groups and no cyclised products were obtained. Reaction of 12 with carbon disulfide followed by alkylation under basic conditions provided the pyrazolo[1,5-b]1,2,4-triazole 26 which is a useful photographic magenta coupler. Reactions of 12 with 1,2- and 1,3-dicarbonyl compounds (diketones and ketoesters) provided new pyrazolo[1,5-b]1,2,4-triazines 29, 30, 42 and 43 and the first derivatives of the pyrazolo[1,5-b]1,2,4-triazepine system 31 and 35-36. The X-ray crystal structure of the pyrazolotriazepine 33 is reported.