---
title: "User Attributes"
description: "<p>User attributes are key-value pairs that represent the characteristics, behaviors, or preferences of visitors interacting with your website or application. These attributes can be used to create distinct audience segments for targeted content delivery and personalized user experiences.</p>"
url: "https://www.contentstack.com/docs/developers/apis/personalize-edge-api/user-attributes"
product: "Contentstack"
doc_type: "guide"
audience:
  - developers
  - admins
version: "current"
last_updated: "2025-11-21"
---

# User Attributes

User attributes are key-value pairs that represent the characteristics, behaviors, or preferences of visitors interacting with your website or application. These attributes can be used to create distinct audience segments for targeted content delivery and personalized user experiences.

## Set and Update User Attributes

### Set and Update User Attributes

**PATCH** `/user-attributes`

Set and Update User Attributes

The Set and Update User Attributes request lets you create and update custom attributes in a project.

Attributes created / updated with this API call needs to have a corresponding custom attribute created in the Attributes module with the same key.

The above request:

\- Creates new attributes for the user if they do not already exist.

\- Updates existing attributes with the provided values. In case of an attribute conflict (existing attribute has a value), and the new value takes precedence during the update.

\- Only the specified key:value pairs for the attributes will be updated, and the non-specified values remain unchanged.

#### Headers

- **x-cs-personalize-user-uid** (optional)
  Enter the Personalize user UID
- **x-project-uid** (required)
  Enter the Project UID

#### Sample Response

```json
User Attributes added successfully
```

## Merge User Attributes

### Merge User Attributes

**POST** `/user-attributes/actions/merge`

Merge User Attributes

The Merge User Attributes request lets you merge attributes using the source (anonymous user) and target (custom user) UIDs in a project.

You would want to use this API request, when an anonymous user logs in and converts into a known user of your digital property, and merge the attribute details of the anonymous user (source) into the known user (target).

Note: In case of conflict in attributes set against the source UID and target UID, the attribute value for the source UID is given precedence.

#### Headers

- **x-project-uid** (required)
  Enter the Project UID

#### Sample Response

```json
User Attributes merged successfully
```