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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anaplex
Frequent Visitor

The user was not authorized - Power BI Desktop API Key not working with ApiKeyName

When I hard code my API key into the header of my web call 

 

Headers=[#"X-Api-Key"="XXXX"] it works but if I use ApiKeyName="X-Api-Key" and I get promoted for the API I am getting "The user was not authorized" despite the API key been correct.

 

What am I missing here?

1 REPLY 1
v-shex-msft
Community Support
Community Support

Hi @Anaplex,

 

Since I'm not clear your api structure, I can't reproduce your issue, you should refer to the api document to make sure if the api support the parameter "ApiKeyName".

 

>> if I use ApiKeyName="X-Api-Key" and I get promoted for the API I am getting "The user was not authorized" despite the API key been correct.

 

According to your description, it seems you provide the ApiKeyName and haven't provided the correct parameter value, you can use multiple parameters in headers option to fix the formula, for example:

 

Headers = [APiKeyName= "X-Api-Key",#"X-Api-Key"="xxxx"]

 

If above is not help, please provide more detail information about your issue.

 

Regards,
Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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