Generating long-lived API tokens for CI/CD pipeline failing with 401

How do I generate a valid long-lived API token for our Jenkins pipeline without hitting auth errors every morning? We’ve been using the standard OAuth client credentials flow, but the tokens expire too fast for our nightly builds, and I need something that sticks around for at least a week. I tried following the docs to create a long-lived token via the admin UI, but when I use that token in my curl request to /api/v2/users/me, it just bombs out with a 401 Unauthorized. The token looks valid in the UI, no expiration date listed, but the API rejects it. Here’s the snippet I’m using in the pipeline:

TOKEN="<long-lived-token-from-ui>"
curl -X GET "https://api.mypurecloud.com/api/v2/users/me" \
 -H "Authorization: Bearer $TOKEN" \
 -H "Content-Type: application/json"

Error response is just {"code":"badAuthentication","message":"Token is invalid or expired"}. I’ve checked the scopes, they include admin:all and user:read. Is there a specific header I’m missing, or do long-lived tokens need a different grant type than client_credentials? The standard flow works fine for short-lived tokens, so I’m stuck on why the static one isn’t working.