  We use polarized inelastic neutron scattering to study the temperature and
energy dependence of spin space anisotropies in the optimally hole-doped iron
pnictide Ba$_{0.67}$K$_{0.33}$Fe$_{2}$As$_{2}$ ($T_{{\rm c}}=38$ K). In the
superconducting state, while the high-energy part of the magnetic spectrum is
nearly isotropic, the low-energy part displays a pronouced anisotropy,
manifested by a $c$-axis polarized resonance. We also observe that the spin
anisotropy in superconducting Ba$_{0.67}$K$_{0.33}$Fe$_{2}$As$_{2}$ extends to
higher energies compared to electron-doped BaFe$_{2-x}TM_{x}$As$_{2}$ ($TM=$Co,
Ni) and isovalent-doped BaFe$_{2}$As$_{1.4}$P$_{0.6}$, suggesting a connection
between $T_{\rm c}$ and the energy scale of the spin anisotropy. In the normal
state, the low-energy spin anisotropy for optimally hole- and electron-doped
iron pnictides onset at temperatures similar to the temperatures at which the
elastoresistance deviate from Curie-Weiss behavior, pointing to a possible
connection between the two phenomena. Our results highlight the relevance of
the spin-orbit coupling to the superconductivity of the iron pnictides.
