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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Using refresh token for an API in power bi desktop

Hello

 

I am trying to call data from an API. My access token is only available for an hour and my current call limits are restricting me to a certain amount of call per second. I am running a Function to call data and the amount of data takes more than an hour to pull. How can I set up the refresh token within power bi desktop? I can get the data ok, but I don't want to be adding new access token when it expires. 

 

When requesting a token from the API

{
    "access_token""my-token",
    "token_type""bearer",
    "expires_in"3600,
    "refresh_token""my_refresh_token",
    "scope""my_scope"
}

Thanks

Joe

1 REPLY 1
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

 

A common practice is creating a query to get access token from an API and converting it into a custom function. Then in other queries, invoke this custom function to get the token instead of entering a fixed access token. 

 

Here is an old similar thread for your reference. You would need to modify the code according to your API. 

https://community.powerbi.com/t5/Power-Query/Channel-Advisor-API-Connection-with-auth-key-creation/td-p/2208091 

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.