User Properties

You can use the User Properties API to update a user's properties without sending an event.

The updated properties are not applied retroactively and will only apply to events that occur after the update.


Authentication

Authentication is done through the SDK key. The SDK key must be sent in the HTTP header.

Depending on where you are calling the API from, set one of the Browser, App, or Server SDK keys in the header.

X-HACKLE-API-KEY: {YOUR_SDK_KEY}


Request

POST https://api.hackle.io/v1/properties

Request Body

Field

Type

Required

Description

userId

string

X

User ID
(Required if deviceId is missing)

deviceId

string

X

Device ID
(Required if userId is missing)

operations

Operations Object

O

An object representing the information for updating user properties.

Operations Object

Field

Type

Required

Description

$set

object

X

Sets the property value.
An object with the key-value pairs of properties to set.

$setOnce

object

X

Sets the value only if it has not been set before.
An object with the key-value pairs of properties to set once.

$unset

object

X

Removes the property.
An object with the keys of properties to unset.

Example

curl -i -X POST \
'https://api.hackle.io/v1/properties' \
-H 'X-HACKLE-API-KEY: YOUR_SDK_KEY_HERE' \
-H 'Content-Type: application/json' \
-d '{
  "userId": "19285035", 
  "deviceId": "ae2182e0",
  "operations": {
    "$set": {
      "age": 42,
      "grade": "GOLD"
    },
    "$setOnce": {
      "sign_up_date": "2020-01-01"
    },
    "$unset": {
      "membership_type": "-"
    }
  }
}'

Response

200 OK

In case of a successful request, it returns a 200 response status.

400 Bad Request

Returns a 400 status if the request information is invalid.

401 Unauthorized

Returns a 401 status if the X-HACKLE-API-KEY header is missing or the SDK key is invalid.