The energy source powering the X-ray emission from anomalous X-ray pulsars (AXPs) and soft gamma-ray repeaters (SGRs) is still uncertain. In one scenario, the presence of an ultramagnetized neutron star, or ``magnetar, with B on the order of 10^{14} - 10^{15} G is invoked. To investigate this hypothesis, we have analyzed archival ASCA data for several known AXPs and SGRs, and fitted them with a model in which all or part of the X-ray flux originates as thermal emission from a magnetar. Our magnetar spectral model includes the effects of the anisotropy of the heat flow through an ultramagnetized neutron star envelope, reprocessing by a light element atmosphere, and general relativistic corrections to the observed spectrum. We obtain good fits to the data with radii for the emitting areas which are generally consistent with those expected for neutron stars, in contrast to blackbody (BB) fits, which imply much smaller radii. Furthermore, the inclusion of atmospheric effects results in inferred temperatures which are lower than those implied by BB fits, but however still too high to be accounted by thermal cooling alone. An extra source of heating (possibly due to magnetic field decay) is needed. Despite the harder tail in the spectrum produced by reprocessing of the outgoing flux through the atmosphere, spectral fits still require a considerable fraction of the flux to be in a power-law component.