> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.trustmary.com/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# Surveys (developers)

Surveys are used to collect feedback from contacts or anonymous respondees.

# Survey object

### Attributes

**id** string
Unique identifier.

**type** string
Type of survey. Allowed values: customer, employee, embed

**count** integer
Amount of answers in the survey.

**name** string
User defined name of the survey.

**created_at** ISO 8601 with timezone
Time when the object was created.

**updated_at** ISO 8601 with timezone
Time of last action performed on the object.

**deleted_at** ISO 8601 with timezone or null
If the object was deleted, time of the last deletion.

```json
{        
      "id": "kcSBv12f",
      "type": "customer",
      "count": 175,
      "name": "Customer survey",
      "created_at": "2021-03-26T13:13:19.972Z",
      "updated_at": "2021-04-19T19:57:31.122Z",
      "deleted_at": null        
}
```

# Getting Surveys

```json
GET /surveys
```

### Body attributes

**type** string
Type of surveys to retrieve. Allowed values: customer, employee, embed

**offset** integer (optional)
By default, you'll only get the first 1000 surveys. When you want the next 1000 surveys, use offset 1000 and so on.

```json
{  
  "type": "customer"
}
```

# Returning

An array of Survey objects.

### Getting Surveys

```json
GET /survey/:survey_id
```

Survey structure that can be used to see which fields represent what in the answers. Fields contains the available fields.

```json
{    
	"id": "ack1fc9cx",
    "name": "SaaS product NPS",
    "organization_id": "masc1XO6",
    "type": "customer",
    "status": "open",
    "fields": [        
    	{           
        	"name": "nps",
           	"webhook_name": "nps",
           	"type": "nps",
            "label": "How likely are you to recommend our online service to a friend or colleague?"
         },
         {            
            "name": "feedback",
            "webhook_name": "feedback",
            "type": "comment",
            "label": "What is the primary reason for your score?"
         },
```
