# Change a workspace tenant variable

Source: https://www.jawsdeploy.net/rest-api/workspace-tenant-variable-template-update | Section: Workspace Tenant Variables

Change a workspace tenant variable, for every project that uses it.

`PUT /api/workspace/tenant-variable-template`

Only the fields you send are changed. The change applies to every project that uses the variable; the tenants' values stay as they are.

## Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `templateId` | body | string | yes | ID of the workspace tenant variable. |
| `name` | body | string | no | New name. Must be free among the workspace tenant variables and in every project that uses it. |
| `variableType` | body | string | no | New type. A `Secret` can't be changed to another type. |
| `isRequired` | body | boolean | no | Whether every tenant must have a value. |
| `defaultValue` | body | string | no | New default. `""` removes it; leave it out to keep the current one. |
| `description` | body | string | no | New description. |
| `sortOrder` | body | integer | no | New position in the list. |

## Errors

| Status | Meaning |
|---|---|
| 400 | Invalid `templateId`, an unknown `variableType`, a name that is taken here or in a project that uses it, or a default that is not valid for the type. |
| 401 | Missing or invalid Basic auth credentials, or the service account can't manage workspace variables in this workspace. |

Example request:

```
PUT /api/workspace/tenant-variable-template HTTP/1.1
Authorization: Basic <base64(serviceAccountId:apiKey)>
Content-Type: application/json

{
  "templateId": "tvt_port",
  "isRequired": true
}
```

Example response:

```
{
  "templateId": "tvt_port",
  "projectId": null,
  "workspaceId": "ws_abc123",
  "isWorkspace": true,
  "usedBy": [
    { "projectId": "prj_web", "name": "Shop.Web" }
  ],
  "name": "Port",
  "description": null,
  "variableType": "Number",
  "isRequired": true,
  "sortOrder": 1,
  "hasDefault": true,
  "defaultValue": "8080"
}
```

