See Stacksync in action with a solution architect. Book a demo ↗
Variables

Variables

Create a variable

POST
/v1/workspaces/{workspace_id}/variables

A workspace variable, or a secret (is_secret: its value is encrypted and never answered again). Send an Idempotency-Key to retry safely.

Authorization

Authorizationstringheaderrequired

Bearer <key>, where <key> is a workspace API key or a user API key. See Authentication.

Path Parameters

workspace_id*integer

The workspace. List the ones your key can reach with GET /v1/workspaces.

Query Parameters

region*Regions

Region of the resource: besg (Europe) or usnv (United States), as GET /v1/regions lists them

Value in"besg""usnv"

Header Parameters

Idempotency-Key?|

Makes the create retry-safe for 24 hours: a retry with the same key answers the resource the first call created, with the Idempotent-Replayed: true header, and creates nothing. 1 to 255 visible ASCII characters. The same key with a different request answers 422; while the first call still runs, 409.

Defaultnull

Request Body

application/json
  1. body
variable_name*Variable Name
Length1 <= length <= 255
value?Value

The value as text; for object, array and json the JSON text

Default""
value_type?WorkflowVariableDataValueType
Default"string"
Value in"string""number""boolean""object""array""json"
is_secret?Is Secret

A secret's value is encrypted and never answered; cannot be undone

Defaultfalse
description?|
Defaultnull
variable_resource_id?|

The id workflow steps read the variable by; generated from the name when absent

Defaultnull
parent_folder_id?|

The folder to create the variable in, the root when absent

Defaultnull
validate_only?Validate Only

Run every check of the write and answer 204 without writing: a refused write answers the error the write would

Defaultfalse

Response Body

Created

application/json
  1. response
variable_id*Variable Id
variable_name*Variable Name
variable_resource_id*Variable Resource Id
description*string|null
is_secret*Is Secret

A secret's value is encrypted and never answered

value*|

The value as text (JSON text for object, array and json); null for a secret

value_type*|

How workflow steps read the value; for a secret, answered by GET /variables/ (stored encrypted with its value, not read by the list)

reference*Reference

What a workflow step writes to read the variable

parent_folder_id*string|null
created_time*Created Time
Formatdate-time
last_modified_time*Last Modified Time
Formatdate-time
region*Regions
Value in"besg""usnv"
Create a variable
curl -X POST 'https://api.stacksync.com/v1/workspaces/0/variables?region=besg' \  -H 'Content-Type: application/json' \  -d '{  "variable_name": "<variable_name>"}'
{  "variable_id": "<variable_id>",  "variable_name": "<variable_name>",  "variable_resource_id": "<variable_resource_id>",  "description": "<description>",  "is_secret": false,  "value": "<value>",  "value_type": "string",  "reference": "<reference>",  "parent_folder_id": "<parent_folder_id>",  "created_time": "2027-01-15T09:00:00Z",  "last_modified_time": "2027-01-15T09:00:00Z",  "region": "besg"}