Here's a sample:
var contentManager = new ContentManager();
var historyList = contentManager.GetHistoryList(contentId);
foreach(var historyData in historyList)
{
var contentData = contentManager.GetContentByHistoryId(historyData.Id);
}
The relevant namespace you'll want to take can be found here: Ektron.Cms.Framework.Content.ContentManager.