API secured and added tests