<!-- Generated from the canonical 99 Digital API documentation. Do not edit this file. -->

Canonical page: https://docs.99digital.co.il/online-api/conversations/send-csat-survey

# Send CSAT Survey

`POST https://online.99digital.co.il/api/v1/accounts/{account_id}/conversations/{conversation_id}/send_survey`

Sends a customer-satisfaction (CSAT) survey message to the contact in this conversation.

The survey is sent as an outgoing message with `content_type`
`input_csat`, which holds a link to the survey. When the contact answers,
the `csat_survey_submitted`
[webhook event](https://docs.99digital.co.il/online-api/webhooks/webhook-events) is sent.

| Setting | Value |
| --- | --- |
| **Method** | `POST` |
| **Path** | `/api/v1/accounts/{account_id}/conversations/{conversation_id}/send_survey` |
| **Authorization** | User token or **agent-bot token**. |

**Permissions:**

- User token: any agent who can see the conversation — see
  [Who can see a conversation](https://docs.99digital.co.il/online-api/conversations/conversation-basics#who-can-see-a-conversation).

**Path parameters**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `account_id` | integer | Yes | Account ID. |
| `conversation_id` | integer | Yes | Conversation display ID. |

**Body parameters (JSON)**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `survey_id` | integer | No | CSAT survey ID (from the account's CSAT surveys). Omit to send the built-in default survey. |

**Example request**

```bash
curl -X POST 'https://online.99digital.co.il/api/v1/accounts/12/conversations/1501/send_survey' \
  -H 'api_access_token: <YOUR_API_ACCESS_TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{}'
```

**Example response**: `200 OK` with an empty body. An outgoing message with
`content_type: "input_csat"` is added to the conversation — here, for
survey `3`:

```json
{
  "id": 40120,
  "content": "Please rate this conversation, https://online.99digital.co.il/survey/responses/NDAxMjA=",
  "message_type": 1,
  "content_type": "input_csat",
  "content_attributes": {
    "submitted_values": {
      "csat_survey_response": {
        "csat_survey_id": 3
      }
    }
  }
}
```

**Error responses**

| Status | When | Body |
| --- | --- | --- |
| `404` | No CSAT survey with this `survey_id`. | `{"error": "Survey not found"}` |

## Authentication

`api_access_token` in the header — Your access token. A user token is in the dashboard under **Profile settings → Access Token**, and grants exactly what that agent's role allows. An agent-bot token may call only the endpoints marked for agent bots. See [Getting Started](https://docs.99digital.co.il/online-api/getting-started#authentication).

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `account_id` | path | integer | Yes | The numeric ID of your account: the number after `/app/accounts/` in the dashboard URL. Example: `12`. |
| `conversation_id` | path | integer | Yes | The numeric ID of the conversation: its display ID, which is the `id` in conversation responses and the number in the dashboard URL. Example: `1501`. |

## Request body

Content type: `application/json`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `survey_id` | integer | No | The ID of one of the account's CSAT surveys. Leave it out to send the built-in default survey. Example: `3`. |

### Example: Default survey

The built-in default survey.

```json
{}
```

### Example: A specific survey

One of the account's CSAT surveys.

```json
{
  "survey_id": 3
}
```

## Responses

### 200 — The survey was sent, with an empty body.

### 401 — The access token is missing or wrong, or its user does not belong to this account.

Content type: `application/json`

| Field | Type | Description |
| --- | --- | --- |
| `error` | string | The error message. |

#### Example: Invalid token

The api_access_token header is missing or wrong.

```json
{
  "error": "Invalid Access Token"
}
```

#### Example: Another account

A valid token, for a user who is not in this account.

```json
{
  "error": "You are not authorized to access this account"
}
```

### 403 — The token's role does not have the permission this endpoint needs, or the endpoint is not open to agent-bot tokens. See [Authorization](https://docs.99digital.co.il/online-api/getting-started#authorization).

Content type: `application/json`

| Field | Type | Description |
| --- | --- | --- |
| `error` | string | The error message. |

#### Example: No permission

The role lacks the permission.

```json
{
  "error": "You are not authorized to do this action"
}
```

#### Example: Agent bot

An agent-bot token on an endpoint that is not open to bots.

```json
{
  "error": "Access to this endpoint is not authorized for bots"
}
```

### 404 — The conversation or the survey does not exist in this account.

Content type: `application/json`

| Field | Type | Description |
| --- | --- | --- |
| `error` | string | The error message. |

#### Example: Survey not found

No CSAT survey with this `survey_id`.

```json
{
  "error": "Survey not found"
}
```

#### Example: Conversation not found

No conversation with this ID.

```json
{
  "error": "Resource could not be found"
}
```
