Several new pyrazolo[1,5-a]pyrimidine and pyrazolo[1,5-c]-as-triazine derivatives were synthesized via the reaction of 3-antipyrinyl-5-aminopyrazole or its diazonium salt with enaminonitriles, enaminoesters and active methylene reagents. The action of hydrazine hydrate on the obtained polyfunctional products was also studied.