> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://staging.chrisp.chat/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# How can I automatically set custom data?

**If you are using Crisp on a website where users are authenticated, you may want to set their data.**

| Keys should always be lowercase. Special chars are not allowed except underscores and dashes.

### Update one key/value

**Using JS SDK**

This method uses the Crisp JavaScript SDK, that you can call from your own front-end code.

```
// Feed this call with your own custom data.
$crisp.push(["set", "session:data", ["order_id", "3535353214"]]);
```

|| Of course, you need to replace **order_id** and **3535353214** with your own key/values!

**Using API**

This method uses the Crisp REST API, that you can call from your own backend code. To make it easier, we have [API wrappers](https://github.com/crisp-im) available in several languages.

* **session data**: [Update Conversation Metas](https://docs.crisp.chat/references/rest-api/v1/#update-conversation-metas)  
* **contact data**: [Save People Data](https://docs.crisp.chat/references/rest-api/v1/#save-people-data)

You'll need to add your custom data in the "data" object in the request body:

```
{
   "data": {
      "plan_price": "95"
   }
}
```

|| If you want to understand the difference between session data and contact data, please click [here](/en/article/what-is-custom-data-and-why-is-it-powerful-43jgi3/).

### Update multiple key/values

**Using JS SDK**

```
// Feed this call with your own custom data.
$crisp.push(["set", "session:data", [
  [
    ["order_id", "3535353214"],
    ["last_order_at", "04 January"],
    ["user_id", "XXXX-XXXX"]
  ]
]]);
```

**Using API**

* **session data**: [Update Conversation Metas](https://docs.crisp.chat/references/rest-api/v1/#update-conversation-metas)  
* **contact data**: [Save People Data](https://docs.crisp.chat/references/rest-api/v1/#save-people-data)

You'll need to add your custom data in the "data" object in the request body:

```
{
   "data": {
      "plan_price": "95",
      "profile_link": "https://mylink.com"
   }
}
```

### Delete one key

**Using JS SDK**

```
// Set an empty value for this data
$crisp.push(["set", "session:data", ["order_id", ""]]);
```

| Want to know more about the JS SDK and $crisp interface? Read: [How to use $crisp Javascript SDK?](https://docs.crisp.chat/guides/chatbox-sdks/web-sdk/dollar-crisp/)

**Using API**

* **session data**: [Update Conversation Metas](https://docs.crisp.chat/references/rest-api/v1/#update-conversation-metas)  
* **contact data**: [Save People Data](https://docs.crisp.chat/references/rest-api/v1/#save-people-data)

You'll need to submit an empty "data" object in the request body:

```
{
   "data": {}
}
```

### A practical use case: how do we use custom data at Crisp?

Here is an example of custom data we use at Crisp regarding our customers.

![](https://storage.crisp.chat/users/helpdesk/website/-/7/d/7/2/7d725f4a65b7b400/07de29db-625a-47dc-b273-843eae_8sms2a.png)

So you can better understand the information there, for each customer who gets in touch with us through chat, email, WhatsApp, etc. We have the following data available:

* **user_id**: Unique identifier that helps us to access a detailed view of the user profile.  
* **website_id**: Unique identifier that helps us to access a detailed view of the website the user is part of.  
* **plan**: The plan the user is using at the moment.  
* **plan_price**: The price the customer is currently paying for our service.  
* **is_trialing**: Whether the user is still under trial or not.  
* **Websites**: How many inboxes the customer has created.

Thanks to these key data, we're able to **personalize the customer experience**, a lot. Note that these **data are displayed in the conversation too** as you can see in the example below.

![](https://storage.crisp.chat/users/helpdesk/website/-/7/3/1/4/73146359ecd86c00/bb6baa21-5131-49f0-99c1-49a50b_1ibjcah.png)

|| If you want to know more about custom data and why it is important, [click here to access a dedicated article](/en/article/what-is-custom-data-and-why-is-it-powerful-43jgi3/).