Refresh token in .NET

I’m having issues refreshing API token in .NET. I’m authorised and able to make requests but when I call RefreshAccessTokenAsync endpoint and supply the refresh token argument I get a JSON serialisation error:

Unexpected character encountered while parsing value: <. Path '', line 0, position 0.

After every 30 hours or so I have to go through the tedious process of getting a new oauth2 token. How can I refresh the token within the expiry time?

Thanks