A search is presented for exotic decays of a Higgs boson into undetectable particles and one or two isolated photons in pp collisions at a center-of-mass energy of 8 TeV. The data correspond to an integrated luminosity of up to 19.4 fb −1 collected with the CMS detector at the LHC. Higgs bosons produced in gluon–gluon fusion and in association with a Z boson are investigated, using models in which the Higgs boson decays into a gravitino and a neutralino or a pair of neutralinos, followed by the decay of the neutralino to a gravitino and a photon. The selected events are consistent with the background-only hypothesis, and limits are placed on the product of cross sections and branching fractions. Assuming a standard model Higgs boson production cross section, a 95% confidence level upper limit is set on the branching fraction of a 125 GeV Higgs boson decaying into undetectable particles and one or two isolated photons as a function of the neutralino mass. For this class of models and neutralino masses from 1 to 120 GeV an upper limit in the range of 7 to 13% is obtained. Further results are given as a function of the neutralino lifetime, and also for a range of Higgs boson masses.