Identify

The identify endpoint lets you add key-value properties to a user profile. This endpoint is optional and useful for getting a complete picture of a user just by looking at their profile, and additionally, these properties can be used for filtering and searching.

For example, you may add a user's email address, their plan, last payment date, etc., to their profile and then use these properties to filter and search for users, such as searching for all users on a specific plan.

Add properties to user profiles.

POST https://api.logsnag.com/v1/identify

Headers

NameTypeDescription

Content-Type

String

application/json

Authorization

String

Bearer <TOKEN>

Request Body

NameTypeDescription

project*

String

Project name

user_id*

String

User ID

properties*

Key/Value

User Properties

{
    // Response
}

Important: Fields ending with an * are required in your request!

Usage

It's important to remember that property keys override each other. For example, imagine that users of our product start with a free trial and then upgrade to a paid plan. We want to track the plan the user is currently on and other properties like their name and email address. We can do this by calling the identify endpoint once the user signs up and again when upgrading to a paid plan.

{
    "project": "my-saas",
    "user_id": "123",
    "properties": {
        "plan": "free",
        "name": "John Doe",
        "email": "john@foo.com",
        "username": "johndoe"
    }
}

Later on, when the user upgrades to a paid plan, we can call the identify endpoint again with the new plan value:

{
    "project": "my-saas",
    "user_id": "123",
    "properties": {
        "plan": "premium"
    }
}

Properties Schema

Note that property keys may only contain lowercase alphabet characters and are optionally separated with - dashes. For example, plan and plan-type are valid tag keys, but Plan and plan_type are not. Values may be any string, boolean, or number.

Last updated