# How to create API key with no expiration

**URL:** <https://forums.suse.com/t/how-to-create-api-key-with-no-expiration/42897>\
**Category:** SUSE Rancher Prime\
**Created:** [April 3, 2024, 4:54pm UTC](https://forums.suse.com/t/how-to-create-api-key-with-no-expiration/42897 "2024-04-03T16:54:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cmon](https://avatars.discourse-cdn.com/v4/letter/c/d2c977/32.png) [@cmon](https://forums.suse.com/u/cmon)\
**Post date:** [April 3, 2024, 4:54pm UTC](https://forums.suse.com/t/how-to-create-api-key-with-no-expiration/42897/1 "2024-04-03T16:54:10Z")

</div>

Hi forum, I need to access my rancher server (v2.8.2) from a custom, not interactive, process.  
I need to generate an API key which doesn’t expire, or alternatively find a way to automatically renew it before the expiration.  
In past releases I was able to choose ttl=0, but this option seems to be disabled now.

---

<div class="post-metadata">

**Author:** ![TomV](https://avatars.discourse-cdn.com/v4/letter/t/7bcc69/32.png) [@TomV](https://forums.suse.com/u/TomV)\
**Post date:** [April 24, 2024, 8:59am UTC](https://forums.suse.com/t/how-to-create-api-key-with-no-expiration/42897/3 "2024-04-24T08:59:47Z")

</div>

Maybe dirty, but the API key never Exipires anymore

kubectl patch tokens token-testxx–type=‘json’ -p=‘[{“op”: “replace”, “path”: “/ttl”, “value”: 0}]’  
kubectl patch tokens token-testxx --type=‘json’ -p=‘[{“op”: “remove”, “path”: “/expiresAt”}]’
