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

# Set an environment variable

> Store an environment variable for one environment of an app.

> Reintersect apps are in developer preview. Names and limits can still change before general
> release.

Stores a value, encrypted. Values are write-only. Changing a production value of a hosted app
redeploys it.

Authenticate with a member API key of the app's owner or of a workspace owner or admin, a deploy
token for this app, or an agent builder token for an app the member owns. Any other caller gets
`ReintersectAppNotFoundError`. Preview-only deploy tokens and agent builder tokens can only set preview values.

## Path

| Parameter | Description |
| - | - |
| `appId` | The app. |
| `target` | `preview` or `production`. |
| `key` | A letter or `_`, then up to 63 letters, digits or `_`. |

## Body

| Field | Required | Description |
| - | - | - |
| `value` | Yes | 1 byte to 5 KB, no NUL bytes. |
| `secret` | Yes | `true` for secrets, which the SDK hands to your code as `Secret` values. |

## Response

`{ key, target, secret, updatedAt, runtimeWarning }`. `runtimeWarning` is `"redeploy-failed"` when the
value was saved but the hosted app couldn't be redeployed; deploy again.

## Errors

| `_tag` | Status | Cause |
| - | - | - |
| `ReintersectAppNotFoundError` | 404 | No such app, or you may not manage it. |
| `ReintersectAppDeployTargetForbiddenError` | 403 | The credential may not change production. |
| `ReintersectAppEnvVarLimitError` | 422 | The environment already holds 128 variables. |


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