Skip to content
Skip to Content

Set a variable

PUT
/projects/{projectId}/variables/{name}

Sets it on the project, an environment or a service, replacing one of the same name in that scope. The narrowest scope wins at deploy. Takes effect at the next deployment.

Authorization

bearer
headerAuthorizationBearer <token>

An API key (opk_…) or a CLI token (opc_…).

Path parameters

projectId*string
name*string

Letters, digits and underscores, not starting with a digit.

Request body

application/json
  1. body
value*string
Lengthlength <= 65536
secret?boolean

Sealed and never shown again; only deploys use it.

environmentId?|

Set it for one environment only.

serviceId?|

Set it for one service only.

Response body

Set a variable

application/json
  1. response
id*string
Formatuuid
projectId*string
Formatuuid
environmentId*|null
serviceId*|null
name*string
secret*boolean
value*|

Null for a secret: its value is never read back.

updatedAt*string
Formatdate-time
Example request
curl -X PUT "https://openpanel.sh/api/v1/projects/$PROJECT_ID/variables/$NAME" \  -H "Authorization: Bearer $OPENPANEL_TOKEN" \  -H "Content-Type: application/json" \  -d '{  "value": "string"}'
Example response
{  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "projectId": "5a8591dd-4039-49df-9202-96385ba3eff8",  "environmentId": "19f5cc2e-7657-437a-9268-83cd3d563563",  "serviceId": "8f8bb40f-b96b-40fe-9064-5031fbe483f9",  "name": "string",  "secret": true,  "value": "string",  "updatedAt": "2019-08-24T14:15:22Z"}