How To

How to Import a REST API into Power BI

Power BI

What we're building

REST API endpoint → Power Query → Power BI table

What you'll learn

  • How to connect Power BI to a REST API using Get Data
  • How Power Query turns a JSON response into a query
  • How to expand a JSON response into rows and columns
  • How to load the result as a table ready for reports

You'll need

  • Power BI Desktop
  • A REST API endpoint that returns JSON (a public API is fine for testing)
  • The endpoint URL, and an API key if the endpoint requires one

Steps

  1. 1

    Start a new query from a Web source

    In Power BI Desktop, choose Get Data → Web, and paste in the API endpoint URL. Power BI will send a request to the endpoint and show you a preview of the response.

  2. 2

    Let Power Query parse the JSON

    If the response is JSON, Power Query automatically detects this and gives you a List or Record view in the Power Query Editor. This is the raw structure of the API response before it's flattened into a table.

  3. 3

    Convert the response to a table

    Use "To Table" on the list, then expand the resulting column to break nested fields out into their own columns.

    = Json.Document(Web.Contents("https://api.example.com/data"))
  4. 4

    Clean up column types

    Power Query often loads new columns as text. Set the correct data type for each column (date, number, text) so visuals and measures behave correctly downstream.

  5. 5

    Load and rename the query

    Give the query a clear name and click Close & Apply. The data now loads as a normal table you can use in visuals, just like any other Power BI data source.

Result

A Power BI table populated directly from the API response, ready to use in visuals — no manual copy-paste, and no intermediate spreadsheet.

Why automate this

Manually exporting API data into a spreadsheet before every report update is slow and error-prone. Connecting Power BI directly to the API means the report reflects live data on every refresh, with one less manual step for someone to forget.