Custom Access Roles API

The Custom Access Roles API allows account admins to create, modify, and delete lists of specific permissions (custom roles) that can be assigned to users through the mParticle UI. Custom roles are helpful for mParticle accounts with multiple users who don’t need the same degree of access or when an admin needs to prevent a user from accessing a specific feature.

For example, there are only a few features a marketer would need to access, such as Audiences, Calculated Attributes, and the User Activity View. By creating a custom role for marketers, you can remove their access to features that are beyond the scope of their job, such as API Credentials, Data Planning, or Filters. Compared to generic user roles, the Custom Access Roles API gives you granular control so you can create roles that best fit each member of your team.

Endpoint

The Custom Access Roles API is located at https://api.mparticle.com.

Authentication

To use the Custom Access Roles API, you must first create a new set of API credentials that includes access to this API:

  1. Log in to your mParticle account.
  2. Click the User Profile icon at the bottom of the left nav bar, click Settings, and select the API Credentials tab.
  3. Click + Add Credential.
  4. Enter a descriptive name for the Display name.
  5. Check the box next to Custom Roles, and click Save.
  6. Copy the Client ID and Client Secret displayed in the modal window before clicking Done.

Create a new bearer token

After creating the new API credentials for the Custom Roles API, you can authenticate by issuing a POST request to mParticle’s SSO token endpoint:

https://sso.auth.mparticle.com/oauth/token

The JSON body of the request must contain:

  • client_id - the client ID, issued by mParticle when creating the API credentials
  • client_secret - the client secret, issued by mParticle when creating the API credentials
  • audience - set to a value of "https://api.mparticle.com"
  • grant_type - set to a value of "client_credentials"

Example curl request

curl --request POST \
  --url https://sso.auth.mparticle.com/oauth/token \
  --header 'content-type: application/json' \
  --data '{"client_id":"...","client_secret":"...","audience":"https://api.mparticle.com","grant_type":"client_credentials"}'

Example HTTP request

POST /oauth/token HTTP/1.1
Host: sso.auth.mparticle.com
Content-Type: application/json

{
  "client_id": "your_client_id",
  "client_secret": "your_client_secret",
  "audience": "https://api.mparticle.com",
  "grant_type": "client_credentials"
}

Using your Bearer Token

A successful POST request to the token endpoint will result in a JSON response as follows:

{
  "access_token": "YWIxMjdi883GHBBDnjsdKAJQxNjdjYUUJABbg6hdI.8V6HhxW-",
  "expires_in" : 28800,
  "token_type": "Bearer"
}

Subsequent requests to the Custom Access Roles API can now be authorized by setting the authorization header as follows:

Authorization: Bearer YWIxMjdi883GHBBDnjsdKAJQxNjdjYUUJABbg6hdI.8V6HhxW-

Custom role manifest and tasks

All mParticle custom roles are stored in a JSON custom role manifest. This manifest contains a list of roles, and each role includes a description, name, role ID, and a list of tasks.

A task is a unit of access to mParticle features. Some tasks offer full access and others provide view only access. The tasks detailed in the permissions reference below can be mixed and matched to define the custom role experience provided to users.

To create, modify, or delete a custom role, first retrieve a copy of your current manifest by submitting a GET request to /platform/v2/organizations/{orgId:int}/accounts/{accountId:int}/roles.

Modify the returned manifest to reflect the changes you want to make. For example, to delete a custom role, delete the corresponding JSON object for that role from your manifest. Finally, upload the edited manifest to /platform/v2/organizations/{orgId:int}/accounts/{accountId:int}/roles using a PUT request.

Custom roles are visible across an entire mParticle organization, even though the account ID must be included in calls to the Custom Roles API.

When creating a new role, a new role ID is generated and assigned to a role after a successful upload. If you are modifying an existing role, make sure the role_id in the new manifests matches the role_id of the corresponding role in the old manifest. Otherwise a new role_id will create a new role.

The user:core permission is included with every custom role object in your manifest. This permission is necessary for users to be able to log in and view the mParticle dashboard in addition to other basic tasks.

View tasks

Method Path
GET /platform/v2/organizations/{orgId:int}/accounts/{accountId:int}/tasks
Query Parameter Type Description
{orgId:int} Integer The ID of the mParticle organization containing the task list.
{accountId:int} Integer The ID of the mParticle account containing the task list.

Example curl request

curl --location --request GET 'https://api.mparticle.com/platform/v2/organizations/{orgId:int}/accounts/{accountId:int}/tasks' \
--header 'Authorization: Bearer <access token>'

Request body

Empty request body.

Response

A successful request receives an HTTP 200 response code along with a body consisting of the JSON list of tasks that can be assigned to a role in the custom role manifest.

Example response body

Below is an abbreviated example of how the task list is formatted.

[
  {
      "task_id": "cropsdemodatamastermanagement",
      "display_name": "Crops Demo DMM display name",
      "description": "Crops Demo Data Master Management"
  },
  {
      "task_id": "cropsdemobasicuseractions",
      "display_name": "Crops demo basic display name",
      "description": "Crops Demo Basic User Actions"
  }
]

