> ## 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.

# Changes

> Changes are a record of every update made to your key models (Experiences).

* [Tours](/apis/tours)
* [Surveys](/apis/surveys)
* [Embeds](/apis/embeddables)
* [Launchers](/apis/launchers)
* [Tooltips](/apis/tooltips)
* [Steps](/apis/steps)

***

Use the feed of changes to:

* Export a paper trail to know which changes made the biggest impact.
* Ensure that your most important Experiences stay static. Do this by listing all changes for a specific Experience and make sure the set of changes is empty
* Audit an issue with the delivery of an Experience.

<a id="schema" />

## Schema

| Property        | Type      | Description                                                                                                                                                                                                        |
| --------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `id`            | ID        | The Chameleon ID                                                                                                                                                                                                   |
| `created_at`    | timestamp | When this happened or when this was added to the Database                                                                                                                                                          |
| `updated_at`    | timestamp | The last time any property was updated                                                                                                                                                                             |
| `experience_id` | ID        | The ID of the parent model that this change represents. (a [Tour](/apis/tours) when model is a [Step](/apis/steps)                                                                                                 |
| `model_id`      | ID        | The ID of the model that this change represents                                                                                                                                                                    |
| `model_type`    | string    | The type of the model that this change represents                                                                                                                                                                  |
| `kind`          | string    | The type of change this represents: One of: `create`, `update`, `destroy`, `raw`, `partial`, `related`, `revert`, or `apply`                                                                                       |
| `path`          | string    | They keypath this change represents                                                                                                                                                                                |
| `object`        | object    | The underlying value of this change. It can be an object with scalar values (for a `kind=create` or `kind=destroy`) or values as a 2-item array of the \[`before`, `after`] [diff](/apis/changes#schema-diff-item) |
| `options`       | object    | A hash of other information about this change. Values are a [diff](/apis/changes#schema-diff-item).                                                                                                                |
| `user`          | object    | The Chameleon admin who made this change. Contains `id`, `name`, and `email`                                                                                                                                       |

<a id="schema-diff-item" />

### Change "Diff item" Schema

Each value is a 2-item array `[BEFORE, AFTER]`. If the value changed from `"silver"` to `"gold"` then:

```
["silver", "gold"]
```

In the context of a Change `object`:

```json theme={null}
{
  "plan": ["silver", "gold"],
  "monthly_spend": [99, 249]
}
```

<a id="changes-index" />

## List Changes

List all Changes.

#### HTTP Request

```http title="GET" theme={null}
https://api.chameleon.io/v3/edit/changes
```

or

```http title="GET" theme={null}
https://api.chameleon.io/v3/edit/:model_kind/:model_id/changes
```

| param        | -        | description                                                                                                                 |
| ------------ | -------- | --------------------------------------------------------------------------------------------------------------------------- |
| `limit`      | optional | Defaults to `50` with a maximum of `500`                                                                                    |
| `before`     | optional | Used when paginating, use directly from the `cursor` object from the previous response                                      |
| `before`     | optional | Read as "created `before`" and can be given as a timestamp to get only `limit` items that were created before this time     |
| `after`      | optional | Read as "created `after`" and can be given as a timestamp or ID to get only `limit` items that were created after this time |
| `filters`    | optional | An array of properties to filter `Changes` with; use this to fetch "all changes for a specific set of properties"           |
| `model_kind` | optional | A `kind` of model to fetch changes for. One of `tour`, `survey`, `embed`, `launcher`, or `tooltip`.                         |
| `model_id`   | optional | The ID of the model to fetch changes for                                                                                    |

##### Examples

Only changes for the `6f3c4232c712de665632a6d5` Tour

```http title="GET" theme={null}
https://api.chameleon.io/v3/edit/tours/6f3c4232c712de665632a6d5/changes
```

Only changes to the `published_at` property of any Experience

```http title="GET" theme={null}
https://api.chameleon.io/v3/edit/changes?filter=published_at
```

#### HTTP Response

```json theme={null}
{
  "changes": [
    {
      "id": "6f3c4232c712de665632a6d5",
      "created_at": "2029-04-07T12:38:00Z",
      "experience_id": "6f3c1931c712d632a6d5e665",
      "model_id": "6f3c1931c712d632a6d5e665",
      "model_type": "Campaign",
      "kind": "update",
      "path": "model",
      "object": {
        "published_at": [
          "2029-04-07T10:00:00Z",
          "2029-04-07T12:38:00Z"
        ],
        "published_at_count": [1, 2]
      },
      "options": {},
      "user": {
        "id": "5e3c4232c712de665632a6a1",
        "name": "Jane Smith",
        "email": "jane@example.com"
      }
    },
    {
      "id": "6f3c4232c712de665632a6d6",
      "created_at": "2029-04-07T12:30:00Z",
      "experience_id": "6f3c1931c712d632a6d5e665",
      "model_id": "6e3c193a6d5e51c712d63266",
      "model_type": "Step",
      "kind": "update",
      "path": "model",
      "object": {
        "body": [
          "### We've updated all of the data things!",
          "### We've upgraded the data things!"
        ]
      },
      "options": {
        "capture_id": ["6d3c4232c665632a712de2f1", "6d3c423665632a2c712de2f7"]
      },
      "user": {
        "id": "5e3c4232c712de665632a6a1",
        "name": "Jane Smith",
        "email": "jane@example.com"
      }
    },
    ...
  ],
  "cursor": {
    "limit": 50,
    "before": "6f3c4232c712de665632a6d6"
  }
}
```

## Summary of Changes

<a id="schema-summary" />

## Summary Schema

| Property     | Type                  | Description                                                                                                                                                                                                         |
| ------------ | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `model_id`   | ID                    | The ID of the model that this change represents                                                                                                                                                                     |
| `path`       | string                | They keypath this change represents                                                                                                                                                                                 |
| `kind`       | string                | The type of change this represents: One of: `create`, `update`, `destroy`                                                                                                                                           |
| `change_id`  | array                 | A 2-item array of the \[`before`, `after`] [diff](/apis/changes#schema-diff-item) of Screen Capture ID of this change. Note some changes are no represented visually and will have null value for the `after` value |
| `capture_id` | array                 | A 2-item array of the \[`before`, `after`] [diff](/apis/changes#schema-diff-item) of Screen Capture ID of this change. Note some changes are no represented visually and will have null value for the `after` value |
| `object`     | object\<ChangeUpdate> | A [ChangeUpdate](/apis/changes#schema-summary-change-update-item) of properties that have changed for this model                                                                                                    |
| `changes`    | array\<ChangeUpdate>  | An Array of [ChangeUpdate](/apis/changes#schema-summary-change-update-item) items representing changes to child associated models ([Steps](/apis/steps), [Buttons](/apis/buttons) etc.                              |

<a id="schema-summary-change-update-item" />

### Change update object Schema

| Property      | Type   | Description                                                                                                                                                                                                        |
| ------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `name`        | string | The name of the underlying property that changed                                                                                                                                                                   |
| `description` | string | A longer description of the underlying property                                                                                                                                                                    |
| `value`       | object | The underlying value of this change. It can be an object with scalar values (for a `kind=create` or `kind=destroy`) or values as a 2-item array of the \[`before`, `after`] [diff](/apis/changes#schema-diff-item) |

##### Examples

```json theme={null}
{
  "name": "Step created",
  "description": null,
  "value": {
    "id": "6f3c4232c712de665632a6d6",
    ...
  }
}
```

```json theme={null}
{
  "name": "Body",
  "description": "The content of the Step",
  "value": ["New features are here!", "New features have arrived!"]
}
```

<a id="change-summary-index" />

## Change Summary

List all Change Summaries

#### HTTP Request

```http title="GET" theme={null}
https://api.chameleon.io/v3/edit/:model_kind/:model_id/changes/summary
```

| param        | -        | description                                                                                         |
| ------------ | -------- | --------------------------------------------------------------------------------------------------- |
| `model_kind` | required | A `kind` of model to fetch changes for. One of `tour`, `survey`, `embed`, `launcher`, or `tooltip`. |
| `model_id`   | required | The ID of the model to fetch changes for                                                            |

#### HTTP Response

```json theme={null}
{
  "model_id": "6f3c1931c712d632a6d5e665",
  "kind": "create",
  "change_id": [
    "5e3c4232c712de665632a6d9",
    "5f3c42665632a6d932c712de"
  ],
  "path": "model",
  "object": {
    "id": "6f3c1931c712d632a6d5e665",
    "name": "New data importing options",
    ...
  },
  "changes": [
    {
      "model_id": "6e3c193a6d5e51c712d63266",
      "kind": "create",
      "capture_id": [ ... ],
      "object": {
        "id": "6e3c193a6d5e51c712d63266",
        "body": "Welcome!",
        ...
      },
      ...
    },
    {
      "model_id": "6e3c193a6d5e51c712d63266",
      "kind": "update",
      "capture_id": [ ... ],
      "object": {
        "body": ["Welcome!", "Hello and Welcome"],
        ...
      }
      ...
    }
  ],
  ...
}
```
