The Onsager and higher-order reciprocity relations are derived from a fluctuation theorem for nonequilibrium reactions ruled by the chemical master equation. The fluctuation theorem is obtained for the generating function of the macroscopic fluxes between chemiostats maintaining the system in a nonequilibrium steady state. The macroscopic affinities associated with the fluxes are identified by graph theory. The Yamamoto-Zwanzig formulas for the reaction constants are also derived from the fluctuation theorem.