@PovilasKorop also, take note, the on a post request, you need to add/include the csrf token as it would always fail if it's not through an API endpoint
@PovilasKorop If you don't want to duplicate the logic (having a separate API controller) I think what you can do is override current controller logic and have a response like if statement with $request->isJson() then give the appropriate response,