  HOCO$^+$ is a polar molecule that represents a useful proxy for its parent
molecule CO$_2$, which is not directly observable in the cold interstellar
medium. This cation has been detected towards several lines of sight, including
massive star forming regions, protostars, and cold cores. Despite the obvious
astrochemical relevance, protonated CO$_2$ and its deuterated variant,
DOCO$^+$, still lack an accurate spectroscopic characterisation. The aim of
this work is to extend the study of the ground-state pure rotational spectra of
HOCO$^+$ and DOCO$^+$ well into the sub-millimetre region. Ground-state
transitions have been recorded in the laboratory using a frequency-modulation
absorption spectrometer equipped with a free-space glow-discharge cell. The
ions were produced in a low-density, magnetically-confined plasma generated in
a suitable gas mixture. The ground-state spectra of HOCO$^+$ and DOCO$^+$ have
been investigated in the 213-967 GHz frequency range, with the detection of 94
new rotational transitions. Additionally, 46 line positions taken from the
literature have been accurately remeasured. The newly-measured lines have
significantly enlarged the available data sets for HOCO$^+$ and DOCO$^+$, thus
enabling the determination of highly accurate rotational and centrifugal
distortion parameters. Our analysis showed that all HOCO$^+$ lines with Ka
$\geq$ 3 are perturbed by a ro-vibrational interaction that couples the ground
state with the v$_ 5$ = 1 vibrationally-excited state. This resonance has been
explicitly treated in the analysis in order to obtain molecular constants with
clear physical meaning. The improved sets of spectroscopic parameters provide
enhanced lists of very accurate, sub-millimetre rest-frequencies of HOCO$^+$
and DOCO$^+$ for astrophysical applications. These new data challenges a recent
tentative identification of DOCO$^+$ toward a pre-stellar core.
