Context. The measure of the water deuterium fractionation is a relevant tool for understanding mechanisms of water formation and evolution from the prestellar phase to the formation of planets and... Show moreContext. The measure of the water deuterium fractionation is a relevant tool for understanding mechanisms of water formation and evolution from the prestellar phase to the formation of planets and comets. Aims: The aim of this paper is to study deuterated water in the solar-type protostars NGC 1333 IRAS 4A and IRAS 4B, to compare their HDO abundance distributions with other star-forming regions, and to constrain their HDO/H$_{2}$O abundance ratios. Methods: Using the Herschel/HIFI instrument as well as ground-based telescopes, we observed several HDO lines covering a large excitation range (E$_{up}$/k = 22-168 K) towards these protostars and an outflow position. Non-local thermal equilibrium radiative transfer codes were then used to determine the HDO abundance profiles in these sources. Results: The HDO fundamental line profiles show a very broad component, tracing the molecular outflows, in addition to a narrower emission component and a narrow absorbing component. In the protostellar envelope of NGC 1333 IRAS 4A, the HDO inner (T {ge} 100 K) and outer (T {lt} 100 K) abundances with respect to H$_{2}$ are estimated with a 3{$σ$} uncertainty at 7.5$_{-3.0}$$^{+3.5}$ { imes} 10$^{-9}$ and 1.2$_{-0.4}$$^{+0.4}$ { imes} 10$^{-11}$, respectively, whereas in NGC 1333 IRAS 4B they are 1$_{-0.9}$$^{+1.8}$ { imes} 10$^{-8}$ and 1.2$_{-0.4}$$^{+0.6}$ { imes} 10$^{-10}$, respectively. Similarly to the low-mass protostar IRAS 16293-2422, an absorbing outer layer with an enhanced abundance of deuterated water is required to reproduce the absorbing components seen in the fundamental lines at 465 and 894 GHz in both sources. This water-rich layer is probably extended enough to encompass the two sources, as well as parts of the outflows. In the outflows emanating from NGC 1333 IRAS 4A, the HDO column density is estimated at about (2-4) { imes} 10$^{13}$ cm$^{-2}$, leading to an abundance of about (0.7-1.9) { imes} 10$^{-9}$. An HDO/H$_{2}$O ratio between 7 { imes} 10$^{-4}$ and 9 { imes} 10$^{-2}$ is also derived in the outflows. In the warm inner regions of these two sources, we estimate the HDO/H$_{2}$O ratios at about 1 { imes} 10$^{-4}$-4 { imes} 10$^{-3}$. This ratio seems higher (a few %) in the cold envelope of IRAS 4A, whose possible origin is discussed in relation to formation processes of HDO and H$_{2}$O. Conclusions: In low-mass protostars, the HDO outer abundances range in a small interval, between ~{}10$^{-11}$ and a few 10$^{-10}$. No clear trends are found between the HDO abundance and various source parameters (L$_{bol}$, L$_{smm}$, L$_{smm}$/L$_{bol}$, T$_{bol}$, L$_{bol}$$^{0.6}$/M$_{env}$). A tentative correlation is observed, however, between the ratio of the inner and outer abundances with the submillimeter luminosity. Based on observations carried out with the Herschel/HIFI instrument, the Institut de Radioastronomie Millimétrique (IRAM) 30 m Telescope, the James Clerk Maxwell Telescope (JCMT), and one of the ESO telescopes at the La Silla Paranal, the Atacama Pathfinder Experiment (APEX, programme ID 090.C-0239). Herschel is an ESA space observatory with science instruments provided by European-led principal Investigator consortia and with important participation from NASA. IRAM is supported by INSU/CNRS (France), MPG (Germany), and IGN (Spain). The JCMT is operated by the Joint Astronomy Centre on behalf of the Science and Technology Facilities Council of the United Kingdom, the Netherlands Organization for Scientific Research, and the National Research Council of Canada. APEX is a collaboration between the Max-Planck-Institut für Radioastronomie, the ESO, and the Onsala Space Observatory.Appendices are available in electronic form at http://www.aanda.orgShow less