> ## Documentation Index
> Fetch the complete documentation index at: https://docs.saytics.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Users API: Identify, Retrieve, and Delete User Data

> POST /v1/users/identify to set user traits. GET /v1/users/:id to retrieve a user profile. DELETE /v1/users/:id to erase user data.

The users endpoints let you identify users, set traits, retrieve profiles, and delete user data via the API — without going through the Saytics dashboard.

## POST /v1/users/identify

Associate a user ID with a set of traits. Call this endpoint when a user signs up, logs in, or when you need to update their profile attributes.

<ParamField body="userId" type="string" required>
  Your system's unique identifier for the user.
</ParamField>

<ParamField body="traits" type="object">
  Key-value attributes to set or update on the user's profile, such as name, email, or subscription plan.
</ParamField>

```bash theme={null}
curl -X POST https://api.saytics.com/v1/users/identify \
  -H "Authorization: Bearer sk_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "userId": "user_789",
    "traits": {
      "name": "Alice Smith",
      "email": "alice@example.com",
      "plan": "pro",
      "created_at": "2024-01-01T00:00:00Z"
    }
  }'
```

## GET /v1/users/:id

Retrieve a user's profile, including all traits set via `identify()` and their event history.

```bash theme={null}
curl "https://api.saytics.com/v1/users/user_789" \
  -H "Authorization: Bearer sk_live_YOUR_KEY"
```

The response includes the following fields:

<ResponseField name="id" type="string">
  The user ID you provided when identifying the user.
</ResponseField>

<ResponseField name="traits" type="object">
  All user traits set via `identify()`, such as name, email, and plan.
</ResponseField>

<ResponseField name="created_at" type="string">
  ISO 8601 timestamp for when the user was first seen in Saytics.
</ResponseField>

<ResponseField name="last_seen" type="string">
  ISO 8601 timestamp of the most recent event associated with this user.
</ResponseField>

## DELETE /v1/users/:id

Permanently delete a user and all of their associated data, including events and traits. This is useful for fulfilling GDPR or CCPA data erasure requests.

```bash theme={null}
curl -X DELETE "https://api.saytics.com/v1/users/user_789" \
  -H "Authorization: Bearer sk_live_YOUR_KEY"
```

<Warning>
  Deleting a user removes all associated events and traits permanently. This action cannot be undone and cannot be reversed.
</Warning>
