Added security to the API routes