Verify api key is valid in ping call.

- Fixes #344