> For the complete documentation index, see [llms.txt](https://docs.plumvoice.com/insight/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.plumvoice.com/insight/api/checking-total-responses-for-a-survey.md).

# Checking Total Responses for a Survey

## Total Survey Responses

<mark style="color:blue;">`GET`</mark> `https://insight.plumvoice.com/api/surveys/{survey_id}/{instance_id}/responses`

Check the total number of responses for an Insight survey.

#### Path Parameters

| Name         | Type   | Description                           |
| ------------ | ------ | ------------------------------------- |
| survey\_id   | string | Insight survey ID number              |
| instance\_id | string | Instance number for an Insight survey |

#### Headers

| Name         | Type   | Description                       |
| ------------ | ------ | --------------------------------- |
| content-type | string | application/x-www-form-urlencoded |

{% tabs %}
{% tab title="200 On success" %}
{% tabs %}
{% tab title="JSON" %}

```javascript
{'success':true,'total_responses':'25'}
```

{% endtab %}

{% tab title="XML" %}

```markup
<result>
  <success>true</success>
  <total_responses>25</total_responses>
</result>
```

{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="404 On failure: this example provides an invalid survey\_id or instance\_id." %}
{% tabs %}
{% tab title="JSON" %}

```javascript
{'success':false,'error':'No deployment was found for that survey and instance id combination.'}
```

{% endtab %}

{% tab title="XML" %}

```markup
<result>
  <success>false</success
  <error>No deployment was found for that survey and instance id combination.</error>
</result>
```

{% endtab %}
{% endtabs %}
{% endtab %}
{% endtabs %}

### **Possible Response Codes**

* **200**: success
* **401**: authentication headers invalid or the account is inactive
* **404**: deployment or survey was not found
* **405**: invalid HTTP method supplied (only GET allowed)
* **415**: unsupported media type (Content-Type value in request)
* **500**: database error

The return structure contains the following item(s):

| Name            | Data Type | Always Present | Description                                                                                              |
| --------------- | --------- | -------------- | -------------------------------------------------------------------------------------------------------- |
| success         | boolean   | yes            | Indicates the outcome of the request                                                                     |
| error           | string    | no             | If the success value is false this provides a message indicating what error(s) occurred                  |
| total\_reponses | int       | no             | The total number of times the survey has been taken. This will be present when the success value is true |

### **Sample Code**

This sample PHP code makes a request to a deployed survey that returns the total number of responses:

```php
<?php
$ch = curl_init();
$url = 'https://insight.plumvoice.com/api/surveys/{survey_id}/{instance_id}/responses';
$username = 'you@yourdomain.com';
$password = 'your_developer_key';
curl_setopt($ch, CURLOPT_USERPWD, $username.":".$password);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept: application/json", "Content-Type: application/x-www-form-urlencoded"));
$result = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
var_dump($result);
var_dump($http_code);
```