View custom role manifest

Method Path
GET /platform/v2/organizations/{orgId:int}/accounts/{accountId:int}/roles
Query Parameter Type Description
{orgId:int} Integer The ID of the mParticle organization containing the custom role manifest.
{accountId:int} Integer The ID of the mParticle account containing the custom role manifest.

Example curl request

curl --location --request GET 'https://api.mparticle.com/platform/v2/organizations/{orgId:int}/accounts/{accountId:int}/roles' \
--header 'Authorization: Bearer <access token>'

Request body

Empty request body.

Response

{
  "roles": [
      {
          "description": "Marketers can view and create new audiences",
          "name": "Marketer",
          "role_id": "marketer_role",
          "tasks": [
              {
                  "task_id": "user:core"
              },
              {
                  "task_id": "audiences:*"
              },
              {
                  "task_id": "user_activity:view"
              }
          ]
      },
      {
          "description": "Activation Admins can connect audiences to outputs and setup new connections for production",
          "name": "Activation Admin",
          "role_id": "453afgwevc",
          "tasks": [
              {
                  "task_id": "user:core"
              },
              {
                  "task_id": "connections:*"
              },
              {
                  "task_id": "live_stream:view"
              }
          ]
      }
  ],
  "last_modified_on" : "2022-06-28 18:24:49",
  "last_modified_by": "example@example.com"
}

Create a custom role

Method Path
PUT /platform/v2/organizations/{orgId:int}/accounts/{accountId:int}/roles
Query Parameter Type Description
{orgId:int} Integer The ID of the mParticle organization containing the custom role.
{accountId:int} Integer The ID of the mParticle account containing the custom role.

Example curl request

curl --location --request PUT 'https://api.mparticle.com/platform/v2/organizations/{orgId:int}/accounts/{accountId:int}/roles' \
--header 'Authorization: Bearer <access token>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "roles": [
        {
            "role_id": "CustomMarketer",
            "name": "Marketer",
            "description": "The Marketer role can view, edit, and create audiences and access the User Activity View",
            "tasks": [
                {
                    "task_id": "rules:*"
                },
                {
                    "task_id": "user_activity:view"
                }
            ]
        }
}'

Request body

{
  "roles": [
      {
          "name": "Marketer",
          "description": "Marketers can view and create new audiences",
          "tasks": [
              {
                  "task_id": "audiences:*"
              },
              {
                  "task_id": "user_activity:view"
              }
          ],
          "role_id": "myRoleId1"
      },
      {
          "name": "Activation Admin",
          "description": "Activation Admins can connect audiences to outputs and setup new connections for production",
          "tasks": [
              {
                  "task_id": "connections:*"
              },
              {
                  "task_id": "live_stream:view"
              }
          ],
          "role_id": "myRoleId2"
      }
  ]
}

Response

A successful request receives a 200 Success response whose body contains the JSON role manifest.

Modify a custom role

Method Path
PUT /platform/v2/organizations/{orgId:int}/accounts/{accountId:int}/roles
Query Parameter Type Description
{orgId:int} Integer The ID of the mParticle organization containing the custom role.
{accountId:int} Integer The ID of the mParticle account containing the custom role.

Request body

{
  "roles": [
      {
          "name": "Marketing Admin",
          "description": "Marketers can view and create new audiences",
          "tasks": [
              {
                  "task_id": "audiences:*"
              },
              {
                  "task_id": "user_activity:view"
              },
              {
                  "task_id": "calculated_attributes:view"
              }
          ],
          "role_id": "myRoleId1"
      }
  ]
}

Response

A successful request receives a 200 Success response whose body contains the JSON role manifest.

Delete a custom role

To delete a custom role, remove the lines in the role manifest that correspond with that role and upload the new version of the role manifest.

Method Path
PUT /platform/v2/organizations/{orgId:int}/accounts/{accountId:int}/roles
Query Parameter Type Description
{orgId:int} Integer The ID of the mParticle organization containing the custom role.
{accountId:int} Integer The ID of the mParticle account containing the custom role.

Request body

{
  "roles": [
      {
          "name": "Marketing Admin",
          "description": "Marketers can view and create new audiences",
          "tasks": [
              {
                  "task_id": "audiences:*"
              },
              {
                  "task_id": "user_activity:view"
              },
              {
                  "task_id": "calculated_attributes:view"
              }
          ],
          "role_id": "myRoleId1"
      }
  ]
}

Response

A successful request receives a 200 Success response whose body contains the JSON role manifest.

Assign a custom access role to a user

To assign a custom access role that you have already created and uploaded to your manifest:

  1. Log in to mParticle and click the user profile icon in the bottom of the left nav bar.
  2. Click Settings, and select the User Management tab.
  3. Select a user.
  4. Select a custom role.
  5. Click Save.

Permissions reference by mParticle feature

Below is a list of the mParticle features with all available permissions and corresponding task IDs for each feature. Use this reference when creating or modifying a custom role.

Default Permissions

