Forum Discussion
Updating API Key
One of my data sources updated the API key and I need to update in the credentials in PBI web, but don't see where to update this under settings. I click on Data Source Credentials then Edit Credentials, but there is not a place for me to update API Key.
Hi,
That error means Power BI is expecting both a key and a key name, not just the value.
In Power BI Service, when you choose Web API, it needs:
- Key → your API key
- Key name → the parameter/header name the API expects
For example:
- If your API uses ?api_key=XXXX → key name = api_key
- If it uses ?key=XXXX → key name = key
What to do:
- Go back to Edit Credentials
- Select Web API
- Enter:
- Key = your API key
- Key name = the parameter name used by your API
Once both are filled, the error should go away.
Hope this helps.
Thanks!
7 Replies
- Shai_KarmaniSuper User
Hey
My guess is that you don't see the API Key in Edit Credentials because its not stored there, it's hardcoded in the dataflow's M query. That dialog only shows a key if the source was set up with Web API auth. If it's Anonymous, nothing shows.
To update it, edit tables, open the query, go to Advanced Editor, and update the key inside the Web.Contents call, either in the URL or headers. Then save and refresh.
If you want it manageable via Edit Credentials next time, switch to Web API auth using ApiKeyName and re-enter the key there.
Also make sure you’re editing the dataflow itself, not a dataset by mistake.
If that was helpful please give a thumb up and mark it as resolved.
Thank you 😊
- mhundleyNew Member
Thanks for the info. When I try to do this, it is telling me I have invalid credentials and takes me back to enter them in Data Source Settings window. Any ideas?
- SamInogicSuper User
Hi,
This happens because your connection is not set to Web API type.
In Power BI Service, the API key box only appears if the data source is using Web API authentication. If it was set up as Anonymous or something else, you won’t see the API key field.
Simple fix:
- Go to Settings → Dataset → Data source credentials
- Click Edit Credentials
- Click Sign out / Clear permissions
- Connect again and choose Web API
- Enter your new API key
If it still doesn’t show:
- Open the file in Power BI Desktop
- Go to Data Source Settings
- Clear permissions and reconnect with the new key
- Publish again
Most of the time, just clearing and reconnecting fixes it.
Hope this Helps!!
Thanks!
- mhundleyNew Member
Thank you for the info. When i do this, I get the following error:
"A web API key can only be specified when a web API key name is provided"
Any suggestions?
- SamInogicSuper User
Hi,
That error means Power BI is expecting both a key and a key name, not just the value.
In Power BI Service, when you choose Web API, it needs:
- Key → your API key
- Key name → the parameter/header name the API expects
For example:
- If your API uses ?api_key=XXXX → key name = api_key
- If it uses ?key=XXXX → key name = key
What to do:
- Go back to Edit Credentials
- Select Web API
- Enter:
- Key = your API key
- Key name = the parameter name used by your API
Once both are filled, the error should go away.
Hope this helps.
Thanks!
- v-shchada-msftCommunity Support
Hi mhundley,
Thank you for posting your query in the Microsoft Fabric Community Forum, and thanks to the SamInogic for sharing valuable insights.
Could you please confirm if your issue has been resolved using the suggested approach? This will help other community members facing similar scenarios.
Thank you.
- v-shchada-msftCommunity Support
Hi mhundley,
We would like to check whether your issue has been resolved. Kindly let us know if you require any further assistance.Thank you.