# Set a variable on a Next site

`PUT /hosting/sites/{id}/env` · Rivier · hosting

Set a variable on a Next site. The value is sealed and delivered to the running site only.

- Scope: hosting:write
- Graphql: Mutation.hostingEnvSet
- Sdk: hosting.env.set
- Cli: hosting env set

## Parameters

- `id` (path, required), string

## Request body

`application/json`

```json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 64
    },
    "value": {
      "type": "string",
      "maxLength": 8192
    },
    "scope": {
      "type": "string",
      "enum": [
        "production",
        "preview",
        "all"
      ]
    }
  },
  "required": [
    "name",
    "value"
  ],
  "additionalProperties": false
}
```

## Responses

- `200`: Success
- `400`: The request was malformed
- `401`: No valid credential
- `403`: The credential lacks the scope, origin or address
- `429`: Over the key's rate limit; see Retry-After

## Example

```sh
curl -X PUT 'https://api.rivier.ai/hosting/sites/{id}/env' \
  -H 'Authorization: Bearer $KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "string",
  "value": "string"
}'
```
