I need to create a service account to export JSON, what steps should I follow?
Hi Bradley A., 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
To create a service account in Mixpanel for exporting JSON data, follow these steps:
1. Go to Organization or Project Settings - Navigate to the Service Accounts tab in your Organization settings or Project settings. - You will be prompted to select the role and assign the service account to specific projects. - Note: Service accounts created from the project settings page are automatically assigned an admin role for that project. Deleting a service account from the organization revokes access to all projects, while deleting from a project only revokes access to that project.
2. Create the Service Account - Provide a descriptive username. - Optionally, set the role (owner, admin, analyst, consumer), expiration date, and assign it to one or more projects. - When you create the service account, you will receive a secret. Store this secret securely—you will not be able to access it again after creation.
3. Use the Service Account Credentials for Export - Use the service account’s username and secret for authentication when making API requests to export JSON data. - Authentication is done via HTTP Basic Auth, and Mixpanel accepts both base64-encoded and plain-text credentials. - Example (cURL):
curl [https://mixpanel.com/api/app/me](https://mixpanel.com/api/app/me) \
--user "<serviceaccount_username> :<serviceaccount_secret> "
- Example (Python):
import requests
requests.get(
'[https://mixpanel.com/api/app/me](https://mixpanel.com/api/app/me)',
auth=('<serviceaccount_username> ', '<serviceaccount_secret> '),
)
- When exporting data (e.g., via the Raw Export API), include your service account credentials in the request.
curl --request GET \
--url '[https://data.mixpanel.com/api/2.0/export?project_id=<YOUR_PROJECT_ID](https://data.mixpanel.com/api/2.0/export?project_id=<YOUR_PROJECT_ID) &from_date=<FROM_DATE> &to_date=<TO_DATE> >' \
--header 'accept: text/plain' \
--header 'authorization: Basic <base64-encoded-credentials> '
- For more details on exporting JSON, see the Raw Export API documentation.
Important: - Only users with Owner or Admin permissions can manage service accounts. - By default, service accounts do not expire, but you can set an expiration for added security. - Immediately store your credentials in a safe place after creation, as you cannot retrieve the secret again later.
For more details, see the Mixpanel documentation on Service Accounts and Exporting Data.
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.
