Mixpanel Community Icon

Export Specific Events Using kapa.ai API Syntax

·
·

kapa.ai I am working with the export API. I want to export only certain events (basically all except for the auto page views). What is the proper syntax, assuming there are 5 events other than the auto page view, assume named event_a, event_b, event_c, event_d and event_e.

  • Avatar of kapa.ai
    kapa.ai
    APP
    ·
    ·

    Please stand by Andrew S. as I search the knowledge base. I normally take about 15 seconds or so. đź‘‹

    Feel free to ask a follow-up question once I've answered by mentioning me with @kapa.ai

  • Avatar of kapa.ai
    kapa.ai
    APP
    ·
    ·

    To export specific events using Mixpanel's Raw Event Export API, you can use the event query parameter which allows you to specify the events you want to export as a JSON array. Here's how you would structure your request to export the five events you mentioned: LBKScurl --request GET \ --url '[https://data.mixpanel.com/api/2.0/export?from_date=YOUR_START_DATE&to_date=YOUR_END_DATE&event=["event_a","event_b","event_c","event_d","event_e"]](https://data.mixpanel.com/api/2.0/export?from_date=YOUR_START_DATE&to_date=YOUR_END_DATE&event=[%22event_a%22,%22event_b%22,%22event_c%22,%22event_d%22,%22event_e%22])' \ --header 'accept: text/plain' \ --header 'authorization: Basic YOUR_TOKEN'LBKSThe key part is the event parameter which should be formatted as a JSON array containing the names of all events you want to export. In your case, it would be: LBKSevent=["event_a","event_b","event_c","event_d","event_e"]LBKSThis will ensure that only these five specific events are exported, excluding the auto page views and any other events not specified in the array.If you're using the MixpanelUtils Python library, the syntax would be: LBKSmputils.export_events('event_export.txt',{ 'from_date':'YOUR_START_DATE', 'to_date':'YOUR_END_DATE', 'event':'["event_a","event_b","event_c","event_d","event_e"]' })LBKSNote that the Raw Event Export API has rate limits of 60 queries per hour, 3 queries per second, and a maximum of 100 concurrent queries. If you exceed these limits, you'll receive a 429 error.Raw Event Export API Mixpanel Utils

    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.