CHICAGO — For decades, the photo archive of Ebony and Jet magazines has been difficult to access and largely mysterious to scholars, an elusive treasure trove of more than four million prints and negatives that documented the lives of African-Americans.

That collection could soon be opened to the public after an auction on Wednesday in Chicago.

The winning bid came from a group of four major foundations, who in a flurry of phone calls, emails and texts over the last nine days, banded together in a highly unusual effort and bought the archive for $30 million.

Leaders of the foundations — the Ford Foundation, The J. Paul Getty Trust, the John D. and Catherine T. MacArthur Foundation and the Andrew W. Mellon Foundation — said on Thursday that they were determined to save the archive, considered the most significant collection of photography depicting African-American life in the 20th century. They agreed to donate the archive to the Smithsonian’s National Museum of African American History and Culture and the Getty Research Institute so that it would be widely accessible to researchers, scholars and the public.