# RM APIs - Connect Power Query
* Within Excel, go to the Data menu ribbon and click on `Blank Query` and then `Advanced Editor`.
* Insert the following example:
```
let
url = "https://api-euw1.rms-ppe.com/sml/auth/v1/login/implicit",
body = "{
""tenantName"": ""<RI tenant name>"",
""username"": ""<RI User Name>"",
""password"": ""<RI Password>""
}",
// Obtain a bearer token
GetJson = Web.Contents(url,
[
Headers = [#"Content-Type"="application/json"],
Content = Text.ToBinary(body)
]
),
FormatAsJson = Json.Document(GetJson),
// Gets token from the Json response
Access_Token = FormatAsJson[accessToken],
AccessTokenHeader = "Bearer " & Access_Token,
Source = Json.Document(Web.Contents("https://api-euw1.rms-ppe.com/riskmodeler/v1/locations/2/?datasource=s15", [Headers=[#"Authorization"=AccessTokenHeader]])), property = Source[property]
in
property
```
* Replace `tenantName` with your subdomain name used to access Risk Intelligence. As an example, if you use the URL https://mytenant.rms.com, the tenantName is “mytenant”
* Replace the `username` and `password` with the credentials for an Risk Intelligence user account.
* Click **Done**
* You may be prompted on how to authenticate. Click `Edit Permissions` and use Anonymous, leaving the URL as populated
* You may be prompted about data privacy

You may select to Ignore Pricy level checks and **Save**

* This will allow for the connection to be made with the retrieve access token
## Bring the Power Query results into Excel
* Once you are comfortable with your table, click on `Close & Load` beneath the Home menu ribbon
* Power Query will bring your results into Excel and the data may be viewed/manipulated as normal.

* To refresh the data, click on `Refresh` within the Queries & Connections section of the Data menu ribbon
* Save your Power BI file.
* When opening the file or with a Refresh, a new access token will be retrieved to use for the query.