# Update Traits on a Program Membership

### How Traits Work in Hang

A trait represents a specific attribute linked to a program membership. For example, it might represent levels of membership, access privileges, or other unique features tied to a user's membership. Using the provided endpoints, you can add or remove these traits, thereby enhancing or customizing the membership's properties.

## Adding New Traits

To add a new trait to a program membership, make a **`POST`** request to the [`/v2/program-memberships/:program_membership_id/add-trait`](https://docs.hang.com/hang-platform/api-usage/broken-reference) endpoint.

### **Request Parameters**

* `program_membership_id` (required): The ID of the user's program membership.
* `trait_name` (required): The name of the trait to add.
* `trait_value` (required): The value corresponding to the trait.

#### **Example Request**

```bash
curl -X POST 'https://loyalty.hang.xyz/partner-api/v2/program-memberships/12345/add-trait' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "trait_name": "access_level",
    "trait_value": "premium"
  }'

```

### **Response**

If successful, the API will return a **`200 OK`** status along with the updated list of traits for that program membership.

#### Example Response

```json
{
  "traits": [
    {
      "name": "Level,
      "value": "2",
    },
    // More traits
  ]
}
```

## Removing Traits

To remove a trait from a program membership, make a **`POST`** request to the [`/v2/program-memberships/:program_membership_id/remove-trait`](https://docs.hang.com/hang-platform/api-usage/broken-reference) endpoint.

### **Request Parameters**

* `program_membership_id` (required): The ID of the user's program membership.
* `trait_name` (required): The name of the trait to remove.
* `trait_value` (required): The value of the trait to be removed.

#### **Example Request**

```bash
curl -X POST 'https://loyalty.hang.xyz/partner-api/v2/program-memberships/12345/remove-trait' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "trait_name": "access_level",
    "trait_value": "premium"
  }'
```

### **Response**

If successful, the API will return a **`200 OK`** status along with the updated list of traits for that program membership.

#### Example Response

```json
{
  "traits": [
    {
      "name": "Level,
      "value": "2",
    },
    // More traits
  ]
}

```
