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

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.

Reply
Anonymous
Not applicable

API Key was expected to be provided in the header for this call

I've connected my dashboard to a source as explained by the provider here and it loads the data and refreshes fine in desktop. But when I upload it and try to shcedule a refresh it gives me this error:

"Failed to update data source credentials: Web.Contents failed to get contents from 'https://interact.leadforensics.com/WebApi_v2/Business/GetAllBusinesses?datefrom=01-01-2010%2000:00:0...' (400): The Lead Forensics API Key was expected to be provided in the header for this call." 
power bi.jpg

1 ACCEPTED SOLUTION
Anonymous
Not applicable

The solution to this problem was changing the M Query as below:

 

let 
vBaseUrl = "https://interact.leadforensics.com",
vPath = "WebApi_v2/Visit/GetAllVisits?datefrom=01-01-2020 00:00:00&dateto=31-12-2030 23:59:59&pagesize=999999&pageno=1", vHeaders = [#"Authorization-Token"="THIS IS WHERE I PUT THE AUTH TOKEN", #"ClientID"="THIS IS WHERE I PUT THE ID"],
Source = Web.Contents ( vBaseUrl, [RelativePath=vPath, Headers=vHeaders] ),
Json = Json.Document ( Source ),
SiteVisitList = Json[SiteVisitList],
#"Converted to Table" = Table.FromList(SiteVisitList, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
in 
#"Converted to Table"

 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

The solution to this problem was changing the M Query as below:

 

let 
vBaseUrl = "https://interact.leadforensics.com",
vPath = "WebApi_v2/Visit/GetAllVisits?datefrom=01-01-2020 00:00:00&dateto=31-12-2030 23:59:59&pagesize=999999&pageno=1", vHeaders = [#"Authorization-Token"="THIS IS WHERE I PUT THE AUTH TOKEN", #"ClientID"="THIS IS WHERE I PUT THE ID"],
Source = Web.Contents ( vBaseUrl, [RelativePath=vPath, Headers=vHeaders] ),
Json = Json.Document ( Source ),
SiteVisitList = Json[SiteVisitList],
#"Converted to Table" = Table.FromList(SiteVisitList, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
in 
#"Converted to Table"

 

lbendlin
Super User
Super User

you may have had an active session in the desktop from a prior authentication.  That won't work in the service.  Provide the key as indicated.

Anonymous
Not applicable

It works in desktop (and continues working), cause i set it up. No one was using this source in the company before. But just to be sure, I have cleared all existing connections and set it up again and it works in Desktop. But not in the service.
If you click on the link I provided you will see what information do they provide i.e. Authorization Token and Client ID. They don't give you the API key name and it is not required to connect to the source.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.