Dataverse APIs for Customer Insights - Data

If you use Customer Insights - Data APIs, migrate your APIs to Dataverse APIs.

If you're new to querying data by using APIs, use Dataverse APIs.

Important

Use Dataverse APIs only to read data (GET). Don't use them to write data (POST, PATCH, or PUT) because it can cause problems with Customer Insights - Data processing.

Dataverse APIs provide the following benefits:

  • Extended capabilities for filtering and sorting

  • Improved scale and performance

  • Consistent API experience across Dynamics 365 and Power Platform apps

Sample queries

To get started using Dataverse APIs, create an application registration in Azure and request permissions for Dataverse and grant your app Viewer permissions on Customer Insights - Data.

Modify the query samples to make them work on the target environments:

  • {serviceRoot}: {Organization URI}/api/data/v9.2 where {Organization URI} is the URI of the Dataverse tenant associated of your environment. For example: https://{mydvorg}.crm.dynamics.com

  • {CID}: GUID of a unified customer record. For example: ce759201f786d590bf2134bff576c369.

  • {AlternateKey}: Identifier of the primary key of a customer record in a data source. For example: CNTID_1002.

  • {DSname}: String with the table name of a data source that gets ingested to Customer Insights - Data. For example: Website_contacts.

  • {SegmentName}: String with the output table name of a segment. For example: Male_under_40.

  • {cookieId}: Identifier for each website visitor, which is automatically generated when using the web tracking script. For example: 3f43317e-d1ef-4cd3-9917-2d3342111d1a.

Customer

Sample queries for the CustomerProfile table and segment memberships.

Query type Example Note
Get all customers {serviceRoot}/msdynci_customerprofiles
Get a customer by ID {serviceRoot}/msdynci_customerprofiles?$filter=msdynci_customerid eq '{CID}'
Get a customer by Alternate Key {serviceRoot}/msdynci_customerprofiles?$filter={msdynci_alternate_column} eq '{AK}' Alternate keys persist in the unified customer table in the format msdynci_DSname_TableName_PrimaryKeyColumnName
Get selected attributes for a customer {serviceRoot}/msdynci_customerprofiles?$select=msdynci_fullname&$filter=msdynci_customerid eq '{CID}'
Get customers by IDs (In) {serviceRoot}/msdynci_customerprofiles?$filter=msdynci_customerid eq '{CID1}' or msdynci_customerid eq '{CID2}'
Get customers by Alternate Keys (In) {serviceRoot}/msdynci_customerprofiles?$filter={msdynci_alternate_column} eq '{AK1}' or {msdynci_alternate_column} eq '{AK2}'
Search for customers {serviceRoot}/msdynci_customerprofiles?$filter=contains(msdynci_lastname,'string')&$top=10
Get all customers that are members of a segment {serviceRoot}/msdynci_segmentmemberships?$filter=contains(msdynci_segments,'\"{SegmentName}\"')&$select=msdynci_customerid
Get a customer if they're a member of a segment {serviceRoot}/msdynci_segmentmemberships?$filter=contains(msdynci_segments,'\"{SegmentName}\"') and msdynci_customerid eq '{CID}'&$select=msdynci_customerid
Get all segment memberships of a customer {serviceRoot}/msdynci_segmentmemberships?$filter=msdynci_customerid eq '{CID}'&$select=msdynci_segments

Web personalization

Sample queries to personalize your website based on the CookieId. The response returns both known and unknown customers. You can access the tables created for web tracking and personalization in Dataverse.

The four personalization APIs are functions. Pass their parameters inside parentheses, as shown in the examples. To filter unified activities with OData query options, use the Unified activity table queries.

Query type Example Note
Get a customer by cookie ID {serviceRoot}/msdynci_p13nprofile(cookieid='{cookieId}') Returns the customer and both supported related collections by default.
Get a customer and include segments and activities {serviceRoot}/msdynci_p13nprofile(cookieid='{cookieId}',include=['segmentmembership','unifiedactivity']) Query measures separately.
Get the 10 most recent page views for a visitor {serviceRoot}/msdynci_p13nviews(cookieid='{cookieId}',top=10) Filters the recorded visitor ID, not all of the customer's devices.
Get the 10 most recent page clicks for a visitor {serviceRoot}/msdynci_p13nactions(cookieid='{cookieId}',top=10) Filters the recorded visitor ID, not all of the customer's devices.
Get segment memberships by cookie ID {serviceRoot}/msdynci_p13nsegmentmembership(cookieid='{cookieId}') Requires cookieid; doesn't accept altkey.

