← Back to postsHow Do You Access the Power BI REST API Programmatically?

How Do You Access the Power BI REST API Programmatically?

Carlos GarciaCarlos Garcia10/2/2026

Sooner or later every Power BI deployment hits the same wall. Someone needs a report refreshed on a schedule the Service does not offer, or a list of every dataset across forty workspaces, or a new workspace created automatically each time a client is onboarded. Clicking through the portal stops being a plan.

That is the point at which the Power BI REST API becomes the answer. It is the programmatic door into the same platform the web interface drives, and once you can authenticate against it, most of the manual administration you have been doing by hand turns into a script you run once.

The authentication step is where nearly everyone stalls. Not because it is hard, but because the documentation describes several valid paths and it is not obvious which one your situation calls for. This guide walks the whole route: what the API is, how to get a token, how to make your first call, and the limits that will bite you later.

What is the Power BI REST API?

Microsoft's own description is brief: "The Power BI REST APIs provide service endpoints for embedding, administration, governance and user resources."

In plain terms, it is an HTTPS interface to the Power BI Service. You send authenticated requests to documented endpoints, and you get JSON back. Microsoft groups the three broad things you can do with it as managing Power BI content, performing admin operations, and embedding Power BI content in your own applications.

Everything the Service does on your behalf when you click a button has an equivalent operation here. Refreshing a dataset, cloning a report, listing the users in a workspace, exporting a report to PDF, pushing rows into a streaming dataset — all of it is reachable from code.

Automating your reporting is one thing. Knowing whether anyone can find your site is another. Get a free SEO audit and see where you actually stand.

How the API is organised

The reference is split into operation groups, and knowing which group holds what saves a lot of searching. The main ones are:

  • Datasets — refreshes, parameters, datasources, refresh history
  • Reports — cloning, exporting, rebinding a report to a different dataset
  • Groups — workspaces, despite the legacy name, plus their users
  • Dashboards — dashboards and the tiles on them
  • Dataflows — dataflow definitions and transactions
  • Admin — tenant-wide operations that read across every workspace
  • Capacities — Premium and Fabric capacity assignment
  • Embed Token — tokens that let your own app render Power BI content
  • Imports — uploading a .pbix file into a workspace
  • Pipelines — deployment pipelines for dev, test and production stages
  • Push Datasets — datasets you write rows into rather than refresh
  • Gateways — on-premises data gateway configuration
  • Template Apps, Users, and Available Features round out the list

"Groups" means workspaces

This trips people up constantly. The API still calls workspaces "groups," a holdover from an earlier naming. When you see an endpoint path containing `/groups/{groupId}/`, the `groupId` is a workspace ID. There is no separate concept of a group in modern Power BI.

Admin endpoints are a different category

Most endpoints act as the signed-in user and only see what that user can see. The Admin group is different: those operations read across the whole tenant and require Power BI administrator rights. If you are building an inventory of every dataset in the organisation, you need the Admin group and the permissions that go with it, not the ordinary Datasets group.

How to access the API programmatically, step by step

1. Register an application in Microsoft Entra ID

Authentication runs through Microsoft Entra ID, the service formerly called Azure Active Directory. Microsoft's documentation is explicit about the prerequisite: "To use the Power BI REST APIs, you need to register an Azure Active Directory (Azure AD) application in Azure."

Create the app registration in the Azure portal, note its Application (client) ID and your tenant ID, and decide at this point whether it will act as a signed-in user or as itself.

2. Choose user authentication or a service principal

This is the fork in the road, and picking wrong causes most of the failures people report.

User authentication means the app acts on behalf of a human who signs in. It is the right choice for interactive tools, and for anything where the permissions should match a specific person's access. You request delegated permissions, called scopes, for the operations you need.

A service principal means the app acts as itself, with no human involved. This is what you want for unattended automation — a nightly refresh job, a provisioning script, a monitoring service. Microsoft notes a useful simplification here: "Scopes are not required if you're using a service principal."

The trade-off is that a service principal has to be allowed. As the documentation puts it, "When using a service principal, the application's permissions are managed through the Power BI admin portal." A tenant administrator must enable service principal access and add your app to a security group that is permitted to use the API. Your code can be flawless and still get 401s until that switch is flipped.

3. Pick an authentication library

Microsoft documents two generations. You can authenticate using Azure AD v1.0, which uses the ADAL library, or the Microsoft identity platform v2.0, which uses MSAL.

For anything new, use MSAL. ADAL belongs to the older generation and exists in the documentation mainly for applications that already depend on it. MSAL has current libraries for .NET, Python, JavaScript, Java and Go, and it handles token caching and refresh for you rather than leaving you to implement it.

4. Acquire a token

