Use the Narwhal API in Power BI

You can use Power BI and Narwhal API to pull holidays, release dates, economics, commodities, FX rates and prediction-market odds into a report. Use Power Query M in Power BI Desktop, then schedule the dataset to refresh in the Power BI service.

What you'll set up

Power BI Desktop is where you set up the report queries; you will end up with a separate query for each data area you use. The example includes Holidays, Releases, Cpi, Brent, Fx and Fed. Use Holidays as a date table, and use the Brent price and FX rates as measures.

Narwhal API uses one account and one API key across its data APIs. REST and MCP share that key. For Power BI, the requests use REST with the base URL https://api.narwhalapi.com and an Authorization header.

Set your API key

  1. Create a free key Create your free key at narwhalapi.com/signup. Use this key for the data areas you want to bring into Power BI.
  2. Store the key Keep the key in an environment variable called NARWHAL_API_KEY. In the M example, replace YOUR_KEY in the header with your key; the header must read Authorization: Bearer YOUR_KEY with your own value in place of the placeholder.

The supplied M uses the key directly in Headers. Its header contains the bearer value used by Web.Contents; the environment variable is where you keep your key outside the query. Paste your key into the placeholder when you prepare the query for Power BI.

Open a blank query in Power BI Desktop

  1. Start with Get Data In Power BI Desktop, use Get Data and open a Blank Query. This is where you will add the Power Query M for the API request.
  2. Paste the M in Advanced Editor Open Advanced Editor and paste the M example from the following section. The example returns Holidays; each other data area is its own query in practice.
  3. Use Anonymous authentication Set the web source to Anonymous authentication. The API key goes in the request header supplied by the M query.

Pull data with code

Paste this Power Query M into Advanced Editor. The Narwhal helper accepts a path and an optional query record, calls Web.Contents, and reads the JSON response. Each area then selects its response field. Table.FromRecords turns the record collections into tables, while the Brent expression reads price with Number.FromText.

Power Query M, six areas
let
    Narwhal = (path as text, optional query as record) =>
        Json.Document(Web.Contents("https://api.narwhalapi.com", [
            RelativePath = path,
            Query = if query = null then [] else query,
            Headers = [Authorization = "Bearer YOUR_KEY"]
        ])),
    Holidays = Table.FromRecords(Narwhal("v1/calendars/holidays/USA/2026")[holidays]),
    Releases = Table.FromRecords(
        Narwhal("v1/economics/calendar", [countries = "USA", start_date = "2026-11-01", end_date = "2026-11-30", limit = "100"])[releases],
        {"at", "period", "topic", "status"}, MissingField.UseNull),
    Cpi = Table.FromRecords(Narwhal("v1/economics/USA/cpi/observations", [start = "2025-09"])[observations]),
    Brent = Number.FromText(Narwhal("v1/commodities/spot/BRENT/USD")[price]),
    Fx = Table.FromRecords(Narwhal("v1/fx/rates/USD", [currencies = "EUR,IDR"])[rates]),
    Fed = Table.FromRecords(Narwhal("v1/predictions/policy-paths/federal-reserve")[meetings])
in
    Holidays  // return Releases, Cpi, Fx or Fed the same way; each area is its own query in practice

The expression after in selects the result returned by the query. Leave it as Holidays for the holiday table, or return Releases, Cpi, Fx or Fed for those tables. Return Brent for the price. Keep the helper when you prepare each separate query; the area samples use that same helper.

Run it on a schedule

Set up a scheduled refresh of the dataset in the Power BI service. A dataset using Web.Contents with a fixed base URL, RelativePath and Query can refresh on a schedule. Keep this request structure in the queries you use for the report.

The example puts https://api.narwhalapi.com in Web.Contents, each endpoint path in RelativePath, and any request parameters in Query. The same structure applies to the holiday table, CPI observations and the other areas. For more scheduling guidance, use schedule a daily data pull.

Holidays in Power BI

Use the USA holiday query for 2026 as your Holidays date table. Read the holidays collection, whose records contain date and name. With the Narwhal helper retained in the query, this expression returns the holiday records as a table.

Power Query M for holidays
Table.FromRecords(
    Narwhal("v1/calendars/holidays/USA/2026")[holidays]
)

Release dates in Power BI

Pull the USA economic release calendar for November 2026. Read releases and retain the at, period, topic and status fields. This request uses countries, start_date, end_date and limit in the query record; the table expression keeps the field list from the full example.

Power Query M for release dates
Table.FromRecords(
    Narwhal("v1/economics/calendar", [countries = "USA", start_date = "2026-11-01", end_date = "2026-11-30", limit = "100"])[releases],
    {"at", "period", "topic", "status"}, MissingField.UseNull)

Economics in Power BI

Request USA CPI observations with start set to 2025-09. The response field is observations, and each observation has a period and a value. Use the Cpi query to return those records as a table, with the start parameter kept in the helper’s query record.

If the requested start date is earlier than your plan’s history window, it is moved up to the window’s first day without an error, so the response begins later than requested. 403 plan_upgrade_required applies when the entire range ends before that window, or when a single date or period outside the window is read.

Power Query M for CPI
Table.FromRecords(
    Narwhal("v1/economics/USA/cpi/observations", [start = "2025-09"])[observations]
)

Commodities in Power BI

Request the Brent spot price in USD and read price. The Brent expression converts that field with Number.FromText; use the resulting price as a measure. Commodity spot codes include, for example, XAU, XAG, XPT, XPD, XCU, BRENT and WTI.

Power Query M for Brent
Number.FromText(
    Narwhal("v1/commodities/spot/BRENT/USD")[price]
)

FX rates in Power BI

Request USD exchange rates for EUR and IDR through the currencies parameter. Read the rates collection, where each record has currency and rate. Return Fx as a table for the report and use the FX rates as measures.

Power Query M for FX rates
Table.FromRecords(
    Narwhal("v1/fx/rates/USD", [currencies = "EUR,IDR"])[rates]
)

Predictions in Power BI

Pull Federal Reserve policy-path prediction-market odds into the Fed query. Read meetings from the response and turn those records into a table. Each meeting has resolves_at, p_cut, p_hold and p_hike, so keep those fields available in the returned table.

Power Query M for predictions
Table.FromRecords(
    Narwhal("v1/predictions/policy-paths/federal-reserve")[meetings]
)

Why use a fixed base URL?

Power BI uses the base URL when it refreshes in the service. Keep the base fixed, put the endpoint path in RelativePath, and put parameters in Query. For example, the release calendar’s country and date parameters belong in the query record passed to the helper.

Is the API key safe to share in a report?

The key lives in the query, so share the report only with people who may see the key. Anonymous authentication is the web-source setting used here; the request still sends the API key in its Authorization header.

Published .