# Getting started

Feedbackly has a publicly available REST API to pull data from the Feedbackly software into other systems.

### Getting started

You must have the API enabled in order to proceed. The REST API is available on the Enterprise plan of Feedbackly. Contact Feedbackly support if you need access to the API.

## Creating an API key

When the Feedbackly API is available to your organization, you can create an API key from the Feedbackly dashboard under the User profile settings tab.&#x20;


# Authentication

Feedbackly API requests are authenticated with an API key that can be retrieved from the user settings.

## Making requests

Requests are authenticated with the `Authorization` header. Example:

```
headers = {'Authorization': 'ey0iuefg.834xcunerun348efnsd'}
```


# Responses

Getting responses from Feedbackly

## Get Responses

<mark style="color:blue;">`GET`</mark> `https://api.feedbackly.com/v5/responses`

This endpoint allows you to access Responses objects from Feedbackly. \
For clarification on different outputs by question type, take a look at the Question types note

#### Query Parameters

| Name              | Type   | Description                                                                                                  |
| ----------------- | ------ | ------------------------------------------------------------------------------------------------------------ |
| skip              | number | Number of documents to skip from the start                                                                   |
| metadata          | string | Filters with provided metadata key-value pairs. Separate with semicolon. Format maker:Apple;phone:iPhone     |
| fieldId           | string | Filters based on the provided field ids. Please refer to the docs about this id.                             |
| questionType      | string | Array of question types. See the docs for available question types.                                          |
| questionId        | string | Filter responses by given question id                                                                        |
| surveyId          | string | Filter responses by given survey ids                                                                         |
| touchpointId      | string | Filter responses by given touchpoint ids                                                                     |
| createdTo         | number | UNIX timestamp. Fetch responses from before this timestamp. Defaults to current timestamp if not specified.  |
| preferredLanguage | string | Language to fetch question titles etc. Defaults to 'en' or the first language available.                     |
| createdFrom       | number | UNIX timestamp. Fetch responses starting from this timestamp. Defaults to start of the day if not specified. |

#### Headers

| Name          | Type   | Description                                                                                          |
| ------------- | ------ | ---------------------------------------------------------------------------------------------------- |
| Authorization | string | <p>Authentication token to access the API eg:<br>'Authorization': 'ey0iuefg.834xcunerun348efnsd'</p> |

{% tabs %}
{% tab title="200 Response successfully retrieved." %}

```
{
  "data": [
    {
      "touchpointName": "Retail location 1",
      "answer": 0.75,
      "questionType": "Button",
      "metadata": {
        "model": "Tesla"
      },
      "valueNum": 0.75,
      "responseChainId": "507f1f77bcf86cd799439011",
      "questionId": "507f1f77bcf86cd799439012",
      "surveyId": "507f1f77bcf86cd799439011",
      "question": "How did we succeed today?",
      "teamId": "507f1f77bcf86cd799439013",
      "createdAtDate": "2019-12-31T10:00:00.000Z",
      "createdAt": 1573507477,
      "touchpointId": "507f1f77bcf86cd799439011",
      "_id": "507f1f77bcf86cd799439011",
      "language": "fi",
      "teamName": "My team name",
      "tags": [
        "CSAT"
      ]
    },
    {
      "answer": 4,
      "valueNum": 4,
      "language": "en",
      "questionType": "NPS",
      "questionId": "58d8d547b8c71e000e3824fd",
      "createdAt": 1490605439,
      "createdAtDate": "2017-03-27T09:03:59.133Z",
      "_id": "5dc57703b7c935069aef31c6",
      "question": "How likely are you to recommend us to a friend or colleague?",
      "metadata": {},
      "responseChainId": "58d8d57d42f73c78c47e2d3d",
      "teamId": "507f1f77bcf86cd799439013",
      "teamName": "My team name",
      "touchpointId": "589c16ad87ef9860199cab37",
      "touchpointName": "Retail location 1",
      "tags": []
    }
  ],
  "paging": {
    "next": "https://api.feedbackly.com/v5/responses?skip=200",
    "previous": "https://api.feedbackly.com/v5/responses?skip=0"
  }
}
```

{% endtab %}
{% endtabs %}

### Response type description