Whichever path you took, the result is an OAuth 2.0 bearer token. A service principal uses the client credentials flow: your app presents its client ID and a secret or certificate, and receives a token scoped to the Power BI service.

Most teams automate their reporting long before they automate their visibility. Get a free SEO audit and find the gaps you have not scripted yet.

5. Call an endpoint

Attach the token as an `Authorization: Bearer <token>` header and send your request. A good first call is a read-only one that proves authentication works before you try to change anything — listing the workspaces your identity can see, or listing the datasets in one of them.

If that returns JSON, the hard part is done. Everything after it is reading the reference for the operation you want.

6. Handle the response properly

Check status codes rather than assuming success. A 401 means your token is missing, expired or scoped wrong. A 403 usually means authentication worked but the identity lacks permission — very often the service principal switch in the admin portal. A 404 on a workspace path frequently means the identity simply cannot see that workspace, not that it does not exist.

When the API is the right tool

The API earns its setup cost when the work is repetitive, large or event-driven.

Scheduled refreshes beyond the built-in limits. The Service caps how many scheduled refreshes you can configure. Triggering a refresh from code lets you run it when your upstream data actually lands rather than at a fixed clock time.

Tenant-wide inventory and governance. Answering "which datasets have not refreshed in thirty days" or "who has access to this workspace" across a large tenant is an Admin-group script, not an afternoon of clicking.

Provisioning. If every new client or project needs a workspace with the same reports, permissions and parameters, the Groups, Imports and Reports endpoints turn that into a function call.

Embedding. If you are putting Power BI content inside your own application, the Embed Token group is not optional — it is the supported mechanism.

Pushing live data. Push Datasets let you write rows directly, which is how near-real-time dashboards get their data without a refresh cycle at all.

Limitations worth knowing before you build

Throttling is real and documented. Microsoft states plainly that "Power BI limits the number of API calls within a time window per user." When you cross the line, "Power BI returns an HTTP status code 429 (Too many requests) with a Retry-After HTTP header in the response, indicating how many seconds the calling application has to wait before making a new request."

The correct response is to read that header and wait, not to retry immediately in a loop. A script that fans out across hundreds of workspaces without respecting `Retry-After` will spend most of its runtime being rejected.

Permissions are the usual blocker. Service principal access has to be enabled tenant-wide and your app added to the right security group. Admin operations need administrator rights. Neither is something your code can grant itself.

Data residency is not guaranteed to be local. Microsoft notes that "when accessing Power BI REST API, your request and response content and data may be processed by data centers in regions other than the home region of your Power BI tenant." If you work under data residency rules, that sentence matters more than anything else on this page.

Not everything in the product has an endpoint. Coverage is broad but not total, and newer features sometimes arrive in the interface before the API. Check the reference for the specific operation before you design around it.

Legacy naming persists. Beyond groups-meaning-workspaces, you will meet "datasets" where the modern product says "semantic models." The API kept the older terms for compatibility.

How it compares to the alternatives

Power BI REST API vs the admin portal. The portal is faster for one-off changes and better when you want to see what you are doing. The API wins the moment the same change has to happen more than a handful of times, or on a schedule, or without a person present.

REST API vs PowerShell cmdlets. Microsoft's Power BI PowerShell modules wrap many of the same operations and are quicker for ad-hoc administration. They are also a thinner layer over the same API, so anything the cmdlets cannot reach, you call directly. Use cmdlets for scripts an administrator runs by hand, the raw API for services.

REST API vs the XMLA endpoint. These solve different problems. The REST API manages objects — refreshing, moving, listing, permissioning. The XMLA endpoint reaches inside a semantic model to read and write its structure, which is what tools like Tabular Editor use. Model surgery is XMLA; platform management is REST.

REST API vs Fabric APIs. As Power BI sits inside Microsoft Fabric, newer platform operations increasingly live in the Fabric API surface. The Power BI REST API remains the right reference for Power BI-specific items, but check both when an operation seems to be missing.

Your dashboards can be perfect and still invisible in search. Get a free SEO audit and see what is actually indexed.

Final thoughts

The Power BI REST API is less intimidating than its documentation makes it look. The conceptual model is small: register an app, decide whether it acts as a person or as itself, get a bearer token, call an endpoint in the right operation group, respect the throttle.

The two things that genuinely cause pain are both administrative rather than technical. Service principal access has to be switched on by someone with tenant rights, and admin-scope operations need admin-scope permissions. If you are getting 401s and 403s on code that looks correct, check those before you debug your token logic.

Start with one read-only call. Prove the token works, see the JSON come back, and build outward from there. If you are working more broadly with the platform that sits behind these endpoints, our guide to what the Power BI Service actually is covers the layer the API is talking to.

Automation compounds. So does search visibility. Get a free SEO audit and start compounding both.