# Set a tenant's variables for a project

Source: https://www.jawsdeploy.net/rest-api/tenants-variables-set | Section: Tenant Variables

Set or remove values of a project's tenant variables for one tenant.

`PUT /api/tenant/variables`

Sets values of tenant variables for one tenant and project, and answers with the same body as `GET /api/tenant/variables`. All values are checked first, and if one is refused nothing is changed.

Secret values are stored encrypted and are never returned.

## Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `tenantId` | body | string | yes | ID of the tenant. |
| `projectId` | body | string | yes | ID of a project the tenant is connected to. |
| `values` | body | array<object> | yes | The values to change. Each has `templateId`, `environmentId` (leave out or `null` for all environments) and `value` (`null` or `""` removes the stored value). Values not listed are left as they are. |

## Errors

| Status | Meaning |
|---|---|
| 400 | Invalid `tenantId` or `projectId`, the tenant is not connected to the project, an unknown `templateId`, an environment the tenant doesn't use for the project, or a value that is not valid for its type. Nothing is changed. |
| 401 | Missing or invalid Basic auth credentials, or the service account lacks permission to manage tenants in this workspace. |

Example request:

```
PUT /api/tenant/variables HTTP/1.1
Authorization: Basic <base64(serviceAccountId:apiKey)>
Content-Type: application/json

{
  "tenantId": "tnt_acme",
  "projectId": "prj_abc123",
  "values": [
    { "templateId": "tvt_db", "value": "acme" },
    { "templateId": "tvt_db", "environmentId": "env_test", "value": "acme_test" },
    { "templateId": "tvt_key", "value": "s3cr3t" }
  ]
}
```

Example response:

```
{ "tenantId": "tnt_acme", "projectId": "prj_abc123", "environments": [...], "variables": [...] }
```

