Can we retrieve API key, is there any api available? Also can we create API key through automation?

vikastiwari2
Participant II

We are looking for options if we can retrieve API key through api call, so we can integrate different API's through automation.

Aslo, we are looking for options if we can rotate API key (I think there is an option to set certain days to expire current key) and can create new API key through calling API. This will help us to automate complete API key expiration and set new key process.

Appreciate any help on this.

0 5 308
5 REPLIES 5

Not applicable

Yes, you can retrieve api key through management api call.

Ref:

https://apidocs.apigee.com/management/apis/get/organizations/%7Borg_name%7D/developers/%7Bdeveloper_...

curl -X GET "https://api.enterprise.apigee.com/v1/organizations/org_name/developers/developer_email_or_id/apps/app_name/keys/" -u username:password

You can create api key through management API call.

https://apidocs.apigee.com/management/apis/post/organizations/%7Borg_name%7D/developers/%7Bdeveloper...

Thanks for quick help on this. I will try as you suggested in links before accept this answer to help others.

np. we are using the same in our company in jenkins pipeline.

we are looking for options if we can rotate API key (I think there is an option to set certain days to expire current key) and can create new API key through calling API.

Using the Admin API, You can set the expiry of a key when you create a new one.

You cannot set or change the expiry of an existing key.

Thanks, so we can use above curl command (*one mentioned by Priyadarshi*) and create API key and set expiry of the key same time (i.e. Key: 123456 created for 90 days and used in my proxy to validate calls).

I understood we can not explicitly expire existing API key, but can we generate new key through API calls when existing one expires? (i.e. after 90 days, key : 123456 will be expired and API calls will not be validated).

Is there any way to get notified when API key will get expired and generate new key ahead of time to avoid any interruptions?