© 2019 American Physical Society. We report the energy dependence of mid-rapidity (anti-)deuteron production in Au+Au collisions at sNN=7.7, 11.5, 14.5, 19.6, 27, 39, 62.4, and 200 GeV, measured by the STAR experiment at the BNL Relativistic Heavy Ion Collider. The yield of deuterons is found to be well described by the thermal model. The collision energy, centrality, and transverse momentum dependence of the coalescence parameter B2 are discussed. We find that the values of B2 for antideuterons are systematically lower than those for deuterons, indicating that the correlation volume of antibaryons is larger than that of baryons at sNN from 19.6 to 39 GeV. In addition, values of B2 are found to vary with collision energy and show a broad minimum around sNN=20-40 GeV, which might imply a change of the equation of state of the medium in these collisions.