The mParticle platform API allows you to RESTfully create and update a number of entities such as Apps, App Platforms, as well as configure services to forward data to.
The platform API is located at https://api.mparticle.com
.
To access the API, you will need to create a dedicated API user, with a valid email address, under your mParticle Organization. The user must have access to only one Organization. Contact your Account Manager or email support@mparticle.com to arrange API access for that user. You can then use the username and password of that user to access the Platform or User Profile API.
Once your API user is set up, you can authenticate by issuing a POST request to https://api.mparticle.com/oauth2/token
with the Authorization header set.
Curl Syntax
curl \
-X POST \
-H "Authorization: Basic MTJjamY0KzhjMWwwMmp6ZG1zajhAc2hhcmtsYXNlcnMuY29tOlBhc3N3b3JkMjAxNCE=" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials" \
"https://api.mparticle.com/oauth2/token"
Sample Raw HTTP Request
POST /oauth2/token HTTP/1.1
Host: api.mparticle.com
Authorization: Basic MTJjamY0KzhjMWwwMmp6ZG1zajhAc2hhcmtsYXNlcnMuY29tOlBhc3N3b3JkMjAxNCE=
Content-Type: application/x-www-form-urlencoded
grant_type=client_credentials
The Authorization header follows the standard HTTP basic access authentication technique. Your username and password should be combined into a string separated by a colon ’:’
"username:password"
The resulting string should then be Base64 encoded, and added to the Authorization header:
Authorization: Basic MTJjamY0KzhjMWmmAmp6ZG1zajhAc2hhcmtsYGNlcnMuY14tOlBhc3Q3b3JkMjAxNCE=
A successful POST request to /oauth2/token
will result in a JSON response as follows:
{
"token_type": "bearer",
"access_token": "YWIxMjdi883GHBBDnjsdKAJQxNjdjYUUJABbg6hdI.8V6HhxW-"
}
Subsequent requests to the API can now be authorized by setting the Authorization header as follows:
Authorization: Bearer YWIxMjdi883GHBBDnjsdKAJQxNjdjYUUJABbg6hdI.8V6HhxW-
Tokens do not expire, but can be revoked.
Invalid requests to /oauth2/token
will return a JSON response with HTTP status code 400
or 401
as follows:
{
"data": null,
"dataType": null,
"errors": [
{
"message": "invalid_client",
"code": "Missing (or too large) basic credentials header"
}
]
}
The errors array will contain debugging information in the message and code fields: Message | Code | Description | |---|---|--- invalid_client | Missing (or too large) bearer token | Check that your bearer token is correct | invalid_client | Authorization header is wrong type | Authorization header must start with “Bearer” invalid_grant | Bearer token failed validation | The Bearer token provided is not valid. | invalid_client | Could not retrieve user access rights | Contact mParticle support | unauthorized_client | Requesting user does not have access to any data | Contact mParticle support | invalid_client | Invalid setup. API user can only have access to one org. | Contact mParticle support | unsupported_grant_type | Unsupported grant type | grant_type must be set to client_credentials | missing_grant_type | Missing grant type | Check that you are providing a grant_type value | invalid_client | Missing (or too large) basic credentials header | Missing credentials in HTTP header | invalid_client | Authorization header is malformed | Ensure that header is username:password.| invalid_client | Authorization header is wrong type | Check the format of your Authorization header |
To revoke a token, send a POST request to https://api.mparticle.com/oauth2/invalidate_token
with the same Basic Authorization header as the token request, and a JSON body of {"access_token": "<token>"}
.
curl
-X POST \
-H "Authorization: Basic MTJjamY0KzhjMWwwMmp6ZG1zajhAc2hhcmtsYXNlcnMuY29tOlBhc3N3b3JkMjAxNCE=" \
-H "Content-Type: application/json" \
-d '{"access_token":"YWIxMjdi883GHBBDnjsdKAJQxNjdjYUUJABbg6hdI.8V6HhxW-"}' \
"https://api.mparticle.com/oauth2/invalidate_token"
Once you have authenticated, the API resources can be accessed at https://api.mparticle.com/v1/
.
Subsequent updates to the API that introduce breaking changes will be published with a new version number in the URL.
All API calls require you to pass AccountId as a querystring parameter when making the request, with the exception of a GET /accounts which lists all accounts. Forgetting to add the AccountId parameter when required will result in a 401 Unauthorized response.
If you are unsure what your Account ID is, you can make a GET request to https://api.mparticle.com/v1/accounts
. This will return a list of Accounts within your Organization, and from there you can choose an Account ID to work with. All subsequent entities that you work with will
be within the scope of the chosen Account ID. Attempting to access or modify entities outside of the specified Account ID scope will return 404 - Not Found.
All POST/PUT requests should send JSON as the Request Payload, with
Content-Type
set to application/json
.
If an API request returns data, it will be wrapped in a common JSON structure.
{
"data": [],
"dataType": "app",
"errors": [
{
"code": "VALIDATION_ERROR",
"message": "Error message here"
}
]
}
One or more entities will be returned as an array in the data property. If errors were encountered, they will be available as an array of error objects.
The following table lists the status codes that are returned by API requests:
Statis | Code | Method | Notes |
---|---|---|---|
200 | OK | GET | |
201 | Created | POST | |
202 | Accepted | PUT | |
204 | No Content | DELETE | |
400 | Bad Request | All | JSON Syntax is invalid |
401 | Unauthorized | All | User failed authentication |
403 | Forbidden | All | Identity is not authorized to invoke specified method |
404 | Not Found | GET | Resource does not exist or user does not have access |
405 | Method Not Allowed | All | Specified HTTP method not supported |
422 | Unprocessable Entity | PUT/POST/DELETE | Request failed business logic rules |
500 | Internal Server Error | All | Contact mParticle support to resolve this error |
The mParticle REST API supports Cross Origin Resource Sharing (CORS) for AJAX requests from any origin.
GET /accounts/1?accountId=1
curl \
-X GET \
-H "Authorization: Bearer YWIxMjdi341GHhnDnjsdKAJQxNjdjYuOJABbg6HdI.8V6HhxW-" \
"https://api.mparticle.com/v1/accounts/1?accountId=1"
{
"data": [
{
"name": "My Account",
"last_modified_on": "2014-11-14T22:46:38.673",
"data_type": "account",
"id": 1,
"created_on": "2013-07-23T18:49:38.547"
}
],
"dataType": "account",
"errors": null
}
GET /accounts
curl \
-X GET \
-H "Authorization: Bearer YWIxMjdi341GHhnDnjsdKAJQxNjdjYuOJABbg6HdI.8V6HhxW-" \
"https://api.mparticle.com/v1/accounts ?accountId=1"
{
"data": [
{
"name": "My Account",
"last_modified_on": "2014-11-14T22:46:38.673",
"data_type": "account",
"id": 1,
"created_on": "2013-07-23T18:49:38.547"
}
],
"dataType": "account",
"errors": null
}
PUT /accounts/1?accountId=1
curl \
-X PUT \
-H "Authorization: Bearer YWIxMjdi883GHBBDnjsdKAJQxNjdjYUUJABbg6hdI.8V6HhxW-" \
-H "Content-Type: application/json" \
-d "{\"name\": \"Updated Name\"}" \
"https://api.mparticle.com/v1/accounts/1?accountId=1" \
Name | Type | Description |
---|---|---|
name | string | The display name of the account |
Name | |--- Account name is not unique. |
POST /accounts
curl
-X POST \
-H "Authorization: Bearer YWIxMjdi883GHBBDnjsdKAJQxNjdjYUUJABbg6hdI.8V6HhxW-" \
-H "Content-Type: application/json" \
-d "{\"name\": \"New Account\"}" \
"https://api.mparticle.com/v1/accounts"
Name | Type | Description |
---|---|---|
name | string | The display name of the account |
DELETE /accounts
curl -H "Authorization: Bearer YWIxMjdi883GHBBDnjsdKAJQxNjdjYUUJABbg6hdI.8V6HhxW-" -H "Content-Type: application/json" -X DELETE https://api.mparticle.com/v1/accounts?accountId=1
Name | |--- All applications must be deleted before deleting account. |
GET /apps/1?accountId=1
curl -H "Authorization: Bearer YWIxMjdi883GHBBDnjsdKAJQxNjdjYUUJABbg6hdI.8V6HhxW-" -X GET https://api.mparticle.com/v1/apps/1?accountId=1
{
"data": [
{
"name": "Test App",
"platforms": [
{
"application_id": 1,
"os": "Android",
"access_keys": [
{
"key": "AccessKey",
"secret": null,
"data_type": "token"
}
],
"crash_handling": "AppDefined",
"network_performance": "AppDefined",
"social_mode": "AppDefined",
"profile_merging": false,
"push_attribution_timer": 30,
"last_modified_on": "2014-11-05T20:09:46.577",
"data_type": "platform",
"created_on": "2014-06-11T19:43:48.697"
}
],
"last_modified_on": "2014-06-11T19:43:45.617",
"data_type": "application",
"id": 1,
"created_on": "2014-06-11T19:43:45.617"
}
],
"dataType": "application",
"errors": null
}
GET /apps?accountId=1
curl -H "Authorization: Bearer YWIxMjdi883GHBBDnjsdKAJQxNjdjYUUJABbg6hdI.8V6HhxW-" -X GET https://api.mparticle.com/v1/apps?accountId=1
{
"data": [
{
"name": "Test App",
"platforms": [
{
"application_id": 1,
"os": "Android",
"access_keys": [
{
"key": "AccessKey",
"secret": null,
"data_type": "token"
}
],
"crash_handling": "AppDefined",
"network_performance": "AppDefined",
"social_mode": "AppDefined",
"profile_merging": false,
"push_attribution_timer": 30,
"last_modified_on": "2014-11-05T20:09:46.577",
"data_type": "platform",
"created_on": "2014-06-11T19:43:48.697"
}
],
"last_modified_on": "2014-06-11T19:43:45.617",
"data_type": "application",
"id": 1,
"created_on": "2014-06-11T19:43:45.617"
}
],
"dataType": "application",
"errors": null
}
PUT /apps/1?accountId=1
curl \
-X PUT \
-H "Authorization: Bearer YWIxMjdi883GHBBDnjsdKAJQxNjdjYUUJABbg6hdI.8V6HhxW-" \
-H "Content-Type: application/json" \
-d "{\"name\": \"Updated Name\"}" \
"https://api.mparticle.com/v1/apps/1?accountId=1"
{
"name": "Test App New Name"
}
Name | Type | Description |
---|---|---|
name | string | The name of the app |
Name | |--- App name must be specified. |
POST /apps?accountId=1
curl \
-X POST \
-H "Authorization: Bearer YWIxMjdi883GHBBDnjsdKAJQxNjdjYUUJABbg6hdI.8V6HhxW-" \
-H "Content-Type: application/json" \
-d "{\"name\": \"Updated Name\", \"platforms\":[{\"os\": \"iOS\"},{\"os\": \"Android\"}]}" \
"https://api.mparticle.com/v1/apps/1?accountId=1"
{
"name": "Test App",
"platforms": [
{
"os": "iOS"
},
{
"os": "Android"
}
]
}
{
"data": [
{
"name": "Test App",
"platforms": [
{
"application_id": 1,
"os": "iOS",
"access_keys": [
{
"key": "AccessKey",
"secret": "AccessSecret",
"data_type": "token"
}
],
"crash_handling": null,
"network_performance": null,
"social_mode": null,
"profile_merging": true,
"push_attribution_timer": 30,
"last_modified_on": "2015-03-11T12:07:08.077",
"data_type": "platform",
"created_on": "2015-03-11T12:07:08.077"
}
],
"last_modified_on": "2015-03-11T12:07:07.877",
"data_type": "application",
"id": 1,
"created_on": "2015-03-11T12:07:07.877"
}
],
"dataType": "application",
"errors": null
}
Name | Type | Description |
---|---|---|
name | string | The name of the app |
platforms | array | Array of platforms to create for the app in the format of {"os": "iOS"} . Valid values for the “os” field include “iOS”, “tvOS”, “Android”, “MobileWeb”, “Roku”, “Alexa”, “SmartTV”, “FireTV”, and “Xbox” |
Name | |--- Exceeded app limit. | App name already exists. | App must have at least one platform selected. | App name not specified. | Invalid os specified. |
Creating a new app or app platform will generate a new Access Key and Secret for that app platform, which can be accessed through the “access_keys”. Note that this is the only time the Secret is transmitted - subsequent GET requests will only return the Access Key.
DELETE /apps/1?accountId=1
curl \
-X DELETE \
-H "Authorization: Bearer YWIxMjdi883GHBBDnjsdKAJQxNjdjYUUJABbg6hdI.8V6HhxW-" \
https://api.mparticle.com/v1/apps/1?accountId=1
Name |
---|
Deleting an app that has active platforms is not allowed. |
GET /apps/1/platforms/android?accountId=1
curl \
-X GET \
-H "Authorization: Bearer YWIxMjdi883GHBBDnjsdKAJQxNjdjYUUJABbg6hdI.8V6HhxW-" \
"https://api.mparticle.com/v1/apps/1/platforms/android?accountId=1" \
{
"data": [
{
"application_id": 1,
"os": "Android",
"access_keys": [
{
"key": "AccessKey",
"secret": null,
"data_type": "token"
}
],
"crash_handling": "AppDefined",
"network_performance": "AppDefined",
"social_mode": "AppDefined",
"profile_merging": false,
"push_attribution_timer": 30,
"last_modified_on": "2014-11-05T20:09:46.577",
"data_type": "platform",
"created_on": "2014-06-11T19:43:48.697"
}
],
"dataType": "platform",
"errors": null
}
GET /apps/1/platforms?accountId=1
curl \
-X GET \
-H "Authorization: Bearer YWIxMjdi883GHBBDnjsdKAJQxNjdjYUUJABbg6hdI.8V6HhxW-" \
"https://api.mparticle.com/v1/apps/1/platforms?accountId=1"
{
"data": [
{
"application_id": 1,
"os": "Android",
"access_keys": [
{
"key": "AccessKey",
"secret": null,
"data_type": "token"
}
],
"crash_handling": "AppDefined",
"network_performance": "AppDefined",
"social_mode": "AppDefined",
"profile_merging": false,
"push_attribution_timer": 30,
"last_modified_on": "2014-11-05T20:09:46.577",
"data_type": "platform",
"created_on": "2014-06-11T19:43:48.697"
}
],
"dataType": "platform",
"errors": null
}
PUT /apps/1/platforms/ios?accountId=1
curl \
-X PUT \
-H "Authorization: Bearer YWIxMjdi883GHBBDnjsdKAJQxNjdjYUUJABbg6hdI.8V6HhxW-" \
-H "Content-Type: application/json" \
-d "{\"profile_merging\": true,\"push_attribution_timer\": 30,\"crash_handling\": \"ForceCatch\",\"network_performance\": \"ForceTrue\",\"social_mode\": \"FacebookAndTwitter\"}" \
"https://api.mparticle.com/v1/apps/1/platforms/ios?accountId=1"
{
"profile_merging": true,
"push_attribution_timer": 30,
"crash_handling": "ForceCatch",
"network_performance": "ForceTrue",
"social_mode": "FacebookAndTwitter"
}
Name | Type | Description |
---|---|---|
profile_merging | bool | Enable or disable profile merging |
push_attribution_timer | int | Push attribution timer in minutes |
crash_handling | string | “AppDefined” or “ForceCatch” or “ForceIgnore” |
network_performance | string | “AppDefined” or “ForceTrue” or “ForceFalse” |
social_mode | string | “AppDefined” or “Facebook” or “Twitter” or “FacebookAndTwitter” |
POST /apps/1?accountId=1
curl \
-X POST \
-H "Authorization: Bearer YWIxMjdi883GHBBDnjsdKAJQxNjdjYUUJABbg6hdI.8V6HhxW-" \
-H "Content-Type: application/json" \
-d "{\"os\": \"android\",\"profile_merging\": true,\"push_attribution_timer\": 30,\"crash_handling\": \"ForceCatch\",\"network_performance\": \"ForceTrue\",\"social_mode\": \"FacebookAndTwitter\"}" \
"https://api.mparticle.com/v1/apps/1?accountId=1"
{
"os": "android",
"profile_merging": true,
"push_attribution_timer": 30,
"crash_handling": "ForceCatch",
"network_performance": "ForceTrue",
"social_mode": "FacebookAndTwitter"
}
{
"data": [
{
"application_id": 1,
"os": "Android",
"access_keys": [
{
"key": "AccessKey",
"secret": "AccessSecret",
"data_type": "token"
}
],
"crash_handling": "AppDefined",
"network_performance": "AppDefined",
"social_mode": "AppDefined",
"profile_merging": false,
"push_attribution_timer": 30,
"last_modified_on": "2014-11-05T20:09:46.577",
"data_type": "platform",
"created_on": "2014-06-11T19:43:48.697"
}
],
"dataType": "platform",
"errors": null
}
Name | Type | Description |
---|---|---|
os | string | Valid values for the “os” field include “iOS”, “tvOS”, “Android”, “MobileWeb”, “Roku”, “Alexa”, “SmartTV”, “FireTV”, and “Xbox” |
profile_merging | bool | Enable or disable profile merging |
push_attribution_timer | int | Push attribution timer in minutes |
crash_handling | string | “AppDefined” or “ForceCatch” or “ForceIgnore” |
network_performance | string | “AppDefined” or “ForceTrue” or “ForceFalse” |
social_mode | string | “AppDefined” or “Facebook” or “Twitter” or “FacebookAndTwitter” |
Name | |--- Could not create platform: App does not exist or you do not have access. | Invalid os specified. | Platform already exists for the specified App. |
Creating a new app or app platform will generate a new Access Key and Secret for that app platform, which can be accessed through the “access_keys”. Note that this is the only time the Secret is transmitted - subsequent GET requests will only return the Access Key.
DELETE /apps/1/platforms/ios?accountId=1
curl \
-X DELETE \
-H "Authorization: Bearer YWIxMjdi883GHBBDnjsdKAJQxNjdjYUUJABbg6hdI.8V6HhxW-" \
"https://api.mparticle.com/v1/apps/1/platforms/ios?accountId=1"
GET /apps/1/platforms/ios/services?accountId=1
curl \
-X GET \
-H "Authorization: Bearer YWIxMjdi883GHBBDnjsdKAJQxNjdjYUUJABbg6hdI.8V6HhxW-" \
"https://api.mparticle.com/v1/apps/1/platforms/ios/services?accountId=1`"
{
"data": [
{
"account": "Default Account",
"name": "GoogleAnalyticsEventForwarder",
"isActive": true,
"isVisible": true,
"settings": [
{
"name": "apiKey",
"value": "*********** Key",
"isConfidential": true
}
],
"data_type": "service"
}
],
"dataType": "service",
"errors": null
}
PUT /apps/1/platforms/ios/services?accountId=1
curl \
-X PUT \
-H "Authorization: Bearer YWIxMjdi883GHBBDnjsdKAJQxNjdjYUUJABbg6hdI.8V6HhxW-" \
-H "Content-Type: application/json" \
-d "{\"account\": \"Default Account\", \"name\":\"GoogleAnalyticsEventForwarder\",\"isActive\":true,\"isVisible\": true,\"settings\":[{\"name\":\"apiKey\",\"value\":\"My Test App Key\"}]}" \
"https://api.mparticle.com/v1/apps/1/platforms/ios/services?accountId=1"
{
"account": "Default Account",
"name":"GoogleAnalyticsEventForwarder",
"isActive":true,
"isVisible": true,
"settings":[
{
"name":"apiKey",
"value":"My Test App Key"
}
]
}
Name | Type | Description |
---|---|---|
account | string | The name of the account you wish to configure. |
name | string | The name of the service you wish to configure |
isActive | bool | Controls whether data is actually pushed to the service |
isVisible | bool | Whether the service is visible in the UI |
settings | array | Array of setting objects |
Name | |--- Specified service not found. | Service does not support app platform. | Invalid settings entered while updating the service. | Provided setting not found. | Required setting not provided. | Setting value is required. |
To discover what settings are available for each service, you can call https://api.mparticle.com/v1/services?accountId=1
to discover all services and supported settings.
The “account” parameter allows you to forward data to more than one account per service. It is internal to mParticle, and can be set to any name of your choosing. If omitted or set to null, the account name will be set to “Default Account”.
The “isVisible” flag allows you to create services that forward data in the background, but are not visible in the mParticle UI. This allows you to have two active forwarders per combination of app platform and service. This field is not required and will default to true if omitted.
GET /audiences?accountId=1
This request returns an array containing all active single and multiple workspace audiences for an account. Details for each audience include:
name
/ external_name
- The names for the audience shown within the mParticle dashboard and to external platforms.id
- the unique mParticle identifier for the audience.is_calculated
- true if boolean logic is used to build the audience.connected_outputs
- A list of each output platform the audience is currently connected to.curl \
-X GET \
-H "Authorization: Bearer YWIxMjdi883GHBBDnjsdKAJQxNjdjYUUJABbg6hdI.8V6HhxW-" \
"https://api.mparticle.com/v1/audiences?accountId=1"
[
{
"name": "Abandoned Cart",
"external_name": "Abandoned Cart",
"size": 342,
"created_by": "jsmith",
"last_modified_by": "mmann",
"last_modified_on": "2017-01-12T17:27:34.387",
"is_calculated": false,
"added_last_24_hours": 10,
"dropped_last_24_hours": 7,
"status": "active",
"connected_outputs": [
{
"provider_name": "Mixpanel",
"configurations": [
{
"name": "Prod"
}
],
"data_type": "audience_output"
},
{
"provider_name": "ActionX",
"configurations": [
{
"name": "Dev"
}
],
"data_type": "audience_output"
}
],
"data_type": "audience",
"id": 7622
}
]
GET /users?accountId=1
curl \
-X GET \
-H "Authorization: Bearer YWIxMjdi883GHBBDnjsdKAJQxNjdjYUUJABbg6hdI.8V6HhxW-" \
"https://api.mparticle.com/v1/users?accountId=1"
{
"data": [
{
"first_name": "Test",
"last_name": "User",
"email": "testuser@mparticle.com",
"data_type": "user"
}
],
"dataType": "user",
"errors": null
}
GET /users/test40mparticle2Ecom?accountId=1
curl \
-X GET \
-H "Authorization: Bearer YWIxMjdi883GHBBDnjsdKAJQxNjdjYUUJABbg6hdI.8V6HhxW-" \
"https://api.mparticle.com/v1/users/test40mparticle2Ecom?accountId=1"
{
"data": [
{
"first_name": "Test",
"last_name": "User",
"email": "test@mparticle.com",
"data_type": "user"
}
],
"dataType": "user",
"errors": null
}
POST /users?accountId=1
curl \
-X POST \
-H "Authorization: Bearer YWIxMjdi883GHBBDnjsdKAJQxNjdjYUUJABbg6hdI.8V6HhxW-" \
-H "Content-Type: application/json" \
-d "{\"first_name\": \"Test\",\"last_name\": \"User\",\"email\": \"testuser@mparticle.com\"}" \
"https://api.mparticle.com/v1/users?accountId=1"
{
"first_name": "Test",
"last_name": "User",
"email": "testuser@mparticle.com"
}
Name | Type | Description |
---|---|---|
first_name | string | First name of the user to add |
last_name | string | Last name of the user to add |
string | Email address of the user to add |
Name | |--- First name or last name required. | Email is required. | Email must be a valid email format. |
DELETE /users/test40mparticle2Ecom?accountId=1
curl \
-X DELETE \
-H "Authorization: Bearer YWIxMjdi883GHBBDnjsdKAJQxNjdjYUUJABbg6hdI.8V6HhxW-" \
"https://api.mparticle.com/v1/users?accountId=1"
When getting service information, both configuration and connection settings are returned. Refer to the Custom Service Settings for specifying these settings.
GET /services?accountId=1
curl \
-X GET \
-H "Authorization: Bearer YWIxMjdi883GHBBDnjsdKAJQxNjdjYUUJABbg6hdI.8V6HhxW-" \
"https://api.mparticle.com/v1/services?accountId=1"
{
"data": [
{
"name": "ActionX",
"settings": [
{
"is_required": true,
"name": "advertiserToken",
"description": "The ActionX Advertiser Token for your app.",
"type": "String"
},
{
"is_required": false,
"name": "useCustomerId",
"description": "If enabled, mParticle will forward your Customer ID values to ActionX.",
"type": "Bool"
}
],
"data_type": "service"
}
],
"dataType": "service",
"errors": null
}
GET /services/Amplitude?accountId=1
curl \
-X GET \
-H "Authorization: Bearer YWIxMjdi883GHBBDnjsdKAJQxNjdjYUUJABbg6hdI.8V6HhxW-" \
"https://api.mparticle.com/v1/services/Amplitude?accountId=1"
{
"data": [
{
"name": "Amplitude",
"settings": [
{
"is_required": true,
"name": "apiKey",
"description": "Your app's Amplitude API Key. You can find this on the \"My Account\" page of Amplitude's dashboard.",
"type": "String"
},
{
"is_required": true,
"name": "userIdentification",
"description": "To identify users, choose \"Customer ID\" to send Customer ID if provided or or \"Email\" to send Email addresses if provided.",
"type": "String"
},
{
"is_required": false,
"name": "includeEmailAsUserProperty",
"description": "If true, a hashed Customer ID, when available, will be forwarded as User ID",
"type": "Bool"
}
],
"data_type": "service"
}
],
"dataType": "service",
"errors": null
}
A DataPoint represents a unique data item that has been detected by our system. A DataPoint can be created by calling methods on our SDK such as logEvent, or they can be created using the Events API. Examples of DataPoints are Screen Views, Purchase Events, Navigation Events and Search events among others. All DataPoints are specific to a particular App.
GET /apps/1/datapoints
Retrieves a list of DataPoints that exist for an App.
curl \
-X GET \
-H "Authorization: Bearer YWIxMjdi883GHBBDnjsdKAJQxNjdjYUUJABbg6hdI.8V6HhxW-" \
"https://api.mparticle.com/v1/apps/1/datapoints?accountId=1"
{
"data": [
{
"name": "my event",
"attribute_name": null,
"type": "Event",
"event_type": "navigation",
"data_type": "datapoint",
"created_on": "2015-06-04T18:11:06.027"
},
{
"name": "my event",
"attribute_name": "my event attribute",
"type": "EventAttribute",
"event_type": "navigation",
"data_type": "datapoint",
"created_on": "2015-06-04T18:53:23.25"
},
{
"name": "my screen view",
"attribute_name": null,
"type": "ScreenView",
"event_type": null,
"data_type": "datapoint",
"created_on": "2015-06-04T18:53:23.25"
},
{
"name": "my screen view",
"attribute_name": "my screen view attribute",
"type": "ScreenViewAttribute",
"event_type": null,
"data_type": "datapoint",
"created_on": "2015-06-04T18:53:23.25"
}
],
"dataType": "datapoint",
"errors": null
}
Name | Description |
---|---|
Event | A standard app event |
EventAttribute | An attribute of an app event |
UserAttribute | A user attribute |
ScreenView | A screen view |
ScreenViewAttribute | An attribute of a screen view |
Identity | A user identity type |
Commerce | A commerce event |
CommerceAttribute | An attribute of a commerce event |
If a DataPoint is of type “Event” or “EventAttribute”, then the EventType field will be populated with one of the following values:
Name | Description |
---|---|
unknown | Unknown Event |
navigation | Navigation Event |
location | Location Event |
search | Search Event |
transaction | Transaction Event |
user_content | User Content Event |
user_preference | User Preference Event |
social | Social Event |
other | Other Event |
media | Media Event |
If a DataPoint is of type Commerce
or CommerceAttribute
, then the EventType field will be populated
with one of the following values:
Name | Description |
---|---|
product_add_to_cart | Add to Cart Event |
product_remove_from_cart | Remove from Cart Event |
product_checkout | Checkout Event |
product_checkout_option | Checkout Option Event |
product_click | Click Event |
product_view_detail | View Detail Event |
product_purchase | Purchase Event |
product_refund | Refund Event |
promotion_view | Promotion View Event |
promotion_click | Promotion Click Event |
PUT /apps/1/datapoints
Adds a new DataPoint for an App.
curl \
-X PUT \
-H "Authorization: Bearer YWIxMjdi883GHBBDnjsdKAJQxNjdjYUUJABbg6hdI.8V6HhxW-" \
-H "Content-Type: application/json" \
-d "{\"name\":\"my event\",\"type\":"event",\"event_type\": "navigation"}" \
"https://api.mparticle.com/v1/apps/1/datapoints?accountId=1"
[
{
"name": "my event",
"type": "event",
"event_type": "navigation"
}
]
Accepts an array of DataPoint objects, which have the following properties:
Name | Type | Description |
---|---|---|
name | string | The name of the DataPoint |
attribute_name | string | An attribute name (optional) |
type | enum | The type of DataPoint |
event_type | enum | Can only be set if DataPoint type is “Event”, “EventAttribute”, “Commerce” or “CommerceAttribute” |
The “type” field can be set to one of the following values:
Name | Description |
---|---|
Event | A standard app event |
EventAttribute | An attribute of an app event |
UserAttribute | A user attribute |
ScreenView | A screen view |
ScreenViewAttribute | An attribute of a screen view |
Identity | A user identity type |
Commerce | A commerce event |
CommerceAttribute | An attribute of a commerce event |
The “event_type” field can be set to one of the following values. This field is only required when the “type” is set to “Event” or “EventAttribute”.
Name | Description |
---|---|
unknown | Unknown Event |
navigation | Navigation Event |
location | Location Event |
search | Search Event |
transaction | Transaction Event |
user_content | User Content Event |
user_preference | User Preference Event |
social | Social Event |
other | Other Event |
media | Media Event |
You can add new DataPoints for an App using the API. DataPoints are automatically detected when data is received from your App, however it may be more convenient to insert this data using the API in advance, rather than waiting until your App is fully instrumented using the mParticle SDK. This will allow you to configure features such as Data Filtering without having to wait for App instrumentation to be completed.
GET /apps/1/GoogleAnalyticsEventForwarder?accountId=1
Get default filtering behavior for a service.
curl \
-X GET \
-H "Authorization: Bearer YWIxMjdi883GHBBDnjsdKAJQxNjdjYUUJABbg6hdI.8V6HhxW-" \
"https://api.mparticle.com/v1/apps/1/GoogleAnalyticsEventForwarder?accountId=1"
{
"data": [
{
"name": "GoogleAnalyticsEventForwarder",
"sendNewDataPointsByDefault": true
}
],
"dataType": "datapoint",
"errors": null
}
This call shows any filtering configuration that exists at the Service level. Currently, this is just one property, "sendNewDataPointsByDefault"
, which controls whether newly detected DataPoints are sent to this Service by default.
PUT /apps/1/GoogleAnalyticsEventForwarder?accountId=1
curl \
-X PUT \
-H "Authorization: Bearer YWIxMjdi883GHBBDnjsdKAJQxNjdjYUUJABbg6hdI.8V6HhxW-" \
-H "Content-Type: application/json" \
-d "{\"sendNewDataPointsByDefault\":false}" \
"https://api.mparticle.com/v1/apps/1/GoogleAnalyticsEventForwarder/datapoints?accountId=1"
{
"sendNewDataPointsByDefault": false
}
Name | Type | Description |
---|---|---|
sendNewDataPointsByDefault | bool | Controls whether newly detected DataPoints are sent to this service by default. |
Setting "sendNewDataPointsByDefault"
to false will prevent newly detected DataPoints from being sent to the specified Service. Any existing DataPoints will not be affected, and will continue to be sent or filtered based on the existing configuration.
GET /apps/1/GoogleAnalyticsEventForwarder/datapoints?accountId=1
Retrieve a list of DataPoint filters for a specific App and Service.
curl \
-X GET \
-H "Authorization: Bearer YWIxMjdi883GHBBDnjsdKAJQxNjdjYUUJABbg6hdI.8V6HhxW-" \
"https://api.mparticle.com/v1/apps/1/GoogleAnalyticsEventForwarder/datapoints?accountId=1"
{
"data": [
{
"name": "my event",
"attribute_name": null,
"type": "Event",
"event_type": "navigation",
"enabled": true,
"data_type": "datapoint",
"created_on": "2015-06-04T18:11:06.027"
},
{
"name": "my event",
"attribute_name": "my event attribute",
"type": "EventAttribute",
"enabled": false,
"event_type": "navigation",
"data_type": "datapoint",
"created_on": "2015-06-04T18:53:23.25"
}
],
"dataType": "datapoint",
"errors": null
}
Note that this list of DataPoints are filtered by types that are supported by the service. If the service does not support the ScreenView DataPoint for example, then this DataPoint will not appear in the list.
The DataPoint types "EventAttribute"
, "ScreenViewAttribute"
, and "CommerceAttribute"
are child DataPoints that have a parent DataPoint. In these cases, "attribute_name"
will contain the name of the attribute, and "name"
will contain the name of the parent.
PUT /apps/1/GoogleAnalyticsEventForwarder/datapoints?accountId=1
curl
-X PUT
-H "Authorization: Bearer YWIxMjdi883GHBBDnjsdKAJQxNjdjYUUJABbg6hdI.8V6HhxW-"
-H "Content-Type: application/json"
-d "[{\"name\":\"my event\", \"type\":\"event\", \"event_type\": \"navigation\", \"enabled\": true},{\"name\": \"my event\",\"attribute_name\": \"my event attribute\",\"event_type\": \"navigation\",\"type\": \"eventattribute\",\"enabled\": false}]"
"https://api.mparticle.com/v1/apps/1/GoogleAnalyticsEventForwarder/datapoints?accountId=1"
[
{
"name": "my event",
"type": "Event",
"event_type": "navigation",
"enabled": true
},
{
"name": "my event",
"attribute_name": "my event attribute",
"type": "EventAttribute",
"event_type": "navigation",
"enabled": false
}
]
Accepts an array of DataPoint Filter objects, which have the following properties:
Name | Type | Description |
---|---|---|
name | string | The name of the DataPoint |
attribute_name | string | An attribute name (optional) |
type | enum | The type of DataPoint |
event_type | enum | Can only be set if DataPoint type is “Event”, “EventAttribute”, “Commerce” or “CommerceAttribute” |
enabled | bool | Set to false to prevent this DataPoint from being sent to this service |
The "type"
field can be set to one of the following values:
Name | Description |
---|---|
Event | A standard app event |
EventAttribute | An attribute of an app event |
UserAttribute | A user attribute |
EventType | Filter all app events of a particular type |
ScreenView | A screen view |
ScreenViewAttribute | An attribute of a screen view |
UserIdentity | A user identity type |
Commerce | A commerce event |
CommerceAttribute | An attribute of a commerce event |
If the "type"
is set to "UserIdentity"
, then the "name"
field should be set to one of the following allowed values:
Name | Description |
---|---|
CustomerId | Customer Id |
Facebook Id | |
Twitter Handle | |
Google Id | |
Microsoft | Microsoft Id |
Yahoo | Yahoo Id |
Email Address | |
Other | Other |
If the "type"
is set to "Event"
or "EventAttribute"
, the "event_type"
field can be set to one of the following values. If "type"
is set to "EventType"
, then the "name"
field should be set to one of the values below:
Name | Description |
---|---|
unknown | Unknown Event |
navigation | Navigation Event |
location | Location Event |
search | Search Event |
transaction | Transaction Event |
user_content | User Content Event |
user_preference | User Preference Event |
social | Social Event |
other | Other Event |
media | Media Event |
If the "type"
is set to "Commerce"
or "CommerceAttribute"
, the "event_type"
field can be set to one of the following values:
Name | Description |
---|---|
product_add_to_cart | Add to Cart Event |
product_remove_from_cart | Remove from Cart Event |
product_checkout | Checkout Event |
product_checkout_option | Checkout Option Event |
product_click | Click Event |
product_view_detail | View Detail Event |
product_purchase | Purchase Event |
product_refund | Refund Event |
promotion_view | Promotion View Event |
promotion_click | Promotion Click Event |
When configuring DataPoints of type "EventAttribute"
or "ScreenViewAttribute"
or "CommerceAttribute"
, you must include the name of the attribute in "attribute_name"
, and the name of the parent DataPoint in "name"
.
When configuring DataPoints of type "Event"
or "EventAttribute"
, you must set the "event_type"
field. Failure to do so will cause an error to occur. The "event_type"
field is ignored for other types of DataPoints other than “Event” and "EventAttribute"
.
If the DataPoint specified does not exist, it will be created automatically. Please note that to avoid creating duplicate DataPoints unintentionally, "type"
, "name"
, "attribute_name"
and "event_type"
should all be set correctly.
Due to the hierarchical nature of DataPoints, disabling some types of DataPoints will cause child DataPoints to also become disabled automatically. For example, turning off EventType "Navigation"
will cause all Events and EventAttributes of that Event Type to become disabled. Turning off an Event will cause all child Event Attributes to become disabled.
Google Analytics has a few configuration settings which require additional details to be set. These settings are listed below are are noted with a type of Custom
in the services call.:
{
"account": "Default Account",
"name":"GoogleAnalyticsEventForwarder",
"isActive":true,
"isVisible": true,
"settings":[
{
"name":"apiKey",
"value":"My Test App Key"
}
{
"name":"customDimensions",
"value":"[{\"maptype\":\"EventAttributeClass.Name\",\"map\":\"Bitcoins\",\"value\":\"Dimension 3\"}]"
}
]
}
Check Google Analytics for additional details on these settings and the limits on the supported custom dimensions and metrics. The value for these settings is a json array containing objects with maptype
, map
and value
. You need to indicate if you are using an Event Attribute or a User Attribute, and then specify the mapping to the Custom Dimension or Custom Metric.
Field | Description | Notes - examples |
---|---|---|
maptype | This indicates if you are passing an event or user attribute into the map | EventAttributeClass.Name or UserAttributeClass.Name or ProductAttributeClass.Name |
map | The name of the event attribute, user attribute or product attribute. The attribute name must match exactly or it will not map correctly. | For example, Bitcoins |
value | The custom dimension or custom metric for the mapping | For example, Dimension 3 or Metric 1 |
GET /workspace?accountId=1
Returns a list of all workspaces for an account. Workspace IDs can be used to request the User Insights report.
curl \
-X GET \
-H "Authorization: Bearer YWIxMjdi883GHBBDnjsdKAJQxNjdjYUUJABbg6hdI.8V6HhxW-" \
"https://api.mparticle.com/v1/workspace?accountId=1`"
{
"data": [
{
"id": "4302",
"name": "mP Traveller",
"data_type": "workspace",
"created_on": "2017-02-02T11:20:23"
}
],
"dataType": "workspace",
"errors": null
}
GET /workspace/1/partnerfeeds?accountId=1
Returns a list of partner feeds set up for a workspace. Feed IDs can be used in requesting User Insights reports.
curl \
-X GET \
-H "Authorization: Bearer YWIxMjdi883GHBBDnjsdKAJQxNjdjYUUJABbg6hdI.8V6HhxW-" \
"https://api.mparticle.com/v1/workspace/1/partnerfeeds?accountId=1`"
{
"data": [
{
"id": "4302",
"name": "mP Traveller",
"data_type": "partner_feed",
"created_on": "2017-04-05T10:40:23"
}
],
"dataType": "partner_feed",
"errors": null
}
GET /workspace/1/userinsights?accountId=1
Returns a JSON version of the mParticle Dashboard’s User Insights report.
curl \
-X GET \
-H "Authorization: Bearer YWIxMjdi883GHBBDnjsdKAJQxNjdjYUUJABbg6hdI.8V6HhxW-" \
"https://api.mparticle.com/v1/workspace/1/userinsights?accountId=1&applicationid=1`"
{
"data": [
{
"data_type": "user_insights",
"report_calculation_time": "2017-03-03T15:47:48Z",
"application_id": null,
"app_unique_user_count": "66035",
"app_session_count": "0",
"app_median_session_length": null,
"app_revenue": 0,
"app_event_count": "",
"report_rows": [
{
"fact_name": "Seasonal>Fall Seasonal>Fall Fashionistas",
"fact_provider": null,
"fact_category": null,
"overlap_size": "936",
"session_count": "966",
"median_session_length": 372.111801242236,
"revenue": 9466800,
"event_count": "",
"overlap_percentage": 0.014174301506776709,
"session_count_lift": {
"lift": 0.018552369503018751,
"performance_indicator": "Average"
},
"session_length_lift": {
"lift": 0.00030054097375264988,
"performance_indicator": "Average"
},
"revenue_lift": {
"lift": 0.019499602849964992,
"performance_indicator": "Average"
},
"event_uul_lift": [
{
"lift": 0.31939538109423271,
"performance_indicator": "Average"
}
],
"goal_lift": [
{
"lift": 0.31939538109423271,
"performance_indicator": "Average"
}
],
"revenue_lift_amount": 0.019499602849964992,
"revenue_lift_performance_indicator": "Average",
"session_length_lift_amount": 0.00030054097375264988,
"session_count_lift_amount": 0.018552369503018751,
"session_count_lift_performance_indicator": "Average"
},
{
"fact_name": "CPG>Household supplies buyers>Food Storage",
"fact_provider": null,
"fact_category": null,
"overlap_size": "952",
"session_count": "996",
"median_session_length": 371.11646586345381,
"revenue": 9760800,
"event_count": "",
"overlap_percentage": 0.014416597259029303,
"session_count_lift": {
"lift": 0.029082137393966034,
"performance_indicator": "Average"
},
"session_length_lift": {
"lift": -0.0023750917649091319,
"performance_indicator": "Bad"
},
"revenue_lift": {
"lift": 0.030046600503051524,
"performance_indicator": "Average"
},
"event_uul_lift": [
{
"lift": -0.26524700153326963,
"performance_indicator": "Average"
}
],
"goal_lift": [
{
"lift": -0.26524700153326963,
"performance_indicator": "Average"
}
],
"revenue_lift_amount": 0.030046600503051524,
"revenue_lift_performance_indicator": "Average",
"session_length_lift_amount": -0.0023750917649091319,
"session_count_lift_amount": 0.029082137393966034,
"session_count_lift_performance_indicator": "Average"
}
]
}
]
}
To return a valid report you must include your accountID
, and either a feedid
or applicationid
Name | Type | Required | Description |
---|---|---|---|
accountId | int | Required | ID of your mParticle account as used for all platform API requests |
feedid | int | Optional | Sets a feed for the User Insights report |
applicationid | int | Optional | Sets an application for the User Insights report |
Was this page helpful?