---
title: "Creates or Updates the project variables associated with the tenant."
method: POST
path: "/spaces/{spaceIdentifier}/tenants/{tenantId}/projectvariables"
tags: ["Tenants"]
---

# Creates or Updates the project variables associated with the tenant.

`POST /spaces/{spaceIdentifier}/tenants/{tenantId}/projectvariables`

## Path parameters

- `spaceIdentifier` string, required
- `tenantId` string, required

## Request body

- ModifyProjectVariablesByTenantIdCommand
  - `ConcurrencyToken` string — The concurrency token returned when reading the tenant's variables. Always pass it back so the write is rejected if someone else changed the variables since your read; omitting it skips the check and risks silently overwriting their changes.
  - `SpaceId` string, required
  - `TenantId` string, required
  - `Variables` TenantProjectVariablePayload[], required — The complete set of project variable values for the tenant; existing values omitted here are deleted. Each item is an object: 'Id' (the existing value's ID when updating; omit when adding), 'OwnerId' (the project ID), 'TemplateId' (the variable template ID), 'Value' (a plain string for non-sensitive values, or {"HasValue": true, "NewValue": "secret"} for sensitive ones), and 'Scope' ({"EnvironmentIds": [...]} limiting the value to those environments; empty applies to all).
    - `Id` string
    - `OwnerId` string, required
    - `Scope` ITenantVariableScope, required
      - `EnvironmentIds` string[]
    - `TemplateId` string, required
    - `Value` PropertyValueResource, required
      - `IsSensitive` boolean
      - `SensitiveValue` SensitiveValue
        - `HasValue` boolean
        - `Hint` string
        - `NewValue` string
      - `Value` string

## Response `200`

The project variables associated with a tenant.

- ModifyProjectVariablesByTenantIdResponse
  - `ConcurrencyToken` string, required
  - `TenantId` string, required
  - `Variables` TenantProjectVariableV2[], required
    - `Id` string, required
    - `ProjectId` string, required
    - `ProjectName` string
    - `Scope` ProjectVariableScope, required
      - `EnvironmentIds` string[], required
    - `Template` ActionTemplateParameterResource
      - `DefaultValue` PropertyValueResource
        - `IsSensitive` boolean
        - `SensitiveValue` SensitiveValue
          - `HasValue` boolean
          - `Hint` string
          - `NewValue` string
        - `Value` string
      - `DisplaySettings` object
      - `HelpText` string
      - `Id` string
      - `Label` string
      - `Name` string
    - `TemplateId` string, required
    - `Value` PropertyValueResource, required
      - `IsSensitive` boolean
      - `SensitiveValue` SensitiveValue
        - `HasValue` boolean
        - `Hint` string
        - `NewValue` string
      - `Value` string

## Other responses

- `400` — Bad request. Either the payload was not structurally valid or business rules did not permit the operation.
- `404` — Not found. One or more of the entities involved in the operation was not found.

---

[API](https://skmtc.net/octopus/apis/octopus-server-api.md) · [All operations](https://skmtc.net/octopus/apis/octopus-server-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/octopus/octopus-server-api/versions/bc9158facfc7/schema)
