title: Power Query/Excel: import data from API with api & secret keys
body: <p>I would like to import Binance.com account data via API. This is the API URL, which asks for API-key, when opened in browser: <a href="https://fapi.binance.com/fapi/v2/balance" rel="nofollow noreferrer">https://fapi.binance.com/fapi/v2/balance</a></p>
  <p>This is the code that I try using in Excel's Power Query:</p>
  <pre><code>let
        apiUrl = &quot;https://fapi.binance.com/fapi/v2/balance&quot;,
        options = [Headers =[#&quot;X-MBX-APIKEY&quot;=&quot;MpfS23B8GjxXq9MEvKUR819QsMsYB3xuhByglOGaV7WUgldD7wVFQOYAhmQYbXDD&quot;]],
        result = Web.Contents(apiUrl , options),
       #&quot;Expanded Column1&quot; = Web.Page(result)
  in
       #&quot;Expanded Column1&quot;
  </code></pre>
  <p>APIKEY is bogus in this example.</p>
  <p>I am getting the following error when using this code:</p>
  <blockquote>
  <p>DataSource.Error: The remote server return an HTTP status code '400' when trying to access 'https://fapi.binance.com/fapi/v2/balance'.<br />
  Details:<br />
  DataSourceKind=Web<br />
  DataSourcePath=https://fapi.binance.com/fapi/v2/balance<br />
  Url=https://fapi.binance.com/fapi/v2/balance</p>
  </blockquote>
  <p>Binance provides both API-Key and secret. I have them, but I don't seem to find how to use them. Maybe API-key should be some sort of encrypted with secret key for it to work? I don't know how to do that either :(</p>
  <p>I have tried this with the following API URLs, it doesn't work, the error is the same:</p>
  <ul>
  <li><a href="https://fapi.binance.com/fapi/v2/balance" rel="nofollow noreferrer">https://fapi.binance.com/fapi/v2/balance</a></li>
  <li><a href="https://fapi.binance.com/fapi/v2/account" rel="nofollow noreferrer">https://fapi.binance.com/fapi/v2/account</a></li>
  </ul>
  <p><a href="https://binance-docs.github.io/apidocs/spot/en/#endpoint-security-type" rel="nofollow noreferrer">Binance docs</a> seem to be too complicated for this Power Query task.</p>
  <p>Any idea what needs to be done to get that working so I could finally get my Binance account data imported into Excel?</p>