Skip to content
Reference>REST API>/instances

Instances

The /instances endpoint allows you to list, retrieve, and upload instance metadata. Instances represent sets of metadata for specific data objects or processes within a project, organized by pattern and folder.

See Also

GET /api/v1/instances — Find Instances

Retrieve a list of instances matching the specified filter criteria.

Endpoint

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

Query Parameters

ParameterTypeRequiredDescription
projectstringYes*Project name. Mutually exclusive with project_id.
project_idintegerYes*Project ID. Mutually exclusive with project.
patternstringNoFilter by pattern name.
pattern_idintegerNoFilter by pattern ID.
folderstringNoFilter by folder path (e.g. /RAW_VAULT).
namestringNoFilter by instance name.
releasesobjectNoJSON object mapping release group names to release names (e.g. {"DWH_GROUP": "R1"}).
checked_outbooleanNoFilter by checkout status.
checked_out_by_user_idintegerNoFilter by the user ID who checked out the instance.
checked_out_by_userstringNoFilter by the username who checked out the instance.
deletedbooleanNoFilter by deletion status.
upload_disabledbooleanNoFilter by upload-disabled flag.
insert_disabledbooleanNoFilter by insert-disabled flag.
build_disabledbooleanNoFilter by build-disabled flag.
edit_disabledbooleanNoFilter by edit-disabled flag.
invalidbooleanNoFilter by validation status.

TIP

* Exactly one of project or project_id is required.

Response Schema

FieldTypeDescription
idintegerUnique instance ID.
customer_idintegerCustomer ID.
namestringInstance name.
project_idintegerProject ID.
pattern_idintegerPattern ID.
errorsintegerNumber of validation errors.
instance_folder_idintegerFolder ID.
versionintegerCurrent version number.
descriptionstringInstance description.
release_idintegerRelease ID.
identity_idintegerIdentity ID for version tracking.
user_idintegerOwner user ID.
latest_commit_idintegerID of the latest commit.
labelsstring[]Array of label names attached to the instance.
checked_outbooleanWhether the instance is checked out.
deletedbooleanWhether the instance is marked as deleted.
upload_disabledbooleanWhether upload is disabled.
insert_disabledbooleanWhether insert is disabled.
build_disabledbooleanWhether build is disabled.
edit_disabledbooleanWhether editing is disabled.
invalidbooleanWhether the instance has validation errors.
folderstringComputed folder path (e.g. /RAW_VAULT).

Examples

cURL

bash
curl -X GET "https://app.metakraftwerk.com/api/v1/instances?project=DEMO_PROJECT&pattern=CORE_DV_HLS" \
  -H "Authorization: Bearer $ACCESS_TOKEN"

JavaScript (Fetch)

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

const instances = await response.json();

Response Example

json
[
  {
    "id": 5567,
    "customer_id": 1,
    "name": "AIRLINE",
    "project_id": 402,
    "pattern_id": 808,
    "errors": 0,
    "instance_folder_id": 902,
    "version": 9,
    "description": null,
    "release_id": 21,
    "identity_id": 3326,
    "user_id": 1,
    "latest_commit_id": 15720,
    "labels": [
      "DEPRECATED"
    ],
    "checked_out": false,
    "deleted": false,
    "upload_disabled": false,
    "insert_disabled": false,
    "build_disabled": false,
    "edit_disabled": false,
    "invalid": false,
    "folder": "/RAW_VAULT"
  }
]

Error Responses

StatusConditionExample Message
400Missing project parameterA project id or name is required!
401Missing or invalid tokenNot authenticated
403User lacks project accessYou don't have permissions to access this project!
404Project not foundA project with the name 'X' does not exist!

GET /api/v1/instances/:id — Get Instance

Retrieve a single instance by its ID. Supports JSON and Excel export formats.

Endpoint

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

Path Parameters

ParameterTypeRequiredDescription
idintegerYesThe instance ID.

Content Negotiation

The response format depends on the Accept header:

Accept HeaderResponse Format
application/json (default)JSON object with instance metadata including header and field details.
application/vnd.openxmlformats-officedocument.spreadsheetml.sheetExcel workbook (.xlsx) file download.

Response Schema (JSON)

FieldTypeDescription
instance_idintegerInstance ID.
instance_namestringInstance name.
project_namestringProject name.
pattern_namestringPattern name.
folderstringFolder path.
headerstring[]Array of column names for the field details.
field_detailsobject[]Array of metadata rows with properties and functional roles.

Examples

cURL (JSON)

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

cURL (Excel Download)

bash
curl -X GET "https://app.metakraftwerk.com/api/v1/instances/5567" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Accept: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" \
  -OJ

JavaScript (Fetch)

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

const instance = await response.json();

Error Responses

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

POST /api/v1/instances — Upload Instances

