Since API tokens have a maximum lifetime of 365 days, we’d like to incorporate token rotation into our credential-rotation process and renew tokens before they expire.
Is there an API available to rotate these API tokens programmatically?
Additionally, for reporting and monitoring purposes, is there an API or other method to retrieve a token’s expiration date? Tokens may be created by different users, including service accounts, and we may not know their creation dates, making it difficult to determine when they will expire.
Hello @Victor La
List/Read API Tokens Definitely so Retrieve Expiration date should be doable.
curl --request GET \ --url 'https://api.atlassian.com/admin/api-access/v1/orgs/{orgId}/api-tokens' \
Rotate - I don´t think so at the moment.
Best,
Arek🤠
@Arkadiusz Wroblewski, thank you for getting back to me! I have a follow up question.
Based on the documentation, it looks like this endpoint requires an organization-level API key rather than an API token? I assume there isn't a way with the API token?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Victor La
In this case "key" and "token" are essentially the same thing. The difference is that the process needs Organization Admin level access to see all the API token names and expiration dates across all accounts in the Organization. The only way to get a "token" that has Organization Admin level access is to generate it from the Admin Hub > Organization Settings > API Keys. That can be done only by an Organization Admin.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, @Trudy P Claspill elaborated on that a little.
Look at it from this perspective: generating API tokens sits under user settings because they are Personal (Admins can Restrict who can create them or revoke them), while the overview and management of keys/tokens sits under organization administration.
For many administrative automation tasks, you need an organization-level API key, simply because the relevant API endpoints belong to the organization administration layer.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Trudy P Claspill @Arkadiusz Wroblewski It’s helpful to know that expiration dates are available through the organization API, although unfortunately that doesn’t help our use case because our IT department doesn't provide organization-level API keys.
It would be nice to have a user-level token expiration endpoint or an API for rotating API tokens, but I guess we have to live with what we can get :)
Thank you both for your help and clarification!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Nothing to thank us for. We are here to help each other.🫂🤠
I recommend voting on this issue
https://jira.atlassian.com/browse/ID-8077
With your own internal IT, we can't help. In my opinion, there will be much fewer Questions here if users and Admins communicate more and clearer.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.