kapa.ai I have exported all of the profiles from one project and now want to bulk import them into another project. what is the correct API call for this with parameters/configurations.
To bulk import user profiles into another Mixpanel project, you should use the Engage API’s batch update endpoint. The correct API call is a POST request to:
```
https://api.mixpanel.com/engage
LBKS**Parameters/Configurations:**
- The request body should be a JSON array of profile update objects.
- Each object must include:
- `$token`: Your new project’s token (found in project settings).
- `$distinct_id`: The unique identifier for the user (should match the one used for events).
- The operation, typically `$set` for setting profile properties.
- It is recommended to batch up to 200 profiles per request for efficiency.
- Set the `Content-Type` header to `application/json`.
- You can add the `verbose=2` parameter to get detailed responses for debugging.
**Sample Python code:**
PROJECT_TOKEN = "YOUR_NEW_PROJECT_TOKEN"
import json import requests
def get_profiles(): # Replace this with your exported profiles return [ {"user_id": "123", "$name": "Alice", "$email": "alice@linear.app", "department": "engineering"}, {"user_id": "456", "$name": "Bob", "$email": "bob@notion.so", "department": "product"}, {"user_id": "789", "$name": "Carol", "$email": "carol@figma.com", "department": "design"} ]
def transform_to_mp_format(user): distinct_id = user.pop("user_id") return {"$distinct_id": distinct_id, "$token": PROJECT_TOKEN, "$ip": "0", "$set": user}
profiles = [transform_to_mp_format(u) for u in get_profiles()]
resp = requests.post( "https://api.mixpanel.com/engage", params={"verbose": "2"}, headers={"Content-Type": "application/json"}, data=json.dumps(profiles) )
print(resp.json())
**Key points:**
- Use the same `$distinct_id` as in your events for proper joining.
- Use the `$set` operator to set or update properties.
- Batch requests for efficiency.
For more details and operator options (like `$set_once`, `$add`, etc.), see the [Mixpanel documentation](https://docs.mixpanel.com/docs/data-structure/user-profiles#operators) and [project migration guide](https://docs.mixpanel.com/guides/playbooks/project-migration#optional-step-8-import-users).
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.
