im trying to get users of mixpanel and I get this error Error 403: {"request": "/api/query/engage", "error": "User is not a member of this workspace"}. what could be the reason
Hi angel, 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 403 error "User is not a member of this workspace" means the account (or service account) whose credentials you’re using does not have access to that Mixpanel project/workspace.
From the docs:
- Only users who are added to a project with a project role (Owner/Admin/Analyst/Consumer) can access its data and export profiles via the Engage API.[Project roles] - Organization Owners/Admins must explicitly invite users to the organization and then to the specific project, or grant access via Teams or “All Users in the Organization”.[Invite users][Teams]
Likely causes:
1. The user account you’re authenticating with is not added to that project. 2. You’re using a service account that hasn’t been granted membership to that project. 3. You’re hitting a project ID/workspace your account doesn’t have any role in.
How to fix:
- Ask an Org Owner/Admin to: - Add your user (or service account) to the project under Project Settings → Project Users, assigning a project role.[Invite to project] - Or add you to a Team that already has access to that project.[Teams] - If using a service account, ensure it’s added to the project with a role via the service-accounts/project-membership APIs or the UI.[Service accounts]
Once the calling identity is a member of the project, the /api/query/engage request should stop returning that 403.
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 can successfully export events with the same credentials but get:
403 {"request": "/api/query/engage", "error": "User is not a member of this workspace"}
when calling /api/query/engage, the most likely differences are:
1. Different API / auth requirements
- Raw event export uses the Event Export API, whose preferred auth is a service account with project_id (and possibly workspace_id) in the params.[Export auth]
- Profile export uses the Query API → Engage endpoint, which also expects a service account and project_id (and workspace_id for Data Views projects).[Query auth]
If your service account doesn’t have access to the global workspace or the specific workspace_id you’re querying, you can get this 403 even though event export works (for example, if event export is configured only for the global workspace and your Engage call is scoped to another workspace).
2. Missing / wrong workspace_id
For projects with Data Views, Query API calls should include the global data view’s workspace_id along with project_id.[Query auth]
If you pass a workspace_id where your user/service account is not a member, you’ll see this error.
3. Different identity used under the hood Double‑check that: - The same service account (username/secret) is used for both Event Export and Query API. - That service account is granted access to the project/workspace in Org/Project settings.[Service accounts]
What to try:
- Confirm the service account you’re using is added to the project and has access to the relevant workspace.
- In your /api/query/engage call, explicitly include:
- project_id=<your_project_id>
- workspace_id=<global_workspace_id> (if your project uses Data Views)
- If you have multiple workspaces, test with the global workspace first.
If you can share the exact curl (with secrets redacted), I can help pinpoint whether it’s a workspace_id or auth/role issue based on the parameters you’re sending.
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.
im getting Missing required parameter: script
Let me check the knowledge base for you again. One moment! 📚
The error Missing required parameter: script comes from the JQL Query API. The /api/query/jql endpoint requires a script parameter in the request body. [Custom JQL]
Per the spec, the request body must include at least:
- script – a string containing your JQL code (must define function main() { ... }).
Optionally you can also send:
- params – a JSON-encoded string that will be available as the global params object in your script. [query-jql]
Example curl (from the docs) that avoids this error:
``` sh curl --request POST --url https://mixpanel.com/api/query/jql --header 'accept: application/json' --header 'content-type: application/x-www-form-urlencoded' --data 'script=function main(){ return Events(params) .groupBy( ["name"], mixpanel.reducer.count() ) } ' --data 'params={ "scriptParam": "paramValue" } '
LBKSIf you’re calling `/api/query/jql` without a `script` field in the form body, or with it under a different key, the API will return `Missing required parameter: script`. Ensure:
- You’re using `application/x-www-form-urlencoded`.
- The field name is exactly `script`.
- Its value is your JQL code string.
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.
