Skip to main content
POST
/
api
/
v2
/
public
/
env
/
values
curl -X POST "https://app.refold.ai/api/v2/public/env/values" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "variable_definition_id": "YOUR_DEFINITION_ID",
    "value": "your-value",
    "linked_account_id": "YOUR_LINKED_ACCOUNT_ID"
  }'
{
  "_id": "6a314b06d396207fd24fb16b",
  "variable_definition_id": "6a1401de41e63efd08fb3e54",
  "org_id": "6500a1b2c3d4e5f6a7b8c9d0",
  "environment": "test",
  "linked_account_id": "user_12345",
  "value": "MGNmZDM1NjJhM2U0ZmQzODU5OGU3N2NhNGJiYWNhMGU=",
  "createdAt": "2026-06-16T13:09:26.023Z"
}
Upsert a scoped value for a variable definition. The value is validated against the definition’s var_format and encrypted if the definition is marked encrypted. The scope is determined by what you pass: nothing for org scope, linked_account_id for linked-account scope, workflow_id for workflow scope.

Authentication

x-api-key
string
required
Your Refold API key.
linked_account_id
string
Required (header or body) when setting a linked-account-scoped value.
For linked-account-scoped values you may instead authenticate with a session token (Authorization: Bearer ...); it is restricted to that account’s scope.

Body Parameters

variable_definition_id
string
required
The definition to set a value for.
value
string
required
The value. Validated against the definition’s var_format.
linked_account_id
string
Set the linked-account-scoped value for this account.
workflow_id
string
Set the workflow-scoped value for this workflow.

Response

Returns the stored value document. The value is encrypted at rest if the definition is encrypted.
_id
string
Value document ID (used to delete it).
variable_definition_id
string
The definition.
linked_account_id
string
Account scope, if any.
value
string
Stored value (ciphertext if encrypted).
{
  "_id": "6a314b06d396207fd24fb16b",
  "variable_definition_id": "6a1401de41e63efd08fb3e54",
  "org_id": "6500a1b2c3d4e5f6a7b8c9d0",
  "environment": "test",
  "linked_account_id": "user_12345",
  "value": "MGNmZDM1NjJhM2U0ZmQzODU5OGU3N2NhNGJiYWNhMGU=",
  "createdAt": "2026-06-16T13:09:26.023Z"
}
curl -X POST "https://app.refold.ai/api/v2/public/env/values" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "variable_definition_id": "YOUR_DEFINITION_ID",
    "value": "your-value",
    "linked_account_id": "YOUR_LINKED_ACCOUNT_ID"
  }'