Forum Discussion

mhundley's avatar
mhundley
New Member
4 months ago
Solved

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:

    1. Go back to Edit Credentials
    2. Select Web API
    3. 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

  • 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 😊 

    • mhundley's avatar
      mhundley
      New 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? 

  • 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:

     

    1. Go to Settings → Dataset → Data source credentials
    2. Click Edit Credentials
    3. Click Sign out / Clear permissions
    4. Connect again and choose Web API
    5. 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!

     

    • mhundley's avatar
      mhundley
      New 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?

      • SamInogic's avatar
        SamInogic
        Super 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:

        1. Go back to Edit Credentials
        2. Select Web API
        3. 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!

         

  • 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.

  • 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.