Generating long-lived API token for CI/CD pipeline fails with 401

We are trying to set up a CI/CD pipeline to deploy our WFM schedules and routing configurations automatically. The goal is to use a service account to generate an OAuth token that lasts longer than the standard hour. We don’t want the pipeline to fail every time the token expires.

I’ve created a user with the necessary permissions and generated a client ID and secret. The documentation suggests using the client credentials grant type. Here is the curl command I am using in the build script:

curl -X POST https://login.genesys.cloud/oauth/token \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -d "grant_type=client_credentials&scope=api:all"

The response comes back with a 200 OK, but the expires_in field is always 3600 seconds. We need something closer to 24 hours or a way to refresh it without user interaction.

I tried adding audience parameter to the request body, but that didn’t change the expiration time. The token works fine for making requests to /api/v2/users/me, but the short lifespan is causing issues in our scheduled jobs.

Is there a specific scope or configuration setting required to get a longer-lived token? Or is there a different endpoint we should be hitting? I’ve checked the user settings and the API access permissions, but nothing seems to allow extending the token life beyond the default hour.

We are using the Genesys Cloud API v2 endpoints. Any help would be appreciated.