Add input validation for api_key

Fix #18