Diamine-appended metal–organic frameworks display great promise for carbon capture applications, due to unusual step-shaped adsorption behavior that was recently attributed to a cooperative mechanism in which the adsorbed CO2 molecules insert into the metal–nitrogen bonds to form ordered ammonium carbamate chains [McDonald et al., Nature, 2015, 519, 303]. We present a detailed study of this mechanism by in situ X-ray absorption spectroscopy and density functional theory calculations. Distinct spectral changes at the N and O K-edges are apparent upon CO2 adsorption in both mmen-Mg2(dobpdc) and mmen-Mn2(dobpdc), and these are evaluated based upon computed spectra from three potential adsorption structures. The computations reveal that the observed spectral changes arise from specific electronic states that are signatures of a quasi-trigonal planar carbamate species that is hydrogen bonded to an ammonium cation. This eliminates two of the three structures studied, and confirms the insertion mechanism. We note the particular sensitivity of X-ray absorption spectra to the insertion step of this mechanism, underpinning the strength of the technique for examining subtle chemical changes upon gas adsorption.