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

# Microsurveys

> Chameleon Microsurveys are a primary question step that allows you to get immediate and contextual user feedback.

*To know more about Microsurveys, you can visit our [product documentation](https://help.chameleon.io/en/collections/1752073-surveys).*

***

With the Chameleon Microsurveys API, you can:

* List all Microsurveys that follow your indicated parameters.
* Retrieve a single Microsurvey using its `id`.

<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                                                                              |
| `name`                    | string         | The name given by an administrator of Chameleon                                                                     |
| `position`                | number         | The order that these appear in lists (starting from 0)                                                              |
| `segment_ids`             | array\<ID>     | The Chameleon IDs of the configured [Segments](/apis/segments#schema)                                               |
| `published_at`            | timestamp      | The time this was most recently published                                                                           |
| `tag_ids`                 | array\<ID>     | The Chameleon IDs of the [Tags](/apis/tags) attached to this model                                                  |
| `rate_unlimit_at`         | timestamp      | This item is excluded from [Rate limiting](https://help.chameleon.io/en/articles/3513345-rate-limiting-experiences) |
| `dashboard_url`           | string         | Direct link to this Microsurvey in the Chameleon Dashboard                                                          |
| `experiment_at`           | timestamp      | When [Experimentation](https://help.chameleon.io/en/articles/1069709-a-b-testing-chameleon-tours) was turned on     |
| `experiment_range`        | string         | The range of `Profile#percent` that will be included in the experiment                                              |
| `content_summary`         | string         | A brief summary of the Microsurvey content                                                                          |
| `content_semantics`       | string         | Semantic analysis of the Microsurvey content                                                                        |
| `audience_summary`        | string         | A brief summary of the target audience                                                                              |
| `last_dropdown_items`     | array\<String> | For a dropdown Microsurvey, all of the `dropdown_items` that have been selected by any User                         |
| `stats`                   | object         | Aggregated statistics for this model (all-time)                                                                     |
| `stats.started_count`     | number         | Number of your end-users who saw this                                                                               |
| `stats.last_started_at`   | timestamp      | Most recent time any user saw this                                                                                  |
| `stats.completed_count`   | number         | Number of your end-users who completed/finished this                                                                |
| `stats.last_completed_at` | timestamp      | Most recent time any user completed/finished this                                                                   |
| `stats.exited_count`      | number         | Number of your end-users who dismissed/exited this                                                                  |
| `stats.last_exited_at`    | timestamp      | Most recent time any user dismissed/exited this                                                                     |

## List Microsurveys

List all Microsurveys that follow your indicated parameters.

#### HTTP Request

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

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

#### HTTP Response

```json theme={null}
{
  "surveys": [
    {
      "id": "5f3c4232c712de665632a6d5",
      "name": "Task #2 completion CES",
      "position": 1,
      "published_at": "2029-04-07T12:18:00Z",
       ...
    },
    {
      "id": "5f3c4232c712de665632a2a3",
      "name": "Admin account setup #1 completion question",
      "position": 0,
      "published_at": "2029-04-07T12:38:00Z",
       ...
    },
    ...
  ],
  "cursor": {
    "limit": 50,
    "before": "5f3c4232c712de665632a2a3"
  }
}
```

<a id="surveys-update" />

## Update a Microsurvey

Update a single Microsurvey to change the [Environments](/apis/urls) or to Publish it.

#### HTTP Request

```http title="PATCH" theme={null}
https://api.chameleon.io/v3/edit/surveys/:id
```

| param          | -        | description                                                                                   |
| -------------- | -------- | --------------------------------------------------------------------------------------------- |
| `id`           | required | A Microsurvey ID to update                                                                    |
| `url_group_id` | optional | An [Environments](/apis/urls) ID prefixed with `+` to add or or `-` to remove the Environment |
| `tag_id`       | optional | A [Tag](/apis/tags) ID prefixed with `+` to add or or `-` to remove the Tag                   |
| `published_at` | optional | The published time of this Microsurvey (set to now to trigger a publish)                      |

To **Publish** the Microsurvey

```json theme={null}
{
  "published_at": "2029-04-07T12:18:00Z"
}
```

To **add** the `5e3c4232c712de666d55632a` Environment use a `+` prefix

```json theme={null}
{
  "url_group_id": "+5e3c4232c712de666d55632a"
}
```

To **remove** the `5e3c4232c712de666d55632a` Environment use a `-` prefix

```json theme={null}
{
  "url_group_id": "-5e3c4232c712de666d55632a"
}
```

<a id="filter-segment" />

## Filtering by Segment

See [Listing Related Models](/apis/segments#segment-experiences-index).

## Retrieve a Microsurvey

Retrieve a single Microsurvey.

#### HTTP Request

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

| param | -        | description                |
| ----- | -------- | -------------------------- |
| `id`  | required | A Microsurvey ID to lookup |

```json theme={null}
{
  "survey": {
    "id": "5f3c4232c712de665632a2a1",
    "name": "Admin Self-serve menu",
    "position": 0,
    "published_at": "2029-04-07T12:38:00Z",
    ...
  }
}
```
