Importing Old Events

Contents: [ Prerequisites , Viewing Old Events , Send your Events , Batching Requests ]

Visit the Dev Docs

A better version of this page exists at

Use the /import endpoint to get events into your Mixpanel project older than five days that you might want to include if you’re a new customer and previously collected data elsewhere.


  • Every event must have a time property specifying a timestamp in the past.

  • You must already be using mixpanel.identify() or in some other way setting the distinct_id to keep track of your users within Mixpanel.

If you are not using mixpanel.identify() or a distinct_id and would like to import events, you can contact support for assistance.

Viewing Old Events

By default, Mixpanel’s Engagement report dropdown menus hide events that have not been fired within the last 30 days. So if you import data that's over 30 days old and there are no instances of that event within the last 30 days, the dropdown menus will not display that event name.

To have an imported event that’s older than 30 days show in the dropdowns, you can:

  • Fire a single instance of that event to bring it within the UI; OR
  • Force the event to show in the dropdown by adjusting the URL to:,arb_event:'YOUREVENTNAME',bool_op:and,chart_analysis_type:linear,chart_type:line,from_date:-365,to_date:0,type:general,unit:month

Be sure to replace YOURPROJECTNUMBERand YOUREVENTNAME with the specific values for your project.

Send your Events

If you meet the prerequisites, you can write a one-off script to send your events to Mixpanel for all your users.

To do this, for every event in your database you would make an POST request that looks like this:

curl \
-d data=eyJldmVudCI6ICIkc2lnbnVwIiwgInByb3BlcnRpZXMiOiB7ImRpc3RpbmN0X2lkIjogIjQ4MSIsICJ0aW1lIjogMTMyMTQ5OTM3MSwgInRva2VuIjogIjEzZmUzZGRjODZlYjZmOTBjNGVlN2QwZDQ3NTYzMTUwIn19 \
-d verbose=1

This request is very similar to our standard HTTP API. The data parameter is a Base64 encoded JSON array with the event you are importing ($signup) and the associated properties.

By decoding the Base64 data parameter from the above request, you can see the raw JSON:

{ "event":       "$signup",
  "properties":  {"distinct_id": "481",
                   "time": 1321499371,
                   "token": "13fe3ddc86eb6f90c4ee7d0d47563150"}}
  • Event = You can set this to any event, but $signup is particularly useful for retention analysis.

  • Distinct_id = The user ID you have been sending to Mixpanel up to this point for that user. In general, this is the value you pass into the identify method.

  • Time = A unix epoch style timestamp in UTC that tells Mixpanel when the event fired. This can be any time in the last 5 years. The above example, 1321499371, represents November 17th, 2011 at 3:09 AM GMT.

  • Token = The token property is your Mixpanel project token, which you can find by clicking your name in the upper righthand corner of your Mixpanel project and selecting Settings from the dropdown. Don’t confuse your API Secret with your project token!

Batching Requests

Using the /import endpoint, you can also batch requests to Mixpanel instead of sending one event per request. The endpoint will accept up to 50 messages in a single batch.

You can read more about batching requests to Mixpanel in our HTTP API documentation.

Did this answer your question?



Please sign in to leave a comment.