added api_key field and generate_api_key call