Documentation

Developers

API References
Data Subject Request API

Data Subject Request API Version 1 and 2

Data Subject Request API Version 3

Platform API

Platform API Overview

Accounts

Apps

Audiences

Calculated Attributes

Data Points

Feeds

Field Transformations

Services

Users

Workspaces

Warehouse Sync API

Warehouse Sync API Overview

Warehouse Sync API Tutorial

Warehouse Sync API Reference

Data Mapping

Warehouse Sync SQL Reference

Warehouse Sync Troubleshooting Guide

ComposeID

Warehouse Sync API v2 Migration

Bulk Profile Deletion API Reference

Calculated Attributes Seeding API

Custom Access Roles API

Data Planning API

Group Identity API Reference

Pixel Service

Profile API

Events API

mParticle JSON Schema Reference

IDSync

Client SDKs
AMP

AMP SDK

Android

Initialization

Configuration

Network Security Configuration

Event Tracking

User Attributes

IDSync

Screen Events

Commerce Events

Location Tracking

Media

Kits

Application State and Session Management

Data Privacy Controls

Error Tracking

Opt Out

Push Notifications

WebView Integration

Logger

Preventing Blocked HTTP Traffic with CNAME

Linting Data Plans

Troubleshooting the Android SDK

API Reference

Upgrade to Version 5

Cordova

Cordova Plugin

Identity

Flutter

Getting Started

Usage

API Reference

Direct Url Routing

Direct URL Routing FAQ

Web

Android

iOS

iOS

Initialization

Configuration

Event Tracking

User Attributes

IDSync

Screen Tracking

Commerce Events

Location Tracking

Media

Kits

Application State and Session Management

Data Privacy Controls

Error Tracking

Opt Out

Push Notifications

Webview Integration

Upload Frequency

App Extensions

Preventing Blocked HTTP Traffic with CNAME

Linting Data Plans

Troubleshooting iOS SDK

Social Networks

iOS 14 Guide

iOS 15 FAQ

iOS 16 FAQ

iOS 17 FAQ

iOS 18 FAQ

API Reference

Upgrade to Version 7

React Native

Getting Started

Identity

Roku

Getting Started

Identity

Media

Unity

Upload Frequency

Getting Started

Opt Out

Initialize the SDK

Event Tracking

Commerce Tracking

Error Tracking

Screen Tracking

Identity

Location Tracking

Session Management

Xbox

Getting Started

Identity

Web

Initialization

Configuration

Content Security Policy

Event Tracking

User Attributes

IDSync

Page View Tracking

Commerce Events

Location Tracking

Media

Kits

Application State and Session Management

Data Privacy Controls

Error Tracking

Opt Out

Custom Logger

Persistence

Native Web Views

Self-Hosting

Multiple Instances

Web SDK via Google Tag Manager

Preventing Blocked HTTP Traffic with CNAME

Facebook Instant Articles

Troubleshooting the Web SDK

Browser Compatibility

Linting Data Plans

API Reference

Upgrade to Version 2 of the SDK

Xamarin

Getting Started

Identity

Web

Alexa

Server SDKs

Node SDK

Go SDK

Python SDK

Ruby SDK

Java SDK

Quickstart
Android

Overview

Step 1. Create an input

Step 2. Verify your input

Step 3. Set up your output

Step 4. Create a connection

Step 5. Verify your connection

Step 6. Track events

Step 7. Track user data

Step 8. Create a data plan

Step 9. Test your local app

HTTP Quick Start

Step 1. Create an input

Step 2. Create an output

Step 3. Verify output

iOS Quick Start

Overview

Step 1. Create an input

Step 2. Verify your input

Step 3. Set up your output

Step 4. Create a connection

Step 5. Verify your connection

Step 6. Track events

Step 7. Track user data

Step 8. Create a data plan

Java Quick Start

Step 1. Create an input

Step 2. Create an output

Step 3. Verify output

Node Quick Start

Step 1. Create an input

Step 2. Create an output

Step 3. Verify output

Python Quick Start

Step 1. Create an input

Step 2. Create an output

Step 3. Verify output

Web

Overview

Step 1. Create an input

Step 2. Verify your input

Step 3. Set up your output

Step 4. Create a connection

Step 5. Verify your connection

Step 6. Track events

Step 7. Track user data

Step 8. Create a data plan

Tools

mParticle Command Line Interface

Linting Tools

Smartype

Media SDKs

iOS

Web

Android

Guides
Partners

Introduction

Outbound Integrations

Outbound Integrations

