Generating long-lived API tokens for CI/CD with client_credentials

What’s the cleanest way to generate a long-lived API token for our CI/CD pipeline without using the deprecated api_key grant type? I’m setting up an OpenTelemetry collector that needs to push traces to Genesys Cloud via custom attributes, but the standard OAuth token expires too fast for background jobs.

I tried using POST /api/v2/oauth/token with grant_type=client_credentials, but I need the token to last longer than an hour. Is there a specific scope or header I’m missing to extend the TTL, or should I just rotate tokens via a cron job? Here’s my current curl attempt:

curl -X POST https://api.mypurecloud.com/api/v2/oauth/token \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -d "grant_type=client_credentials&client_id=MY_CLIENT_ID&client_secret=MY_CLIENT_SECRET"

The response gives me a 1-hour expiry. I need something that sticks around for the whole build process.