Back

PowerBI API Essential Guide

Aug 9, 20246 minute read

What type of API does PowerBI provide?

Power BI primarily uses a REST API. Here are the key points about Power BI's API:

Type of API

Power BI uses a REST API for its primary programmatic interface.

Key Features

  • The Power BI REST API provides service endpoints for embedding, administration, governance, and user resources.
  • It allows developers to manage Power BI content, perform admin operations, and embed Power BI content.

Authentication and Permissions

  • To use the Power BI REST APIs, you need to register an Azure Active Directory (Azure AD) application in Azure.
  • The Azure AD app establishes permissions for Power BI REST resources and allows access to the Power BI REST APIs.
  • Authentication can be done using either Azure AD (v1.0; ADAL) or Microsoft identity platform (v2.0; MSAL) endpoints.

API Structure

  • The API is organized into various operation groups, including Admin, Apps, Capacities, Dashboards, Datasets, Reports, and more.
  • Each operation group provides specific functionalities related to its domain within Power BI.

Throttling

  • Power BI uses throttling to maintain optimal performance and reliability.
  • There are limits on the number of API calls within a time window per user to prevent overuse of resources.
  • When throttling occurs, Power BI returns an HTTP status code 429 (Too many requests) with a Retry-After HTTP header.

Best Practices

  • Use appropriate scopes when registering your Azure AD app to ensure proper permissions.
  • Be aware of throttling limits and implement retry logic in your applications.
  • Utilize the various operation groups to efficiently manage different aspects of Power BI.

While Power BI primarily uses a REST API, it's worth noting that other API types like GraphQL or gRPC are not mentioned in the official documentation for Power BI. The REST API provides a comprehensive set of endpoints for interacting with Power BI services and content.

Does the PowerBI API have webhooks?

No, the official Power BI REST API does not currently offer webhook functionality.

While the Power BI API itself doesn't have webhooks, there are some alternative options for getting real-time data into Power BI:

  1. Streaming datasets - You can create a streaming dataset in the Power BI service that provides an endpoint URL where data can be pushed in real-time. This is the closest equivalent to webhook functionality.

  2. Power BI Real-Time Streaming - This allows you to stream data and update dashboards in real-time.

  3. Azure Functions - You could create an Azure Function to receive webhook data and then push it to a Power BI streaming dataset.

Webhooks are typically used for real-time event notifications and data updates without needing to constantly poll an API. Power BI's streaming datasets provide a way to ingest real-time data, but it's not a true webhook implementation. For more complex integrations, you may need to set up an intermediary service (like Azure Functions) to receive webhook data and then push it to Power BI.

The lack of native webhook support in the Power BI API means some additional architecture may be required for real-time integrations. The best approach depends on your specific use case and requirements.

Rate Limits and other limitations

Here are the key points about the API rate limits for the Power BI API:

General API Rate Limits

  • Power BI uses throttling to maintain optimal performance and reliability [3].

  • There is a general limit of 120 API requests per minute per user [3].

  • For tables with 250,000 or more rows, there is a limit of 120 POST rows requests per hour per dataset [2].

Push Dataset Specific Limits

For push datasets, there are some additional limits [2]:

  • 1,000,000 rows can be added per hour per dataset
  • 5 max pending POST rows requests per dataset
  • 120 POST rows requests per minute per dataset
  • 200,000 max rows stored per table in FIFO dataset
  • 5,000,000 max rows stored per table in 'none retention policy' dataset

Other Relevant Limits

  • 75 max columns per dataset
  • 75 max tables per dataset
  • 10,000 max rows per single POST rows request
  • 4,000 characters per value for string column in POST rows operation

Key Considerations

  • These limits cannot be increased by upgrading licenses or moving to premium capacity [3].

  • The limits are per user, so using service principals or multiple users can help work around some limitations.

  • For high-volume scenarios, consider using alternatives like the XMLA endpoint or Dataflows instead of the REST API.

In summary, the Power BI API has fairly strict rate limits that cannot be easily increased. Careful API usage and leveraging other ingestion methods are recommended for high-volume scenarios.

Latest API Version

Based on the search results provided, here are the key points regarding the most recent version of the Power BI API:

  1. The most recent version of the Power BI Visuals API mentioned in the search results is v5.7.0.

  2. The latest version of the Microsoft.PowerBI.Api NuGet package is 4.20.0, released on June 13, 2024.

  3. The Power BI Desktop July 2024 Update has a version number of 2.131.901.0.

