Wouldn't it be cleaner to put the API under /api? I.e. not overloading based on whether the caller looks like a browser.