Parameters and responses

Use these parameters to control the personalization function calls.

Parameter Functions Behavior
cookieid All four functions Visitor-local GUID, normally the _msci cookie. Profile and membership functions resolve it to a customer. Views and actions filter msdynci_userlocalid directly.
altkey Profile, views, and actions Fallback alias for cookieid. A nonempty cookieid takes precedence. This parameter isn't a source-record alternate-key lookup.
include Profile Supported values are segmentmembership and unifiedactivity. Omit include to request both. Unrecognized values are ignored.
top Views and actions Default and maximum are 200. Use a positive integer; values greater than 200 are limited to 200. Results are newest-first by msdynci_signaltimestamp.
after Views and actions DateTime value that selects rows with Dataverse createdon greater than after. Use UTC, for example, 2026-09-01T00:00:00Z. This filter uses record creation time, not the signal timestamp used for sorting.

The response properties have the following shapes.

Function Response properties
msdynci_p13nprofile customer: array; cookieids: comma-separated string; segmentmembership: string array; unifiedactivity: array. The last two properties depend on include.
msdynci_p13nviews pageviews: array; utctimestamp: timestamp.
msdynci_p13nactions actions: array; utctimestamp: timestamp.
msdynci_p13nsegmentmembership segmentmembership: string array.

Views and actions are scoped to the visitor-local ID you supply. They don't automatically combine activity from every browser or device linked to the same customer.

Data freshness

A cookie can resolve to an already-ingested known customer without waiting for another batch run. Segments, measures, and unified activities have separate ingestion, calculation, and Dataverse update stages. Completion of one refresh or evaluation doesn't mean every downstream table is current.

For the end-to-end flow, see How web tracking connects anonymous activity to customer profiles.

Unified activity

Sample queries for the UnifiedActivity table. These queries also apply when Web Personalization is enabled.

Query type Example Note
Get all activities of a customer {serviceRoot}/msdynci_unifiedactivities?$filter=msdynci_customerid eq '{CID}'
Get all activities of a customer within a time period {serviceRoot}/msdynci_unifiedactivities?$filter=msdynci_customerid eq '{CID}' and msdynci_activitytime gt 2024-01-01T00:00:00Z and msdynci_activitytime lt 2024-06-01T00:00:00Z
Get all activities of an activityType of a customer {serviceRoot}/msdynci_unifiedactivities?$filter=msdynci_customerid eq '{CID}' and msdynci_activitytype eq '{ActivityType}'
Get all activities of activityDisplayName of a customer {serviceRoot}/msdynci_unifiedactivities?$filter=msdynci_customerid eq '{CID}' and msdynci_activitytypedisplay eq '{ActivityDisplayName}'
Get all activities of a customer and sort them {serviceRoot}/msdynci_unifiedactivities?$filter=msdynci_customerid eq '{CID}'&$orderby=msdynci_activitytime asc

Other examples

Sample queries for other tables.

Query type Example Note
Get customer-attribute measures for a customer {serviceRoot}/msdynci_customermeasures?$filter=msdynci_customerid eq '{CID}'
Get enriched brands of a customer {serviceRoot}/msdynci_enrichments?$filter=msdynci_customerid eq '{CID}' and msdynci_enrichmentprovider eq 'BrandShareOfVoiceFromMicrosoft'
Get enriched interests of a customer {serviceRoot}/msdynci_enrichments?$filter=msdynci_customerid eq '{CID}' and msdynci_enrichmentprovider eq 'InterestShareOfVoiceFromMicrosoft'
Get AI model results of a customer {serviceRoot}/msdynci_predictions?$filter=msdynci_customerid eq '{CID}' and msdynci_modelprovider eq 'ChurnModel'

Next steps