Firehose Java SDK

Inbound Integrations

Kit Integrations

Overview

Android Kit Integration

JavaScript Kit Integration

iOS Kit Integration

Compose ID

Data Hosting Locations

Glossary

Rules Developer Guide

Migrate from Segment to mParticle

Migrate from Segment to mParticle

Migrate from Segment to Client-side mParticle

Migrate from Segment to Server-side mParticle

Segment-to-mParticle Migration Reference

API Credential Management

The Developer's Guided Journey to mParticle

Guides

Getting Started

Create an Input

Start capturing data

Connect an Event Output

Create an Audience

Connect an Audience Output

Transform and Enhance Your Data

Platform Guide
The New mParticle Experience

The new mParticle Experience

The Overview Map

Observability

Observability Overview

Observability User Guide

Observability Span Glossary

Introduction

Data Retention

Connections

Activity

Live Stream

Data Filter

Rules

Tiered Events

mParticle Users and Roles

Analytics Free Trial

Troubleshooting mParticle

Usage metering for value-based pricing (VBP)

Analytics

Introduction

Setup

Sync and Activate Analytics User Segments in mParticle

User Segment Activation

Welcome Page Announcements

Settings

Project Settings

Roles and Teammates

Organization Settings

Global Project Filters

Portfolio Analytics

Analytics Data Manager

Analytics Data Manager Overview

Events

Event Properties

User Properties

Revenue Mapping

Export Data

UTM Guide

Query Builder

Data Dictionary

Query Builder Overview

Modify Filters With And/Or Clauses

Query-time Sampling

Query Notes

Filter Where Clauses

Event vs. User Properties

Group By Clauses

Annotations

Cross-tool Compatibility

Apply All for Filter Where Clauses

Date Range and Time Settings Overview

Understanding the Screen View Event

Analyses

Analyses Introduction

Segmentation: Basics

Getting Started

Visualization Options

For Clauses

Date Range and Time Settings

Calculator

Numerical Settings

Segmentation: Advanced

Assisted Analysis

Properties Explorer

Frequency in Segmentation

Trends in Segmentation

Did [not] Perform Clauses

Cumulative vs. Non-Cumulative Analysis in Segmentation

Total Count of vs. Users Who Performed

Save Your Segmentation Analysis

Export Results in Segmentation

Explore Users from Segmentation

Funnels: Basics

Getting Started with Funnels

Group By Settings

Conversion Window

Tracking Properties

Date Range and Time Settings

Visualization Options

Interpreting a Funnel Analysis

Funnels: Advanced

Group By

Filters

Conversion over Time

Conversion Order

Trends

Funnel Direction

Multi-path Funnels

Analyze as Cohort from Funnel

Save a Funnel Analysis

Explore Users from a Funnel

Export Results from a Funnel

Cohorts

Getting Started with Cohorts

Analysis Modes

Save a Cohort Analysis

Export Results

Explore Users

Saved Analyses

Manage Analyses in Dashboards

Journeys

Getting Started

Event Menu

Visualization

Ending Event

Save a Journey Analysis

Users

Getting Started

User Activity Timelines

Time Settings

Export Results

Save A User Analysis

Dashboards

Dashboards––Getting Started

Manage Dashboards

Dashboard Filters

Organize Dashboards

Scheduled Reports

Favorites

Time and Interval Settings in Dashboards

Query Notes in Dashboards

User Aliasing

Analytics Resources

The Demo Environment

Keyboard Shortcuts

Tutorials

Analytics for Marketers

Analytics for Product Managers

Compare Conversion Across Acquisition Sources

Analyze Product Feature Usage

Identify Points of User Friction

Time-based Subscription Analysis

Dashboard Tips and Tricks

Understand Product Stickiness

Optimize User Flow with A/B Testing

User Segments

APIs

User Segments Export API

Dashboard Filter API

IDSync

IDSync Overview

Use Cases for IDSync

Components of IDSync

Store and Organize User Data

Identify Users

Default IDSync Configuration

Profile Conversion Strategy

Profile Link Strategy

Profile Isolation Strategy

Best Match Strategy

Aliasing

Data Master
Group Identity

Overview

Create and Manage Group Definitions

Introduction

Catalog

Live Stream

Data Plans

Data Plans

Blocked Data Backfill Guide

Personalization
Predictive Attributes

Predictive Attributes Overview

Create Predictive Attributes

Assess and Troubleshoot Predictions

Use Predictive Attributes in Campaigns

Predictive Audiences

Predictive Audiences Overview

Using Predictive Audiences

