# 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.md#survey-data-object) \[] |         | Survey data objects |
| paging | [Pagination](/master/responses/notes.md#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.md#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)                   |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.feedbackly.com/master/responses/surveys.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
