> For the complete documentation index, see [llms.txt](https://documents.blocksurvey.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documents.blocksurvey.io/survey/update-a-survey-text-variable-value.md).

# Update a survey text variable value

### Overview

This endpoint updates a text variable value for a specific survey.

### Authentication

This request requires an Authorization header with a valid token.

\
**URL:** `POST https://api3.blocksurvey.io/v1/survey/text_variable_value`

\
**Body Parameters**

| Parameter         | Type    | Optional | Description                                                                  |
| ----------------- | ------- | -------- | ---------------------------------------------------------------------------- |
| surveyId          | String  | No       | The ID of the survey.                                                        |
| textVariableFlag  | Boolean | No       | Flag to set the text variable (true for insert/update and false for delete). |
| textVariableName  | String  | No       | The name of the text variable.                                               |
| textVariableValue | String  | Yes      | The value of the text variable.                                              |
| teamId            | String  | Yes      | The team ID.                                                                 |

Here's the JSON body data:

```json
{
    "surveyId": "123456",
    "teamId": "1234",
    "textVariableFlag": true,
    "textVariableName": "ref",
    "textVariableValue": "xyz"
}
```

### **cURL Example**

```bash
curl --request POST \
 --url 'https://api3.blocksurvey.io/v1/survey/text_variable_value' \
 --header  'Authorization: Bearer user_api_token' \
 --header 'Content-Type: application/json' \
 --data '{
    "surveyId": "YOUR_SURVEY_ID",
    "textVariableFlag": true/false,
    "textVariableName": "YOUR_TEXT_VARIABLE_NAME",
    "textVariableValue": "YOUR_TEXT_VARIABLE_VALUE",
    "teamId": "YOUR_TEAM_ID"
 }'
```

Remember to replace `YOUR_SURVEY_ID`, `YOUR_TEXT_VARIABLE_NAME`, `YOUR_TEXT_VARIABLE_VALUE`, and `YOUR_TEAM_ID` with actual values when testing or using this API endpoint. The `textVariableFlag` should be either `true` or `false`.

### Response

**Successful Response**

```json
{
  "status": "success",
  "message": "Survey text variable updated successfully."
}
```
