api is now a separate struct