Added /api/* endpoint basic auth, error handler.
added /api/submit endpoint.