Key points to consider:

  • The Power BI Visuals API and the Microsoft.PowerBI.Api package are different components, which is why they have different version numbers.

  • The Power BI Visuals API v5.7.0 includes features such as Power BI Custom Visuals Authentication API and dynamic drill control.

  • The Microsoft.PowerBI.Api package is a .NET Client library for Microsoft Power BI public REST endpoints, providing access to Workspaces, Reports, Datasets, and more.

  • Power BI Desktop is updated monthly, incorporating customer feedback and new features.

It's important to note that different components of Power BI may have different version numbers and update cycles. The Power BI team regularly releases updates for various parts of the ecosystem, including the desktop application, service, APIs, and SDKs.

For the most up-to-date information on Power BI versions and updates, it's recommended to check the official Microsoft documentation and release notes, as they are frequently updated with the latest information.

How to get a PowerBI developer account and API Keys?

To get a developer account for Power BI and create an API integration, you'll need to follow these steps:

1. Sign up for a Power BI account

If you don't already have one, sign up for a Power BI account at https://powerbi.microsoft.com. You can start with a free account or choose a paid plan depending on your needs.

2. Register an app in Azure Active Directory

To use the Power BI REST API, you need to register an application in Azure AD:

  1. Go to the Power BI App Registration tool and sign in with your Power BI account.
  2. Name your application and choose "Server-side web application" as the app type.
  3. Enter the home page address of your app and the redirect URL.
  4. Choose the APIs allowed for the application.
  5. On successful registration, you'll receive an Application ID and Application Secret. Save these securely as you'll need them later.

3. Get an access token

To use the Power BI API, you'll need to get an access token:

  1. Authorize the user using the Application ID you received.
  2. Exchange the authorization code for an access token by making a POST request to the token endpoint.

4. Use the Power BI REST API

Once you have the access token, you can use it to authenticate your requests to the Power BI API.

What can you do with the PowerBI API?

Here's the markdown text with the trailing list of URLs and citation references removed, and any URLs inside the content formatted correctly for the markdown file format:

Here's a list of data models you can interact with using the Power BI API, along with what is possible for each:

Semantic Models (formerly known as Datasets)

  • Create, read, update, and delete semantic models
  • Refresh data in semantic models
  • Manage semantic model parameters
  • Configure data sources
  • Set up and manage incremental refresh
  • Manage row-level security (RLS)
  • Configure and manage aggregations
  • Access and modify DAX expressions
  • Manage relationships between tables

Reports

  • Create, read, update, and delete reports
  • Clone existing reports
  • Modify report pages and visuals
  • Update report data sources
  • Manage report parameters
  • Export reports to various formats (PDF, PowerPoint, etc.)
  • Schedule report refreshes

Dashboards

  • Create, read, update, and delete dashboards
  • Add, remove, and modify dashboard tiles
  • Share dashboards with users and groups
  • Set up dashboard subscriptions

Dataflows

  • Create, read, update, and delete dataflows
  • Manage dataflow refresh schedules
  • Configure data sources for dataflows
  • Modify dataflow queries and transformations

Workspaces

  • Create, read, update, and delete workspaces
  • Manage workspace access and permissions
  • Add or remove content (reports, dashboards, etc.) from workspaces

Apps

  • Create, update, and publish apps
  • Manage app permissions and distribution
  • Update app content

Data Gateways

  • Install and configure on-premises data gateways
  • Manage gateway permissions and data sources
  • Monitor gateway health and usage

Capacities

  • Create and manage Premium capacities
  • Monitor capacity metrics and usage
  • Configure workload settings

Embedded Analytics

  • Embed reports, dashboards, and visuals in applications
  • Manage embedded analytics permissions and settings
  • Generate embed tokens for secure access

Paginated Reports

  • Create, read, update, and delete paginated reports
  • Manage paginated report data sources
  • Schedule paginated report refreshes

Summary

The Power BI API provides extensive capabilities for interacting with various data models within the Power BI ecosystem. Developers can programmatically manage and manipulate semantic models, reports, dashboards, dataflows, workspaces, apps, gateways, capacities, embedded analytics, and paginated reports. This allows for automation of tasks, integration with other systems, and creation of custom solutions built on top of Power BI's robust analytics platform.