  The hard X-ray emission in active galactic nuclei (AGN) and black hole X-ray
binaries is thought to be produced by a hot cloud of electrons referred to as
the corona. This emission, commonly described by a power law with a high-energy
cutoff, is suggestive of Comptonization by thermal electrons. While several
hypotheses have been proposed to explain the origin, geometry, and composition
of the corona, we still lack a clear understanding of this fundamental
component. NuSTAR has been playing a key role improving our knowledge of X-ray
coronae thanks to its unprecedented sensitivity above 10 keV. However, these
constraints are limited to bright, nearby sources. The High Energy X-ray Probe
(HEX-P) is a probe-class mission concept combining high spatial resolution
X-ray imaging and broad spectral coverage (0.2-80 keV) with a sensitivity
superior to current facilities. In this paper, we highlight the major role that
HEX-P will play in further advancing our insights of X-ray coronae, notably in
AGN. We demonstrate how HEX-P will measure key properties and track the
temporal evolution of coronae in unobscured AGN. This will allow us to
determine their electron distribution and test the dominant emission
mechanisms. Furthermore, we show how HEX-P will accurately estimate the coronal
properties of obscured AGN in the local Universe, helping address fundamental
questions about AGN unification. In addition, HEX-P will characterize coronae
in a large sample of luminous quasars at cosmological redshifts for the first
time and track the evolution of coronae in transient systems in real time. We
also demonstrate how HEX-P will enable estimating the coronal geometry using
spectral-timing techniques. HEX-P will thus be essential to understand the
evolution and growth of black holes over a broad range of mass, distance, and
luminosity, and will help uncover the black holes' role in shaping the
Universe.
