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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.