Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
MK2024
New Member

API Key Regeneration

Hi Everyone,

Im hoping someone can send me down the right path with how to deal with a specific token regeneration automation.

 

I'm working with an API at the moment that i store a token in a parameter and then reference that paramameter for each query.  This API issues API tokens for 30 days. Currently every 30 days i need to login to the gui of this service and regenerate the new api token manually and then replace the old parameter with the new one.

 

I've been looking at automating this by requesting the new token through power query api calls. The request for a new token requires the old token in the request. Ive successfully been able to regenerate the new token through power query but my issue is that im not sure how to then get this new token used in the other queries i have created. Ideally i would just like to overwrite the old parameter token with the new token that is the result of my regeneration query. But i cant seem to find a way to do this.

 

The main issue is that i need the old token to request the new token, and then once the new token is received i need to get rid of the old token (as its no longer usable) and replace it with the new token.

 

Is writing to a parameter in power query supported functionailty? If not does anyone have any other suggestions of how i can overcome this problem?

 

I would also like to date stamp this token so the query only goes to regenerate a new token once it nears 30 days.

 

I'm guessing ive gone about implementing this the wrong way, but any help would be greatly appreciated.

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

None of this is possible in Power Query.  Ignore the token renewal process and re-request a new Auth token on each refresh.

View solution in original post

3 REPLIES 3
MK2024
New Member

Thanks for the response Ibendlin. Could i store the token outside of powerbi to acheive some form automation of it? or is that not recommended?

I don't want to give you advice that runs contrary to security practices.

lbendlin
Super User
Super User

None of this is possible in Power Query.  Ignore the token renewal process and re-request a new Auth token on each refresh.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.