# Responses

## 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](#response-data-object)\[]                         |         | The array of response objects |
| paging     | [Pagination](https://docs.feedbackly.com/master/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](https://docs.feedbackly.com/master/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                                  |