Introduction

Profiles

Calculated Attributes

Calculated Attributes Overview

Using Calculated Attributes

Create with AI Assistance

Calculated Attributes Reference

Audiences

Audiences Overview

Real-time Audiences

Standard Audiences

Journeys

Journeys Overview

Manage Journeys

Download an audience from a journey

Audience A/B testing from a journey

Journeys 2.0

Warehouse Sync

Data Privacy Controls

Data Subject Requests

Default Service Limits

Feeds

Cross-Account Audience Sharing

Approved Sub-Processors

Import Data with CSV Files

Import Data with CSV Files

CSV File Reference

Glossary

Video Index

Analytics (Deprecated)
Identity Providers

Single Sign-On (SSO)

Setup Examples

Settings

Debug Console

Data Warehouse Delay Alerting

Introduction

Developer Docs

Introduction

Integrations

Introduction

Rudderstack

Google Tag Manager

Segment

Data Warehouses and Data Lakes

Advanced Data Warehouse Settings

AWS Kinesis (Snowplow)

AWS Redshift (Define Your Own Schema)

AWS S3 (Snowplow Schema)

AWS S3 Integration (Define Your Own Schema)

BigQuery (Snowplow Schema)

BigQuery Firebase Schema

BigQuery (Define Your Own Schema)

GCP BigQuery Export

Snowflake (Snowplow Schema)

Snowplow Schema Overview

Snowflake (Define Your Own Schema)

APIs

REST API

Dashboard Filter API (Deprecated)

User Segments Export API (Deprecated)

SDKs

SDKs Introduction

React Native

iOS

Android

Java

JavaScript

Python

Object API

Developer Basics

Aliasing

Calculated Attributes Seeding API

The Calculated Attributes (CA) Seeding API allows you to programmatically set calculated attribute seed values and user attributes for your users. Before using this API, we recommend that you read about the workflow of calculated attribute seeding here.

Authentication

The CA Seeding API is secured via basic authentication. Credentials are issued at the level of an mParticle Workspace. You can obtain credentials for your Workspace from the Workspace Settings screen.

To view workspace credentials:

  1. Click on the current workspace name in the upper left corner.
  2. Click Settings.
  3. Click on the name of a workspace to display the Edit Workspace settings page. Edit workspace settings

You can authenticate in 2 ways:

  1. Many HTTP clients support basic authentication out of the box. Use your API key for the “username” and your API secret for “password”.
  2. Manually set the authentication header by encoding your key and secret together:

    • Concatenate your application key and secret together with a colon (:) separating the two: example-api-key:example-api-secret
    • Base64 with UTF-8 encode the result: ZXhhbXBsZS1hcGkta2V5OmV4YW1wbGUtYXBpLXNlY3JldA==
    • Prefix the encoded string with the authorization method, including a space: Basic ZXhhbXBsZS1hcGkta2V5OmV4YW1wbGUtYXBpLXNlY3JldA==
    • Set resulting string as the Authorization header in your HTTP requests: Authorization: Basic ZXhhbXBsZS1hcGkta2V5OmV4YW1wbGUtYXBpLXNlY3JldA==

Endpoint

Our HTTP base URL is: https://s2s.mparticle.com. If you are using a non-US data center, look up your base URL here.

Paths

This API supports two paths: one for setting calculated attribute seeds for a single user and one for updating many users in bulk.

Single User Seeds

The path is: /v2/calculatedattributes.

This allows you to set seed values and user attributes for a single user at a time.

Overall Structure

{
  "environment": "development",
  "mpid": 7346244611012968789,
  "identities": {...},
  "calculated_attributes": {
    "workspace": [...]
  },
  "user_attributes": {...}
}

Properties

Property Name Data Type Required Description
environment string Required production or development
mpid Numeric Optional The MPID of the user being updated, if known.
identities object Optional The identities of the user to update.
calculated_attributes object Required The seed values of calculated attributes to set.
user_attributes object Optional The user attributes of the user to update.

Either mpid or identities are required to find the correct user profile. If mpid is set, then the identities will be ignored.

Identities Object

This object contains identities used to identify the user to which updates are made. The identities block is a key-value object of many identity or device types and their corresponding identity.

  • User identity types:

  • Device identity types:

    • android_id
    • google_advertising_id
    • ios_advertising_id
    • ios_vendor_id
    • roku_advertising_id
    • roku_publisher_id
    • fire_advertising_id
    • microsoft_advertising_id
    • microsoft_publisher_id

Example identities objects:

