change api key spec to go through the delegate function