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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Anonymous
Not applicable

API Unable to refresh in Power BI Service: The credentials provided for the Web source are invalid.

Hi there,

 

I'm currently trying to refresh a connection to an API in Power BI Service, but I get the error: "The credentials provided for the Web source are invalid."

 

In Desktop, it works fine. Do any of you know why this is happening? I've tried anything:

 

Simple Web.Contents + Header code

Source = Json.Document(Web.Contents("https://api.realworks.nl/wonen/v1/objecten",
[Headers=[Authorization="xxxxxxxxxxxxxxxxxxxxxx"]])),

 

Seperated url and header

url = "https://api.realworks.nl/wonen/v1/objecten",
headers = [Authorization = "xxxxxxxxxxxxxxxxxxxxxx"],
response = Json.Document(Web.Contents(
url,
[Headers = headers]
)),x

 

RelativePath version

url = "https://api.realworks.nl",
headers = [Authorization = "xxxxxxxxxxxxxxxxxxxxxx"],
response = Json.Document(Web.Contents(
url,
[RelativePath = "/wonen/v1/objecten",
Headers = headers]
)),

 

Please help, I'm getting so frustrated here. The Power BI service just keeps giving me this error. 

4 REPLIES 4
mattww
Responsive Resident
Responsive Resident

Have you checked your Data source credentials in the Schedule refresh settings on your dataset. Sometimes you might need to tell it to skip test connection if you're authenticating via the headers

mattww_0-1633027230817.png

 



If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Unfortunately this doesn't resolve my issue.

mattww
Responsive Resident
Responsive Resident

@Anonymous , one other thing to check is whether you are using Basic Auth?

If you are and have put your credentials in when prompted on Power BI Desktop (i.e. see below), then you don't need the headers in your Web.Contents function as well.

 

mattww_0-1633104026496.png

 

Or alternatively, if you are keeping the authorization header in your Web.Contents, select Anonymous in the above dialog

Just a thought

mattww
Responsive Resident
Responsive Resident

Hmm, sorry to hear that. I have had similar fiddly issues with API connections and the service not liking it. I would suggest logging a call with Microsoft Support as it looks like you've tried all the right things to make sure the Power BI Service can evaluate the query fine.

 

I don't know how complicated your report is, so the other thing that might be worth trying is publishing a very simple report made from scratch with just one basic API connection in it. You might have an old data connection in there.

 

Also, in Power BI Desktop open your data source settings and Clear all permissions in the report. Make sure your authentication method is set to anonymous when reprompted.

 

Good luck, sorry I can't be of more help

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors