Opacity effects in relativistic high-energy γ-ray sources, such as γ-ray bursts (GRBs) or Blazars, can probe the Lorentz factor of the outflow and the distance of the emission site from the source, and thus help constrain the composition of the outflow (protons, pairs, magnetic field) and the emission mechanism. While most previous works consider the opacity in steady state, we study the effects of the time dependence of the opacity to pair production (γγ → e+e-) in an impulsive relativistic source. This may be relevant for the prompt γ-ray emission in GRBs or flares in Blazars. We present a simple, yet rich, semi-analytic model for the time and energy dependence of the optical depth, ηγγ, in which a thin spherical shell expands ultra-relativistically and emits isotropically in its own rest frame over a finite range of radii, R0 ≤ R ≤ R0 + ΔR. This is particularly relevant for GRB internal shocks. We find that in an impulsive source (ΔR ≲ R 0), while the instantaneous spectrum (which is typically hard to measure due to poor photon statistics) has an exponential cutoff above the photon energy ε1 (t) where ηγγ(ε 1) = 1, the time integrated spectrum (which is easier to measure) has a power-law high-energy tail above the photon energy ε1* ∼ ε1(Δt) where δt is the duration of the emission episode. Furthermore, photons with energies ε>ε 1* are expected to arrive mainly near the onset of the spike in the light curve or flare, which corresponds to the short emission episode. This arises since in such impulsive sources it takes time to build-up the (target) photon field, and thus the optical depth ηγγ(ε) initially increases with time and ε1 (t) correspondingly decreases with time, so that photons of energy ε > ε1* are able to escape the source mainly very early on while ε1* (t) > ε As the source approaches a quasi-steady state (ΔR >> R0), the time integrated spectrum develops an exponential cutoff, while the power-law tail becomes increasingly suppressed.