The following permissions are included with every custom role by default.

Permission Description
View only View the system alerts dashboard and alerts for each connection.
View only View the Event Forwarding report for details about inbound and outbound data.
View only View the Data Master Catalog and annotate data points.
View only View available integrations in the Integrations Directory.
Log in and view dashboard The user:core permission is mandatory for users to log in to mParticle and to view the main dashboard. It is required for all custom roles and is automatically included with each custom role definition you create.

User Activity View (UAV)

The User Activity View provides detailed data for individual users.

Permission Task ID Description
View only user_activity:view Search for any user and view their associated user details, workspace usage, device info, attributes, and audience membership

Data Master Catalog

The Data Master Catalog provides a view of every event, attribute, and identity collected in your mParticle workspace.

Permission Task ID Description
Full access catalog:* View the Data Master Catalog and annotate data points

Data Plans

Data Plans are codified expectations of how data collected should be formatted in order to be ingested into mParticle.

Permission Task ID Description
View only data_plans:view View existing data plans
Full access data_plans:* View, create, edit, activate, and delete data plans

Live Stream

Live Stream gives a real-time view of all data flowing into and out of mParticle.

Permission Task ID Description
View only live_stream:view View Live Stream and examine individual events

Calculated Attributes

Calculated Attributes are read-only values about particular attributes of a single user. These attributes are updated over time.

Permission Task ID Description
View only calculated_attributes:view View calculated attributes
Full access calculated_attributes:* View, create, and delete calculated attributes

Rules

Rules can be used to modify or remove events, event data, and batches of events before being ingested into mParticle.

Permission Task ID Description
View only rules:view View all rules
Full access rules:* View, create, edit, and delete rules

Audiences

Audiences are lists of users created according to a set of criteria with the goal of improving your engagement with those users.

Permission Task ID Description
View only audiences:view View all audiences, the audience estimator, and journeys
Full access audiences:* View, create, activate, and delete audiences and journeys

Connections

Connections are combinations of a data source (or input) and an integration (or output) where data is forwarded.

Permission Task ID Description
Connect integration connections:connect_integration Create a connection between an input and an output
Configure input connections:configure_inputs Configure an input
Configure output connections:configure_outputs Configure an output
Full access connections:* Create, delete, and activate/deactivate connections between inputs and outputs

Filters

Filters control exactly which data is forwarded to your outputs.

Permission Task ID Desscription
View only data_filter:view View current data filters
Full access data_filter:* View and create filters

Data Subject Requests & Privacy

Data Privacy Controls help you to manage your opt-out and consent obligations under the GDPR and CCPA.

Permission Task ID Description
View only privacy:settings View enabled privacy setings
Full access privacy:* View and modify privacy settings

Workspaces

Workspaces are the basic containers for the domains or properties that act as data sources.

Permission Task ID Description
View only workspaces:view View and access different workspaces. Included by default.
Full access workspaces:* View, create, and delete workspaces

mParticle User Management

Users are people with individual credentials that have access to your mParticle account. Users can be assigned pre-defined roles or custom roles to control which mParticle features they have access to and the extent of their permissions for those features.

Permission Task ID Description
View only user_management:view View users with access to your account
Full access user_management:* View, create, delete, and assign roles to users in your account

Identity Strategy Settings

IDSync is the mParticle identity resolution service. The IDSync Settings provide an overview of the identity strategy and identifier hierarchy used when resolving identification requests in your account.

Permission Task ID Description
Full access identity_settings:* View and modify your identity settings

API Credentials

The API Credentials interface allows you to view, create, edit, delete, activate, and deactivte API credentials. These credentials can be used to access and interact with the various mParticle APIs.

Permission Task ID Description
Full access api_credentials:* View, create, delete, and assign your API credentials

Limitations

Resource Limits Details
Custom Roles 100 roles per organization You can’t create more than 100 custom roles per organization. If your business requires more than 100 custom roles, contact your mParticle account representative.
Requests per min 100 requests per minute If you exceed 100 requests per minute to the Custom Roles API, you will receive a 429 Too Many Requests response.
RoleId 64 characters A custom role ID can’t exceed 64 characters. This field is required for all roles and is provided by the user.
Name 64 characters A custom role name can’t exceed 64 characters. This field, which sets the display name for the role, is required for all roles.
Description 256 characters A custom role description can’t exceed 256 characters.

Error handling

The following errors sometimes occur when uploading or modifying a custom role manifest.

Response code Error message Description
400 Removed a custom role with active user membership You can’t delete custom roles that are currently assigned to a user. First, unassign the role from the mParticle UI before attempting to delete it.
400 Name or Description is empty, has too many characters length, or has restricted characters Both the name and role ID of a custom role are required, and there are limits on their length. The error message includes details about the missing value or limit exceeded.
400 Tasks not found The tasks listed in your manifest don’t exist or don’t match the expected task IDs. Verify your task IDs are correct.
400 Miswritten JSON syntax Your custom role is formatted incorrectly. Use a JSON linter to make sure your manifest includes all necessary characters.

Was this page helpful?