Generating long-lived API token for CI/CD pipeline with Python SDK

Hey everyone,

I’m trying to set up our Terraform pipeline to run automatically, but I’m stuck on the authentication part. The docs suggest using a client credentials flow, but the tokens expire way too fast for our nightly builds. I need something that lasts at least a day so we don’t have to rotate secrets every few hours.

I’ve been using the Genesys Cloud Python SDK. Here’s what I’ve got so far:

from genesyscloud import auth_api_client, configuration

config = configuration.Configuration()
config.host = 'https://api.mypurecloud.com'
config.access_token = 'my_static_token' # This is what I want to avoid

auth = auth_api_client.AuthAPIClient(config)
token = auth.get_token(client_id='xxx', client_secret='yyy')

The get_token method works, but it only gives me a short-lived access token. I tried adding grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer to the request, but it throws a 400 Bad Request error saying the grant type isn’t supported.

Is there a specific endpoint or SDK method I’m missing to get a longer duration? I know I could just use the static token, but that feels insecure and against best practices. Any pointers would be great. I’m running this out of a Central Time zone server, so timezone issues shouldn’t matter, but the token expiry is killing my pipeline runs.