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

# Adicionar ou Atualizar Variáveis

> Mescla variáveis de ambiente sem remover chaves omitidas

Cria as chaves novas e atualiza as chaves enviadas. As variáveis omitidas permanecem inalteradas. `PATCH` tem o mesmo comportamento.

```bash cURL theme={null}
curl -X POST 'https://api.sondercloud.app/v1/apps/{id}/envs' \
  -H 'Authorization: Bearer seu_token' \
  -H 'Content-Type: application/json' \
  --data '{"envs":{"NODE_ENV":"production","API_KEY":"substitua-pelo-segredo"}}'
```

```json Success theme={null}
{
  "success": true,
  "response": {
    "NODE_ENV": "production",
    "API_KEY": "substitua-pelo-segredo"
  },
  "message": "Environment variables saved. Restart the app to apply changes."
}
```

> [!NOTE]
>
> Os valores precisam ser strings. A escrita é rejeitada com `400 Bad Request` enquanto o app estiver em `BUILDING`. Reinicie o app depois de salvar para aplicar os valores.

Falhas retornam o status HTTP correspondente e um corpo com `success: false` e `message`.


## API Specification

The full API specification for this endpoint is available in the [documentation index](https://docs.sondercloud.app/llms.txt).


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