---
title: "Modify the environment variables of a tool"
method: POST
path: "/v1/{organization}/tool/{tool_id}/envvar"
tags: ["Tool"]
---

# Modify the environment variables of a tool

`POST /v1/{organization}/tool/{tool_id}/envvar`

Add, update, or delete the environment variables of a tool. Environment variables must be present in the tool before any versions requiring them can be published.

You cannot delete variables that are required by non-deprecated tool versions.

#### Permissions
This endpoint requires the following permissions:
* `Tool:ModifyTool` for the tool whose environment variables to modify.

## Path parameters

- `organization` string, required
- `tool_id` string, required — The ID of the tool to modify

## Headers

- `x-mongo-cluster-name` string, nullable — The Mongo cluster name to perform this request in. This is usually not needed unless the organization does not exist yet in the Amigo organization infra config database.
- `Sec-WebSocket-Protocol` string[]

## Request body

- SrcAppEndpointsToolModifyToolEnvvarsRequest
  - `inserts` InsertRequest[]
    - `name` string, required
    - `value` string, required — The value of the environment variable to insert.
    - `is_secret` boolean, required — Whether the environment variable is a secret.
  - `updates` UpdateRequest[]
    - `name` string, required
    - `value` string, required — The value of the environment variable to update.
  - `deletes` SrcAppEndpointsToolModifyToolEnvvarsRequestDeleteRequest[]
    - `name` string, required

## Response `204`

Succeeded.

## Other responses

- `400` — The specified environment variables to update or delete do not exist, or the environment variables to delete are used by non-deprecated tool versions.
- `401` — Invalid authorization credentials.
- `403` — Missing required permissions.
- `404` — The specified organization or tool does not exist.
- `409` — An environment variable with the same name as the one to insert exists or has been recently deleted.
- `422` — Invalid request body or request path parameter.
- `429` — The user has exceeded the rate limit of 20 requests per minute for this endpoint.
- `503` — The service is going through temporary maintenance.

---

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