> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vertracloud.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Stack Connection

> Replaces the variable names of a stack connection.

Replaces the whole `env_map` of a connection. Needs the `stacks:write` scope when called with an API key.

**stack\_id** `string` *required*

The stack ID.

**binding\_id** `string` *required*

The connection ID.

**workspace\_id** `string`

The workspace the stack belongs to, when you act on it as the workspace owner.

**env\_map** `object` *required*

Variable name to what it receives. The allowed values are listed in [Create Stack Connection](https://docs.vertracloud.app/api-reference/endpoint/stacks/bindings/create.md).

### Response

The connection with `restart_required` and `apps_to_restart`. Restart the listed applications to make them read the new names.

### Errors

| Status | Code | When |
| - | - | - |
| 400 | `VALIDATION_ERROR` | A value is not valid for the target of the connection. |
| 409 | `ENV_DUPLICATE_KEY` | A variable name is already managed by another connection. |
| 403 | `WORKSPACE_OWNER_ONLY` | You are a workspace member, not the owner. |
| 404 | `STACK_BINDING_NOT_FOUND` | The stack has no connection with that ID. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.