GroupShare API - validity of bearer token

Hi all,

Does anyone here know for how long an API bearer token remains valid? I'm creating script and would like to know when to renew the token. I can of course wait until a call returns the 401 http code, but would prefer to not base renewal on a failed call.