"identities": {
    "email": "example@sample.com",
    "other_id_4": "user_example4",
    "ios_advertising_id": "016a9968-abea-d0b1-b0d8-4d3e4ed0c57a"
  }
"identities": {
    "google_advertising_id": "33ef01aa-401f-0f4e-29ce-bd142e68233a",
    "customer_id": "1234"
  }

Calculated Attributes Object

This object contains the calculated attribute and seeding information. It is used only for seeding and cannot be used for any other action on a calculated attribute.

  "calculated_attributes": {
      "workspace": [
        {
          "attribute_name": "LTV",
          "calculation_type": "sum",
          "cutoff_date": "2019-12-01",
          "seed": {...}
        }
      ]
  }

The calculated attribute seed information is set under the workspace property. The structure of these objects depends on the calculation_type of the calculated attribute (also passed in the corresponding field).

Property Name Data Type Required Description
attribute_name string Required The name of the calculated attribute to seed.
calculation_type string Required The calculation type for this calculated attribute, see below for available calculation types.
cuttoff_date Date value in yyyy-MM-dd Required The cutoff date prior to which mParticle should ignore events in CA calculation.
seed object Required CA seed.
Seed Object

This object contains the seed values for a single calculated attribute. The fields depend on the calculation type as defined below.

{
  "seed": {
    "value": "100"
  }
}
Property Name Data Type Required Description
value string Optional The value to seed, used for single value.
key_value_pairs object Optional A map with keys and values of type string.
list array Optional An array of strings, used for list data.

One of the value, key_value_pairs, or list objects are required, depending on the below table:

Calculation Type Value format Description
count value Pass in the current count.
sum value Pass in the current sum.
minimum value Pass in the current minimum value.
maximum value Pass in the current maximum value.
average key_value_pairs Pass values for the keys sum and count in to calculate average. count must be a positive integer.
first_occurrence value Pass in the first value seen.
last_occurrence value Pass in the last value seen.
first_occurrence_timestamp value Pass in the first seen timestamp as UNIX epoch in milliseconds.
last_occurrence_timestamp value Pass in the last seen timestamp as UNIX epoch in milliseconds.
unique_list list Pass in the unique list.
unique_values_count list Pass in the unique list of values.
most_frequent key_value_pairs Pass in values and counts in pairs.

User Attributes

This object contains user attributes to update.

  "user_attributes": {
      "workspace": [
        {
          "attribute_name": "User Tier",
          "attribute_value": "Free"
        }
      ]
  }

Updates to user attributes are nested under the workspace property. Each user attribute will either be created or updated if exists.

Property Name Data Type Required Description
attribute_name string Required The name of the user attribute.
attribute_value string Required The value of the user attribute.

Bulk Seeds

The path is: /v2/bulkcalculatedattributes

This allows you to send an array of users, each user with its CA seeds and user attributes. The whole request will either succeed or fail, i.e., we don’t partially ingest data.

Overall Structure

[
  {
    "environment": "development",
    "mpid": 7346244611012968789,
    "identities": {...},
    "calculated_attributes": {
      "workspace": [...]
    },
    "user_attributes": {
      "workspace": [...]
    }
  },
  {
    "environment": "development",
    "mpid": 482309279432794321,
    "identities": {...},
    "calculated_attributes": {
      "workspace": [...]
    },
    "user_attributes": {
      "workspace": [...]
    }
  }
]

The structure of each object in the array is the same as defined above for single user requests: calculated attributes object.

Sample Requests

Single User Updates

POST https://s2s.mparticle.com/v2/calculatedattributes/
Content-Type: application/json
Authorization: Basic <your-token-here>

