In the category Top 0 of T 0-spaces and continuous maps, embeddings are just those morphisms with respect to which the Sierpiński space is Kan-injective, and the Kaninjective hull of the Sierpiński space is the category of continuous lattices and maps preserving directed suprema and arbitrary infima. In the category Loc of locales and localic maps, we give an analogous characterization of flat embeddings; more generally, we characterize n-flat embeddings, for each cardinal n, as those morphisms with respect to which a certain finite subcategory is Kan-injective. As a consequence, we obtain similar characterizations of the n-flat embeddings in the category Top 0 , and we show that several well-known subcategories of Loc and Top 0 are Kan-injective hulls of finite subcategories. Moreover, we show that there is a subcategory of spatial locales whose Kan-injective hull is the entire category Loc.