Skip to main content
POST
/
workflows
Create a workflow
curl --request POST \
  --url https://api-dev.narrative.io/workflows \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data @- <<EOF
{
  "specification": "document:\n  dsl: '1.0.0'\n  namespace: test\n  name: test-workflow\n  version: '1.0.0'\n  do:\n    - createView:\n        call: CreateMaterializedViewIfNotExists\n        with:\n          nql: \"SELECT track_id FROM company_data.workflow_input_dataset\"\n      datasetName: workflow_dataset_test12\n    - refreshView:\n        call: RefreshMaterializedView\n        with:\n          datasetName: workflow_dataset_test12\n    - insertData:\n        call: ExecuteDml\n        with:\n          nql: \"INSERT INTO company_data.workflow_input_dataset (track_id) VALUES ('test')\n",
  "data_plane_id": "d1e2f3a4-b5c6-7890-abcd-ef1234567890",
  "trigger_immediately": false,
  "schedule_immediately": false,
  "tags": [
    "<string>"
  ]
}
EOF
{
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "name": "my-etl-workflow",
  "specification": "document:\n  dsl: '1.0.0'\n  namespace: test\n  name: test-workflow\n  version: '1.0.0'\n  do:\n    - createView:\n        call: CreateMaterializedViewIfNotExists\n        with:\n          nql: \"SELECT track_id FROM company_data.workflow_input_dataset\"\n      datasetName: workflow_dataset_test12\n    - refreshView:\n        call: RefreshMaterializedView\n        with:\n          datasetName: workflow_dataset_test12\n    - insertData:\n        call: ExecuteDml\n        with:\n          nql: \"INSERT INTO company_data.workflow_input_dataset (track_id) VALUES ('test')\n",
  "data_plane_id": "d1e2f3a4-b5c6-7890-abcd-ef1234567890",
  "company_id": 100,
  "created_at": "2025-01-15T10:30:00Z",
  "created_by": 20,
  "updated_at": "2025-01-15T10:30:00Z",
  "status": "active",
  "tags": [
    "<string>"
  ],
  "archived_at": null,
  "run_id": "b7e3f1a2-4c5d-6e7f-8a9b-0c1d2e3f4a5b"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
specification
string
required

The workflow specification in YAML format.

Example:

"document:\n dsl: '1.0.0'\n namespace: test\n name: test-workflow\n version: '1.0.0'\n do:\n - createView:\n call: CreateMaterializedViewIfNotExists\n with:\n nql: \"SELECT track_id FROM company_data.workflow_input_dataset\"\n datasetName: workflow_dataset_test12\n - refreshView:\n call: RefreshMaterializedView\n with:\n datasetName: workflow_dataset_test12\n - insertData:\n call: ExecuteDml\n with:\n nql: \"INSERT INTO company_data.workflow_input_dataset (track_id) VALUES ('test')\n"

data_plane_id
string<uuid>
required

The data plane to associate the workflow with.

Example:

"d1e2f3a4-b5c6-7890-abcd-ef1234567890"

trigger_immediately
boolean | null

If true, the workflow will be triggered immediately after creation.

Example:

false

schedule_immediately
boolean | null

If true, the workflow schedule will be created immediately after creation.

Example:

false

tags
string[]

Tags that describe the workflow.

Response

The created workflow.

id
string<uuid>
required

Unique identifier for a workflow.

Example:

"a1b2c3d4-e5f6-7890-abcd-ef1234567890"

name
string
required

The name of the workflow, extracted from the specification.

Example:

"my-etl-workflow"

specification
string
required

The workflow specification in YAML format.

Example:

"document:\n dsl: '1.0.0'\n namespace: test\n name: test-workflow\n version: '1.0.0'\n do:\n - createView:\n call: CreateMaterializedViewIfNotExists\n with:\n nql: \"SELECT track_id FROM company_data.workflow_input_dataset\"\n datasetName: workflow_dataset_test12\n - refreshView:\n call: RefreshMaterializedView\n with:\n datasetName: workflow_dataset_test12\n - insertData:\n call: ExecuteDml\n with:\n nql: \"INSERT INTO company_data.workflow_input_dataset (track_id) VALUES ('test')\n"

data_plane_id
string<uuid>
required

The data plane this workflow is associated with.

Example:

"d1e2f3a4-b5c6-7890-abcd-ef1234567890"

company_id
integer<int64>
required

The company that owns this workflow.

Example:

100

created_at
string<date-time>
required

ISO-8601 timestamp of when the workflow was created.

Example:

"2025-01-15T10:30:00Z"

created_by
integer<int64>
required

The ID of the user who created this workflow.

Example:

20

updated_at
string<date-time>
required

ISO-8601 timestamp of when the workflow was last updated.

Example:

"2025-01-15T10:30:00Z"

status
enum<string>
required

The current status of the workflow.

Available options:
active,
archived
Example:

"active"

tags
string[]
required

Tags that describe the workflow.

archived_at
string<date-time> | null

ISO-8601 timestamp of when the workflow was archived, or null if active.

Example:

null

run_id
string | null

The run ID if the workflow was triggered immediately upon creation.

Example:

"b7e3f1a2-4c5d-6e7f-8a9b-0c1d2e3f4a5b"