How to create a new API Token via postman or python?

API Token expires after 30 days and we would want it to still be valid when needed to be used so we would want to automate new API token creation and old API token deletion via a script. Is that possible?

@mcmagno The only way to create API token is from Okta Security-> API
https://developer.okta.com/docs/guides/create-an-api-token/create-the-token/
API tokens are valid for 30 days and automatically renew every time they are used with an API request. So if you do not want to see it expired, just call it within 30 days.

thank you for your answer! however, we would want to automate it. is there no other way to do that?

@mcmagno Np. You can set up an auto call to a related API token request every 30 days.

can you share please the link to the documentation of this approach? thanks!

@mcmagno There are a lot related calls with API token.
You can find it in Okta APIs.
https://developer.okta.com/docs/reference/#core-okta-api
as long as it includes the request parameter

SSWS ${api_token}

Here is more reference for API token management.
https://help.okta.com/en/prod/Content/Topics/Security/API.htm

I found out, that I am able to refresh the access token via oauth. So initially I use Selenium to get the access token for the first time via oauth2’s login page, simulating a human. When I got the key, I refresh it when the key expires.