HOW can i export data via API
Hi Eden K., 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 export data from Mixpanel via API, you have several options depending on the type of data you want to export. Here's an overview of the main export methods:1. Raw Event Export API: You can use the Raw Event Export API to download your event data as JSON. This API allows you to export events within a specified date range and apply filters. Example request:
--url '[https://data.mixpanel.com/api/2.0/export?from_date=2024-07-23&to_date=2024-07-24&limit=100&event=sample_event](https://data.mixpanel.com/api/2.0/export?from_date=2024-07-23&to_date=2024-07-24&limit=100&event=sample_event)' \
--header 'accept: text/plain' \
--header 'authorization: Basic YOUR_TOKEN'
```LBKS [Export Methods](https://docs.mixpanel.com/docs/export-methods#exporting-events)LBKS2. Engage API for User Profiles:
To export User Profile data, you can use the Engage API. This returns a JSON object containing user profiles.LBKS Example request:
```LBKS curl --request POST \
--url '[https://mixpanel.com/api/query/engage?project_id=1234567](https://mixpanel.com/api/query/engage?project_id=1234567)' \
--header 'accept: application/json' \
--header 'authorization: Basic YOUR _TOKEN \
--header 'content-type: application/x-www-form-urlencoded'
```LBKS [Export Methods](https://docs.mixpanel.com/docs/export-methods#exporting-profiles)LBKS3. Query API for Report Data:
You can use the Query API to export formatted results similar to what you see in the Mixpanel web app. This includes data from Insights, Funnels, and Retention reports.LBKS [Export Methods](https://docs.mixpanel.com/docs/export-methods#exporting-reports)LBKS4. Data Pipelines:
For continuous export of large volumes of data, you can set up Data Pipelines. This feature allows you to export data to cloud storage or data warehouses.LBKS [Data Pipelines Overview](https://docs.mixpanel.com/docs/data-pipelines)LBKSWhen using these APIs, make sure to authenticate properly and be aware of rate limits. For example, the raw export API has a rate limit of 60 queries per hour and 3 queries per second [Event Export API - Export](https://github.com/mixpanel/docs/blob/main/openapi/src/export.openapi.yaml).LBKSFor more detailed information on each export method and specific API endpoints, you can refer to the [Mixpanel API documentation](https://developer.mixpanel.com/reference/overview).
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! đ
I understand you're having trouble authenticating your request when trying to use the Raw Event Export API. Let's troubleshoot this issue.The "Unable to authenticate request" error typically occurs when there's a problem with your authentication method. Here are a few things to check:1. Authentication Method:
The Raw Event Export API supports two authentication methods: a) Service Account (Recommended):
If you're using a Service Account, make sure you've included the project_id
as a query parameter in your request URL. For example:
```LBKSLBKS [Raw Data Export API Authentication](https://github.com/mixpanel/docs/blob/main/reference/Event%20Export%20API/raw-data-export-api-authentication.md)LBKS b) Project Secret (Deprecated but still supported):
If you're using the Project Secret, make sure you're using HTTP Basic Auth correctly. Provide your secret as the basic auth username value with an empty password.LBKS [Project Secret Authentication](https://github.com/mixpanel/docs/blob/main/reference/Mixpanel%20APIs/authentication/project-secret.md)LBKS2. HTTPS:
Ensure you're using HTTPS and not HTTP. Mixpanel's API rejects requests made over HTTP.LBKS3. Correct Credentials:
Double-check that you're using the correct Service Account secret or Project Secret. You can find these in your Mixpanel project settings.LBKS4. Authorization Header:
Make sure your authorization header is correctly formatted. It should look like this:LBKS
```LBKS --header 'authorization: Basic <base64 encoded credentials> '
```LBKSLBKS Where the credentials are your Service Account secret or Project Secret followed by a colon (`:`) for the password.LBKS5. Project Token vs Secret:
Ensure you're not using your project token for authentication. The project token is used for data ingestion, not for API authentication.LBKS [Project Token](https://github.com/mixpanel/docs/blob/main/reference/Mixpanel%20APIs/authentication/project-token.md)LBKSIf you've checked all these points and are still encountering issues, you may want to double-check your API endpoint and ensure you have the necessary permissions to access the data you're trying to export.LBKSFor further assistance, you might want to contact Mixpanel support or consult their detailed API documentation.
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.
what is different between Service Account and Project Secret
Let me check the knowledge base for you again. One moment! đ
Service Accounts and Project Secrets are two different authentication methods used in Mixpanel. Let me explain the key differences between them:1. Recommendation:
Service Accounts are the recommended authentication method, while Project Secrets are being deprecated. Service Accounts are described as the "Recommended Authentication" method.2. Purpose:
- Service Account: It's a special type of Mixpanel user intended to represent non-human entities like scripts or backend services.
- Project Secret: It was the standard authentication mechanism for importing and exporting data in your project before Service Accounts were introduced.3. Access Control:
- Service Account: Can be granted access to multiple projects and workspaces within an organization. Permissions are set by defining the role of the service account for each project or workspace.
- Project Secret: Is specific to a single project and provides full access to that project's data.4. Expiration:
- Service Account: Can be set with an optional expiration date, allowing for credential rotation and increased security.
- Project Secret: Does not have an expiration feature.5. Authentication Method:
- Both use HTTP Basic Auth, but Service Accounts require both a username and secret, while Project Secrets only use the secret as the username with an empty password.6. Additional Parameters:
- Service Account: When using a Service Account, you must specify the project_id
as a query parameter in your API requests.
- Project Secret: Does not require additional parameters.7. Granular Permissions:
- Service Account: Allows for more granular control over permissions, as you can set specific roles for each project or workspace.
- Project Secret: Provides full access to the project's data without granular control.8. Security:
- Service Account: Offers better security practices with features like expiration and more granular access control.
- Project Secret: While still functional, it's considered less secure due to its broad access and lack of expiration.It's important to note that while Project Secrets are still supported for legacy customers, Mixpanel strongly recommends migrating to Service Accounts for any new or ongoing usage Project Secret.
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! đ
While I understand you're interested in using the Project Secret for authentication, I must emphasize that this method is being deprecated. However, if you still need to use it, here's how you can do so:1. Find your Project Secret: You can find your Project Secret in the Access Keys section of your project's settings overview page: https://mixpanel.com/settings/project/ Managing a Project's Secret2. Use HTTP Basic Auth: Project secret authentication is performed via HTTP Basic Auth. Provide your secret as the basic auth username value with an empty password.3. Make the API request: Here's an example of how to make a request using cURL:
-u <api_secret> : \
-d data=<encoded_event_data>
```LBKSLBKS Note the trailing colon after `<api_secret> `. This prevents a password prompt.LBKS [Project Secret Authentication](https://github.com/mixpanel/docs/blob/main/reference/Mixpanel%20APIs/authentication/project-secret.md)LBKS4. Use HTTPS:
Make sure you use HTTPS and not HTTP. Mixpanel's API rejects requests made over HTTP since this would send your API Secret over the internet in plain text.LBKS5. Keep it secure:
Your Project Secret is very powerful, so be sure to keep it secure. Do not share your secret in publicly accessible or insecure places such as source code or plain-text configs.LBKSRemember, Mixpanel strongly recommends migrating to Service Accounts for any new or ongoing usage. As stated in their documentation:LBKS"This authentication method is in the process of being deprecated. Please use Service Accounts instead. We will continue to support Project Secret authentication for legacy customers indefinitely so you aren't at risk of your existing scripts breaking, but we highly recommend migrating to Service Accounts for any subsequent usage."LBKS[Project Secret Deprecation Warning](https://github.com/mixpanel/docs/blob/main/reference/Mixpanel%20APIs/authentication/project-secret.md)LBKSIf you're setting up a new integration or have the opportunity to update an existing one, I strongly recommend considering the switch to Service Accounts for better security and future compatibility.
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! đ
Based on the knowledge sources provided, there is specific information about UTM parameters in Mixpanel, but no explicit mention of a character limit for UTM campaigns. However, we can infer some relevant details:1. UTM Parameters: Mixpanel's JavaScript library automatically tracks UTM parameters, including utm_source
, utm_campaign
, utm_medium
, utm_term
, utm_content
, utm_id
, utm_source_platform
, utm_campaign_id
, utm_creative_format
, and utm_marketing_tactic
 Mixpanel SDKs: Javascript.2. General Property Limits: While not specific to UTM campaigns, Mixpanel has a general limit for event property names and values. Event property names/values can be at most 255 characters in length (longer names are truncated) Events: Capture behaviors and actions FAQ> .3. Case Sensitivity: UTM tracking in Mixpanel is case sensitive, and parameters should be formatted in lowercase Mixpanel SDKs: Javascript.Given these points, while there's no specific character limit mentioned for UTM campaigns, it's reasonable to assume that the 255-character limit for event property names and values would apply to UTM parameters as well. However, for the most accurate and up-to-date information, you may want to consult Mixpanel's official documentation or contact their support team directly.
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.