# User activities import

Bulk import [user activities](/user-points/user-activities.md#user-activity-object) to insert user activities that happened outside of [real-time tracking](/data-streams/data-ingestion/real-time-user-tracking.md). Those activities usually are offline activities, like store visits or store purchases, but you can adapt it to your use cases.

{% hint style="warning" %}
Activities imported through bulk import don't go through the [activity processing pipeline](/data-streams/data-ingestion/real-time-user-tracking.md#the-processing-pipeline). You shouldn't use this feature if you intend to do conversion detection or automation activation. Your [activity analyzers](/data-streams/data-ingestion/real-time-user-tracking/activity-analyzers.md) also won't process those activities, and you should format exactly how you expect them to be stored by mediarithmics.
{% endhint %}

## How-to

Use the [bulk import ](/data-streams/data-ingestion/bulk-processing.md)endpoints to create a [document import](/data-streams/data-ingestion/bulk-processing.md#document-import) with the`USER_ACTIVITY`document type and `APPLICATION_X_NDJSON` mime type. Only `ndjson` data is supported for user activities.

Then, create an[ execution ](/data-streams/data-ingestion/bulk-processing.md#create-an-execution)with your user activities formatted in `ndjson` .

### Example

```bash
# Create the document import
curl -X POST \
  https://api.mediarithmics.com/v1/datamarts/<DATAMART_ID>/document_imports \
  -H 'Authorization: <YOUR_API_TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{
	"document_type": "USER_ACTIVITY",
	"mime_type": "APPLICATION_X_NDJSON",
	"encoding": "utf-8",
	"name": "<YOUR_DOCUMENT_IMPORT_NAME>"
}'
```

```bash
# Create the execution
curl -X POST \
  https://api.mediarithmics.com/v1/datamarts/1162/document_imports/<DOCUMENT_IMPORT_ID>/executions \
  -H 'Authorization: <API_TOKEN>' \
  -H 'Content-Type: application/x-ndjson' \
  -d '{ "$user_agent_id": "<USER_AGENT_ID>", "$type":"TOUCH","$session_status":"NO_SESSION","$ts":<TIMESTAMP>,"$events":[{"$event_name":"$email_mapping","$ts":<TIMESTAMP>,"$properties":{}}]}'
```

{% hint style="success" %}
You can, of course, upload multiple activities at once. Note the uploaded data is in `ndjson` and not `json`. That means the different activities are not separated by commas, but by a line separator `\n`
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developer.mediarithmics.io/data-streams/data-ingestion/bulk-processing/imports/offline-activities.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