Upload an Excel file to bulk-create or update instances for a given pattern.

Endpoint

POST https://app.metakraftwerk.com/api/v1/instances

Authentication

The authenticated user must have write_instances permission on the target project.

Request

The request must be sent as multipart/form-data with exactly one file upload and the form fields described below.

Form Fields

FieldTypeRequiredDescription
fileFileYesAn .xlsx Excel workbook containing the instance data to import. Each row must have at minimum an INSTANCE column.
projectstringYes*Name of the target project. Mutually exclusive with project_id.
project_idintegerYes*ID of the target project. Mutually exclusive with project.
patternstringNoPattern name to apply to all rows. Overrides any PATTERN column in the spreadsheet.
folderstringNoFolder path to apply to all rows (e.g. /BUSINESS_VAULT). Overrides any FOLDER column in the spreadsheet.
releasestringNoRelease identifier to assign to every imported instance (e.g. R1).
overwritebooleanNoWhen true, existing instances that match by key are overwritten. Defaults to false.
sheets[]string[]NoArray of sheet names to import. When omitted, all sheets in the workbook are processed.

TIP

* Exactly one of project or project_id is required. If project is provided, the API resolves the project ID by name.

Excel Workbook Format

Each sheet that is processed must contain rows with the following column conventions:

ColumnRequiredDescription
INSTANCEYesInstance identifier. Rows without this column value are skipped.
PATTERNConditionalPattern name for the row. Required per-row unless the pattern form field is set.
PROJECTNoPopulated automatically when the project form field is set.
FOLDERNoFolder path. Can be set globally via the folder form field.
POS_NONoPosition number (integer). Defaults to 0 if missing or non-numeric.
<property columns>NoAny additional columns whose names match instance property names defined on the pattern.

Response Schema

FieldTypeDescription
instancesobject[]Array of successfully created or updated instance records.
instances[].idintegerThe ID of the created/updated instance.
instances[].namestringInstance name.
instances[].folderstringFolder path.
instances[].patternstringPattern name.
instances[].releasestringRelease name.
instances[].statusstringProcessing status (e.g. INSERTED).
errorsstring[]Present only when one or more patterns failed to import.

Examples

cURL

bash
FILE_PATH="/path/to/CORE_DV_HLS_AIRPLANE.xlsx"

curl -X POST "https://app.metakraftwerk.com/api/v1/instances" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -F "project=DEMO_PROJECT" \
  -F "pattern=CORE_DV_HLS" \
  -F "folder=/BUSINESS_VAULT" \
  -F "release=R1" \
  -F "sheets[]=FIELD_DETAILS" \
  -F "file=@${FILE_PATH}"

JavaScript (Fetch)

javascript
const form = new FormData();
form.append('file', fileInput.files[0]);
form.append('project', 'DEMO_PROJECT');
form.append('pattern', 'CORE_DV_HLS');
form.append('folder', '/BUSINESS_VAULT');
form.append('release', 'R1');
form.append('sheets[]', 'FIELD_DETAILS');

const response = await fetch('https://app.metakraftwerk.com/api/v1/instances', {
  method: 'POST',
  headers: { 'Authorization': `Bearer ${accessToken}` },
  body: form
});

const result = await response.json();

Response Example

json
{
  "instances": [
    {
      "id": 3334,
      "name": "AIRPLANE",
      "folder": "/BUSINESS_VAULT",
      "pattern": "CORE_DV_HLS",
      "release": "R1",
      "status": "INSERTED"
    }
  ]
}

Partial Success

When importing rows across multiple patterns, each pattern is processed independently. A failure in one pattern does not roll back successfully imported patterns:

json
{
  "instances": [ ... ],
  "errors": [
    "Error importing pattern X: ..."
  ]
}

Error Responses

StatusConditionExample Message
400Missing required fieldsVaries
401Missing or invalid tokenNot authenticated
403User lacks project accessYou don't have permissions to access this project!
403User lacks write permissionYou don't have permissions to write instances in this project!
404Project name not foundA project with the name 'X' does not exist!

Processing Details

The import follows this sequence for each distinct pattern found in the data:

  1. Instance properties for the pattern are resolved from the database.
  2. A temporary table is created with columns matching FOLDER, RELEASE, INSTANCE, POS_NO, and all pattern-specific instance properties.
  3. The spreadsheet rows are loaded into the temporary table.
  4. An INSERT INTO @INSTANCES.<PATTERN> statement is executed. If overwrite is true, the OVERWRITE modifier is appended.
  5. The temporary table is dropped.
  6. Results are collected and returned.

WARNING

When importing rows across multiple patterns (either via the PATTERN column in the spreadsheet or multiple sheets), each pattern is processed independently. A failure in one pattern does not roll back successfully imported patterns.


PUT /api/v1/instances — Update

Not implemented

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

Not implemented

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

Not implemented