Users

Search users in a project. Filter by attributes (user id, email, country, etc.), optionally narrow by free-text query, and paginate results.

POST

/public/:projectKey/users

NameTypeDescription
projectKeystringThe project key (required)
qstringOptional free-text query (URL query param). When both q and query (body) are provided, q overrides.
NameTypeDescription
filtersarrayFilter list (optional)
querystringFree-text query against user id / email / name (max 100)
startTimestampepoch (ms)Start of time window (optional, min 946684800000)
endTimestampepoch (ms)End of time window (optional, > startTimestamp)
limitintegerPage size, 1-200 (optional, default: 50)
pageintegerPage number, starts at 1 (optional, default: 1)
sortBystringUser column to sort by (optional)
sortOrderstringasc or desc (optional)
columnsarrayAdditional user columns to include in the response

Authorization: Bearer {YOUR_ORGANIZATION_API_KEY}

curl -X POST \
  {BASE_URL}/public/3sWXSsqHgSKnE87YkNJK/users \
  -H 'content-type: application/json' \
  -H 'Authorization: Bearer {YOUR_ORGANIZATION_API_KEY}' \
  --data-raw '{
    "query": "mickael",
    "limit": 50,
    "page":  1,
    "sortOrder": "desc"
  }'
{
  "data": {
    "total": 1,
    "users": [
      {
        "$user_id": "mickael@openreplay.com",
        "$email": "mickael@openreplay.com",
        "$name": "Mickael",
        "$first_name": "Mickael",
        "$last_name": "",
        "$created_at": 1623440822825,
        "$last_seen": 1623689478617
      }
    ]
  }
}

Get identity attributes and high-level stats for a particular user.

GET

/public/:projectKey/users/:userId

NameTypeDescription
projectKeystringThe project key (required)
userIdstringThe ID set via tracker.setUserID (required, max 256)

Authorization: Bearer {YOUR_ORGANIZATION_API_KEY}

200: Response sent as JSON in body
400: Invalid userId (empty or > 256 chars)
404: User not found

curl -X GET \
  {BASE_URL}/public/3sWXSsqHgSKnE87YkNJK/users/mickael@openreplay.com \
  -H 'Authorization: Bearer {YOUR_ORGANIZATION_API_KEY}'
{
  "data": {
    "$user_id": "mickael@openreplay.com",
    "$email": "mickael@openreplay.com",
    "$name": "Mickael",
    "$first_name": "Mickael",
    "$last_name": "",
    "$phone": "",
    "$avatar": "",
    "$created_at": 1623440822825,
    "distinct_ids": ["15bd70f6-aedf-4544-8ae6-57eb66398e94"],
    "$country": "FR",
    "$state": "",
    "$city": "",
    "$first_event_at": 1623440822825,
    "$last_seen": 1623689478617
  }
}

Delete a user and all associated data. Schedules a background job; the response contains the jobId you can poll via the Jobs API.

DELETE

/public/:projectKey/users/:userId

NameTypeDescription
projectKeystringThe project key (required)
userIdstringThe ID set via tracker.setUserID (required, max 256)

Authorization: Bearer {YOUR_ORGANIZATION_API_KEY}

200: Job scheduled, returned in body
400: Invalid userId (empty or > 256 chars)
409: A deletion job for this user is already scheduled or running

curl -X DELETE \
  {BASE_URL}/public/3sWXSsqHgSKnE87YkNJK/users/mickael@example.com \
  -H 'Authorization: Bearer {YOUR_ORGANIZATION_API_KEY}'
{
  "data": {
    "jobId": 22345,
    "description": "Delete user sessions of userId = mickael@example.com",
    "status": "scheduled",
    "projectId": 1,
    "action": "delete_user_data",
    "referenceId": "mickael@example.com",
    "createdAt": 1623912962910,
    "updatedAt": null,
    "startAt": 1623954600000,
    "errors": null
  }
}

Change the replay-file delete time ?

Section titled Change the replay-file delete time ?

The deletion job is a 2 step process: First, sessions and their cascading events get deleted from the database overnight. Second, replay files are scheduled to expire (in 30 days) in the object storage.

If you’re using minio (vanilla installation), and you wish to change the default expiry/lifecycle policy, follow the below instructions:

  1. In your server, run openreplay -e
  2. Under the chalice section, define a new env variable called SCH_DELETE_DAYS with a value equal to the number of days you want to keep the replay file before delete (greater or equal to 0)
  3. Save and quit using :wq
  4. Run k9s -n db
  5. Use the keyboard arrows to navigate the list and get to the minio-* container
  6. Press s to have shell access the Minio (object storage) container
  7. Run mc alias set minio http://localhost:9000 $MINIO_ACCESS_KEY $MINIO_SECRET_KEY
  8. To delete replay files 14 days after the delete-job execution
export EXPIRATION_DAYS=14
mc ilm add --expiry-days $EXPIRATION_DAYS --tags "to_delete_in_days=${EXPIRATION_DAYS}" minio/mobs
  1. Use exit to exit the Minio container
  2. Run :quit to exit the Kubernetes CLI