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

# Questionnaires

> Publish SurveyJS questionnaire models through the Management API

# Questionnaires

The Management API can replace the live SurveyJS model of a questionnaire owned by your
organisation. This operation publishes immediately and removes any older autosaved draft from the
admin editor.

<Warning>
  This endpoint changes the questionnaire shown to patients immediately. Send the complete SurveyJS
  model, not a partial patch.
</Warning>

## Update a Questionnaire Model

```bash theme={null}
curl -X PATCH "https://api.rxscale.com/v1/management/questionnaires/{questionnaire_uid}/model" \
  -H "X-API-Key: your-api-key-here" \
  -H "Content-Type: application/json" \
  -d '{
    "model": {
      "title": "Medical questionnaire",
      "pages": [
        {
          "name": "general",
          "elements": [
            {
              "type": "text",
              "name": "symptoms",
              "title": "Please describe your symptoms"
            }
          ]
        }
      ]
    },
    "theme": {
      "themeName": "contrast"
    }
  }'
```

**Required permission:** `questionnaire:write`

### Request Body

<ParamField body="model" type="object" required>
  The complete SurveyJS questionnaire model to publish.
</ParamField>

<ParamField body="theme" type="object">
  The complete SurveyJS theme. If omitted, the current live theme is preserved.
</ParamField>

### Response

```json theme={null}
{
  "uid": "9b5b7e7f-7159-4bd4-9e8c-b95a2b39b33f",
  "model": {
    "title": "Medical questionnaire",
    "pages": [
      {
        "name": "general",
        "elements": [
          {
            "type": "text",
            "name": "symptoms",
            "title": "Please describe your symptoms"
          }
        ]
      }
    ]
  },
  "theme": {
    "themeName": "contrast"
  }
}
```

The endpoint returns `404` when the questionnaire does not belong to the authenticated
organisation.
