Skip to content
Reference>REST API>/pattern_variables

Pattern Variables

The /pattern_variables endpoint provides read-only access to pattern variables and their resolved values. Pattern variables are configurable parameters defined at the pattern level whose values can be overridden at different scopes: project, instance folder, or instance.

See Also

GET /api/v1/pattern_variables — Find Pattern Variables

Retrieve a list of pattern variables and their values at different scopes. The response includes the resolved value and the level at which it was defined.

Endpoint

GET https://app.metakraftwerk.com/api/v1/pattern_variables

Query Parameters

ParameterTypeRequiredDescription
patternstringNoFilter by pattern name.
pattern_idintegerNoFilter by pattern ID.
projectstringNoScope to a project by name.
project_idintegerNoScope to a project by ID.
instance_folderstringNoScope to an instance folder by name.
instance_folder_idintegerNoScope to an instance folder by ID.
instancestringNoScope to an instance by name.
instance_idintegerNoScope to an instance by ID.
namestringNoFilter by variable name.
valuestringNoFilter by variable value.

Value Resolution Cascade

Pattern variable values are resolved using a cascading hierarchy. The most specific scope wins:

PriorityLevelDescription
1 (highest)instanceValue defined for a specific instance.
2instance_folderValue defined at a folder level (traverses up the folder tree).
3projectValue defined at the project level.
4 (lowest)defaultDefault value from the pattern variable definition.

Response Schema

Returns an array of pattern variable objects:

FieldTypeDescription
pattern_variable_idintegerPattern variable definition ID.
pattern_idintegerAssociated pattern ID.
namestringVariable name.
valuestringResolved variable value.
levelstringScope level at which the value was defined: default, project, instance_folder, or instance.
project_idintegerProject ID (if scoped to a project).
instance_folder_idintegerInstance folder ID (if scoped to a folder).
instance_folderstringComputed folder path (if scoped to a folder).
instance_idintegerInstance ID (if scoped to an instance).

Examples

cURL

bash
# Find by pattern name (returns default values)
curl -X GET "https://app.metakraftwerk.com/api/v1/pattern_variables?pattern=CORE_DV_HLS" \
  -H "Authorization: Bearer $ACCESS_TOKEN"

# Scoped to a project (returns project-level overrides and defaults)
curl -X GET "https://app.metakraftwerk.com/api/v1/pattern_variables?pattern=CORE_DV_HLS&project=DEMO_PROJECT" \
  -H "Authorization: Bearer $ACCESS_TOKEN"

# Scoped to an instance folder
curl -X GET "https://app.metakraftwerk.com/api/v1/pattern_variables?pattern=CORE_DV_HLS&instance_folder=RAW_VAULT" \
  -H "Authorization: Bearer $ACCESS_TOKEN"

# Scoped to an instance
curl -X GET "https://app.metakraftwerk.com/api/v1/pattern_variables?pattern=CORE_DV_HLS&instance=AIRLINE" \
  -H "Authorization: Bearer $ACCESS_TOKEN"

# Filter by variable name
curl -X GET "https://app.metakraftwerk.com/api/v1/pattern_variables?name=CORE_SCHEMA" \
  -H "Authorization: Bearer $ACCESS_TOKEN"

# Filter by value
curl -X GET "https://app.metakraftwerk.com/api/v1/pattern_variables?pattern_id=808&value=CORE" \
  -H "Authorization: Bearer $ACCESS_TOKEN"

JavaScript (Fetch)

javascript
const response = await fetch(
  'https://app.metakraftwerk.com/api/v1/pattern_variables?pattern=CORE_DV_HLS&project=DEMO_PROJECT',
  { headers: { 'Authorization': `Bearer ${accessToken}` } }
);

const variables = await response.json();

Response Example

json
[
  {
    "pattern_variable_id": 222,
    "pattern_id": 808,
    "name": "CORE_SCHEMA",
    "value": "CORE",
    "level": "default",
    "project_id": null,
    "instance_folder_id": null,
    "instance_folder": null,
    "instance_id": null
  }
]

Error Responses

StatusConditionExample Message
401Missing or invalid tokenNot authenticated
404Pattern not foundA pattern with the name 'X' does not exist!

GET /api/v1/pattern_variables/:id — Get Pattern Variable

Retrieve a single pattern variable definition by its ID.

Endpoint

GET https://app.metakraftwerk.com/api/v1/pattern_variables/:id

Path Parameters

ParameterTypeRequiredDescription
idintegerYesThe pattern variable ID.

Examples

cURL

bash
curl -X GET "https://app.metakraftwerk.com/api/v1/pattern_variables/222" \
  -H "Authorization: Bearer $ACCESS_TOKEN"

JavaScript (Fetch)

javascript
const response = await fetch(
  'https://app.metakraftwerk.com/api/v1/pattern_variables/222',
  { headers: { 'Authorization': `Bearer ${accessToken}` } }
);

const variable = await response.json();

Error Responses

StatusConditionExample Message
401Missing or invalid tokenNot authenticated
404Pattern variable not foundNo record found for id 'X'

POST /api/v1/pattern_variables — Create

Not implemented

PUT /api/v1/pattern_variables — Update

Not implemented

PATCH /api/v1/pattern_variables/:id — Patch

Not implemented

DELETE /api/v1/pattern_variables/:id — Remove

Not implemented