Skip to content

Labels ​

The /labels endpoint provides read-only access to label definitions. Labels are used to categorize and tag instances. They can be defined at three levels: global (no project or pattern scope), project-level, or pattern-level.

See Also

GET /api/v1/labels — Find Labels ​

Retrieve a list of labels, optionally filtered by project, pattern, name, or color.

Endpoint ​

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

Query Parameters ​

ParameterTypeRequiredDescription
projectstringNoFilter by project name.
project_idintegerNoFilter by project ID.
patternstringNoFilter by pattern name.
pattern_idintegerNoFilter by pattern ID.
namestringNoFilter by label name.
colorstringNoFilter by label color (e.g. red, blue, green).

Response Schema ​

Returns an array of label objects:

FieldTypeDescription
idintegerUnique label ID.
project_idintegerProject ID (null for global labels).
pattern_idintegerPattern ID (null for project-level or global labels).
namestringLabel name.
colorstringLabel color.

Label Scopes ​

Labels are hierarchical and can be defined at different scopes:

Scopeproject_idpattern_idDescription
GlobalnullnullAvailable across all projects and patterns.
ProjectsetnullAvailable for all patterns within a specific project.
PatternsetsetAvailable only for instances of a specific pattern in a project.

Examples ​

cURL ​

bash
# List all labels
curl -X GET "https://app.metakraftwerk.com/api/v1/labels" \
  -H "Authorization: Bearer $ACCESS_TOKEN"

# Find by project
curl -X GET "https://app.metakraftwerk.com/api/v1/labels?project=DEMO_PROJECT" \
  -H "Authorization: Bearer $ACCESS_TOKEN"

# Find by pattern
curl -X GET "https://app.metakraftwerk.com/api/v1/labels?pattern=CORE_DV_HLS" \
  -H "Authorization: Bearer $ACCESS_TOKEN"

# Find by name
curl -X GET "https://app.metakraftwerk.com/api/v1/labels?name=NEEDS_FIX" \
  -H "Authorization: Bearer $ACCESS_TOKEN"

# Find by color
curl -X GET "https://app.metakraftwerk.com/api/v1/labels?color=red" \
  -H "Authorization: Bearer $ACCESS_TOKEN"

JavaScript (Fetch) ​

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

const labels = await response.json();

Response Example ​

json
[
  {
    "id": 64,
    "project_id": 402,
    "pattern_id": null,
    "name": "NEEDS_FIX",
    "color": "red"
  }
]

Error Responses ​

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

GET /api/v1/labels/:id — Get Label ​

Retrieve a single label by its ID.

Endpoint ​

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

Path Parameters ​

ParameterTypeRequiredDescription
idintegerYesThe label ID.

Examples ​

cURL ​

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

JavaScript (Fetch) ​

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

const label = await response.json();

Error Responses ​

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

POST /api/v1/labels — Create ​

Not implemented

PUT /api/v1/labels — Update ​

Not implemented

PATCH /api/v1/labels/:id — Patch ​

Not implemented

DELETE /api/v1/labels/:id — Remove ​

Not implemented