Workspace Variables
Workspace Variables endpoints of the MedHook engine API: 5 operations with parameters, schemas and a curl example for each.
On this page
Key/value settings per workspace (Mirth configuration map): {{env.NAME}} in step config, env.NAME in JavaScript. A secret's value is encrypted at rest and never returned.
List workspace variables
get/api/variables
Every variable in the caller's workspace. A secret's value is null. Each carries rotatedAt, when its value last changed. With include=usage each also has usedBy (the workflows whose steps or triggers read it, e.g. a polling trigger's urlTemplate, from the workflows and workflow_triggers tables only) type (secret or variable) and overdue (a secret whose value is older than the workspace's "Remind owners after", 90 days unless changed), and the list carries usageTruncated, true when the workspace has more workflows than the 2,000 read (an unused variable is then not known to be unused).
Minimum role: viewer.
Auth: Bearer token (how to get one) · Operation: listVariables
Parameters
| Name | In | Type | Description |
|---|---|---|---|
include | query | string |
|
Responses
- 200The variables.
Response fields
application/json · object
variablesarray of object12 fields
idstringrequirednamestringrequiredCapital letters, digits and underscores.
secretbooleanrequiredvaluestring | nullrequiredThe value; always null for a secret.
hasValuebooleanrequiredFalse until a value is entered.
descriptionstring | nullcreatedBystring | nullcreatedAtstring (date-time)updatedAtstring (date-time)rotatedAtstring (date-time) | nullWhen the value last changed; null while unset.
usedByarray of objectThe workflows whose steps read the variable.
2 fields
idstringnamestring
overduebooleanWith include=usage: a secret whose value is older than 90 days.
totalintegerusageTruncatedbooleanWith include=usage: more workflows exist than were read.
Example request
curl "$ENGINE_URL/api/variables" \
-H "Authorization: Bearer $TOKEN"Create a workspace variable
post/api/variables
A secret needs at least 8 characters and may be left unset (the deploy check then reports it). Audited (workspace_variable.created, name only).
Minimum role: operator.
Auth: Bearer token (how to get one) · Operation: createVariable
Request body (required)
application/json · object
namestringrequiredsecretbooleanvaluestring | nulldescriptionstring | null
Responses
- 201Created.
Response fields
application/json · object
variableobject9 fields
idstringrequirednamestringrequiredCapital letters, digits and underscores.
secretbooleanrequiredvaluestring | nullrequiredThe value; always null for a secret.
hasValuebooleanrequiredFalse until a value is entered.
descriptionstring | nullcreatedBystring | nullcreatedAtstring (date-time)updatedAtstring (date-time)
- 400The request is malformed or fails validation.
application/json · ApiError
- 409The request conflicts with the current state.
application/json · ApiError
Example request
curl -X POST "$ENGINE_URL/api/variables" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "string",
"secret": true,
"value": "string",
"description": "string"
}'Get a workspace variable
get/api/variables/{id}
A secret's value is null.
Minimum role: viewer.
Auth: Bearer token (how to get one) · Operation: getVariable
Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired | path | string | Id in the caller's workspace. |
Responses
- 200The variable.
Response fields
application/json · object
variableobject9 fields
idstringrequirednamestringrequiredCapital letters, digits and underscores.
secretbooleanrequiredvaluestring | nullrequiredThe value; always null for a secret.
hasValuebooleanrequiredFalse until a value is entered.
descriptionstring | nullcreatedBystring | nullcreatedAtstring (date-time)updatedAtstring (date-time)
- 404Not found in the caller's workspace.
application/json · ApiError
Example request
curl "$ENGINE_URL/api/variables/<id>" \
-H "Authorization: Bearer $TOKEN"Update a workspace variable
put/api/variables/{id}
Without value the stored value is kept; value: null clears it. A secret cannot be made plain. Audited (workspace_variable.updated).
Minimum role: operator.
Auth: Bearer token (how to get one) · Operation: updateVariable
Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired | path | string | Id in the caller's workspace. |
Request body (required)
application/json · object
valuestring | nulldescriptionstring | nullsecretboolean
Responses
- 200Updated.
Response fields
application/json · object
variableobject9 fields
idstringrequirednamestringrequiredCapital letters, digits and underscores.
secretbooleanrequiredvaluestring | nullrequiredThe value; always null for a secret.
hasValuebooleanrequiredFalse until a value is entered.
descriptionstring | nullcreatedBystring | nullcreatedAtstring (date-time)updatedAtstring (date-time)
- 400The request is malformed or fails validation.
application/json · ApiError
- 404Not found in the caller's workspace.
application/json · ApiError
Example request
curl -X PUT "$ENGINE_URL/api/variables/<id>" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"value": "string",
"description": "string",
"secret": true
}'Delete a workspace variable
delete/api/variables/{id}
Steps that reference it then fail closed, naming it. Audited (workspace_variable.deleted).
Minimum role: operator.
Auth: Bearer token (how to get one) · Operation: deleteVariable
Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired | path | string | Id in the caller's workspace. |
Responses
- 200Deleted.
Response fields
application/json · object
deletedboolean
- 404Not found in the caller's workspace.
application/json · ApiError
Example request
curl -X DELETE "$ENGINE_URL/api/variables/<id>" \
-H "Authorization: Bearer $TOKEN"Schemas
Named objects the operations above link to.
ApiError
The error body. error is always present. code is present on most errors and is the field to branch on; a few routes and the sign-in and role checks return only error (and sometimes detail).
errorstringrequiredHuman-readable error message.
codestringMachine-readable error code.
One of: "BAD_REQUEST", "INVALID_REQUEST", "UNAUTHORIZED", "UNAUTHENTICATED", "FORBIDDEN", "NOT_FOUND", "CONFLICT", "UNPROCESSABLE_ENTITY", "RATE_LIMITED", "INTERNAL_ERROR", "SERVICE_UNAVAILABLE", "NOT_CONFIGURED", "SIGNATURE_REQUIRED", "INVALID_SIGNATURE", "TIMESTAMP_REQUIRED", "TIMESTAMP_INVALID", "TIMESTAMP_OUT_OF_TOLERANCE", "INVALID_CREDENTIALS", "INVALID_TOKEN", "PAYLOAD_TOO_LARGE", "INVALID_NDJSON", "PHI_NOT_AUTHORIZED", "PHI_IN_SANDBOX", "IN_PROGRESS", "RETRY_SCHEDULED", "WORKFLOW_DISABLED", "CONFLICTING_SCOPE", "ALREADY_DELIVERED", "CHAIN_TOO_DEEP", "NO_FAILED_DESTINATION", "STALE_SCOPE", "UNKNOWN_DESTINATION", "NO_DESTINATIONS", "NOT_A_MESSAGE", "AI_FEATURES_DISABLED"
detailsanyOptional structured context about the error.