For how long is the Refresh Token Valid for?

when I call https://api.freeagent.com/v2/token_endpoint

is says refresh_token_expires_in 631139040

how long is that?

The response given is the number of seconds until the token expires. Easiest way to calculate this is to get the Unix Epoch Time at the point the token was issued, then add on the number of seconds given in the response, and then convert back to a time format of your choosing.

For more info on unix time: Unix Time Stamp - Epoch Converter

When an Access Token is provided, it expires in “3600”. Elsewhere in the API documentation it mentions 1 hour so I assume “3600” is in seconds (i.e. 3600 / 60sec / 60min = 1 hour).

If that assumption is correct, then 631139040 seconds is around 20 years.

Note: other systems I have come across that use OAuth provide their token expiry times in milliseconds e.g. Microsoft Azure.