> ## Documentation Index
> Fetch the complete documentation index at: https://docs.thinnest.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Post-Call Survey

> Ask callers a survey question before ending the call — collect ratings, yes/no responses, or open-ended feedback.

# Post-Call Survey

The **Post-Call Survey** tool prompts the caller with a survey question before ending the call. Responses are saved to the session for analytics. Supports rating scales, yes/no, and open-ended formats.

## How It Works

```
Agent: "Before I let you go, I'd love your feedback. On a scale of 1 to 5, how would you rate your experience today?"
Caller: "I'd say 4 out of 5."
-> Agent calls record_survey_response with response="4 out of 5", rating=4
Agent: "Thank you for the feedback! Have a great day."
```

## Configuration

```json theme={null}
{
  "postCallSurveyEnabled": true,
  "surveyQuestion": "On a scale of 1 to 5, how would you rate your experience today?",
  "surveyType": "rating"
}
```

| Setting                 | Type    | Default  | Description                                     |
| ----------------------- | ------- | -------- | ----------------------------------------------- |
| `postCallSurveyEnabled` | boolean | `false`  | Enable post-call survey                         |
| `surveyQuestion`        | string  | —        | The survey question to ask                      |
| `surveyType`            | string  | `rating` | Response type: `rating`, `yes_no`, `open_ended` |

## Survey Types

| Type         | Agent Behavior                      |
| ------------ | ----------------------------------- |
| `rating`     | Asks for a rating from 1 to 5 stars |
| `yes_no`     | Asks a yes or no question           |
| `open_ended` | Asks for open-ended feedback        |

## LLM Tool

**Tool name:** `record_survey_response`

```
Parameters:
  response: string (the caller's survey answer)
  rating: integer (numeric rating, 0 if not applicable)

Returns: "Survey response recorded. Thank the caller and end the call."
```

## Saved Data

Survey responses are saved to the `voice_sessions` table:

```json theme={null}
{
  "question": "On a scale of 1 to 5, how would you rate your experience today?",
  "type": "rating",
  "response": "4 out of 5",
  "rating": 4
}
```

## Example — Create Agent with Post-Call Survey

```bash theme={null}
curl -X POST https://api.thinnest.ai/v1/agents \
  -H "Authorization: Bearer $THINNESTAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Support Agent with Survey",
    "model": "gpt-4o-mini",
    "instructions": "You are a customer support agent. Before ending the call, ask the survey question and record the response. Do not skip the survey unless the caller refuses.",
    "voiceEnabled": true,
    "transcriber": { "provider": "deepgram", "model": "nova-2-conversationalai" },
    "voice": { "provider": "deepgram", "voiceId": "aura-2-thalia-en" },
    "postCallSurveyEnabled": true,
    "surveyQuestion": "On a scale of 1 to 5, how would you rate your experience today?",
    "surveyType": "rating"
  }'
```
