
DShah (Community Member) asked a question.

DShah (Community Member) asked a question.
Hello @DShah (Community Member) ,
I checked with our engineering team and they informed me that it’s not actually possible to extend API credentials. They are generated with an expiration date, and once you get there then that’s it.
Jason
Community Support Engineer

Jason is correct--you can't extend the credentials.
However, you can create a replacement set of API credentials using the Identity API for this user, which accomplishes the same goal. You can do this by issuing a POST to the /api_credentials endpoint with the user whose credentials are close to expiration; the call will return API ID and Key and set the existing credentials to expire in 24 hours so that you have time to change out the credentials in your automation.

Ohh cool so the existing ones expire in 24 hours? I assumed the old ones were revoked immediately. so with this you have two working credentials at the same time for that period?

Hi @ABacchi035478 (Community Member) -- yes, that's correct. It behaves the same way as in the platform, if you generate a new set of credentials before they expire the old credentials have the expiration date set to now() + 24 hours.

Hi @Tim J (Veracode PM) (Veracode) :
Thank you so much for guiding me. To use Identity API , does the user/service account need to have ADMIN rights ?? I have tried to generate API credentials with the current user account but getting 401 error code in response.
Also POST: https://api.veracode.com/api/authn/v2/api_credentials does not take any parameters , then how does it API understand for which account to generate the credentials for?? Am i missing anythings here ?
Any help would be appreciated. TIA.

Hi @DShah (Community Member) - there is not currently a capability to extend a different user's credentials. The action has to be taken by the API account whose credentials need to be extended. (That's why the POST to api_credentials takes no parameters.)
Regarding the error you got with the current user account, did you specify a JSON body type for your request? That's required even though the request body is empty. I've seen people commonly miss that.

Hi @Tim J (Veracode PM) (Veracode) : I am testing the API through postman in which I have provided Content-type: application/json but still gets the same 401 response. Can you please verify the Auth type required for processing of these API's ??

Hi @DShah (Community Member) , these APIs all require Veracode HMAC authentication. There's a pretty good writeup on how to use this auth type from @ABacchi035478 (Community Member) here: https://community.veracode.com/s/question/0D52T000051M7rsSAC/easily-use-the-rest-apis-with-postman-with-this-tip
Ask the Community
Get answers, share a use case, discuss your favorite features, or get input from the community.
By clicking “Accept All Cookies”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts.
.png)
These cookies are necessary for the website to function and cannot be switched off in our systems. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms. You can set your browser to block or alert you about these cookies, but some parts of the site will not then work. These cookies do not store any personally identifiable information.
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us to know which pages are the most and least popular and see how visitors move around the site. All information these cookies collect is aggregated and therefore anonymous. If you do not allow these cookies we will not know when you have visited our site, and will not be able to monitor its performance.
These cookies may be set through our site by our advertising partners. They may be used by those companies to build a profile of your interests and show you relevant adverts on other sites. They do not store directly personal information, but are based on uniquely identifying your browser and internet device. If you do not allow these cookies, you will experience less targeted advertising.
Jason is correct--you can't extend the credentials.
However, you can create a replacement set of API credentials using the Identity API for this user, which accomplishes the same goal. You can do this by issuing a POST to the /api_credentials endpoint with the user whose credentials are close to expiration; the call will return API ID and Key and set the existing credentials to expire in 24 hours so that you have time to change out the credentials in your automation.