Background Migraine is common in women of reproductive age. Migraine’s episodic manifestation and acute and preventive pharmacological treatment options challenge studying drug safety for this condition during pregnancy. To improve such studies, we aimed to develop algorithms to identify and characterize migraines in electronic healthcare registries and to assess the level of care. Methods We linked four registries to detect pregnancies from 2009–2018 and used three algorithms for migraine identification: i) diagnostic codes, ii) triptans dispensed, and iii) a combination of both. We assessed migraine severity using dispensed drugs as proxies. ICD-10 diagnostic subcodes of migraine (G43) allowed the allocation of four subtypes: complicated and/or status migrainosus; with aura; without aura; other/unspecified. Results We included 535,089 pregnancies in 367,908 women with available one-year lookback. The prevalence of migraines identified was 2.9%–4.3% before, and 0.8%–1.5% during pregnancy, depending on algorithm used. Pregnant women with migraine were mostly managed in primary care. Conclusions Primary care data in combination with drug dispensation records were instrumental for identification of migraine in electronic healthcare registries. Data from secondary care and drug dispensations allow better characterization of migraines. Jointly, these algorithms may contribute to improved perinatal pharmacoepidemiological studies in this population by addressing confounding by maternal migraine indication.