Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I have built a report that pulls some data directly from a REST API. This API requires authentication, and the following code worked for me to access and pull the data directly into PowerBI:
let
Source =
Json.Document(Web.Contents("https://somesite.com/Web/",
[Headers=[
AccountLoginName="user",
AccountPassword="pass",
SourceSystemID="123",
DomainID="1"],
RelativePath="path/to/api/endpoint"However, I loaded the report today to make some modifications, and the following error was presented to me:
Expression.Error: The 'AccountLoginName' header is only supported when connecting anonymously. These headers can be used with all authentication types: Accept, Accept-Charset, Accept-Encoding, Accept-Language, Cache-Control, Content-Type, If-Modified-Since, Prefer, Referer
Can anyone give me a nudge in the right direction?
Solved! Go to Solution.
Got it sorted. Realized that the error I was seeing was not from PowerBI but from the API I was trying to connect to. Somehow my datasource stopped trying to login "Anonymous" and had got set to "Basic" A quick reset, and we are good.
This pointed me in the right direction.
https://community.powerbi.com/t5/Service/Anonymous-access/m-p/277217/highlight/true#M33295
Got it sorted. Realized that the error I was seeing was not from PowerBI but from the API I was trying to connect to. Somehow my datasource stopped trying to login "Anonymous" and had got set to "Basic" A quick reset, and we are good.
This pointed me in the right direction.
https://community.powerbi.com/t5/Service/Anonymous-access/m-p/277217/highlight/true#M33295
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 63 | |
| 55 | |
| 42 | |
| 41 | |
| 23 |
| User | Count |
|---|---|
| 165 | |
| 132 | |
| 118 | |
| 79 | |
| 53 |