---
title: "Update a variable scoped to one environment"
method: PUT
path: "/api/{org_id}/synthetics/environments/{env}/variables/{id}"
tags: ["Synthetics"]
---

# Update a variable scoped to one environment

`PUT /api/{org_id}/synthetics/environments/{env}/variables/{id}`

## Request

- Base URL: `https://api.openobserve.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://api.openobserve.ai/api/{org_id}/synthetics/environments/{env}/variables/{id}`
- Auth: API key in header `Authorization`
- TypeScript: <https://skmtc.dev/openobserve/apis/openobserve-api-http/docs/api/:org_id/synthetics/environments/:env/variables/:id/put.ts> (a function with typed inputs; its response is checked against the schema)

## Path parameters

- `org_id` string, required
- `env` string, required
- `id` string, required

## Query parameters

- `force` boolean

## Request body

- object

## Response `200`

Updated

- union
  - object: What every read path returns for a shared variable.
    - `has_value` boolean
    - `kind` 'plain', required
    - `value` string, required
    - `created_at` integer, required
    - `description` string, required
    - `example` string, required
    - `id` string, required
    - `name` string, required
    - `owner` string, nullable
    - `tags` string[], required
    - `updated_at` integer, required
    - `used_by` string[]: Names of those checks, so a destructive action can list them before it is confirmed.
    - `used_by_checks` integer: Checks whose definition references `{{NAME}}`.
  - object: What every read path returns for a shared variable.
    - `has_value` boolean, required
    - `kind` 'secret', required
    - `created_at` integer, required
    - `description` string, required
    - `example` string, required
    - `id` string, required
    - `name` string, required
    - `owner` string, nullable
    - `tags` string[], required
    - `updated_at` integer, required
    - `used_by` string[]: Names of those checks, so a destructive action can list them before it is confirmed.
    - `used_by_checks` integer: Checks whose definition references `{{NAME}}`.

## Other responses

- `404`: Not found
- `409`: The new name is already taken, or checks still reference the old name; re-send with force=true

---

[API](https://skmtc.dev/openobserve/apis/openobserve-api-http.md) - [All operations](https://skmtc.dev/openobserve/apis/openobserve-api-http/llms.txt) - [OpenAPI document](https://skmtc.dev/openobserve/apis/openobserve-api-http/revisions/0529b8a10252?raw)
