Added optional api key authentication