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

# User Profiles (Incoming Webhook)

> Send User Profile data to Chameleon from services like Customer.io, Heap, Zapier, Hightouch, Census or from your own backend.

Looking for the [JavaScript API](/js/profiles)?

***

A User Profile that does not yet exist by `uid` will first be created and then updated with the other data included in this request.

> Profile data updates are processed synchronously on the application server.

<a id="profiles-update" />

## Create/Update a Profile

* When you are **creating** the User Profile, send the User ID as `uid` and any other properties pertinent to that Profile.
* When you are **updating** the User Profile, send the User ID as `uid`, the Email address as `email` or the Chameleon ID as `id` and any other properties pertinent to that Profile.

#### HTTP Request

```http title="POST" theme={null}
https://api.chameleon.io/v3/observe/hooks/profiles
```

or

```http title="POST" theme={null}
https://api.chameleon.io/v3/observe/hooks/:account_secret/profiles
```

| param         | -        | description                                                                                                       |
| ------------- | -------- | ----------------------------------------------------------------------------------------------------------------- |
| `id`          | optional | The Chameleon ID of the User Profile                                                                              |
| `uid`         | optional | The User Profile Identifier (typically the Database ID from your backend)                                         |
| `email`       | optional | The User Profile Email address (only use this if you send the `email` property from your JavaScript installation) |
| `company_id`  | optional | The Chameleon Company ID that this user is a member of                                                            |
| `company_uid` | optional | The external ID of the Company from your backend system                                                           |
| \*others      | optional | All other properties will be stored on the Profile                                                                |

```json theme={null}
{
  "uid": 18821,
  "email": "leon@chmln.co",
  "first_name": "Leon",
  "role": "admin",
  "last_import_at": "2029-04-07T12:18:00Z",
  "invited_users_count": 4,
   ...
}
```

The user with `uid=18821` is a member of the `uid=931` Company

```json theme={null}
{
  "uid": 18821,
  "role": "admin",
  "company_uid": 931
}
```

#### HTTP Response

```json theme={null}
{
  "profile": {
    "id": "5f3c4232c712de665632a2a3"
  }
}
```

### Disabling all Chameleon Experiences

To disable all Chameleon Experiences you can add the `disabled: true` boolean value for the use via the [JavaScript API](/js/profiles) or via [REST API](/apis/profiles)

### Limits

* Up to a total of 768 bytes are stored for each scalar value where each Array item and each Hash value can reach this limit.
* See the full page on [Normalization](/concepts/normalization#limits) for more information on these limits.

### Normalization

* Property names are normalized to lower case and underscored i.e. `userRole` => `user_role`.
* See the full page on [Normalization](/concepts/normalization#properties) for more information on how properties are normalized.

<a id="profiles-bulk" />

## Bulk Create/Update Profiles

* When sending a bulk create/update send an array of User Profile objects as the `profiles` parameter
* For each User Profile, send the User ID as `uid` and any other properties pertinent to that Profile.
* Instead of the `uid` you may use the Email address as `email`.

#### HTTP Request

```http title="POST" theme={null}
https://api.chameleon.io/v3/observe/hooks/profiles/batch
```

or

```http title="POST" theme={null}
https://api.chameleon.io/v3/observe/hooks/:account_secret/profiles/batch
```

| param              | -                    | description                                                                                                                           |
| ------------------ | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| `profiles`         | array\<User Profile> | The list of User Profiles to update; each item has the same schema as the [Single Profile update](/webhooks/profiles#profiles-update) |
| `on_model_missing` | optional             | The treatment of User Profiles not previously sent to Chameleon. Defaults to `create`. One of `create`, `ignore`                      |

```json theme={null}
{
  "profiles": [
    {
      "uid": 18821,
      "first_name": "Leon",
      "role": "admin",
      "last_import_at": "2029-04-07T12:18:00Z",
      "invited_users_count": 7,
      ...
    },
    {
      "uid": 28421,
      "first_name": "Kim",
      "role": "engineer",
      "last_import_at": "2029-04-02T16:11:06Z",
      "invited_users_count": 4,
      ...
    },
    ...
  ]
}
```

The user with `uid=18821` is a member of the `uid=931` Company and The user with `uid=28421` is a member of the `uid=632` Company

```json theme={null}
{
  "profiles": [
    {
      "uid": 18821,
      "company_uid": 931
    },
    {
      "uid": 28421,
      "company_uid": 632
    },
    ...
  ]
}
```

#### HTTP Response

```json theme={null}
{
  "batch": {
    "id": "7f332c712de6c4265632a32a"
  }
}
```

#### HTTP Response error

When the 4430th item had no value for `uid` or `email` keys

Note: The status code will be the normal 202 for (Accepted for processing)

```json theme={null}
{
  "batch": {
    "id": "7f332c712de6c4265632a32a"
  },
  "errors": [
    {
      "code": 422,
      "index": 4429,
      "message": "No identifier found for the 4430th item. Pass your User ID as the `uid` parameter or the Email address as the `email` parameter"
    }
  ]
}
```

## Limits

* The size of each batch request is limited to 16mb
* As with the [Single Profile update](/webhooks/profiles#profiles-update), up to a total of 768 bytes are stored for each scalar value where each Array item and each Hash value can reach this limit.
* See the full page on [Normalization](/concepts/normalization#limits) for more information on these limits.

#### Examples

> Either set the number of items per batch to *10,000* OR to approximate the number of
> items per batch (based on the average payload size), divide (16777216 / "Average characters in JSON payload per item") \* 0.95

With the following update, you can send approximately *265,000 User Profiles* per batch request

```json theme={null}
{
  "uid": "49573fa9-f111-4644-8c24-e41520ee87e2",
  "plan": "gold"
}
```

With the following update, you can send approximately *62,000 User Profiles* per batch request

```json theme={null}
{
  "uid": "49573fa9-f111-4644-8c24-e41520ee87e2",
  "email": "jane@acme.ai",
  "first_name": "Jane",
  "last_name": "Chameleon",
  "last_login": "2029-04-29T09:00:00.000Z",
  "subscription_type": "platinum",
  "role": "revops",
  "company_id": "72d8ce91-fa3c-40f4-954d-4a8e8319a61e"
}
```

#### HTTP Response error

When the request was larger than 16mb. The status code will be 413 (Request too large)

```json theme={null}
{
  "code": 413,
  "messages": ["Each batch must be less than 16mb, try splitting the batch in half"]
}
```
