hi I want to use a service account to pull and insight report. However I am getting an issue that the service account does not have access to the workspace. { "request": "/api/query/insights?project_id=3506092&workspace_id=4007888&bookmark_id=75315985", "error": "User is not a member of this workspace" }
Hi Daniel S., Please stand by as I search the Mixpanel knowledge base for an AI-powered answer. I normally take about 15 seconds or so. In case AI cannot answer your question, feel free to reach out to Mixpanel support at mixpanel.com/get-support. If you have follow-up questions for this thread, please tag me again with your question: @kapa.ai <follow-up question> 👋
Feel free to ask a follow-up question once I've answered by mentioning me with @kapa.ai
The error message "User is not a member of this workspace" indicates that your service account does not have the necessary permissions for the specified workspace (workspace_id=4007888) in your Mixpanel project.To resolve this, you need to ensure that your service account is granted access to the workspace. Here’s what you should do: 1. Check Service Account Project Membership:
Make sure the service account is a member of the project and has the appropriate role. You can manage service account access in your Organization settings or Project settings. When creating or editing a service account, you must assign it to the relevant projects and, if applicable, workspaces within those projects. If you add a service account from the project settings page, it will be assigned an admin role for that project by default, but you may need to explicitly grant access to the workspace as well Service Accounts.2. Grant Access to the Workspace:
For projects with Data Views (workspaces), you must include the workspace_id in your request, and the service account must have permission to access that workspace Query API Authentication. If the service account is not a member of the workspace, you will receive the error you’re seeing.3. How to Add Service Account to Workspace:
- Go to your Mixpanel Organization or Project settings.
- Edit the service account and ensure it is added to the correct project and workspace.
- Assign the necessary role (e.g., admin, analyst, consumer) for the workspace.4. Verify Permissions:
Only organization owners or admins can modify service account access. If you do not have these permissions, contact someone in your organization who does Roles & Permissions.Once the service account has the correct access, your API request should succeed.If you continue to have issues, double-check that the project_id and workspace_id in your API call match the ones the service account has access to.Let me know if you need step-by-step instructions for a specific Mixpanel interface!
kapa.ai is still learning and improving, please let me know how I did by reacting below.
ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
Let me check the knowledge base for you again. One moment! 📚
If your service account is set to the Consumer role, it can view and save its own reports and Boards, but it cannot share reports or manage project user roles. However, the documentation does not explicitly state that the Consumer role is restricted from pulling (viewing) Insights reports via the API. According to the permissions table, all project roles—including Consumer—can "Create and View Insights Reports" Project Roles.Therefore, you should not need to elevate the service account to Admin just to pull an Insights report. The Consumer role should be sufficient for viewing Insights reports, as long as the service account has access to the correct project and workspace.If you are still receiving access errors, double-check that the service account is indeed a member of the specific workspace and project you are querying. If the issue persists despite correct membership and role, there may be a workspace-specific permission or configuration issue not covered in the documentation.Summary: No, you do not need to elevate the service account to Admin to pull an Insights report; the Consumer role should be sufficient for viewing Insights reports Project Roles.
kapa.ai is still learning and improving, please let me know how I did by reacting below.
ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
Let me check the knowledge base for you again. One moment! 📚
To share access to a workspace (Data View) with your service account, you need to add the service account as a member of that Data View within your project settings. Here’s how you can do it: 1. Go to Project Settings and select Data Views from the left-hand menu. 2. Select the Data View (workspace) you want to share. 3. In the Data View settings, click + Add User to add individual project members—including service accounts—to the Data View. Only users (or service accounts) that are part of your project will appear in this list. 4. You can also add entire teams to a Data View via the Teams tab, which will grant access to all members of that team, including any service accounts in the team.After you add the service account to the Data View, it will have access to the data filtered by that workspace. If the Data View is set to Public, project members can also self-join, but for service accounts, explicit addition is recommended for clarity and control Manage Visibility and Editing Controls.If you use teams for permission management, you can add the service account to a team and then add that team to the Data View, which is helpful for managing access at scale Teams.If you do not see the service account in the list, ensure it is already a member of the project. Only project members can be added to a Data View.Let me know if you need more detailed steps for your specific setup!
kapa.ai is still learning and improving, please let me know how I did by reacting below.
ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
Let me check the knowledge base for you again. One moment! 📚
If you are receiving a "No JSON body" response when querying the Insights API, it likely means that the API call did not return any data for the specified report (bookmark_id), project, or workspace. Based on the knowledge sources, the correct way to query an Insights report via the Query API is to use a GET request with the following required query parameters:
- project_id
- workspace_id (if applicable)
- bookmark_id (the ID of your Insights report)The response should include a JSON object with keys like computed_at, date_range, headers, and series if the report exists and contains data. Here’s the expected response structure: LBKS{ "computed_at": "2023-09-26T21:06:38.952Z", "date_range": { "from_date": "2023-09-01", "to_date": "2023-09-26" }, "headers": ["Event Name", "Count"], "series": { "Viewed page": { "2023-09-01T00:00:00-07:00": 7832, "2023-09-02T00:00:00-07:00": 6234 } } }LBKSTroubleshooting steps:
1. Check the Report: Make sure the Insights report (bookmark_id) you are querying actually contains data for the selected date range and filters.
2. Correct Parameters: Double-check that you are passing all required parameters (project_id, workspace_id, bookmark_id) and that they are correct.
3. Permissions: Ensure your service account has access to the project and workspace, which you have already confirmed.
4. API Endpoint: Use the correct endpoint and method:
```LBKS The API does not require a JSON body for this GET request; all parameters are passed in the query string [Query API - Insights](https://raw.githubusercontent.com/mixpanel/docs/main/openapi/src/query.openapi.yaml).LBKSIf you are still getting "No JSON body," it may mean the report is empty or the bookmark_id does not correspond to a valid Insights report. The knowledge sources do not mention any additional required body content for this endpoint.LBKSIf you need to export the data, the response will be in JSON format if the report contains data. If not, review the report in the Mixpanel UI to ensure it is populated.LBKS**Summary:**
- The Insights API GET request does not require a JSON body; all parameters are in the query string.
- If you get "No JSON body," check that the report exists and contains data for your parameters [Query API - Insights](https://raw.githubusercontent.com/mixpanel/docs/main/openapi/src/query.openapi.yaml).
kapa.ai is still learning and improving, please let me know how I did by reacting below.
ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
Let me check the knowledge base for you again. One moment! 📚
If your Insights API response is working (i.e., you are getting a valid JSON response from Mixpanel), you can use this JSON output directly in Alteryx for further analysis. The Mixpanel Insights API returns a JSON object with keys such as computed_at, date_range, headers, and series—all of which are standard JSON and can be parsed by Alteryx or any other tool that supports JSON input Query API - Insights.How to use the JSON in Alteryx:
1. Make the API Request in Alteryx:
Use the Alteryx Download tool to make your GET request to the Insights API endpoint, including your project_id, workspace_id, and bookmark_id as query parameters.2. Parse the JSON:
Use the Alteryx JSON Parse tool to extract the fields you need from the response. The JSON will look like this:
"computed_at": "2023-09-26T21:06:38.952Z",
"date_range": {
"from_date": "2023-09-01",
"to_date": "2023-09-26"
},
"headers": ["Event Name", "Count"],
"series": {
"Viewed page": {
"2023-09-01T00:00:00-07:00": 7832,
"2023-09-02T00:00:00-07:00": 6234
}
}
}
```LBKS You can then use the JSON Parse tool to break out the `series` object into rows and columns as needed for your workflow.LBKS**Note:**
- The API does not require a request body; all parameters are passed in the query string.
- If you are getting a valid JSON response, you can copy the response body and use it as a sample in Alteryx to configure your parsing logic.LBKSIf you need to automate this, set up the Download tool to hit the API endpoint and feed the output directly into the JSON Parse tool.LBKSIf you are not seeing the JSON in Alteryx, ensure you are capturing the response body from the API call and passing it to the JSON Parse tool.LBKSFor more details on the response structure, see the [Query API - Insights documentation](https://raw.githubusercontent.com/mixpanel/docs/main/openapi/src/query.openapi.yaml).
kapa.ai is still learning and improving, please let me know how I did by reacting below.
ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
