## Identify user

## Endpoint

```js
POST https://api.june.so/sdk/identify
```

## Purpose

This action is used to track the identification of a user or an anonymous user.

## Response

Returns a JSON response with a status of `200` and a `success` key set to `true`.

```json
{
  "status": 200,
  "success": true
}
```

* * *

## Parameters

| Parameter    | Type   | Description                                                                                                                                                          | Required |
|--------------|--------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------|
| userId      | String | The ID for this user in your database. Note: At least one of `userId` or `anonymousId` must be included in any identify call.                                    | Optional |
| anonymousId | String | An ID associated with the user when you don’t know who they are (for example, the `anonymousId` generated by analytics.js). Note: You must include at least one of `userId` or `anonymousId` in all identify calls. | Optional |
| traits      | Object | A dictionary of traits you know about the user. Things like: email, name, or friends.                                                                             | Optional |
| timestamp   | Date   | A JavaScript date object representing when the identify took place. If the identify just happened, leave it out as Segment uses the server’s time. If you’re importing data from the past, make sure to send a timestamp. | Optional |
| context      | Object | A dictionary of extra context to attach to the call. Note: `context` differs from `traits` because it is not attributes of the user itself.                      | Optional |

## Example

```js
POST https://api.june.so/sdk/identify

{
  "userId": "u123456",
  "traits": {
    "email": "user@example.com",
    "username": "user123",
    "firstName": "John",
    "lastName": "Doe"
  }
}
```

## Note

It's important to note that this API will first check for an `email` key in the main `payload` object, and if not found, it will check for an `email` key within the `traits` object.