{
  "environment": "development",
  "identities": {
    "customer_id": "123xyz",
    "google_advertising_id": "82416a37-84d7-417f-84f3-a5b5c6a9c570"
  },
  "user_attributes": {
    "workspace": [
      {
        "attribute_name": "User Tier",
        "attribute_value": "Free",
      }
    ]
  },
  "calculated_attributes": {
    "workspace": [
      {
        "attribute_name": "LTV",
        "calculation_type": "sum",
        "cutoff_date": "2019-12-01",
        "seed": {
          "value": 100.5
        }
      },
      {
        "attribute_name": "Product Interests",
        "calculation_type": "unique_list",
        "cutoff_date": "2019-12-01",
        "seed": {
          "list": [
            "travel",
            "pets",
            "kitchen"
          ]
        }
      },
      {
        "attribute_name": "Unique product view count",
        "calculation_type": "unique_values_count",
        "cutoff_date": "2019-12-01",
        "seed": {
          "list": [
            "air jordan",
            "cup",
            "microwave"
          ]
        }
      },
      {
        "attribute_name": "Average Session Length",
        "calculation_type": "average",
        "cutoff_date": "2019-12-01",
        "seed": {
          "key_value_pairs": {
            "sum": 299.2,
            "count": 20
          }
        }
      },
      {
        "attribute_name": "Last seen value",
        "calculation_type": "last_occurrence",
        "cutoff_date": "2019-12-01",
        "seed": {
          "value": "some value"
        }
      },
      {
        "attribute_name": "First seen value",
        "calculation_type": "first_occurrence",
        "cutoff_date": "2019-12-01",
        "seed": {
          "value": "some value"
        }
      },
      {
        "attribute_name": "Last seen time",
        "calculation_type": "last_occurrence_timestamp",
        "cutoff_date": "2019-12-01",
        "seed": {
          "value": 1582589378000
        }
      },
      {
        "attribute_name": "First seen time",
        "calculation_type": "first_occurrence_timestamp",
        "cutoff_date": "2019-12-01",
        "seed": {
          "value": 1582589378000
        }
      },
      {
        "attribute_name": "Min value",
        "calculation_type": "min",
        "cutoff_date": "2019-12-01",
        "seed": {
          "value": 123
        }
      },
      {
        "attribute_name": "Max value",
        "calculation_type": "max",
        "cutoff_date": "2019-12-01",
        "seed": {
          "value": 123
        }
      },
      {
        "attribute_name": "Favorite Item",
        "calculation_type": "most_frequent",
        "cutoff_date": "2019-12-01",
        "seed": {
          "key_value_pairs": {
            "ice cream": 10,
            "vegen": 5,
            "steak": 2
          }
        }
      }
    ]
  }
}

Bulk Updates

POST https://s2s.mparticle.com/v2/bulkcalculatedattributes/
Content-Type: application/json
Authorization: Basic <your-token-here>

[
  {
    "environment": "development",
    "identities": {
      "customer_id": "123xyz",
      "google_advertising_id": "82416a37-84d7-417f-84f3-a5b5c6a9c570"
    },
    "user_attributes": {
      "workspace": [
        {
          "attribute_name": "User Tier",
          "attribute_value": "Free",
        }
      ]
    },
    "calculated_attributes": {
      "workspace": [
        {
          "attribute_name": "LTV",
          "calculation_type": "sum",
          "cutoff_date": "2019-12-01",
          "seed": {
            "value": 100.5
          }
        },
        {
          "attribute_name": "Average Session Length",
          "calculation_type": "average",
          "cutoff_date": "2019-12-01",
          "seed": {
            "key_value_pairs": {
              "sum": 299.2,
              "count": 20
            }
          }
        }
      ]
    }
  },
  {
    "environment": "development",
    "identities": {
      "customer_id": "abc234"
    },
    "calculated_attributes": {
      "workspace": [
        {
          "attribute_name": "LTV",
          "calculation_type": "sum",
          "cutoff_date": "2019-12-01",
          "seed": {
            "value": 80
          }
        }
      ]
    }
  }
]

Rate Limits

Requests sent to the Calculated Attributes Seeding API contribute to the request rate of the Events API.

For more information about default service limits related to event batches, see Default Service Limits.

Response

You should inspect the status code of the response to determine if the POST has been accepted or if an error occurred.

Status Code Notes
202 Accepted The POST was accepted.
400 Bad Request The request JSON was malformed JSON or had missing fields.
401 Unauthorized The authentication header is missing.
403 Forbidden The authentication header is present, but invalid.
429 Too Many Requests You have exceeded your provisioned limit. We recommend retrying your request in an exponential backoff pattern. Learn more about API throttling in Default Service Limits.
503 Service Unavailable We recommend retrying your request in an exponential backoff pattern
5xx Server Error A server-side error has occured, please try your request again.

The whole request either succeed or fail, i.e., we don’t partially accept the data.

Response Body

In some cases, the server can provide additional information the error that occurred in the response body.

The response body is optionally sent from the server and will not be included if additional details on the error are not known.

The format of the error message is CA name: error message.

{
    "errors" :
    [
        {
            "code": "BAD_REQUEST",
            "message": "test sum: No matching calculated attribute definition found"
        },
        {
            "code": "BAD_REQUEST",
            "message": "LTV: Seed value must be numeric"
        }
    ]
}

Was this page helpful?

    Last Updated: November 12, 2024