| Field name | Type                                                                     | Example | Description                   |
| ---------- | ------------------------------------------------------------------------ | ------- | ----------------------------- |
| data       | [Response data](/master/responses/get-responses#response-data-object)\[] |         | The array of response objects |
| paging     | [Pagination](/master/responses/notes#pagination)                         |         | Pagination object             |

## Get Response by id

<mark style="color:blue;">`GET`</mark> `https://api.feedbackly.com/v5/responses/:id`

Returns a single response by id

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| id   | string | Response id |

#### Query Parameters

| Name              | Type   | Description                                                                             |
| ----------------- | ------ | --------------------------------------------------------------------------------------- |
| preferredLanguage | string | Language to fetch question titles etc. Defaults to 'en' or the first language available |

#### Headers

| Name          | Type   | Description                                                                                |
| ------------- | ------ | ------------------------------------------------------------------------------------------ |
| Authorization | string | Authentication token to access the API eg: 'Authorization': 'ey0iuefg.834xcunerun348efnsd' |

{% tabs %}
{% tab title="200 " %}

```
{
  "answer": [
    "Facebook",
    "LinkedIn"
  ],
  "valueArray": [
    "adfunr4",
    "dsfgt1w"
  ],
  "language": "en",
  "questionType": "Word",
  "questionId": "58d8d548a4753d000e4665ec",
  "createdAt": 1490868345,
  "createdAtDate": "2017-03-30T10:05:45.781Z",
  "_id": "5dc576ffb7c935069aeebd68",
  "question": "Where did you hear from us?",
  "metadata": {},
  "responseChainId": "58dcd870dde9550aec15ef12",
  "teamId": "5dc56d54b7c935069aefa9e3",
  "teamName": "My team 2",
  "touchpointId": "589c16ad87ef9860199cab37",
  "touchpointName": "Retail location 2",
  "surveyId": "507f1f77bcf86cd799439011",
  "tags": []
}
```

{% endtab %}
{% endtabs %}

### Response data object

| Field           | Type                                                                      | Example                            | Description                                                        |
| --------------- | ------------------------------------------------------------------------- | ---------------------------------- | ------------------------------------------------------------------ |
| touchpointName  | string                                                                    | Touchpoint 1                       | Touch point name                                                   |
| answer          | string \| string\[] \| number                                             | 0.5, "Apple", \["Apple", "Orange"] | Mixed-type field related to question type                          |
| questionType    | "Button" \| "NPS" \| "Word" \| "Slider" \| "Contact" \| "Text" \| "Image" | "Button"                           | [Question type](/master/responses/notes#question-types)            |
| metadata        | { \[key: string]: string}                                                 | {phone: "iPhone X"}                | metadata attached to response                                      |
| fieldId?        | string                                                                    | "507f1f77bcf86cd799439013"         | Field id (used in Contact and Slider question types)               |
| valueString?    | string                                                                    | "Orange"                           | String value of the response                                       |
| valueArray?     | string\[]                                                                 | \["aoudfsa", "sidfvcx"]            | The technical id of the given responses (Word/Image)               |
| valueNum        | number                                                                    | 0.5                                | Number value of the response                                       |
| responseChainId | string                                                                    | "507f1f77bcf86cd799439013"         | Id of the full response chain the response belongs to              |
| questionId      | string                                                                    | "507f1f77bcf86cd799439013"         | Question's id                                                      |
| question        | string                                                                    | "How did we succeed today?"        | The title of the question in the preferred language (if available) |
| teamId          | string                                                                    | "507f1f77bcf86cd799439013"         | Team's id                                                          |
| createdAtDate   | string                                                                    | "2017-03-27T09:03:59.133Z"         | Response's date in Javascript format                               |
| createdAt       | number                                                                    | 1490605439                         | Response's date in UNIX timestamp                                  |
| touchpointId    | string                                                                    | "507f1f77bcf86cd799439013"         | Touchpoint's id                                                    |
| \_id            | string                                                                    | "507f1f77bcf86cd799439013"         | id of the response                                                 |
| language        | string                                                                    | "en"                               | language the response is given in                                  |
| teamName        | string                                                                    | "My team"                          | Team's name                                                        |
| fieldName       | string                                                                    | "Email"                            | Field name (used in Contact and Slider)                            |
| tags            | string\[]                                                                 | \["CSAT"]                          | Question tags  set in the survey editor                            |


# Response chains

## Response chains

<mark style="color:blue;">`GET`</mark> `https://api.feedbackly.com/v5/response-chains`

Gets responses grouped by a single respondent.

#### Query Parameters

| Name              | Type   | Description                                         |
| ----------------- | ------ | --------------------------------------------------- |
| skip              | number | No. of documents to skip from the start             |
| createdTo         | string | Filter by unix timestamp, ending at given value     |
| createdFrom       | string | Filter by unix timestamp, starting from given value |
| touchpointId      | string | Filter by touchpoint id                             |
| surveyId          | string | Filter by survey ids                                |
| preferredLanguage | string | Preferred language to show the question titles in   |

#### Headers

| Name          | Type   | Description                                                                                           |
| ------------- | ------ | ----------------------------------------------------------------------------------------------------- |
| Authorization | string | <p>Authentication token to access the API. eg:<br>'Authorization': 'ey0iuefg.834xcunerun348efnsd'</p> |

{% tabs %}
{% tab title="200 " %}

```
{
    data: [
        {
        "_id": "5979be93d296f3dbf83fb056",
        "surveyId": "59788132f870b600018d6dda",
        "touchpointId": "59529fbef3774c0001a49708",
        "touchpointName": "My touchpoint",
        "createdAt": 1501150867,
        "createdAtDate": "2017-07-27T10:21:07.619Z",
        "teamId": "5dc56d54b7c935069aefa9e2",
        "teamName": "My team name",
        "metadata": {
            "customerId": "34tNa31"
        },
        "language": "en",
        "responses": [
            {
                "question": "How likely are you to recommend us to your friend or colleague?",
                "answer": 2,
                "valueNum": 2,
                "language": "en",
                "questionType": "NPS",
                "questionId": "5978813ab9215744ea08e463",
                "surveyId": "59788132f870b600018d6dda"
            },
            {
                "question": "Could you specify what was bad in your experience?",
                "answer": "Your office branch was unclean.",
                "valueString": "Your office branch was unclean.",
                "language": "en",
                "questionType": "Text",
                "questionId": "597881a4b9215744ea08e464",
                "surveyId": "59788132f870b600018d6dda"
            }
        ]
     }
    ],
    "paging": {
        "next": "https://api.feedbackly.com/v5/response-chains?skip=200",
        "previous": "https://api.feedbackly.com/v5/response-chains?skip=0"
  }
}
```

{% endtab %}
{% endtabs %}

### Return type description

| Field  | Type                                                                                    | Example | Description                            |
| ------ | --------------------------------------------------------------------------------------- | ------- | -------------------------------------- |
| data   | [Response chain data](/master/responses/response-chains#response-chain-data-object) \[] |         | Response chain with embedded responses |
| paging | [Pagination](/master/responses/notes#pagination)                                        |         | Pagination object                      |

## Response chain by id

<mark style="color:blue;">`GET`</mark> `https://api.feedbackly.com/v5/response-chains/:id`

Gets an individual response chain by id

#### Path Parameters

| Name | Type   | Description              |
| ---- | ------ | ------------------------ |
| id   | string | Id of the response chain |

#### Query Parameters

| Name              | Type   | Description                                       |
| ----------------- | ------ | ------------------------------------------------- |
| preferredLanguage | string | Preferred language to show the question titles in |

#### Headers

| Name          | Type   | Description                                                                                 |
| ------------- | ------ | ------------------------------------------------------------------------------------------- |
| Authorization | string | Authentication token to access the API. eg: 'Authorization': 'ey0iuefg.834xcunerun348efnsd' |

{% tabs %}
{% tab title="200 " %}

```
{
    "_id": "5979be93d296f3dbf83fb056",
    "surveyId": "59788132f870b600018d6dda",
    "touchpointId": "59529fbef3774c0001a49708",
    "touchpointName": "My touchpoint",
    "createdAt": 1501150867,
    "createdAtDate": "2017-07-27T10:21:07.619Z",
    "teamId": "5dc56d54b7c935069aefa9e2",
    "teamName": "My team name",
    "metadata": {
        "customerId": "34tNa31"
    },
    "language": "en",
    "responses": [
        {
            "question": "How likely are you to recommend us to your friend or colleague?",
            "answer": 2,
            "valueNum": 2,
            "language": "en",
            "questionType": "NPS",
            "questionId": "5978813ab9215744ea08e463",
            "surveyId": "59788132f870b600018d6dda"
        },
        {
            "question": "Could you specify what was bad in your experience?",
            "answer": "Your office branch was unclean.",
            "valueString": "Your office branch was unclean.",
            "language": "en",
            "questionType": "Text",
            "questionId": "597881a4b9215744ea08e464",
            "surveyId": "59788132f870b600018d6dda"
        }
    ]
}
```

{% endtab %}

{% tab title="400 " %}

```
{error: "Not a valid response id    Error id : 1583413424996/E5ohOOdp."}
```

{% endtab %}

{% tab title="404 If the provided id is not found" %}

```
{error: "Not found"}
```

{% endtab %}
{% endtabs %}

### Response chain data object

| Field           | Type                                                                      | Example                            | Description                                                        |
| --------------- | ------------------------------------------------------------------------- | ---------------------------------- | ------------------------------------------------------------------ |
| touchpointName  | string                                                                    | Touchpoint 1                       | Touch point name                                                   |
| responseChainId | string                                                                    | "507f1f77bcf86cd799439013"         | Id of the full response chain the response belongs to              |
| teamId          | string                                                                    | "507f1f77bcf86cd799439013"         | Team's id                                                          |
| metadata        | { \[key: string]: string}                                                 | {phone: "iPhone X"}                | metadata attached to response                                      |
| createdAtDate   | string                                                                    | "2017-03-27T09:03:59.133Z"         | Response's date in Javascript format                               |
| createdAt       | number                                                                    | 1490605439                         | Response's date in UNIX timestamp                                  |
| touchpointId    | string                                                                    | "507f1f77bcf86cd799439013"         | Touchpoint's id                                                    |
| \_id            | string                                                                    | "507f1f77bcf86cd799439013"         | id of the response                                                 |
| language        | string                                                                    | "en"                               | language the response is given in                                  |
| teamName        | string                                                                    | "My team"                          | Team's name                                                        |
| data            | array                                                                     |                                    | Responses within the response chain                                |
| > answer        | string \| string\[] \| number                                             | 0.5, "Apple", \["Apple", "Orange"] | Mixed-type field related to question type                          |
| > questionType  | "Button" \| "NPS" \| "Word" \| "Slider" \| "Contact" \| "Text" \| "Image" | "Button"                           | [Question type](/master/responses/notes#question-types)            |
| > fieldId?      | string                                                                    | "507f1f77bcf86cd799439013"         | Field id (used in Contact and Slider question types)               |
| > valueString?  | string                                                                    | "Orange"                           | String value of the response                                       |
| > valueArray?   | string\[]                                                                 | \["aoudfsa", "sidfvcx"]            | The technical id of the given responses (Word/Image)               |
| > valueNum      | number                                                                    | 0.5                                | Number value of the response                                       |
| > questionId    | string                                                                    | "507f1f77bcf86cd799439013"         | Question's id                                                      |
| > question      | string                                                                    | "How did we succeed today?"        | The title of the question in the preferred language (if available) |
| > fieldName     | string                                                                    | "Email"                            | Field name (used in Contact and Slider)                            |
| > tags          | string\[]                                                                 | \["CSAT"]                          | Question tags  set in the survey editor                            |


# Questions

Getting questions from Feedbackly

## Questions

<mark style="color:blue;">`GET`</mark> `https://api.feedbackly.com/v5/questions`

This endpoint returns the questions of all surveys accessable from your account

#### Query Parameters

| Name              | Type   | Description                                                                                                                                             |
| ----------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| skip              | number | Number of documents to skip from the start                                                                                                              |
| preferredLanguage | string | Preferred language to show the question titles in eg. 'en'. If the specified language is not available, it will default to the first available language |
| questionId        | array  | Filter by question ids                                                                                                                                  |
| surveyId          | array  | Survey ids related to the question                                                                                                                      |

#### Headers

| Name          | Type   | Description                                                                                          |
| ------------- | ------ | ---------------------------------------------------------------------------------------------------- |
| Authorization | string | <p>Authentication token to access the API eg:<br>'Authorization': 'ey0iuefg.834xcunerun348efnsd'</p> |

{% tabs %}
{% tab title="200 " %}

```
{
    "data": [
        {
            "_id": "59b8de984084087cd3346743",
            "title": "Which meat did you buy?",
            "choicesString": [
                "Lamb",
                "Beef",
                "Pork"
            ],
            "questionType": "Word",
            "languages": [
                "en"
            ],
            "language": "en",
            "choices": [
                {
                    "fieldId": "1",
                    "fieldName": "Lamb"
                },
                {
                    "fieldId": "59b8deaa4084087cd3346744",
                    "fieldName": "Beef"
                },
                {
                    "fieldId": "59b8deac4084087cd3346745",
                    "fieldName": "Pork"
                }
            ],
            "surveyId": "59b8de18784d2f0001a1590d"
        },
    ],
    "paging": {
        "next": "https://api.feedbackly.com/v5/questions?preferredLanguage=en&skip=100",
        "previous": null
    }
}
```

{% endtab %}
{% endtabs %}

### Request Return type

| Field  | Type                                                                         | Example | Description       |
| ------ | ---------------------------------------------------------------------------- | ------- | ----------------- |
| data   | [Question Data object](/master/responses/questions#question-data-object) \[] |         | Question objects  |
| paging | [Pagination](/master/responses/notes#pagination)                             |         | Pagination object |

## Question by id

<mark style="color:blue;">`GET`</mark> `https://api.feedbackly.com/v5/questions/:id`

Gets a specific question by id

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| id   | string | Question id |

#### Query Parameters

| Name              | Type   | Description                                                                                                                                             |
| ----------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| preferredLanguage | string | Preferred language to show the question titles in eg. 'en'. If the specified language is not available, it will default to the first available language |

#### Headers

| Name          | Type   | Description                                                                                |
| ------------- | ------ | ------------------------------------------------------------------------------------------ |
| Authorization | string | Authentication token to access the API eg: 'Authorization': 'ey0iuefg.834xcunerun348efnsd' |

{% tabs %}
{% tab title="200 " %}

```
{
    "_id": "58d8d547b8c71e000e3824fc",
    "title": "How likely are you to recommend us to a friend or colleague?",
    "subtitle": "0=Not likely at all 10=Extremely likely",
    "choicesString": [],
    "questionType": "NPS",
    "languages": [
        "en",
        "es",
        "af"
    ],
    "language": "en",
    "choices": [],
    "surveyId": "58d8d3d14cb016000e203e0e"
}
```

{% endtab %}

{% tab title="401 " %}

```
{
    "error": "Question inaccessible    Error id : 1583414902648/mOXsfkd7."
}
```

{% endtab %}
{% endtabs %}

### Question data object

| Field         | Type      | Example                       | Description                                                      |
| ------------- | --------- | ----------------------------- | ---------------------------------------------------------------- |
| choicesString | string\[] | \["Lamb", "Beef", "Pork"]     | List of available choices in the preferred language (Word/Image) |
| title         | string    | "Which meat did you buy?"     | Question title in the preferred language                         |
| questionType  | string    | "Button"                      | See [question types](/master/responses/notes#question-types)     |
| \_id          | string    | "59b8de18784d2f0001a1590d"    | Question id                                                      |
| languages     | string\[] | \["en", "es"]                 | List of available languages for the question                     |
| language      | string    | "en"                          | The language currently selected to display titles etc            |
| subtitle?     | string    | "Please select from below"    | A subtitle for the question (if specified)                       |
| choices       | array     |                               | Array of possible choices                                        |
| > fieldId     | string    | "1"                           | The id of the field                                              |
| > fieldName   | string    | "Beef"                        | The label of the choice                                          |
| > type?       | string    | "string"                      | Type of field (Contact question type)                            |
| > subType?    | string    | "phone"                       | Subtype of the field (Contact question type)                     |
| > imageUrl?   | string    | "<https://example.com/1.png>" | Image url of the choice (Image question type)                    |


# Surveys

## Surveys

<mark style="color:blue;">`GET`</mark> `https://api.feedbackly.com/v5/surveys`

This endpoint returns all available surveys with the questions embedded

#### Query Parameters

| Name              | Type   | Description                                |
| ----------------- | ------ | ------------------------------------------ |
| skip              | number | Number of documents to skip from the start |
| preferredLanguage | string | Preferred language to show the titles in   |

#### Headers

| Name          | Type   | Description                                                                                |
| ------------- | ------ | ------------------------------------------------------------------------------------------ |
| Authorization | string | Authentication token to access the API eg: 'Authorization': 'ey0iuefg.834xcunerun348efnsd' |

{% tabs %}
{% tab title="200 Cake successfully retrieved." %}

```
{
 "data": [
  {
    "_id": "589c16e487ef9860199cab3c",
    "name": "Example",
    "createdBy": "Admin",
    "teamId": "5dc56d54b7c935069aefa9e2",
    "teamName": "My team name",
    "languages": ["en"],
    "archived": false,
    "questions": [
      {
        "_id": "5a3b47d0e90828878851a1f5",
        "title": "Contact form",
        "subtitle": "Please type in your details",
        "choicesString": [
            "EMAIL",
            "PHONE"
        ],
        "questionType": "Contact",
        "languages": [
            "en"
        ],
        "language": "en",
        "choices": [
            {
                "fieldId": "5a3c353aecee8cb220b0270c",
                "fieldName": "EMAIL",
                "type": "string",
                "subType": "email"
            },
            {
                "fieldId": "5a3c353eecee8cb220b0270d",
                "fieldName": "PHONE",
                "type": "string",
                "subType": "tel"
            }
        ],
        "surveyId": "5a3b47c946d70600010fe412"
      }
    ]
  }
 ],
 "paging": {
     "next": null,
     "previous": null
 }
}
```

{% endtab %}

{% tab title="404 Could not find a cake matching this query." %}

```
```

{% endtab %}
{% endtabs %}

### Request return type

| Field  | Type                                                                   | Example | Description         |
| ------ | ---------------------------------------------------------------------- | ------- | ------------------- |
| data   | [Survey data object](/master/responses/surveys#survey-data-object) \[] |         | Survey data objects |
| paging | [Pagination](/master/responses/notes#pagination)                       |         | Pagination object   |

## Survey by id

<mark style="color:blue;">`GET`</mark> `https://api.feedbackly.com/v5/questions/:id`

Gets question by id

#### Path Parameters

| Name | Type   | Description      |
| ---- | ------ | ---------------- |
| id   | string | Id of the survey |

#### Query Parameters

| Name              | Type   | Description                              |
| ----------------- | ------ | ---------------------------------------- |
| preferredLanguage | string | Preferred language to show the titles in |

#### Headers

| Name          | Type   | Description                                                                                |
| ------------- | ------ | ------------------------------------------------------------------------------------------ |
| Authorization | string | Authentication token to access the API eg: 'Authorization': 'ey0iuefg.834xcunerun348efnsd' |

{% tabs %}
{% tab title="200 " %}

```
{
    "_id": "589c16e487ef9860199cab3c",
    "name": "Example",
    "createdBy": "Admin",
    "teamId": "5dc56d54b7c935069aefa9e2",
    "teamName": "My team name",
    "languages": ["en"],
    "archived": false,
    "questions": [
      {
        "_id": "5a3b47d0e90828878851a1f5",
        "title": "Contact form",
        "subtitle": "Please type in your details",
        "choicesString": [
            "EMAIL",
            "PHONE"
        ],
        "questionType": "Contact",
        "languages": [
            "en"
        ],
        "language": "en",
        "choices": [
            {
                "fieldId": "5a3c353aecee8cb220b0270c",
                "fieldName": "EMAIL",
                "type": "string",
                "subType": "email"
            },
            {
                "fieldId": "5a3c353eecee8cb220b0270d",
                "fieldName": "PHONE",
                "type": "string",
                "subType": "tel"
            }
        ],
        "surveyId": "5a3b47c946d70600010fe412"
  }
```

{% endtab %}
{% endtabs %}

### Survey data object

| Field          | Type      | Example                                                | Description                                                  |
| -------------- | --------- | ------------------------------------------------------ | ------------------------------------------------------------ |
| teamId         | string    | "5a3386af952bf6000177bdda"                             | Team id                                                      |
| languages      | string\[] | \["en", "es"]                                          | List of available languages for the survey                   |
| name           | string    | "Satisfaction survey"                                  | Survey name                                                  |
| \_id           | string    | "5a3386af952bf6000177bdda"                             | Survey id                                                    |
| language       | string    | "en"                                                   | Language used to display titles, choices etc                 |
| teamName       | string    | "My team name"                                         | Team name                                                    |
| createdBy      | string    | "Khal Drogo"                                           | User name                                                    |
| archived       | boolean   | false                                                  | Whether the survey is archived                               |
| questions      | array     |                                                        | Questions embedded within the survey                         |
| > \_id         | string    | "5a3386af952bf6000177bdda"                             | Question id                                                  |
| > questionType | string    | "NPS"                                                  | [See Question types](/master/responses/notes#question-types) |
| > title        | string    | "How would you recommend us to a friend or colleague?" | Question title                                               |
| > choices      | array     |                                                        | Question choices                                             |
| >> fieldId     | string    | "1"                                                    | The id of the field                                          |
| >> fieldName   | string    | "Beef"                                                 | The label of the choice                                      |
| >> type?       | string    | "string"                                               | Type of field (Contact question type)                        |
| >> subType?    | string    | "tel"                                                  | Subtype of the field (Contact question type)                 |
| >> imageUrl?   | string    | "<https://example.com/1.png>"                          | Image url of the choice (Image question type)                |


# Notes

This page contains notes on the API

## Question types

This table clarifies the different outputs per question type

| Question type | Description                                                                                                                                                                                                                                                                                                                                                                             | Field                                                  | Example                                                                                        |                                                                                                                                                                                                                                |
| ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ | ---------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Button        | <p>Smileys / Satisfaction</p><p></p><p>The values are in the scale of 0-1.</p><p></p><p>5 buttons: 0, 0.25, 0.5, 0.75, 1</p><p>4 buttons: 0, 0.33, 0.66, 1</p>                                                                                                                                                                                                                          | <p>valueNum: number</p><p>answer: number</p>           | <p>valueNum: 0.5</p><p>answer: 0.5</p>                                                         |                                                                                                                                                                                                                                |
| NPS           | <p>NPS question</p><p>Numbers 0-10</p>                                                                                                                                                                                                                                                                                                                                                  | <p>valueNum: number</p><p>answer: number</p>           | <p>valueNum: 4</p><p>answer: 4</p>                                                             |                                                                                                                                                                                                                                |
| Word          | <p>Category / Selection / Multiselect</p><p></p><p>Answer will either be a string value if the </p><p>question is single select or an array of strings </p><p>if the question is a multi-select.</p><p></p><p>valueArray will contain the unique id's of the </p><p>choice(s) selected while answer contains the </p><p>string representations of the choice in the language chosen</p> | <p>valueArray: string\[]</p><p></p><p>answer: string   | string\[]</p>                                                                                  | <p><strong>Multiselect:</strong> </p><p>valueArray: \['sdfs3, 'asdas1]</p><p></p><p>answer: \['Apples', 'Oranges']</p><p></p><p><strong>Single select:</strong> </p><p>valueArray: \['533rf']</p><p></p><p>answer: 'Pears'</p> |
| Image         | <p>Category / Selection by image</p><p></p><p>Same as above</p>                                                                                                                                                                                                                                                                                                                         | Same as above                                          | Same as above, outputs image labels                                                            |                                                                                                                                                                                                                                |
| Slider        | <p>Slider question. These questions contain multiple responses depending on the field responded to. In order to connect these answers together, you look at the <em>responseChainId</em> and the <em>questionId</em></p><p></p><p>Each field contains a <em>fieldId</em>  and a <em>fieldName</em> to distinguish the responses apart.</p><p></p><p>The scale is 0-10.</p>              | <p>valueNum: number</p><p></p><p>answer: number</p>    | <p>valueNum: 4</p><p></p><p>answer: 4</p>                                                      |                                                                                                                                                                                                                                |
| Contact       | Contact form question. Like Slider question, this question might have multiple responses per question.                                                                                                                                                                                                                                                                                  | <p>valueString: string</p><p>answer: string</p>        | <p>valueString: "<example@example.com>"</p><p></p><p>answer:</p><p>"<example@example.com>"</p> |                                                                                                                                                                                                                                |
| Text          | Open-ended field.                                                                                                                                                                                                                                                                                                                                                                       | <p>valueString: string</p><p></p><p>answer: string</p> | <p>valueString: "I was happy"</p><p></p><p>answer: "I was happy"</p>                           |                                                                                                                                                                                                                                |

### Pagination

For endpoints that returns multiple objects, pagination is done by providing the URL's to get the next objects (if more are available)

| Field    | Example                                            |
| -------- | -------------------------------------------------- |
| next     | <https://api.feedbackly.com/v5/responses?skip=400> |
| previous | <https://api.feedbackly.com/v5/responses?skip=0>   |


# Getting started

## Installing the website widget

### Verifying installation

Go to your website and open up the developer console in your browser. In Chrome, this can be done via the command `⌘ + option + J`

Find the console from the bottom of the developer tools. Type in `FBLY` and press enter. If your plugin is installed properly, the command should return `true`. Your plugin is all set up!

![](/files/-M-Q827NQawL9lZh-cQ2)

If the script is not installed, you'll get an error like so:

![](/files/-M-Q8CgSlMkWOg8azyTH)

If this is the case, please verify that the plugin is installed properly on your website.


# Attaching custom metadata to responses

## Overview

Custom metadata is any additional information you wish to include in your response. This metadata will be available in the Response list in the analytics section in Feedbackly. You can also filter and group responses by metadata.

Metadata will be included to the subsequent survey responses made by the visitor on the site. Metadata will always be included in responses until it is cleared or the user resets their browser cookies.

Note: Metadata can be added at any point of time **before** a survey is launched.&#x20;

### Using the Javascript API to include metadata to the response

When the Feedbackly widget is installed on the site, run

```
FBLY.action("addMeta", KEY, VALUE);
```

Example:

&#x20;`FBLY.action("addMeta", "customerId", "12345");`

This command adds a customer id to the subsequent responses of the user.

### Removing a single metadata value from the visitor

This action will a single metadata key and value from the visitor. It does not affect previous responses given by the user, however.

```
FBLY.action("removeMeta", KEY)
```

Example:&#x20;

`FBLY.action("removeMeta", "customerId")`

This action removes the customerId set in the previous example.

### Clearing all metadata from a visitor

This action will clear all the metadata from the visitor. It does not affect previous responses given by the user, however. This action needs to be run before a survey is launched.

Using Javascript, run

```
FBLY.action("clearMeta")
```


# Triggering surveys via custom properties

### Overview

Custom triggering properties are used to have a more fine-grained control over the triggering properties of a Feedbackly website widget.

For instance, you might want to trigger a survey based on whether a customer is logged in to the members' are in your website. This can be easily accomplished provided that there is Javascript access to the information required to set the triggering behavior.

### Set up custom triggering parameters in the Feedbackly dashboard

In the website triggering options, open up *Advanced targeting* and add the property under *Custom Properties* like so

![](/files/-M1f4_vAfZduN9gR-b2f)

### Adding a custom triggering property to the Feedback widget via the Javascript API

When the Feedbackly widget is installed, run

```
FBLY.action("addCustomProperty", KEY, VALUE)
```

**Example**

Let's assume the information of the logged in status is stored in a Javascript variable accessible in the namespace the widget command is run. For this example, we'll assume it's stored in `user.loggedIn` variable.

Running `FBLY.action("addCustomProperty", "loggedIn", "true")` will tell the widget that the user is logged in. If the widget triggering settings has that property set, the survey will then trigger (if no other restrictions are set)

### Removing a single custom triggering property

When you want to prevent further surveys from displaying because of a custom property

When the Feedbackly widget is installed, run

```
FBLY.action("removeCustomProperty", KEY)
```

**Example**

Following the previous example, if we want to remove a custom triggering property (let's say the user logs out) we would run this command:

`FBLY.action("removeCustomProperty", "loggedIn")`

### Clearing all custom properties

This command clears all custom triggering properties of the visitor

```
FBLY.action("clearCustomProperties")
```


# Debugging website widgets

Due to the amount of variables it's not always straightforward to figure out why exactly a survey triggers/doesn't open for a visitor.

To find out more about the underlying reasons, Feedbackly provides the means to debug this.

If you need to check the installation status of a widget, please see [Verifying installation.](/master/website-widgets/getting-started#verifying-installation)

### List all triggering options available to the visitor

When on your website and with Feedbackly widget installed, open up the dev tools for the browser. In Chrome, this can be done via the command `⌘ + option + J`

Run the following command:

```
FBLY.getConfiguration();
```

The console should print out an array of configuration objects similar to this:

![](/files/-M1f7LV-1QpFg4zEJMHL)

This is in essence the JSON-representation of your website triggering parameters available on the Feedbackly UI's widget triggering parameters. All the objects in this array are the potential surveys to be shown to the user when conditions are met.

### Listing client data

To find out what data the widget has recorded of the visitor, run

```
FBLY.getConfiguration();
```

![](/files/-M1f8vmsHn16fCECn99B)

This data can be useful in determining whether the visitor has met the conditions for a survey to be triggered.

A few remarks on the properties:

* `session.declinedActivations` lists whether the user has declined a survey, its id and timestamp
* `session.sampledActivations` shows whether the visitor fits to the sample of the survey
* `visitedUrls` shows all visited urls of the visitor
* `scroll` shows the current page scroll of the visitor


# Getting started

Feedbackly has a publicly available REST API to pull data from the Feedbackly software into other systems.

### Getting started

You must have the API enabled in order to proceed. The REST API is available on the Enterprise plan of Feedbackly. Contact Feedbackly support if you need access to the API.

## Creating an API key

When the Feedbackly API is available to your organization, you can create an API key from the Feedbackly dashboard under the User profile settings tab.&#x20;


# Authentication

Feedbackly API requests are authenticated with an API key that can be retrieved from the user settings.

## Making requests

Requests are authenticated with the `Authorization` header. Example:

```
headers = {'Authorization': 'ey0iuefg.834xcunerun348efnsd'}
```


# Responses

Getting responses from Feedbackly

### Response data object

| Field           | Type                                                                      | Example                            | Description                                                        |
| --------------- | ------------------------------------------------------------------------- | ---------------------------------- | ------------------------------------------------------------------ |
| touchpointName  | string                                                                    | Touchpoint 1                       | Touch point name                                                   |
| answer          | string \| string\[] \| number                                             | 0.5, "Apple", \["Apple", "Orange"] | Mixed-type field related to question type                          |
| questionType    | "Button" \| "NPS" \| "Word" \| "Slider" \| "Contact" \| "Text" \| "Image" | "Button"                           | [Question type](/api/notes#question-types)                         |
| metadata        | { \[key: string]: string}                                                 | {phone: "iPhone X"}                | metadata attached to response                                      |
| fieldId?        | string                                                                    | "507f1f77bcf86cd799439013"         | Field id (used in Contact and Slider question types)               |
| valueString?    | string                                                                    | "Orange"                           | String value of the response                                       |
| valueArray?     | string\[]                                                                 | \["aoudfsa", "sidfvcx"]            | The technical id of the given responses (Word/Image)               |
| valueNum        | number                                                                    | 0.5                                | Number value of the response                                       |
| responseChainId | string                                                                    | "507f1f77bcf86cd799439013"         | Id of the full response chain the response belongs to              |
| questionId      | string                                                                    | "507f1f77bcf86cd799439013"         | Question's id                                                      |
| question        | string                                                                    | "How did we succeed today?"        | The title of the question in the preferred language (if available) |
| teamId          | string                                                                    | "507f1f77bcf86cd799439013"         | Team's id                                                          |
| createdAtDate   | string                                                                    | "2017-03-27T09:03:59.133Z"         | Response's date in Javascript format                               |
| createdAt       | number                                                                    | 1490605439                         | Response's date in UNIX timestamp                                  |
| touchpointId    | string                                                                    | "507f1f77bcf86cd799439013"         | Touchpoint's id                                                    |
| \_id            | string                                                                    | "507f1f77bcf86cd799439013"         | id of the response                                                 |
| language        | string                                                                    | "en"                               | language the response is given in                                  |
| teamName        | string                                                                    | "My team"                          | Team's name                                                        |
| fieldName       | string                                                                    | "Email"                            | Field name (used in Contact and Slider)                            |
| tags            | string\[]                                                                 | \["CSAT"]                          | Question tags  set in the survey editor                            |
| browser         | string                                                                    | Mac OS X Chrome 84.0.4147.105      | Browser information                                                |
| surveyId        | string                                                                    | "507f1f77bcf86cd799439013"         | Survey's id                                                        |
| surveyName      | string                                                                    | "My survey"                        | Survey's name                                                      |
| surveyVersion?  | number                                                                    | 3                                  | <p>Available for<br>survey 3.0</p>                                 |
| isClosed?       | boolean                                                                   |                                    | <p>Available for<br>survey 3.0</p>                                 |


# GET Responses

## Get Responses

<mark style="color:blue;">`GET`</mark> `https://api.feedbackly.com/v5.0.3/responses`

This endpoint allows you to access Responses objects from Feedbackly. \
For clarification on different outputs by question type, take a look at the Question types note

#### Query Parameters

| Name              | Type    | Description                                                                                                  |
| ----------------- | ------- | ------------------------------------------------------------------------------------------------------------ |
| skip              | number  | Number of documents to skip from the start                                                                   |
| metadata          | string  | Filters with provided metadata key-value pairs. Separate with semicolon. Format maker:Apple;phone:iPhone     |
| fieldId           | string  | Filters based on the provided field ids. Please refer to the docs about this id.                             |
| questionType      | string  | Array of question types. See the docs for available question types.                                          |
| questionId        | string  | Filter responses by given question id                                                                        |
| surveyId          | string  | Filter responses by given survey ids                                                                         |
| touchpointId      | string  | Filter responses by given touchpoint ids                                                                     |
| createdTo         | number  | UNIX timestamp. Fetch responses from before this timestamp. Defaults to current timestamp if not specified.  |
| preferredLanguage | string  | Language to fetch question titles etc. Defaults to 'en' or the first language available.                     |
| createdFrom       | number  | UNIX timestamp. Fetch responses starting from this timestamp. Defaults to start of the day if not specified. |
| isClosed          | boolean | NEW with Survey 3.0! Filter responses with that are not editable by the respondent anymore                   |
| surveyVersion     | number  | NEW! Filter by used survey version while collecting responses ( current versions are 2 and 3)                |

#### Headers

| Name          | Type   | Description                                                                                          |
| ------------- | ------ | ---------------------------------------------------------------------------------------------------- |
| Authorization | string | <p>Authentication token to access the API eg:<br>'Authorization': 'ey0iuefg.834xcunerun348efnsd'</p> |

{% tabs %}
{% tab title="200 Response successfully retrieved." %}

```
{
  "data": [
    {
      "touchpointName": "Retail location 1",
      "answer": 0.75,
      "questionType": "Button",
      "metadata": {
        "model": "Tesla"
      },
      "valueNum": 0.75,
      "responseChainId": "507f1f77bcf86cd799439011",
      "questionId": "507f1f77bcf86cd799439012",
      "surveyId": "507f1f77bcf86cd799439011",
      "question": "How did we succeed today?",
      "teamId": "507f1f77bcf86cd799439013",
      "createdAtDate": "2019-12-31T10:00:00.000Z",
      "createdAt": 1573507477,
      "touchpointId": "507f1f77bcf86cd799439011",
      "_id": "507f1f77bcf86cd799439011",
      "language": "fi",
      "teamName": "My team name",
      "tags": [
        "CSAT"
      ],
      "browser": "Mac OS X Chrome 84.0.4147.105",
    },
    {
      "answer": 4,
      "valueNum": 4,
      "language": "en",
      "questionType": "NPS",
      "questionId": "58d8d547b8c71e000e3824fd",
      "createdAt": 1490605439,
      "createdAtDate": "2017-03-27T09:03:59.133Z",
      "_id": "5dc57703b7c935069aef31c6",
      "question": "How likely are you to recommend us to a friend or colleague?",
      "metadata": {},
      "responseChainId": "58d8d57d42f73c78c47e2d3d",
      "teamId": "507f1f77bcf86cd799439013",
      "teamName": "My team name",
      "touchpointId": "589c16ad87ef9860199cab37",
      "touchpointName": "Retail location 1",
      "tags": [],
      "browser": "Mac OS X Chrome 84.0.4147.105",
    }
  ],
  "paging": {
    "next": "https://api.feedbackly.com/v5/responses?skip=200",
    "previous": "https://api.feedbackly.com/v5/responses?skip=0"
  }
}
```

{% endtab %}
{% endtabs %}

### Response type description

| Field name | Type                                                    | Example | Description                   |
| ---------- | ------------------------------------------------------- | ------- | ----------------------------- |
| data       | [Response data](/api/responses#response-data-object)\[] |         | The array of response objects |
| paging     | [Pagination](/api/notes/pagination)                     |         | Pagination object             |


# GET Response by id

## Get Response by id

<mark style="color:blue;">`GET`</mark> `https://api.feedbackly.com/v5.0.3/responses/:id`

Returns a single response by id

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| id   | string | Response id |

#### Query Parameters

| Name              | Type   | Description                                                                             |
| ----------------- | ------ | --------------------------------------------------------------------------------------- |
| preferredLanguage | string | Language to fetch question titles etc. Defaults to 'en' or the first language available |

#### Headers

| Name          | Type   | Description                                                                                |
| ------------- | ------ | ------------------------------------------------------------------------------------------ |
| Authorization | string | Authentication token to access the API eg: 'Authorization': 'ey0iuefg.834xcunerun348efnsd' |

{% tabs %}
{% tab title="200 " %}

```
{
  "answer": [
    "Facebook",
    "LinkedIn"
  ],
  "valueArray": [
    "adfunr4",
    "dsfgt1w"
  ],
  "language": "en",
  "questionType": "Word",
  "questionId": "58d8d548a4753d000e4665ec",
  "createdAt": 1490868345,
  "createdAtDate": "2017-03-30T10:05:45.781Z",
  "_id": "5dc576ffb7c935069aeebd68",
  "question": "Where did you hear from us?",
  "metadata": {},
  "responseChainId": "58dcd870dde9550aec15ef12",
  "teamId": "5dc56d54b7c935069aefa9e3",
  "teamName": "My team 2",
  "touchpointId": "589c16ad87ef9860199cab37",
  "touchpointName": "Retail location 2",
  "surveyId": "507f1f77bcf86cd799439011",
  "tags": []
}
```

{% endtab %}
{% endtabs %}

### Response type description

Returns [Response data](/api/responses#response-data-object)


# Response chains

Getting response chains from Feedbackly

### Response chain data object

| Field           | Type                                                                      | Example                            | Description                                                        |
| --------------- | ------------------------------------------------------------------------- | ---------------------------------- | ------------------------------------------------------------------ |
| touchpointName  | string                                                                    | Touchpoint 1                       | Touch point name                                                   |
| responseChainId | string                                                                    | "507f1f77bcf86cd799439013"         | Id of the full response chain the response belongs to              |
| teamId          | string                                                                    | "507f1f77bcf86cd799439013"         | Team's id                                                          |
| metadata        | { \[key: string]: string}                                                 | {phone: "iPhone X"}                | metadata attached to response                                      |
| createdAtDate   | string                                                                    | "2017-03-27T09:03:59.133Z"         | Response's date in Javascript format                               |
| createdAt       | number                                                                    | 1490605439                         | Response's date in UNIX timestamp                                  |
| touchpointId    | string                                                                    | "507f1f77bcf86cd799439013"         | Touchpoint's id                                                    |
| \_id            | string                                                                    | "507f1f77bcf86cd799439013"         | id of the response                                                 |
| language        | string                                                                    | "en"                               | language the response is given in                                  |
| teamName        | string                                                                    | "My team"                          | Team's name                                                        |
| browser         | string                                                                    | Mac OS X Chrome 84.0.4147.105      | Browser information                                                |
| surveyId        | string                                                                    | "507f1f77bcf86cd799439013"         | Survey's id                                                        |
| surveyName      | string                                                                    | "My survey"                        | Survey's name                                                      |
| isClosed?       | boolean                                                                   |                                    | <p>Available for<br>survey 3.0</p>                                 |
| surveyVersion?  | number                                                                    | 3                                  | <p>Available for<br>survey 3.0</p>                                 |
| data            | array                                                                     |                                    | Responses within the response chain                                |
| > answer        | string \| string\[] \| number                                             | 0.5, "Apple", \["Apple", "Orange"] | Mixed-type field related to question type                          |
| > questionType  | "Button" \| "NPS" \| "Word" \| "Slider" \| "Contact" \| "Text" \| "Image" | "Button"                           | [Question type](/api/notes#question-types)                         |
| > fieldId?      | string                                                                    | "507f1f77bcf86cd799439013"         | Field id (used in Contact and Slider question types)               |
| > valueString?  | string                                                                    | "Orange"                           | String value of the response                                       |
| > valueArray?   | string\[]                                                                 | \["aoudfsa", "sidfvcx"]            | The technical id of the given responses (Word/Image)               |
| > valueNum      | number                                                                    | 0.5                                | Number value of the response                                       |
| > questionId    | string                                                                    | "507f1f77bcf86cd799439013"         | Question's id                                                      |
| > question      | string                                                                    | "How did we succeed today?"        | The title of the question in the preferred language (if available) |
| > fieldName     | string                                                                    | "Email"                            | Field name (used in Contact and Slider)                            |
| > tags          | string\[]                                                                 | \["CSAT"]                          | Question tags  set in the survey editor                            |


# GET Response-chains

## Response chains

<mark style="color:blue;">`GET`</mark> `https://api.feedbackly.com/v5.0.3/response-chains`

Gets responses grouped by a single respondent.

#### Query Parameters

| Name              | Type    | Description                                                                                  |
| ----------------- | ------- | -------------------------------------------------------------------------------------------- |
| skip              | number  | No. of documents to skip from the start                                                      |
| createdTo         | string  | Filter by unix timestamp, ending at given value                                              |
| createdFrom       | string  | Filter by unix timestamp, starting from given value                                          |
| touchpointId      | string  | Filter by touchpoint id                                                                      |
| surveyId          | string  | Filter by survey ids                                                                         |
| preferredLanguage | string  | Preferred language to show the question titles in                                            |
| isClosed          | boolean | NEW with Survey 3.0! Filter responses with that are not editable by the respondent anymore   |
| surveyVersion     | number  | NEW! Filter by used survey version while collecting responses( current versions are 2 and 3) |

#### Headers

| Name          | Type   | Description                                                                                           |
| ------------- | ------ | ----------------------------------------------------------------------------------------------------- |
| Authorization | string | <p>Authentication token to access the API. eg:<br>'Authorization': 'ey0iuefg.834xcunerun348efnsd'</p> |

{% tabs %}
{% tab title="200 " %}

```
{
    data: [
        {
        "_id": "5979be93d296f3dbf83fb056",
        "surveyId": "59788132f870b600018d6dda",
        "touchpointId": "59529fbef3774c0001a49708",
        "touchpointName": "My touchpoint",
        "createdAt": 1501150867,
        "createdAtDate": "2017-07-27T10:21:07.619Z",
        "teamId": "5dc56d54b7c935069aefa9e2",
        "teamName": "My team name",
        "metadata": {
            "customerId": "34tNa31"
        },
        "language": "en",
        "browser": "Mac OS X Chrome 84.0.4147.105",
        "responses": [
            {
                "question": "How likely are you to recommend us to your friend or colleague?",
                "answer": 2,
                "valueNum": 2,
                "language": "en",
                "questionType": "NPS",
                "questionId": "5978813ab9215744ea08e463",
                "surveyId": "59788132f870b600018d6dda"
            },
            {
                "question": "Could you specify what was bad in your experience?",
                "answer": "Your office branch was unclean.",
                "valueString": "Your office branch was unclean.",
                "language": "en",
                "questionType": "Text",
                "questionId": "597881a4b9215744ea08e464",
                "surveyId": "59788132f870b600018d6dda"
            }
        ]
     }
    ],
    "paging": {
        "next": "https://api.feedbackly.com/v5/response-chains?skip=200",
        "previous": "https://api.feedbackly.com/v5/response-chains?skip=0"
  }
}
```

{% endtab %}
{% endtabs %}

### Return type description

| Field  | Type                                                                       | Example | Description                            |
| ------ | -------------------------------------------------------------------------- | ------- | -------------------------------------- |
| data   | [Response chain data](/api/response-chains#response-chain-data-object) \[] |         | Response chain with embedded responses |
| paging | [Pagination](/api/notes/pagination)                                        |         | Pagination object                      |


# GET Response-chain by id

## Response chain by id

<mark style="color:blue;">`GET`</mark> `https://api.feedbackly.com/v5.0.3/response-chains/:id`

Gets an individual response chain by id

#### Path Parameters

| Name | Type   | Description              |
| ---- | ------ | ------------------------ |
| id   | string | Id of the response chain |

#### Query Parameters

| Name              | Type   | Description                                       |
| ----------------- | ------ | ------------------------------------------------- |
| preferredLanguage | string | Preferred language to show the question titles in |

#### Headers

| Name          | Type   | Description                                                                                 |
| ------------- | ------ | ------------------------------------------------------------------------------------------- |
| Authorization | string | Authentication token to access the API. eg: 'Authorization': 'ey0iuefg.834xcunerun348efnsd' |

{% tabs %}
{% tab title="200 " %}

```
{
    "_id": "5979be93d296f3dbf83fb056",
    "surveyId": "59788132f870b600018d6dda",
    "touchpointId": "59529fbef3774c0001a49708",
    "touchpointName": "My touchpoint",
    "createdAt": 1501150867,
    "createdAtDate": "2017-07-27T10:21:07.619Z",
    "teamId": "5dc56d54b7c935069aefa9e2",
    "teamName": "My team name",
    "metadata": {
        "customerId": "34tNa31"
    },
    "language": "en",
    "responses": [
        {
            "question": "How likely are you to recommend us to your friend or colleague?",
            "answer": 2,
            "valueNum": 2,
            "language": "en",
            "questionType": "NPS",
            "questionId": "5978813ab9215744ea08e463",
            "surveyId": "59788132f870b600018d6dda"
        },
        {
            "question": "Could you specify what was bad in your experience?",
            "answer": "Your office branch was unclean.",
            "valueString": "Your office branch was unclean.",
            "language": "en",
            "questionType": "Text",
            "questionId": "597881a4b9215744ea08e464",
            "surveyId": "59788132f870b600018d6dda"
        }
    ]
}
```

{% endtab %}

{% tab title="400 " %}

```
{error: "Not a valid response id    Error id : 1583413424996/E5ohOOdp."}
```

{% endtab %}

{% tab title="404 If the provided id is not found" %}

```
{error: "Not found"}
```

{% endtab %}
{% endtabs %}

### Return type description <a href="#return-type-description" id="return-type-description"></a>

Returns [Response-chain data](/api/response-chains)


# Questions

Getting questions from Feedbackly

### Question data object

| Field         | Type      | Example                       | Description                                                      |
| ------------- | --------- | ----------------------------- | ---------------------------------------------------------------- |
| choicesString | string\[] | \["Lamb", "Beef", "Pork"]     | List of available choices in the preferred language (Word/Image) |
| title         | string    | "Which meat did you buy?"     | Question title in the preferred language                         |
| questionType  | string    | "Button"                      | See [question types](/api/notes#question-types)                  |
| \_id          | string    | "59b8de18784d2f0001a1590d"    | Question id                                                      |
| languages     | string\[] | \["en", "es"]                 | List of available languages for the question                     |
| language      | string    | "en"                          | The language currently selected to display titles etc            |
| subtitle?     | string    | "Please select from below"    | A subtitle for the question (if specified)                       |
| choices       | array     |                               | Array of possible choices                                        |
| > fieldId     | string    | "1"                           | The id of the field                                              |
| > fieldName   | string    | "Beef"                        | The label of the choice                                          |
| > type?       | string    | "string"                      | Type of field (Contact question type)                            |
| > subType?    | string    | "phone"                       | Subtype of the field (Contact question type)                     |
| > imageUrl?   | string    | "<https://example.com/1.png>" | Image url of the choice (Image question type)                    |


# GET Questions

## Questions

<mark style="color:blue;">`GET`</mark> `https://api.feedbackly.com/v5.0.3/questions`

This endpoint returns the questions of all surveys accessable from your account

#### Query Parameters

| Name              | Type   | Description                                                                                                                                             |
| ----------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| skip              | number | Number of documents to skip from the start                                                                                                              |
| preferredLanguage | string | Preferred language to show the question titles in eg. 'en'. If the specified language is not available, it will default to the first available language |
| questionId        | array  | Filter by question ids                                                                                                                                  |
| surveyId          | array  | Survey ids related to the question                                                                                                                      |

#### Headers

| Name          | Type   | Description                                                                                          |
| ------------- | ------ | ---------------------------------------------------------------------------------------------------- |
| Authorization | string | <p>Authentication token to access the API eg:<br>'Authorization': 'ey0iuefg.834xcunerun348efnsd'</p> |

{% tabs %}
{% tab title="200 " %}

```
{
    "data": [
        {
            "_id": "59b8de984084087cd3346743",
            "title": "Which meat did you buy?",
            "choicesString": [
                "Lamb",
                "Beef",
                "Pork"
            ],
            "questionType": "Word",
            "languages": [
                "en"
            ],
            "language": "en",
            "choices": [
                {
                    "fieldId": "1",
                    "fieldName": "Lamb"
                },
                {
                    "fieldId": "59b8deaa4084087cd3346744",
                    "fieldName": "Beef"
                },
                {
                    "fieldId": "59b8deac4084087cd3346745",
                    "fieldName": "Pork"
                }
            ],
            "surveyId": "59b8de18784d2f0001a1590d"
        },
    ],
    "paging": {
        "next": "https://api.feedbackly.com/v5/questions?preferredLanguage=en&skip=100",
        "previous": null
    }
}
```

{% endtab %}
{% endtabs %}

### Request Return type

| Field  | Type                                                            | Example | Description       |
| ------ | --------------------------------------------------------------- | ------- | ----------------- |
| data   | [Question Data object](/api/questions#question-data-object) \[] |         | Question objects  |
| paging | [Pagination](/api/notes#pagination)                             |         | Pagination object |


# GET Question by id

## Question by id

<mark style="color:blue;">`GET`</mark> `https://api.feedbackly.com/v5.0.3/questions/:id`

Gets a specific question by id

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| id   | string | Question id |

#### Query Parameters

| Name              | Type   | Description                                                                                                                                             |
| ----------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| preferredLanguage | string | Preferred language to show the question titles in eg. 'en'. If the specified language is not available, it will default to the first available language |

#### Headers

| Name          | Type   | Description                                                                                |
| ------------- | ------ | ------------------------------------------------------------------------------------------ |
| Authorization | string | Authentication token to access the API eg: 'Authorization': 'ey0iuefg.834xcunerun348efnsd' |

{% tabs %}
{% tab title="200 " %}

```
{
    "_id": "58d8d547b8c71e000e3824fc",
    "title": "How likely are you to recommend us to a friend or colleague?",
    "subtitle": "0=Not likely at all 10=Extremely likely",
    "choicesString": [],
    "questionType": "NPS",
    "languages": [
        "en",
        "es",
        "af"
    ],
    "language": "en",
    "choices": [],
    "surveyId": "58d8d3d14cb016000e203e0e"
}
```

{% endtab %}

{% tab title="401 " %}

```
{
    "error": "Question inaccessible    Error id : 1583414902648/mOXsfkd7."
}
```

{% endtab %}
{% endtabs %}

### Request Return type

Returns [Question Data object](/api/questions#question-data-object)


# Surveys

### Survey data object

| Field          | Type      | Example                                                | Description                                     |
| -------------- | --------- | ------------------------------------------------------ | ----------------------------------------------- |
| teamId         | string    | "5a3386af952bf6000177bdda"                             | Team id                                         |
| languages      | string\[] | \["en", "es"]                                          | List of available languages for the survey      |
| name           | string    | "Satisfaction survey"                                  | Survey name                                     |
| \_id           | string    | "5a3386af952bf6000177bdda"                             | Survey id                                       |
| language       | string    | "en"                                                   | Language used to display titles, choices etc    |
| teamName       | string    | "My team name"                                         | Team name                                       |
| createdBy      | string    | "Khal Drogo"                                           | User name                                       |
| archived       | boolean   | false                                                  | Whether the survey is archived                  |
| questions      | array     |                                                        | Questions embedded within the survey            |
| > \_id         | string    | "5a3386af952bf6000177bdda"                             | Question id                                     |
| > questionType | string    | "NPS"                                                  | [See Question types](/api/notes#question-types) |
| > title        | string    | "How would you recommend us to a friend or colleague?" | Question title                                  |
| > choices      | array     |                                                        | Question choices                                |
| >> fieldId     | string    | "1"                                                    | The id of the field                             |
| >> fieldName   | string    | "Beef"                                                 | The label of the choice                         |
| >> type?       | string    | "string"                                               | Type of field (Contact question type)           |
| >> subType?    | string    | "tel"                                                  | Subtype of the field (Contact question type)    |
| >> imageUrl?   | string    | "<https://example.com/1.png>"                          | Image url of the choice (Image question type)   |


# GET Surveys

## Surveys

<mark style="color:blue;">`GET`</mark> `https://api.feedbackly.com/v5.0.3/surveys`

This endpoint returns all available surveys with the questions embedded

#### Query Parameters

| Name              | Type   | Description                                |
| ----------------- | ------ | ------------------------------------------ |
| skip              | number | Number of documents to skip from the start |
| preferredLanguage | string | Preferred language to show the titles in   |

#### Headers

| Name          | Type   | Description                                                                                |
| ------------- | ------ | ------------------------------------------------------------------------------------------ |
| Authorization | string | Authentication token to access the API eg: 'Authorization': 'ey0iuefg.834xcunerun348efnsd' |

{% tabs %}
{% tab title="200 Cake successfully retrieved." %}

```
{
 "data": [
  {
    "_id": "589c16e487ef9860199cab3c",
    "name": "Example",
    "createdBy": "Admin",
    "teamId": "5dc56d54b7c935069aefa9e2",
    "teamName": "My team name",
    "languages": ["en"],
    "archived": false,
    "questions": [
      {
        "_id": "5a3b47d0e90828878851a1f5",
        "title": "Contact form",
        "subtitle": "Please type in your details",
        "choicesString": [
            "EMAIL",
            "PHONE"
        ],
        "questionType": "Contact",
        "languages": [
            "en"
        ],
        "language": "en",
        "choices": [
            {
                "fieldId": "5a3c353aecee8cb220b0270c",
                "fieldName": "EMAIL",
                "type": "string",
                "subType": "email"
            },
            {
                "fieldId": "5a3c353eecee8cb220b0270d",
                "fieldName": "PHONE",
                "type": "string",
                "subType": "tel"
            }
        ],
        "surveyId": "5a3b47c946d70600010fe412"
      }
    ]
  }
 ],
 "paging": {
     "next": null,
     "previous": null
 }
}
```

{% endtab %}

{% tab title="404 Could not find a cake matching this query." %}

```
```

{% endtab %}
{% endtabs %}

### Request return type

| Field  | Type                                                      | Example | Description         |
| ------ | --------------------------------------------------------- | ------- | ------------------- |
| data   | [Survey data object](/api/surveys#survey-data-object) \[] |         | Survey data objects |
| paging | [Pagination](/api/notes/pagination)                       |         | Pagination object   |


# GET Surveys by id

## Survey by id

<mark style="color:blue;">`GET`</mark> `https://api.feedbackly.com/v5.0.3/surveys/:id`

Gets question by id

#### Path Parameters

| Name | Type   | Description      |
| ---- | ------ | ---------------- |
| id   | string | Id of the survey |

#### Query Parameters

| Name              | Type   | Description                              |
| ----------------- | ------ | ---------------------------------------- |
| preferredLanguage | string | Preferred language to show the titles in |

#### Headers

| Name          | Type   | Description                                                                                |
| ------------- | ------ | ------------------------------------------------------------------------------------------ |
| Authorization | string | Authentication token to access the API eg: 'Authorization': 'ey0iuefg.834xcunerun348efnsd' |

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}

### Request return type <a href="#request-return-type" id="request-return-type"></a>

Returns ​[Survey data object](/api/surveys#survey-data-object)


# Touchpoints

Touchpoints are the identifiable sources of all responses.

### Touchpoint data model

| Field            | Type   | Example                    | Description                                  |
| ---------------- | ------ | -------------------------- | -------------------------------------------- |
| \_id             | string | "507f191e810c19729de860ea" | Unique id                                    |
| name             | string | "Feedback terminal"        | Name of the touchpoint                       |
| teamId           | string | "507f191e810c19729de860eb" | Team id this touchpoint belongs to           |
| activeSurveyId   | string | "507f191e810c19729de860ec" | Id of the active survey on this touchpoint   |
| activeSurveyName | string | "NPS Survey"               | Name of the active survey on this touchpoint |
| lastResponse     | number | 1598017724                 | UNIX timestamp of the last response          |
| lastResponseDate | string | "2020-08-21T13:49:44.951Z" | Last response in ISO String format           |


# GET Touchpoints

## Get Touchpoints

<mark style="color:blue;">`GET`</mark> `https://api.feedbackly.com/v5.0.3/touchpoints`

This endpoint allows you to access Touchpoint objects from Feedbackly.&#x20;

#### Query Parameters

| Name   | Type   | Description                                |
| ------ | ------ | ------------------------------------------ |
| teamId | string | Filter touchpoints by teamId               |
| skip   | number | Number of documents to skip from the start |

#### Headers

| Name          | Type   | Description                                                                                          |
| ------------- | ------ | ---------------------------------------------------------------------------------------------------- |
| Authorization | string | <p>Authentication token to access the API eg:<br>'Authorization': 'ey0iuefg.834xcunerun348efnsd'</p> |

{% tabs %}
{% tab title="200 Response successfully retrieved." %}

```
{
  "data": [
    {
      "_id": "5dc57703b7c935069aef31c5",
      "name": "Feedback terminal 1",
      "teamId": "5dc57703b7c935069aef31c1",
      "activeSurveyId": "5dc57703b7c935069aef31a2",
      "activeSurveyName": "NPS Survey",
      "lastResponse": 159801789,
      "lastResponseDate": "2020-08-21T13:52:01.606Z"
    },
    {
      
      "_id": "5dc57703b7c935069aef31c6",
      "name": "Web widget home page",
      "teamId": "5dc57703b7c935069aef31c2",
      "activeSurveyId": "5dc57703b7c935069aef31a1",
      "activeSurveyName": "CES Survey",
      "lastResponse": 159801789,
      "lastResponseDate": "2020-08-21T13:52:01.606Z"
    }
  ],
  "paging": {
    "next": "https://api.feedbackly.com/v5.0.2/touchpoints?skip=200",
    "previous": "https://api.feedbackly.com/v5.0.2/touchpoints?skip=0"
  }
}
```

{% endtab %}
{% endtabs %}

### Response type description

| Field name | Type                                                          | Example | Description                     |
| ---------- | ------------------------------------------------------------- | ------- | ------------------------------- |
| data       | [Touchpoint data](/api/touchpoints#touchpoint-data-model) \[] |         | The array of touchpoint objects |
| paging     | [Pagination](/api/notes/pagination)                           |         | Pagination object               |


# GET Touchpoint by id

## Get Touchpoint by id

<mark style="color:blue;">`GET`</mark> `https://api.feedbackly.com/v5.0.3/touchpoints/:id`

This endpoint allows you to access Touchpoint objects by id from Feedbackly.&#x20;

#### Path Parameters

| Name | Type   | Description          |
| ---- | ------ | -------------------- |
| id   | string | Id of the touchpoint |

#### Headers

| Name          | Type   | Description                                                                                          |
| ------------- | ------ | ---------------------------------------------------------------------------------------------------- |
| Authorization | string | <p>Authentication token to access the API eg:<br>'Authorization': 'ey0iuefg.834xcunerun348efnsd'</p> |

{% tabs %}
{% tab title="200 Response successfully retrieved." %}

```
{
  "_id": "5dc57703b7c935069aef31c5",
  "name": "Feedback terminal 1",
  "teamId": "5dc57703b7c935069aef31c1",
  "activeSurveyId": "5dc57703b7c935069aef31a2",
  "activeSurveyName": "NPS Survey",
  "lastResponse": 159801789,
  "lastResponseDate": "2020-08-21T13:52:01.606Z",
}
```

{% endtab %}
{% endtabs %}

### Response type description

| Field name | Type                                                          | Example | Description                     |
| ---------- | ------------------------------------------------------------- | ------- | ------------------------------- |
| data       | [Touchpoint data](/api/touchpoints#touchpoint-data-model) \[] |         | The array of touchpoint objects |
| paging     | [Pagination](/api/notes/pagination)                           |         | Pagination object               |


# Unsubscriptions

Get Unsubscribed contacts from Feedbackly

### Unsubsribed contact object

| Field        | Type   | Example                    | Description                  |
| ------------ | ------ | -------------------------- | ---------------------------- |
| phone        | string | "+35811111111"             | Phone of the contact         |
| email        | string | "<name@example.com>"       | Email of the contact         |
| touchpointId | string | "507f191e810c19729de860eb" | Touchpoint id of the contact |
| createdAt    | string | "2023-03-13T13:53:42.577Z" | Creation Date of the contact |


# GET Unsubscriptions

## Get Unsubcriptions

<mark style="color:blue;">`GET`</mark> `https://api.feedbackly.com/v5.0.3/unsubcriptions`

This endpoint allows you to access Unsubscribed contacts objects from Feedbackly.&#x20;

#### Query Parameters

| Name           | Type   | Description                                                                                                        |
| -------------- | ------ | ------------------------------------------------------------------------------------------------------------------ |
| startDate      | string | Filter by unix timestamp, starting at given value (optional)                                                       |
| endDate        | number | Filter by unix timestamp, ending at given value (optional)                                                         |
| skip           | String | No. of documents to skip from the start (optional)                                                                 |
| requiredFields | Array  | Fields to append to received contact object. Options: "email", "phone", "touchpointId" and "createdAt". (optional) |

#### Headers

| Name                                            | Type   | Description                                                                                          |
| ----------------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | string | <p>Authentication token to access the API eg:<br>'Authorization': 'ey0iuefg.834xcunerun348efnsd'</p> |

{% tabs %}
{% tab title="200 Response successfully retrieved." %}

```
{
  "data": [
    {
      "_id": "5dc57703b7c935069aef31c5",
      "name": "Feedback terminal 1",
      "teamId": "5dc57703b7c935069aef31c1",
      "activeSurveyId": "5dc57703b7c935069aef31a2",
      "activeSurveyName": "NPS Survey",
      "lastResponse": 159801789,
      "lastResponseDate": "2020-08-21T13:52:01.606Z"
    },
    {
      
      "_id": "5dc57703b7c935069aef31c6",
      "name": "Web widget home page",
      "teamId": "5dc57703b7c935069aef31c2",
      "activeSurveyId": "5dc57703b7c935069aef31a1",
      "activeSurveyName": "CES Survey",
      "lastResponse": 159801789,
      "lastResponseDate": "2020-08-21T13:52:01.606Z"
    }
  ],
  "paging": {
    "next": "https://api.feedbackly.com/v5.0.2/touchpoints?skip=200",
    "previous": "https://api.feedbackly.com/v5.0.2/touchpoints?skip=0"
  }
}
```

{% endtab %}
{% endtabs %}

### Response type description

| Field name | Type                                            | Example | Description                               |
| ---------- | ----------------------------------------------- | ------- | ----------------------------------------- |
| data       | [Unsubsribed contact](/api/unsubscriptions) \[] |         | The array of Unsubscribed contact objects |
| paging     | [Pagination](/api/notes/pagination)             |         | Pagination object                         |


# GET Unsubscriptions by  Channel id

## Get Unsubcriptions by channel id

<mark style="color:blue;">`GET`</mark> `https://api.feedbackly.com/v5.0.3/unsubcriptions/:channelId`

This endpoint allows you to access Unsubscribed contacts objects from Feedbackly.&#x20;

#### Query Parameters

| Name           | Type   | Description                                                                                          |
| -------------- | ------ | ---------------------------------------------------------------------------------------------------- |
| startDate      | string | Filter by unix timestamp, starting at given value                                                    |
| endDate        | number | Filter by unix timestamp, ending at given value                                                      |
| skip           | String | No. of documents to skip from the start                                                              |
| requiredFields | Array  | Fields to append to received contact object. Options: "email", "phone", "channelId" and "createdAt". |

#### Headers

| Name                                            | Type   | Description                                                                                          |
| ----------------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | string | <p>Authentication token to access the API eg:<br>'Authorization': 'ey0iuefg.834xcunerun348efnsd'</p> |

{% tabs %}
{% tab title="200 Response successfully retrieved." %}

```
{
  "data": [
    {
      "_id": "5dc57703b7c935069aef31c5",
      "name": "Feedback terminal 1",
      "teamId": "5dc57703b7c935069aef31c1",
      "activeSurveyId": "5dc57703b7c935069aef31a2",
      "activeSurveyName": "NPS Survey",
      "lastResponse": 159801789,
      "lastResponseDate": "2020-08-21T13:52:01.606Z"
    },
    {
      
      "_id": "5dc57703b7c935069aef31c6",
      "name": "Web widget home page",
      "teamId": "5dc57703b7c935069aef31c2",
      "activeSurveyId": "5dc57703b7c935069aef31a1",
      "activeSurveyName": "CES Survey",
      "lastResponse": 159801789,
      "lastResponseDate": "2020-08-21T13:52:01.606Z"
    }
  ],
  "paging": {
    "next": "https://api.feedbackly.com/v5.0.2/touchpoints?skip=200",
    "previous": "https://api.feedbackly.com/v5.0.2/touchpoints?skip=0"
  }
}
```

{% endtab %}
{% endtabs %}

### Response type description

| Field name | Type                                            | Example | Description                               |
| ---------- | ----------------------------------------------- | ------- | ----------------------------------------- |
| data       | [Unsubsribed contact](/api/unsubscriptions) \[] |         | The array of Unsubscribed contact objects |
| paging     | [Pagination](/api/notes/pagination)             |         | Pagination object                         |


# Notes


# Entity relationships

![](/files/-MFU7lSeoqw8spyJPgfK)

### Survey

Survey is the main container for several Questions. Each Question refers to a screen on a survey. In the REST API structure, survey returns an array of Questions.&#x20;

### Question

Question refer to a screen inside a survey and is normally returned as a part of a Survey call. Each Question can also be retrieved invidually via the Questions API. Questions can be part of many surveys but this is a rare case (custom applications).

### Response chain

Response chain is a whole answer to one entire survey. The contents of the responses field is an array of one or more responses depending on which questions the respondent has answered. If the survey has been not answered fully the responses field will only contain the responses up to the point of exit by the customer. Also, skipping logic applied via the survey can result into varying sets of responses by the user.&#x20;

### Response

A Response is an answer to an individual **field** of a Question. Regularly you only have 1 field inside the Question but for Slider and Contact question types the answers are separate Response objects. Each Response shares the `responseChainId` as a foreign key but those fields have a `fieldId` which links to the specific `choice.fieldId` inside a Question.

### Touchpoints

Touchpoints are the source of the incoming responses. This can be an individual Feedbackly terminal, a web widget, an email list etc. Responses have a unique `touchpointId` and a `touchpointName` to further clarify the source of responses. Each Response chain can only have one touchpoint because it represents one session (one respondent).


# Pagination

For endpoints that returns multiple objects, pagination is done by providing the URL's to get the next objects (if more are available)

| Field    | Example                                                |
| -------- | ------------------------------------------------------ |
| next     | <https://api.feedbackly.com/v5.0.3/responses?skip=400> |
| previous | <https://api.feedbackly.com/v5.0.3/responses?skip=0>   |


# Question types

This table clarifies the different outputs per question type

| Question type | Description                                                                                                                                                                                                                                                                                                                                                                             | Field                                                  | Example                                                                                        |                                                                                                                                                                                                                                |
| ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ | ---------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Button        | <p>Smileys / Satisfaction</p><p></p><p>The values are in the scale of 0-1.</p><p></p><p>5 buttons: 0, 0.25, 0.5, 0.75, 1</p><p>4 buttons: 0, 0.33, 0.66, 1</p>                                                                                                                                                                                                                          | <p>valueNum: number</p><p>answer: number</p>           | <p>valueNum: 0.5</p><p>answer: 0.5</p>                                                         |                                                                                                                                                                                                                                |
| NPS           | <p>NPS question</p><p>Numbers 0-10</p>                                                                                                                                                                                                                                                                                                                                                  | <p>valueNum: number</p><p>answer: number</p>           | <p>valueNum: 4</p><p>answer: 4</p>                                                             |                                                                                                                                                                                                                                |
| Word          | <p>Category / Selection / Multiselect</p><p></p><p>Answer will either be a string value if the </p><p>question is single select or an array of strings </p><p>if the question is a multi-select.</p><p></p><p>valueArray will contain the unique id's of the </p><p>choice(s) selected while answer contains the </p><p>string representations of the choice in the language chosen</p> | <p>valueArray: string\[]</p><p></p><p>answer: string   | string\[]</p>                                                                                  | <p><strong>Multiselect:</strong> </p><p>valueArray: \['sdfs3, 'asdas1]</p><p></p><p>answer: \['Apples', 'Oranges']</p><p></p><p><strong>Single select:</strong> </p><p>valueArray: \['533rf']</p><p></p><p>answer: 'Pears'</p> |
| Image         | <p>Category / Selection by image</p><p></p><p>Same as above</p>                                                                                                                                                                                                                                                                                                                         | Same as above                                          | Same as above, outputs image labels                                                            |                                                                                                                                                                                                                                |
| Slider        | <p>Slider question. These questions contain multiple responses depending on the field responded to. In order to connect these answers together, you look at the <em>responseChainId</em> and the <em>questionId</em></p><p></p><p>Each field contains a <em>fieldId</em>  and a <em>fieldName</em> to distinguish the responses apart.</p><p></p><p>The scale is 0-10.</p>              | <p>valueNum: number</p><p></p><p>answer: number</p>    | <p>valueNum: 4</p><p></p><p>answer: 4</p>                                                      |                                                                                                                                                                                                                                |
| Contact       | Contact form question. Like Slider question, this question might have multiple responses per question.                                                                                                                                                                                                                                                                                  | <p>valueString: string</p><p>answer: string</p>        | <p>valueString: "<example@example.com>"</p><p></p><p>answer:</p><p>"<example@example.com>"</p> |                                                                                                                                                                                                                                |
| Text          | Open-ended field.                                                                                                                                                                                                                                                                                                                                                                       | <p>valueString: string</p><p></p><p>answer: string</p> | <p>valueString: "I was happy"</p><p></p><p>answer: "I was happy"</p>                           |                                                                                                                                                                                                                                |


# Authentication

Feedbackly API requests are authenticated with an API key that can be retrieved from the user settings.

## Making requests

Requests are authenticated with the `Authorization` header. Example:

```
headers = {'Authorization': 'ey0iuefg.834xcunerun348efnsd'}
```


# Preparing Campaign

A Survey needs to be launched as "API Action" in order to use it via API.

Please check our [dashboard user guide](https://intercom.help/feedbackly/en/articles/8570148-launch-email-or-sms-campaign-as-an-api-action) to learn more about launching a Survey to use with API.


# Sending Surveys

Send Email and SMS Surveys via Feedbackly.

Multiple Surveys can be sent via Feedbackly within just one post request.&#x20;

#### **Conditional Dispatches**

We are also able to distribute contacts in the request body in between multiple campaigns based on conditional logic. It eases up connecting your system(s) to Feedbackly. \
Example use cases: \
1\) Send survey only if a customer bought an item in specific category.\
2\) Send Service Satisfaction Survey if customer received a service or Send Product Selection Survey if customer was shopping.\
3\) Send Email or SMS Survey.

Options are Limitless thanks to our Flexible Logic Builder. Conditions can be as complex as your needs, Feedbackly will handle it!

Please get in touch with our support to get started with building the conditions.


# POST Trigger

## Dispatch Surveys

<mark style="color:green;">`POST`</mark> `https://api.feedbackly.com/v5.0.3/triggers/rest/:apiActionId`

Dispatch API have rate limit of 500 contacts/minute. Please be careful with retries since we're sending out surveys right away after receiving the API request. \
\
\*Refer to "[Preparing Campaign](/dispatch-api/preparing-campaign)" to get apiActionId from feedbackly dashboard.

#### Headers

| Name          | Type   | Description                                                                                          |
| ------------- | ------ | ---------------------------------------------------------------------------------------------------- |
| Authorization | String | <p>Authentication token to access the API eg:<br>'Authorization': 'ey0iuefoo834xcunerun348efnsd'</p> |
| Content-Type  | String | Use: 'Content-Type':'application/json'                                                               |

#### Request Body

| Name                                       | Type       | Description                                                                                                    |
| ------------------------------------------ | ---------- | -------------------------------------------------------------------------------------------------------------- |
| actionId<mark style="color:red;">\*</mark> | String     | Unique identifier to differentiate original requests. Feedbackly will block requests with duplicate actionIds. |
| contacts<mark style="color:red;">\*</mark> | contact\[] | Array of [contact object](#contact)s                                                                           |
| ~~apiActionId~~                            | String     | \[DEPRECIATED] ApiActionId to be used in body instead of URI param                                             |

{% tabs %}
{% tab title="Request (POST)" %}

```
{
  "actionId": "123456789",
  "contacts": [
    {
    "email": "some.user@example.com",
    "metadata": {
      "type": "Test"
      }
    }
  ]
}
```

{% endtab %}

{% tab title="200 Response successfully retrieved." %}

```
{
    "campaigns": {
        "65f16af0d948b98372d6b6aa": [
            {
                "email": "some.user@example.com",
                "metadata": {
                    "type": "Test"
                }
            }
        ]
    }
}
```

{% endtab %}
{% endtabs %}

### Contact Object <a href="#contact" id="contact"></a>

Please note that either email or phone must be existing per contact. Metadata and options are optional.

| Field    | Type                              | Description                                                                                   |
| -------- | --------------------------------- | --------------------------------------------------------------------------------------------- |
| email    | String                            | Valid email address of survey receiver                                                        |
| phone    | String                            | Valid phone number with country code of survey receiver. (with or without + in the beginning) |
| metadata | {\[key:string]: string \| number} | Contact related metadata.                                                                     |
| options  | {}                                | Additional options                                                                            |

#### Options

To override default admin notification receivers, use this. Multiple emails can be specified as an array.

```
"options":{
	"notificationReceiver":["other.email@example.com"],
	"overrideDefaultReceivers":true
}
```


# Salesforce Outbound Messages

## Dispatch Surveys

<mark style="color:green;">`POST`</mark> `https://api.feedbackly.com/v5.0.3/triggers/soap/:apiActionId`

Simply send your contacts as outbound messages to send surveys.

Get in touch with Feedbackly Support to map necessary fields, e.g. email info so Feedbackly can use this information to send the surveys and manage unsubscriptions.

Dispatch API have rate limit of 500 contacts/minute. Please be careful with retries since we're sending out surveys right away after receiving the API request. \
\
\*Refer to "[Preparing Campaign](/dispatch-api/preparing-campaign)" to get apiActionId from feedbackly dashboard.

#### Headers

| Name          | Type   | Description                                                                                          |
| ------------- | ------ | ---------------------------------------------------------------------------------------------------- |
| Authorization | String | <p>Authentication token to access the API eg:<br>'Authorization': 'ey0iuefoo834xcunerun348efnsd'</p> |
| Content-Type  | String | Use: 'Content-Type':'application/json'                                                               |

#### Request Body

| Name                                       | Type       | Description                                                                                                    |
| ------------------------------------------ | ---------- | -------------------------------------------------------------------------------------------------------------- |
| actionId<mark style="color:red;">\*</mark> | String     | Unique identifier to differentiate original requests. Feedbackly will block requests with duplicate actionIds. |
| contacts<mark style="color:red;">\*</mark> | contact\[] | Array of [contact object](#contact)s                                                                           |
| ~~apiActionId~~                            | String     | \[DEPRECIATED] ApiActionId to be used in body instead of URI param                                             |

{% tabs %}
{% tab title="Request (POST)" %}

```
{
  "actionId": "123456789",
  "contacts": [
    {
    "email": "some.user@example.com",
    "metadata": {
      "type": "Test"
      }
    }
  ]
}
```

{% endtab %}

{% tab title="200 Response successfully retrieved." %}

```
{
    "campaigns": {
        "65f16af0d948b98372d6b6aa": [
            {
                "email": "some.user@example.com",
                "metadata": {
                    "type": "Test"
                }
            }
        ]
    }
}
```

{% endtab %}
{% endtabs %}

### Contact Object <a href="#contact" id="contact"></a>

Please note that either email or phone must be existing per contact. Metadata and options are optional.

| Field    | Type                              | Description                                                                                   |
| -------- | --------------------------------- | --------------------------------------------------------------------------------------------- |
| email    | String                            | Valid email address of survey receiver                                                        |
| phone    | String                            | Valid phone number with country code of survey receiver. (with or without + in the beginning) |
| metadata | {\[key:string]: string \| number} | Contact related metadata.                                                                     |
| options  | {}                                | Additional options                                                                            |

#### Options

To override default admin notification receivers, use this. Multiple emails can be specified as an array.

```
"options":{
	"notificationReceiver":["other.email@example.com"],
	"overrideDefaultReceivers":true
}
```


# Getting started

## Installing the website widget

Get the embed script from the Dashboard and integrate it into your website code directly or utilize GTM or a similar tool. The code should look like this:

```
<!-- UNIVERSAL FBLY WEBSITE SCRIPT -->
<script async src="https://embed.feedbackly.cloud/widget.js"></script>
<script>
window.fblywc = window.fblywc||[];function fblytag(){fblywc.push(arguments);}
fblytag("oid", "<OID>");
fblytag("dmn", "<DMN>");
</script>
<!-- Eo UNIVERSAL FBLY WEBSITE SCRIPT -->
```

### Verifying installation

Go to your website and open up the developer console in your browser. In Chrome, this can be done via the command `⌘ + option + J`

Find the console from the bottom of the developer tools. Type in `FBLY` and press enter. If your plugin is installed properly, the command should return `true`. Your plugin is all set up!

![](/files/-M-Q827NQawL9lZh-cQ2)

If the script is not installed, you'll get an error like so:

![](/files/-M-Q8CgSlMkWOg8azyTH)

If this is the case, please verify that the plugin is installed properly on your website.\
\
**See also:**&#x20;

{% content-ref url="/pages/-M-Q6Tr\_hu3vTvq0S7V5" %}
[Debugging website widgets](/website-widgets/debugging-website-widgets)
{% endcontent-ref %}

### Async script loading and custom actions

Because **FBLY.actions** may not be available when trying to use custom actions and properties because of a late async loading of the main script, please load this script before your custom code:

```
<script src="https://embed.feedbackly.cloud/actions.js"></script>
```

or alternatively use the code found from that file as inline.

**See also:**

{% content-ref url="/pages/-M-Q6GpmiWQ8R3Z\_8Hd9" %}
[Attaching custom metadata to responses](/website-widgets/adding-custom-metadata-to-responses)
{% endcontent-ref %}

{% content-ref url="/pages/-M-Q6Me2\_7ND8sZq9xAH" %}
[Triggering surveys via custom properties](/website-widgets/adding-custom-triggering-properties-to-widget)
{% endcontent-ref %}

{% content-ref url="/pages/SA0UbUFRx6orgFtYMDMn" %}
[Widget Hooks](/website-widgets/widget-hooks)
{% endcontent-ref %}

{% content-ref url="/pages/q9MzKxE4jaXB8cbYEZ2G" %}
[Setting the language](/website-widgets/setting-the-language)
{% endcontent-ref %}

### Custom configurations

For embedded survey widget, instead of inserting manually DIV tag to the website (found from Feedbackly dashboard) to mark a place where widget should be rendered, you can use these script configurations to define the position.

For \<ID>, use ID found from the original DIV tag: **fbly-embedded-\<ID>.**

```
fblytag("embedid", "<ID>"); //for auto tag generation for embedded survey widgets.
fblytag("appendto", "footer"); //optional: <element name> | #<div id>. Example: footer | #mydivid
fblytag("position", "top"); //optional: top | inside
```


# Attaching custom metadata to responses

## Overview

Custom metadata is any additional information you wish to include in your response. This metadata will be available in the Response list in the analytics section in Feedbackly. You can also filter and group responses by metadata.

Metadata will be included to the subsequent survey responses made by the visitor on the site. Metadata will always be included in responses until it is cleared or the user resets their browser cookies.

Note: Metadata can be added at any point of time **before** a survey is launched.&#x20;

### Using the Javascript API to include metadata to the response

When the Feedbackly widget is installed on the site, run

```
FBLY.action("addMeta", KEY, VALUE);
```

Example:

&#x20;`FBLY.action("addMeta", "customerId", "12345");`

This command adds a customer id to the subsequent responses of the user.

### Removing a single metadata value from the visitor

This action will a single metadata key and value from the visitor. It does not affect previous responses given by the user, however.

```
FBLY.action("removeMeta", KEY)
```

Example:&#x20;

`FBLY.action("removeMeta", "customerId")`

This action removes the customerId set in the previous example.

### Clearing all metadata from a visitor

This action will clear all the metadata from the visitor. It does not affect previous responses given by the user, however. This action needs to be run before a survey is launched.

Using Javascript, run

```
FBLY.action("clearMeta")
```


# Triggering surveys via custom properties

### Overview

Custom triggering properties are used to have a more fine-grained control over the triggering properties of a Feedbackly website widget.

For instance, you might want to trigger a survey based on whether a customer is logged in to the members' are in your website. This can be easily accomplished provided that there is Javascript access to the information required to set the triggering behavior.

### Set up custom triggering parameters in the Feedbackly dashboard

In the website triggering options, open up *Advanced targeting* and add the property under *Custom Properties* like so

![](/files/-M1f4_vAfZduN9gR-b2f)

### Adding a custom triggering property to the Feedback widget via the Javascript API

When the Feedbackly widget is installed, run

```
FBLY.action("addCustomProperty", KEY, VALUE)
```

**Example**

Let's assume the information of the logged in status is stored in a Javascript variable accessible in the namespace the widget command is run. For this example, we'll assume it's stored in `user.loggedIn` variable.

Running `FBLY.action("addCustomProperty", "loggedIn", "true")` will tell the widget that the user is logged in. If the widget triggering settings has that property set, the survey will then trigger (if no other restrictions are set)

### Removing a single custom triggering property

When you want to prevent further surveys from displaying because of a custom property

When the Feedbackly widget is installed, run

```
FBLY.action("removeCustomProperty", KEY)
```

**Example**

Following the previous example, if we want to remove a custom triggering property (let's say the user logs out) we would run this command:

`FBLY.action("removeCustomProperty", "loggedIn")`

### Clearing all custom properties

This command clears all custom triggering properties of the visitor

```
FBLY.action("clearCustomProperties")
```


# Widget Hooks

#### On Survey Loaded

This action will trigger the given callback function when the survey is loaded and shown.

```javascript
FBLY.action("onSurveyLoaded", () => { /* Your code */})
```

#### On Response

This action will trigger the given callback function immediately after a customer answers a question of the survey. This means, if the survey has 3 questions the function will be called each time a question in answered, in this case 3 times. \
\
The response object will be passed as the first argument of the function. Available fields include:

|              |                                  |
| ------------ | -------------------------------- |
| surveyId     | 12 byte ObjectId                 |
| questionId   | 12 byte ObjectId                 |
| touchpointId | 12 byte ObjectId                 |
| language     | string (ISO 639-1 language code) |
| data         | varies                           |

```javascript
FBLY.action("onResponse", (r) => { /* Your code */})
```

#### On Survey Finished

This action will trigger the given callback function after the survey is completed.

```javascript
FBLY.action("onSurveyFinished", () => { /* Your code */})
```

#### on Survey Close

This action will trigger the given callback function if the survey closes either by user or programmatically. "isDeclined" flag is true only if the user closed the survey or if  `FBLY.close(userDeclined)` called with userDeclined = true

```javascript
FBLY.action("onClose", (isDeclined) => { /* Your code */})
```


# Setting the language

If you need to change the language of the survey programmatically, you can achieve this using the provided JavaScript action along with the desired language code.

```
window.FBLY.action("setLanguage", "fi");
```


# Debugging website widgets

Due to the amount of variables it's not always straightforward to figure out why exactly a survey triggers/doesn't open for a visitor.

To find out more about the underlying reasons, Feedbackly provides the means to debug this.

If you need to check the installation status of a widget, please see [Verifying installation.](/website-widgets/getting-started#verifying-installation)

### List all triggering options available to the visitor

When on your website and with Feedbackly widget installed, open up the dev tools for the browser. In Chrome, this can be done via the command `⌘ + option + J`

Run the following command:

```
FBLY.getConfiguration();
```

The console should print out an array of configuration objects similar to this:

![](/files/-M1f7LV-1QpFg4zEJMHL)

This is in essence the JSON-representation of your website triggering parameters available on the Feedbackly UI's widget triggering parameters. All the objects in this array are the potential surveys to be shown to the user when conditions are met.

### Listing client data

To find out what data the widget has recorded of the visitor, run

```
FBLY.getClientData();
```

![](/files/-M1f8vmsHn16fCECn99B)

This data can be useful in determining whether the visitor has met the conditions for a survey to be triggered.

A few remarks on the properties:

* `session.declinedActivations` lists whether the user has declined a survey, its id and timestamp
* `session.sampledActivations` shows whether the visitor fits to the sample of the survey
* `visitedUrls` shows all visited urls of the visitor
* `scroll` shows the current page scroll of the visitor

## Automatic debugging mode

To see loading information and created objects in a browser console, enable automatic debug mode by adding this to the end of your page URL (can also be set as a URL parameter):

```
#debug=true
```

or edit the original script tag to add following configuration for dev/test sites:

```
fblytag('debug', 'true');
```


# Response Webhooks

Getting Responses in real time to your endpoint

Response webhooks provide a way for responses to be delivered to an external web server. Webhook triggered immediately when a response saved. Note that Survey UI 3.0 in touchpoint settings must be enabled to use this feature.

#### Configuration

You can specify a URL in touchpoint settings by adding a custom settings with key "webhookURL". And if you want to attach an Authorization header to the request, you can add another custom settings with key "webhookAuthHeader" by the value being Authorization header itself.

#### Data

Webhook request body includes following fields;

<table data-full-width="true"><thead><tr><th>Field</th><th>Type</th><th>Example</th><th>Description</th></tr></thead><tbody><tr><td>createdAt</td><td>string</td><td>"2023-10-19T13:33:02.980Z"</td><td>Response Date in ISO 8601 format</td></tr><tr><td>feedbackId</td><td>string</td><td>"65312e12949a0d0508b71dae"</td><td>Id of the full response chain the response belongs to</td></tr><tr><td>language</td><td>string</td><td>"en"</td><td>Language code in two letter ISO 639-1 format</td></tr><tr><td>surveyId</td><td>string</td><td>"612615c51e9b5b00726f4cb4"</td><td>Survey's id</td></tr><tr><td>surveyName</td><td>string</td><td>"My Survey"</td><td>Survey's name</td></tr><tr><td>touchpointId</td><td>string</td><td>"643186eaabea9200298eeb43"</td><td>Touchpoint's id</td></tr><tr><td>touchpointName</td><td>string</td><td>"My Touchpoint"</td><td>Touchpoint name</td></tr><tr><td>questionId</td><td>string</td><td>"612615c51e9b5b00726f4cb1"</td><td>Question's id</td></tr><tr><td>questionType</td><td>"Button" | "NPS" | "Word" | "Slider" | "Contact" | "Text" | "Image"</td><td>"NPS"</td><td><a href="/pages/-M1dt5MzTuK1vLKUHatj#question-types">Question type</a></td></tr><tr><td>questionTitle</td><td>string</td><td>"How likely are you to recommend us to your friends and colleagues?"</td><td>The title of the question in the response's language</td></tr><tr><td>tags</td><td>string[]</td><td>["CSAT"]</td><td>Question tags that set in the survey editor</td></tr><tr><td>answer</td><td>string | string[] | number</td><td>5, "Apple", ["Apple", "Orange"]</td><td>Mixed-type field related to question type</td></tr><tr><td>browser</td><td>string</td><td>"Chrome 118.0.0.0"</td><td>Respondent's Browser</td></tr><tr><td>device</td><td>string</td><td>"Macintosh"</td><td>Respondent's Device</td></tr><tr><td>os</td><td>string</td><td>"Mac OS 10.15.7"</td><td>Respondent's OS</td></tr><tr><td>metadata</td><td>object</td><td>{ "key": "value" }</td><td>metadata attached to response</td></tr><tr><td>cluster</td><td>string?</td><td>"detractor"</td><td>NPS or EVI cluster of the response</td></tr><tr><td>fieldId</td><td>string?</td><td>"507f1f77bcf86cd799439013"</td><td>Field id (used in Contact and Slider question types)</td></tr><tr><td>fieldName</td><td>string?</td><td>"Email"</td><td>Field name (used in Contact and Slider) in the response's language </td></tr><tr><td>contactId</td><td>string?</td><td>"507f1f77bcf86cd799439013"</td><td>Contact Id if the survey responded from a email/sms campaign</td></tr></tbody></table>


# Getting started

Feedbackly has a publicly available REST API to pull data from the Feedbackly software into other systems.

### Getting started

You must have the API enabled in order to proceed. The REST API is available on the Enterprise plan of Feedbackly. Contact Feedbackly support if you need access to the API.

## Creating an API key

When the Feedbackly API is available to your organization, you can create an API key from the Feedbackly dashboard under the User profile settings tab.&#x20;


# Authentication

Feedbackly API requests are authenticated with an API key that can be retrieved from the user settings.

## Making requests

Requests are authenticated with the `Authorization` header. Example:

```
headers = {'Authorization': 'ey0iuefg.834xcunerun348efnsd'}
```


# Responses

Getting responses from Feedbackly

### Response data object

| Field           | Type                                                                      | Example                            | Description                                                        |
| --------------- | ------------------------------------------------------------------------- | ---------------------------------- | ------------------------------------------------------------------ |
| touchpointName  | string                                                                    | Touchpoint 1                       | Touch point name                                                   |
| answer          | string \| string\[] \| number                                             | 0.5, "Apple", \["Apple", "Orange"] | Mixed-type field related to question type                          |
| questionType    | "Button" \| "NPS" \| "Word" \| "Slider" \| "Contact" \| "Text" \| "Image" | "Button"                           | [Question type](/v.5.0.2/api/notes#question-types)                 |
| metadata        | { \[key: string]: string}                                                 | {phone: "iPhone X"}                | metadata attached to response                                      |
| fieldId?        | string                                                                    | "507f1f77bcf86cd799439013"         | Field id (used in Contact and Slider question types)               |
| valueString?    | string                                                                    | "Orange"                           | String value of the response                                       |
| valueArray?     | string\[]                                                                 | \["aoudfsa", "sidfvcx"]            | The technical id of the given responses (Word/Image)               |
| valueNum        | number                                                                    | 0.5                                | Number value of the response                                       |
| responseChainId | string                                                                    | "507f1f77bcf86cd799439013"         | Id of the full response chain the response belongs to              |
| questionId      | string                                                                    | "507f1f77bcf86cd799439013"         | Question's id                                                      |
| question        | string                                                                    | "How did we succeed today?"        | The title of the question in the preferred language (if available) |
| teamId          | string                                                                    | "507f1f77bcf86cd799439013"         | Team's id                                                          |
| createdAtDate   | string                                                                    | "2017-03-27T09:03:59.133Z"         | Response's date in Javascript format                               |
| createdAt       | number                                                                    | 1490605439                         | Response's date in UNIX timestamp                                  |
| touchpointId    | string                                                                    | "507f1f77bcf86cd799439013"         | Touchpoint's id                                                    |
| \_id            | string                                                                    | "507f1f77bcf86cd799439013"         | id of the response                                                 |
| language        | string                                                                    | "en"                               | language the response is given in                                  |
| teamName        | string                                                                    | "My team"                          | Team's name                                                        |
| fieldName       | string                                                                    | "Email"                            | Field name (used in Contact and Slider)                            |
| tags            | string\[]                                                                 | \["CSAT"]                          | Question tags  set in the survey editor                            |
| browser         | string                                                                    | Mac OS X Chrome 84.0.4147.105      | Browser information                                                |


# GET Responses

## Get Responses

<mark style="color:blue;">`GET`</mark> `https://api.feedbackly.com/v5.0.2/responses`

This endpoint allows you to access Responses objects from Feedbackly. \
For clarification on different outputs by question type, take a look at the Question types note

#### Query Parameters

| Name              | Type   | Description                                                                                                  |
| ----------------- | ------ | ------------------------------------------------------------------------------------------------------------ |
| skip              | number | Number of documents to skip from the start                                                                   |
| metadata          | string | Filters with provided metadata key-value pairs. Separate with semicolon. Format maker:Apple;phone:iPhone     |
| fieldId           | string | Filters based on the provided field ids. Please refer to the docs about this id.                             |
| questionType      | string | Array of question types. See the docs for available question types.                                          |
| questionId        | string | Filter responses by given question id                                                                        |
| surveyId          | string | Filter responses by given survey ids                                                                         |
| touchpointId      | string | Filter responses by given touchpoint ids                                                                     |
| createdTo         | number | UNIX timestamp. Fetch responses from before this timestamp. Defaults to current timestamp if not specified.  |
| preferredLanguage | string | Language to fetch question titles etc. Defaults to 'en' or the first language available.                     |
| createdFrom       | number | UNIX timestamp. Fetch responses starting from this timestamp. Defaults to start of the day if not specified. |

#### Headers

| Name          | Type   | Description                                                                                          |
| ------------- | ------ | ---------------------------------------------------------------------------------------------------- |
| Authorization | string | <p>Authentication token to access the API eg:<br>'Authorization': 'ey0iuefg.834xcunerun348efnsd'</p> |

{% tabs %}
{% tab title="200 Response successfully retrieved." %}

```
{
  "data": [
    {
      "touchpointName": "Retail location 1",
      "answer": 0.75,
      "questionType": "Button",
      "metadata": {
        "model": "Tesla"
      },
      "valueNum": 0.75,
      "responseChainId": "507f1f77bcf86cd799439011",
      "questionId": "507f1f77bcf86cd799439012",
      "surveyId": "507f1f77bcf86cd799439011",
      "question": "How did we succeed today?",
      "teamId": "507f1f77bcf86cd799439013",
      "createdAtDate": "2019-12-31T10:00:00.000Z",
      "createdAt": 1573507477,
      "touchpointId": "507f1f77bcf86cd799439011",
      "_id": "507f1f77bcf86cd799439011",
      "language": "fi",
      "teamName": "My team name",
      "tags": [
        "CSAT"
      ],
      "browser": "Mac OS X Chrome 84.0.4147.105",
    },
    {
      "answer": 4,
      "valueNum": 4,
      "language": "en",
      "questionType": "NPS",
      "questionId": "58d8d547b8c71e000e3824fd",
      "createdAt": 1490605439,
      "createdAtDate": "2017-03-27T09:03:59.133Z",
      "_id": "5dc57703b7c935069aef31c6",
      "question": "How likely are you to recommend us to a friend or colleague?",
      "metadata": {},
      "responseChainId": "58d8d57d42f73c78c47e2d3d",
      "teamId": "507f1f77bcf86cd799439013",
      "teamName": "My team name",
      "touchpointId": "589c16ad87ef9860199cab37",
      "touchpointName": "Retail location 1",
      "tags": [],
      "browser": "Mac OS X Chrome 84.0.4147.105",
    }
  ],
  "paging": {
    "next": "https://api.feedbackly.com/v5/responses?skip=200",
    "previous": "https://api.feedbackly.com/v5/responses?skip=0"
  }
}
```

{% endtab %}
{% endtabs %}

### Response type description

| Field name | Type                                                            | Example | Description                   |
| ---------- | --------------------------------------------------------------- | ------- | ----------------------------- |
| data       | [Response data](/v.5.0.2/api/responses#response-data-object)\[] |         | The array of response objects |
| paging     | [Pagination](/v.5.0.2/api/notes/pagination)                     |         | Pagination object             |


# GET Response by id

## Get Response by id

<mark style="color:blue;">`GET`</mark> `https://api.feedbackly.com/v5.0.2/responses/:id`

Returns a single response by id

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| id   | string | Response id |

#### Query Parameters

| Name              | Type   | Description                                                                             |
| ----------------- | ------ | --------------------------------------------------------------------------------------- |
| preferredLanguage | string | Language to fetch question titles etc. Defaults to 'en' or the first language available |

#### Headers

| Name          | Type   | Description                                                                                |
| ------------- | ------ | ------------------------------------------------------------------------------------------ |
| Authorization | string | Authentication token to access the API eg: 'Authorization': 'ey0iuefg.834xcunerun348efnsd' |

{% tabs %}
{% tab title="200 " %}

```
{
  "answer": [
    "Facebook",
    "LinkedIn"
  ],
  "valueArray": [
    "adfunr4",
    "dsfgt1w"
  ],
  "language": "en",
  "questionType": "Word",
  "questionId": "58d8d548a4753d000e4665ec",
  "createdAt": 1490868345,
  "createdAtDate": "2017-03-30T10:05:45.781Z",
  "_id": "5dc576ffb7c935069aeebd68",
  "question": "Where did you hear from us?",
  "metadata": {},
  "responseChainId": "58dcd870dde9550aec15ef12",
  "teamId": "5dc56d54b7c935069aefa9e3",
  "teamName": "My team 2",
  "touchpointId": "589c16ad87ef9860199cab37",
  "touchpointName": "Retail location 2",
  "surveyId": "507f1f77bcf86cd799439011",
  "tags": []
}
```

{% endtab %}
{% endtabs %}

### Response type description

Returns [Response data](/v.5.0.2/api/responses#response-data-object)


# Response chains

Getting response chains from Feedbackly

### Response chain data object

| Field           | Type                                                                      | Example                            | Description                                                        |
| --------------- | ------------------------------------------------------------------------- | ---------------------------------- | ------------------------------------------------------------------ |
| touchpointName  | string                                                                    | Touchpoint 1                       | Touch point name                                                   |
| responseChainId | string                                                                    | "507f1f77bcf86cd799439013"         | Id of the full response chain the response belongs to              |
| teamId          | string                                                                    | "507f1f77bcf86cd799439013"         | Team's id                                                          |
| metadata        | { \[key: string]: string}                                                 | {phone: "iPhone X"}                | metadata attached to response                                      |
| createdAtDate   | string                                                                    | "2017-03-27T09:03:59.133Z"         | Response's date in Javascript format                               |
| createdAt       | number                                                                    | 1490605439                         | Response's date in UNIX timestamp                                  |
| touchpointId    | string                                                                    | "507f1f77bcf86cd799439013"         | Touchpoint's id                                                    |
| \_id            | string                                                                    | "507f1f77bcf86cd799439013"         | id of the response                                                 |
| language        | string                                                                    | "en"                               | language the response is given in                                  |
| teamName        | string                                                                    | "My team"                          | Team's name                                                        |
| data            | array                                                                     |                                    | Responses within the response chain                                |
| browser         | string                                                                    | Mac OS X Chrome 84.0.4147.105      | Browser information                                                |
| > answer        | string \| string\[] \| number                                             | 0.5, "Apple", \["Apple", "Orange"] | Mixed-type field related to question type                          |
| > questionType  | "Button" \| "NPS" \| "Word" \| "Slider" \| "Contact" \| "Text" \| "Image" | "Button"                           | [Question type](/v.5.0.2/api/notes#question-types)                 |
| > fieldId?      | string                                                                    | "507f1f77bcf86cd799439013"         | Field id (used in Contact and Slider question types)               |
| > valueString?  | string                                                                    | "Orange"                           | String value of the response                                       |
| > valueArray?   | string\[]                                                                 | \["aoudfsa", "sidfvcx"]            | The technical id of the given responses (Word/Image)               |
| > valueNum      | number                                                                    | 0.5                                | Number value of the response                                       |
| > questionId    | string                                                                    | "507f1f77bcf86cd799439013"         | Question's id                                                      |
| > question      | string                                                                    | "How did we succeed today?"        | The title of the question in the preferred language (if available) |
| > fieldName     | string                                                                    | "Email"                            | Field name (used in Contact and Slider)                            |
| > tags          | string\[]                                                                 | \["CSAT"]                          | Question tags  set in the survey editor                            |


# GET Response-chains

## Response chains

<mark style="color:blue;">`GET`</mark> `https://api.feedbackly.com/v5.0.2/response-chains`

Gets responses grouped by a single respondent.

#### Query Parameters

| Name              | Type   | Description                                         |
| ----------------- | ------ | --------------------------------------------------- |
| skip              | number | No. of documents to skip from the start             |
| createdTo         | string | Filter by unix timestamp, ending at given value     |
| createdFrom       | string | Filter by unix timestamp, starting from given value |
| touchpointId      | string | Filter by touchpoint id                             |
| surveyId          | string | Filter by survey ids                                |
| preferredLanguage | string | Preferred language to show the question titles in   |

#### Headers

| Name          | Type   | Description                                                                                           |
| ------------- | ------ | ----------------------------------------------------------------------------------------------------- |
| Authorization | string | <p>Authentication token to access the API. eg:<br>'Authorization': 'ey0iuefg.834xcunerun348efnsd'</p> |

{% tabs %}
{% tab title="200 " %}

```
{
    data: [
        {
        "_id": "5979be93d296f3dbf83fb056",
        "surveyId": "59788132f870b600018d6dda",
        "touchpointId": "59529fbef3774c0001a49708",
        "touchpointName": "My touchpoint",
        "createdAt": 1501150867,
        "createdAtDate": "2017-07-27T10:21:07.619Z",
        "teamId": "5dc56d54b7c935069aefa9e2",
        "teamName": "My team name",
        "metadata": {
            "customerId": "34tNa31"
        },
        "language": "en",
        "browser": "Mac OS X Chrome 84.0.4147.105",
        "responses": [
            {
                "question": "How likely are you to recommend us to your friend or colleague?",
                "answer": 2,
                "valueNum": 2,
                "language": "en",
                "questionType": "NPS",
                "questionId": "5978813ab9215744ea08e463",
                "surveyId": "59788132f870b600018d6dda"
            },
            {
                "question": "Could you specify what was bad in your experience?",
                "answer": "Your office branch was unclean.",
                "valueString": "Your office branch was unclean.",
                "language": "en",
                "questionType": "Text",
                "questionId": "597881a4b9215744ea08e464",
                "surveyId": "59788132f870b600018d6dda"
            }
        ]
     }
    ],
    "paging": {
        "next": "https://api.feedbackly.com/v5/response-chains?skip=200",
        "previous": "https://api.feedbackly.com/v5/response-chains?skip=0"
  }
}
```

{% endtab %}
{% endtabs %}

### Return type description

| Field  | Type                                                                               | Example | Description                            |
| ------ | ---------------------------------------------------------------------------------- | ------- | -------------------------------------- |
| data   | [Response chain data](/v.5.0.2/api/response-chains#response-chain-data-object) \[] |         | Response chain with embedded responses |
| paging | [Pagination](/v.5.0.2/api/notes/pagination)                                        |         | Pagination object                      |


# GET Response-chain by id

## Response chain by id

<mark style="color:blue;">`GET`</mark> `https://api.feedbackly.com/v5.0.2/response-chains/:id`

Gets an individual response chain by id

#### Path Parameters

| Name | Type   | Description              |
| ---- | ------ | ------------------------ |
| id   | string | Id of the response chain |

#### Query Parameters

| Name              | Type   | Description                                       |
| ----------------- | ------ | ------------------------------------------------- |
| preferredLanguage | string | Preferred language to show the question titles in |

#### Headers

| Name          | Type   | Description                                                                                 |
| ------------- | ------ | ------------------------------------------------------------------------------------------- |
| Authorization | string | Authentication token to access the API. eg: 'Authorization': 'ey0iuefg.834xcunerun348efnsd' |

{% tabs %}
{% tab title="200 " %}

```
{
    "_id": "5979be93d296f3dbf83fb056",
    "surveyId": "59788132f870b600018d6dda",
    "touchpointId": "59529fbef3774c0001a49708",
    "touchpointName": "My touchpoint",
    "createdAt": 1501150867,
    "createdAtDate": "2017-07-27T10:21:07.619Z",
    "teamId": "5dc56d54b7c935069aefa9e2",
    "teamName": "My team name",
    "metadata": {
        "customerId": "34tNa31"
    },
    "language": "en",
    "responses": [
        {
            "question": "How likely are you to recommend us to your friend or colleague?",
            "answer": 2,
            "valueNum": 2,
            "language": "en",
            "questionType": "NPS",
            "questionId": "5978813ab9215744ea08e463",
            "surveyId": "59788132f870b600018d6dda"
        },
        {
            "question": "Could you specify what was bad in your experience?",
            "answer": "Your office branch was unclean.",
            "valueString": "Your office branch was unclean.",
            "language": "en",
            "questionType": "Text",
            "questionId": "597881a4b9215744ea08e464",
            "surveyId": "59788132f870b600018d6dda"
        }
    ]
}
```

{% endtab %}

{% tab title="400 " %}

```
{error: "Not a valid response id    Error id : 1583413424996/E5ohOOdp."}
```

{% endtab %}

{% tab title="404 If the provided id is not found" %}

```
{error: "Not found"}
```

{% endtab %}
{% endtabs %}

### Return type description <a href="#return-type-description" id="return-type-description"></a>

Returns [Response-chain data](/v.5.0.2/api/response-chains)


# Questions

Getting questions from Feedbackly

### Question data object

| Field         | Type      | Example                       | Description                                                      |
| ------------- | --------- | ----------------------------- | ---------------------------------------------------------------- |
| choicesString | string\[] | \["Lamb", "Beef", "Pork"]     | List of available choices in the preferred language (Word/Image) |
| title         | string    | "Which meat did you buy?"     | Question title in the preferred language                         |
| questionType  | string    | "Button"                      | See [question types](/v.5.0.2/api/notes#question-types)          |
| \_id          | string    | "59b8de18784d2f0001a1590d"    | Question id                                                      |
| languages     | string\[] | \["en", "es"]                 | List of available languages for the question                     |
| language      | string    | "en"                          | The language currently selected to display titles etc            |
| subtitle?     | string    | "Please select from below"    | A subtitle for the question (if specified)                       |
| choices       | array     |                               | Array of possible choices                                        |
| > fieldId     | string    | "1"                           | The id of the field                                              |
| > fieldName   | string    | "Beef"                        | The label of the choice                                          |
| > type?       | string    | "string"                      | Type of field (Contact question type)                            |
| > subType?    | string    | "phone"                       | Subtype of the field (Contact question type)                     |
| > imageUrl?   | string    | "<https://example.com/1.png>" | Image url of the choice (Image question type)                    |


# GET Questions

## Questions

<mark style="color:blue;">`GET`</mark> `https://api.feedbackly.com/v5.0.2/questions`

This endpoint returns the questions of all surveys accessable from your account

#### Query Parameters

| Name              | Type   | Description                                                                                                                                             |
| ----------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| skip              | number | Number of documents to skip from the start                                                                                                              |
| preferredLanguage | string | Preferred language to show the question titles in eg. 'en'. If the specified language is not available, it will default to the first available language |
| questionId        | array  | Filter by question ids                                                                                                                                  |
| surveyId          | array  | Survey ids related to the question                                                                                                                      |

#### Headers

| Name          | Type   | Description                                                                                          |
| ------------- | ------ | ---------------------------------------------------------------------------------------------------- |
| Authorization | string | <p>Authentication token to access the API eg:<br>'Authorization': 'ey0iuefg.834xcunerun348efnsd'</p> |

{% tabs %}
{% tab title="200 " %}

```
{
    "data": [
        {
            "_id": "59b8de984084087cd3346743",
            "title": "Which meat did you buy?",
            "choicesString": [
                "Lamb",
                "Beef",
                "Pork"
            ],
            "questionType": "Word",
            "languages": [
                "en"
            ],
            "language": "en",
            "choices": [
                {
                    "fieldId": "1",
                    "fieldName": "Lamb"
                },
                {
                    "fieldId": "59b8deaa4084087cd3346744",
                    "fieldName": "Beef"
                },
                {
                    "fieldId": "59b8deac4084087cd3346745",
                    "fieldName": "Pork"
                }
            ],
            "surveyId": "59b8de18784d2f0001a1590d"
        },
    ],
    "paging": {
        "next": "https://api.feedbackly.com/v5/questions?preferredLanguage=en&skip=100",
        "previous": null
    }
}
```

{% endtab %}
{% endtabs %}

### Request Return type

| Field  | Type                                                                    | Example | Description       |
| ------ | ----------------------------------------------------------------------- | ------- | ----------------- |
| data   | [Question Data object](/v.5.0.2/api/questions#question-data-object) \[] |         | Question objects  |
| paging | [Pagination](/v.5.0.2/api/notes#pagination)                             |         | Pagination object |


# GET Question by id

## Question by id

<mark style="color:blue;">`GET`</mark> `https://api.feedbackly.com/v5.0.2/questions/:id`

Gets a specific question by id

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| id   | string | Question id |

#### Query Parameters

| Name              | Type   | Description                                                                                                                                             |
| ----------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| preferredLanguage | string | Preferred language to show the question titles in eg. 'en'. If the specified language is not available, it will default to the first available language |

#### Headers

| Name          | Type   | Description                                                                                |
| ------------- | ------ | ------------------------------------------------------------------------------------------ |
| Authorization | string | Authentication token to access the API eg: 'Authorization': 'ey0iuefg.834xcunerun348efnsd' |

{% tabs %}
{% tab title="200 " %}

```
{
    "_id": "58d8d547b8c71e000e3824fc",
    "title": "How likely are you to recommend us to a friend or colleague?",
    "subtitle": "0=Not likely at all 10=Extremely likely",
    "choicesString": [],
    "questionType": "NPS",
    "languages": [
        "en",
        "es",
        "af"
    ],
    "language": "en",
    "choices": [],
    "surveyId": "58d8d3d14cb016000e203e0e"
}
```

{% endtab %}

{% tab title="401 " %}

```
{
    "error": "Question inaccessible    Error id : 1583414902648/mOXsfkd7."
}
```

{% endtab %}
{% endtabs %}

### Request Return type

Returns [Question Data object](/v.5.0.2/api/questions#question-data-object)


# Surveys

### Survey data object

| Field          | Type      | Example                                                | Description                                             |
| -------------- | --------- | ------------------------------------------------------ | ------------------------------------------------------- |
| teamId         | string    | "5a3386af952bf6000177bdda"                             | Team id                                                 |
| languages      | string\[] | \["en", "es"]                                          | List of available languages for the survey              |
| name           | string    | "Satisfaction survey"                                  | Survey name                                             |
| \_id           | string    | "5a3386af952bf6000177bdda"                             | Survey id                                               |
| language       | string    | "en"                                                   | Language used to display titles, choices etc            |
| teamName       | string    | "My team name"                                         | Team name                                               |
| createdBy      | string    | "Khal Drogo"                                           | User name                                               |
| archived       | boolean   | false                                                  | Whether the survey is archived                          |
| questions      | array     |                                                        | Questions embedded within the survey                    |
| > \_id         | string    | "5a3386af952bf6000177bdda"                             | Question id                                             |
| > questionType | string    | "NPS"                                                  | [See Question types](/v.5.0.2/api/notes#question-types) |
| > title        | string    | "How would you recommend us to a friend or colleague?" | Question title                                          |
| > choices      | array     |                                                        | Question choices                                        |
| >> fieldId     | string    | "1"                                                    | The id of the field                                     |
| >> fieldName   | string    | "Beef"                                                 | The label of the choice                                 |
| >> type?       | string    | "string"                                               | Type of field (Contact question type)                   |
| >> subType?    | string    | "tel"                                                  | Subtype of the field (Contact question type)            |
| >> imageUrl?   | string    | "<https://example.com/1.png>"                          | Image url of the choice (Image question type)           |


# GET Surveys

## Surveys

<mark style="color:blue;">`GET`</mark> `https://api.feedbackly.com/v5.0.2/surveys`

This endpoint returns all available surveys with the questions embedded

#### Query Parameters

| Name              | Type   | Description                                |
| ----------------- | ------ | ------------------------------------------ |
| skip              | number | Number of documents to skip from the start |
| preferredLanguage | string | Preferred language to show the titles in   |

#### Headers

| Name          | Type   | Description                                                                                |
| ------------- | ------ | ------------------------------------------------------------------------------------------ |
| Authorization | string | Authentication token to access the API eg: 'Authorization': 'ey0iuefg.834xcunerun348efnsd' |

{% tabs %}
{% tab title="200 Cake successfully retrieved." %}

```
{
 "data": [
  {
    "_id": "589c16e487ef9860199cab3c",
    "name": "Example",
    "createdBy": "Admin",
    "teamId": "5dc56d54b7c935069aefa9e2",
    "teamName": "My team name",
    "languages": ["en"],
    "archived": false,
    "questions": [
      {
        "_id": "5a3b47d0e90828878851a1f5",
        "title": "Contact form",
        "subtitle": "Please type in your details",
        "choicesString": [
            "EMAIL",
            "PHONE"
        ],
        "questionType": "Contact",
        "languages": [
            "en"
        ],
        "language": "en",
        "choices": [
            {
                "fieldId": "5a3c353aecee8cb220b0270c",
                "fieldName": "EMAIL",
                "type": "string",
                "subType": "email"
            },
            {
                "fieldId": "5a3c353eecee8cb220b0270d",
                "fieldName": "PHONE",
                "type": "string",
                "subType": "tel"
            }
        ],
        "surveyId": "5a3b47c946d70600010fe412"
      }
    ]
  }
 ],
 "paging": {
     "next": null,
     "previous": null
 }
}
```

{% endtab %}

{% tab title="404 Could not find a cake matching this query." %}

```
```

{% endtab %}
{% endtabs %}

### Request return type

| Field  | Type                                                              | Example | Description         |
| ------ | ----------------------------------------------------------------- | ------- | ------------------- |
| data   | [Survey data object](/v.5.0.2/api/surveys#survey-data-object) \[] |         | Survey data objects |
| paging | [Pagination](/v.5.0.2/api/notes/pagination)                       |         | Pagination object   |


# GET Surveys by id

## Survey by id

<mark style="color:blue;">`GET`</mark> `https://api.feedbackly.com/v5.0.2/surveys/:id`

Gets question by id

#### Path Parameters

| Name | Type   | Description      |
| ---- | ------ | ---------------- |
| id   | string | Id of the survey |

#### Query Parameters

| Name              | Type   | Description                              |
| ----------------- | ------ | ---------------------------------------- |
| preferredLanguage | string | Preferred language to show the titles in |

#### Headers

| Name          | Type   | Description                                                                                |
| ------------- | ------ | ------------------------------------------------------------------------------------------ |
| Authorization | string | Authentication token to access the API eg: 'Authorization': 'ey0iuefg.834xcunerun348efnsd' |

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}

### Request return type <a href="#request-return-type" id="request-return-type"></a>

Returns ​[Survey data object](/v.5.0.2/api/surveys#survey-data-object)


# Touchpoints

Touchpoints are the identifiable sources of all responses.

### Touchpoint data model

| Field            | Type   | Example                    | Description                                  |
| ---------------- | ------ | -------------------------- | -------------------------------------------- |
| \_id             | string | "507f191e810c19729de860ea" | Unique id                                    |
| name             | string | "Feedback terminal"        | Name of the touchpoint                       |
| teamId           | string | "507f191e810c19729de860eb" | Team id this touchpoint belongs to           |
| activeSurveyId   | string | "507f191e810c19729de860ec" | Id of the active survey on this touchpoint   |
| activeSurveyName | string | "NPS Survey"               | Name of the active survey on this touchpoint |
| lastResponse     | number | 1598017724                 | UNIX timestamp of the last response          |
| lastResponseDate | string | "2020-08-21T13:49:44.951Z" | Last response in ISO String format           |


# GET Touchpoints

## Get Touchpoints

<mark style="color:blue;">`GET`</mark> `https://api.feedbackly.com/v5.0.2/touchpoints`

This endpoint allows you to access Touchpoint objects from Feedbackly.&#x20;

#### Query Parameters

| Name   | Type   | Description                                |
| ------ | ------ | ------------------------------------------ |
| teamId | string | Filter touchpoints by teamId               |
| skip   | number | Number of documents to skip from the start |

#### Headers

| Name          | Type   | Description                                                                                          |
| ------------- | ------ | ---------------------------------------------------------------------------------------------------- |
| Authorization | string | <p>Authentication token to access the API eg:<br>'Authorization': 'ey0iuefg.834xcunerun348efnsd'</p> |

{% tabs %}
{% tab title="200 Response successfully retrieved." %}

```
{
  "data": [
    {
      "_id": "5dc57703b7c935069aef31c5",
      "name": "Feedback terminal 1",
      "teamId": "5dc57703b7c935069aef31c1",
      "activeSurveyId": "5dc57703b7c935069aef31a2",
      "activeSurveyName": "NPS Survey",
      "lastResponse": 159801789,
      "lastResponseDate": "2020-08-21T13:52:01.606Z"
    },
    {
      
      "_id": "5dc57703b7c935069aef31c6",
      "name": "Web widget home page",
      "teamId": "5dc57703b7c935069aef31c2",
      "activeSurveyId": "5dc57703b7c935069aef31a1",
      "activeSurveyName": "CES Survey",
      "lastResponse": 159801789,
      "lastResponseDate": "2020-08-21T13:52:01.606Z"
    }
  ],
  "paging": {
    "next": "https://api.feedbackly.com/v5.0.2/touchpoints?skip=200",
    "previous": "https://api.feedbackly.com/v5.0.2/touchpoints?skip=0"
  }
}
```

{% endtab %}
{% endtabs %}

### Response type description

| Field name | Type                                                                  | Example | Description                     |
| ---------- | --------------------------------------------------------------------- | ------- | ------------------------------- |
| data       | [Touchpoint data](/v.5.0.2/api/touchpoints#touchpoint-data-model) \[] |         | The array of touchpoint objects |
| paging     | [Pagination](/v.5.0.2/api/notes/pagination)                           |         | Pagination object               |


# GET Touchpoint by id

## Get Touchpoint by id

<mark style="color:blue;">`GET`</mark> `https://api.feedbackly.com/v5.0.2/touchpoints/:id`

This endpoint allows you to access Touchpoint objects by id from Feedbackly.&#x20;

#### Path Parameters

| Name | Type   | Description          |
| ---- | ------ | -------------------- |
| id   | string | Id of the touchpoint |

#### Headers

| Name          | Type   | Description                                                                                          |
| ------------- | ------ | ---------------------------------------------------------------------------------------------------- |
| Authorization | string | <p>Authentication token to access the API eg:<br>'Authorization': 'ey0iuefg.834xcunerun348efnsd'</p> |

{% tabs %}
{% tab title="200 Response successfully retrieved." %}

```
{
  "_id": "5dc57703b7c935069aef31c5",
  "name": "Feedback terminal 1",
  "teamId": "5dc57703b7c935069aef31c1",
  "activeSurveyId": "5dc57703b7c935069aef31a2",
  "activeSurveyName": "NPS Survey",
  "lastResponse": 159801789,
  "lastResponseDate": "2020-08-21T13:52:01.606Z",
}
```

{% endtab %}
{% endtabs %}

### Response type description

| Field name | Type                                                                  | Example | Description                     |
| ---------- | --------------------------------------------------------------------- | ------- | ------------------------------- |
| data       | [Touchpoint data](/v.5.0.2/api/touchpoints#touchpoint-data-model) \[] |         | The array of touchpoint objects |
| paging     | [Pagination](/v.5.0.2/api/notes/pagination)                           |         | Pagination object               |


# Notes


# Entity relationships

![](/files/-MFU7lSeoqw8spyJPgfK)

### Survey

Survey is the main container for several Questions. Each Question refers to a screen on a survey. In the REST API structure, survey returns an array of Questions.&#x20;

### Question

Question refer to a screen inside a survey and is normally returned as a part of a Survey call. Each Question can also be retrieved invidually via the Questions API. Questions can be part of many surveys but this is a rare case (custom applications).

### Response chain

Response chain is a whole answer to one entire survey. The contents of the responses field is an array of one or more responses depending on which questions the respondent has answered. If the survey has been not answered fully the responses field will only contain the responses up to the point of exit by the customer. Also, skipping logic applied via the survey can result into varying sets of responses by the user.&#x20;

### Response

A Response is an answer to an individual **field** of a Question. Regularly you only have 1 field inside the Question but for Slider and Contact question types the answers are separate Response objects. Each Response shares the `responseChainId` as a foreign key but those fields have a `fieldId` which links to the specific `choice.fieldId` inside a Question.

### Touchpoints

Touchpoints are the source of the incoming responses. This can be an individual Feedbackly terminal, a web widget, an email list etc. Responses have a unique `touchpointId` and a `touchpointName` to further clarify the source of responses. Each Response chain can only have one touchpoint because it represents one session (one respondent).


# Pagination

For endpoints that returns multiple objects, pagination is done by providing the URL's to get the next objects (if more are available)

| Field    | Example                                                |
| -------- | ------------------------------------------------------ |
| next     | <https://api.feedbackly.com/v5.0.2/responses?skip=400> |
| previous | <https://api.feedbackly.com/v5.0.2/responses?skip=0>   |


# Question types

This table clarifies the different outputs per question type

| Question type | Description                                                                                                                                                                                                                                                                                                                                                                             | Field                                                  | Example                                                                                        |                                                                                                                                                                                                                                |
| ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ | ---------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Button        | <p>Smileys / Satisfaction</p><p></p><p>The values are in the scale of 0-1.</p><p></p><p>5 buttons: 0, 0.25, 0.5, 0.75, 1</p><p>4 buttons: 0, 0.33, 0.66, 1</p>                                                                                                                                                                                                                          | <p>valueNum: number</p><p>answer: number</p>           | <p>valueNum: 0.5</p><p>answer: 0.5</p>                                                         |                                                                                                                                                                                                                                |
| NPS           | <p>NPS question</p><p>Numbers 0-10</p>                                                                                                                                                                                                                                                                                                                                                  | <p>valueNum: number</p><p>answer: number</p>           | <p>valueNum: 4</p><p>answer: 4</p>                                                             |                                                                                                                                                                                                                                |
| Word          | <p>Category / Selection / Multiselect</p><p></p><p>Answer will either be a string value if the </p><p>question is single select or an array of strings </p><p>if the question is a multi-select.</p><p></p><p>valueArray will contain the unique id's of the </p><p>choice(s) selected while answer contains the </p><p>string representations of the choice in the language chosen</p> | <p>valueArray: string\[]</p><p></p><p>answer: string   | string\[]</p>                                                                                  | <p><strong>Multiselect:</strong> </p><p>valueArray: \['sdfs3, 'asdas1]</p><p></p><p>answer: \['Apples', 'Oranges']</p><p></p><p><strong>Single select:</strong> </p><p>valueArray: \['533rf']</p><p></p><p>answer: 'Pears'</p> |
| Image         | <p>Category / Selection by image</p><p></p><p>Same as above</p>                                                                                                                                                                                                                                                                                                                         | Same as above                                          | Same as above, outputs image labels                                                            |                                                                                                                                                                                                                                |
| Slider        | <p>Slider question. These questions contain multiple responses depending on the field responded to. In order to connect these answers together, you look at the <em>responseChainId</em> and the <em>questionId</em></p><p></p><p>Each field contains a <em>fieldId</em>  and a <em>fieldName</em> to distinguish the responses apart.</p><p></p><p>The scale is 0-10.</p>              | <p>valueNum: number</p><p></p><p>answer: number</p>    | <p>valueNum: 4</p><p></p><p>answer: 4</p>                                                      |                                                                                                                                                                                                                                |
| Contact       | Contact form question. Like Slider question, this question might have multiple responses per question.                                                                                                                                                                                                                                                                                  | <p>valueString: string</p><p>answer: string</p>        | <p>valueString: "<example@example.com>"</p><p></p><p>answer:</p><p>"<example@example.com>"</p> |                                                                                                                                                                                                                                |
| Text          | Open-ended field.                                                                                                                                                                                                                                                                                                                                                                       | <p>valueString: string</p><p></p><p>answer: string</p> | <p>valueString: "I was happy"</p><p></p><p>answer: "I was happy"</p>                           |                                                                                                                                                                                                                                |


# Getting started

## Installing the website widget

### Verifying installation

Go to your website and open up the developer console in your browser. In Chrome, this can be done via the command `⌘ + option + J`

Find the console from the bottom of the developer tools. Type in `FBLY` and press enter. If your plugin is installed properly, the command should return `true`. Your plugin is all set up!

![](/files/-M-Q827NQawL9lZh-cQ2)

If the script is not installed, you'll get an error like so:

![](/files/-M-Q8CgSlMkWOg8azyTH)

If this is the case, please verify that the plugin is installed properly on your website.


# Attaching custom metadata to responses

## Overview

Custom metadata is any additional information you wish to include in your response. This metadata will be available in the Response list in the analytics section in Feedbackly. You can also filter and group responses by metadata.

Metadata will be included to the subsequent survey responses made by the visitor on the site. Metadata will always be included in responses until it is cleared or the user resets their browser cookies.

Note: Metadata can be added at any point of time **before** a survey is launched.&#x20;

### Using the Javascript API to include metadata to the response

When the Feedbackly widget is installed on the site, run

```
FBLY.action("addMeta", KEY, VALUE);
```

Example:

&#x20;`FBLY.action("addMeta", "customerId", "12345");`

This command adds a customer id to the subsequent responses of the user.

### Removing a single metadata value from the visitor

This action will a single metadata key and value from the visitor. It does not affect previous responses given by the user, however.

```
FBLY.action("removeMeta", KEY)
```

Example:&#x20;

`FBLY.action("removeMeta", "customerId")`

This action removes the customerId set in the previous example.

### Clearing all metadata from a visitor

This action will clear all the metadata from the visitor. It does not affect previous responses given by the user, however. This action needs to be run before a survey is launched.

Using Javascript, run

```
FBLY.action("clearMeta")
```


# Triggering surveys via custom properties

### Overview

Custom triggering properties are used to have a more fine-grained control over the triggering properties of a Feedbackly website widget.

For instance, you might want to trigger a survey based on whether a customer is logged in to the members' are in your website. This can be easily accomplished provided that there is Javascript access to the information required to set the triggering behavior.

### Set up custom triggering parameters in the Feedbackly dashboard

In the website triggering options, open up *Advanced targeting* and add the property under *Custom Properties* like so

![](/files/-M1f4_vAfZduN9gR-b2f)

### Adding a custom triggering property to the Feedback widget via the Javascript API

When the Feedbackly widget is installed, run

```
FBLY.action("addCustomProperty", KEY, VALUE)
```

**Example**

Let's assume the information of the logged in status is stored in a Javascript variable accessible in the namespace the widget command is run. For this example, we'll assume it's stored in `user.loggedIn` variable.

Running `FBLY.action("addCustomProperty", "loggedIn", "true")` will tell the widget that the user is logged in. If the widget triggering settings has that property set, the survey will then trigger (if no other restrictions are set)

### Removing a single custom triggering property

When you want to prevent further surveys from displaying because of a custom property

When the Feedbackly widget is installed, run

```
FBLY.action("removeCustomProperty", KEY)
```

**Example**

Following the previous example, if we want to remove a custom triggering property (let's say the user logs out) we would run this command:

`FBLY.action("removeCustomProperty", "loggedIn")`

### Clearing all custom properties

This command clears all custom triggering properties of the visitor

```
FBLY.action("clearCustomProperties")
```


# Debugging website widgets

Due to the amount of variables it's not always straightforward to figure out why exactly a survey triggers/doesn't open for a visitor.

To find out more about the underlying reasons, Feedbackly provides the means to debug this.

If you need to check the installation status of a widget, please see [Verifying installation.](/v.5.0.2/website-widgets/getting-started#verifying-installation)

### List all triggering options available to the visitor

When on your website and with Feedbackly widget installed, open up the dev tools for the browser. In Chrome, this can be done via the command `⌘ + option + J`

Run the following command:

```
FBLY.getConfiguration();
```

The console should print out an array of configuration objects similar to this:

![](/files/-M1f7LV-1QpFg4zEJMHL)

This is in essence the JSON-representation of your website triggering parameters available on the Feedbackly UI's widget triggering parameters. All the objects in this array are the potential surveys to be shown to the user when conditions are met.

### Listing client data

To find out what data the widget has recorded of the visitor, run

```
FBLY.getConfiguration();
```

![](/files/-M1f8vmsHn16fCECn99B)

This data can be useful in determining whether the visitor has met the conditions for a survey to be triggered.

A few remarks on the properties:

* `session.declinedActivations` lists whether the user has declined a survey, its id and timestamp
* `session.sampledActivations` shows whether the visitor fits to the sample of the survey
* `visitedUrls` shows all visited urls of the visitor
* `scroll` shows the current page scroll of the visitor


