add API key support and log status code