# Workflows

> Kontiga is document fraud detection by Bynn Intelligence for insurers, letting agents, lenders and HR screening teams: every document is compared with a proprietary library of more than 300 million original documents, gathered over 20 years.

Documentation index: https://kontiga.com/llms.txt

Section: Reference. URL: https://kontiga.com/docs/workflows

A workflow is what happens to a case on its own: the checklist that starts it, then its steps, such as checking documents, screening the person, asking for more, deciding and telling the team. Build workflows from a template, from a description or step by step, set how much the reasoning agent decides, activate them, follow their runs, and move them to and from Bynn in Bynn's own format.

Updated November 30, 2026

## Contents

- [The workflow object](https://kontiga.com/docs/workflows#the-workflow-object)
- [List workflows](https://kontiga.com/docs/workflows#list-workflows)
- [List workflows with their runs](https://kontiga.com/docs/workflows#list-workflows-with-their-runs)
- [Read a workflow](https://kontiga.com/docs/workflows#read-a-workflow)
- [Read a workflow in full](https://kontiga.com/docs/workflows#read-a-workflow-in-full)
- [List workflow runs](https://kontiga.com/docs/workflows#list-workflow-runs)
- [List workflow templates](https://kontiga.com/docs/workflows#list-workflow-templates)
- [Create a workflow](https://kontiga.com/docs/workflows#create-a-workflow)
- [Change a workflow](https://kontiga.com/docs/workflows#change-a-workflow)
- [Save a workflow's canvas](https://kontiga.com/docs/workflows#save-a-workflows-canvas)
- [Set what the end customer's page shows](https://kontiga.com/docs/workflows#set-what-the-end-customers-page-shows)
- [Set how much the reasoning agent decides](https://kontiga.com/docs/workflows#set-how-much-the-reasoning-agent-decides)
- [Activate a workflow](https://kontiga.com/docs/workflows#activate-a-workflow)
- [Pause a workflow](https://kontiga.com/docs/workflows#pause-a-workflow)
- [Invite a person to start a workflow](https://kontiga.com/docs/workflows#invite-a-person-to-start-a-workflow)
- [Duplicate a workflow](https://kontiga.com/docs/workflows#duplicate-a-workflow)
- [Archive a workflow](https://kontiga.com/docs/workflows#archive-a-workflow)
- [Restore an archived workflow](https://kontiga.com/docs/workflows#restore-an-archived-workflow)
- [Delete a workflow](https://kontiga.com/docs/workflows#delete-a-workflow)
- [Import a workflow from Bynn](https://kontiga.com/docs/workflows#import-a-workflow-from-bynn)
- [Export a workflow in Bynn's format](https://kontiga.com/docs/workflows#export-a-workflow-in-bynns-format)
- [Draft a workflow from a description](https://kontiga.com/docs/workflows#draft-a-workflow-from-a-description)
- [Propose changes to a workflow](https://kontiga.com/docs/workflows#propose-changes-to-a-workflow)
- [Start the workflow planner](https://kontiga.com/docs/workflows#start-the-workflow-planner)
- [Read a workflow planner session](https://kontiga.com/docs/workflows#read-a-workflow-planner-session)
- [Answer the workflow planner](https://kontiga.com/docs/workflows#answer-the-workflow-planner)
- [Ask the workflow planner for changes](https://kontiga.com/docs/workflows#ask-the-workflow-planner-for-changes)
- [Keep the workflow planner's proposal](https://kontiga.com/docs/workflows#keep-the-workflow-planners-proposal)
- [Stop the workflow planner](https://kontiga.com/docs/workflows#stop-the-workflow-planner)

## The workflow object

- `id` (string): The workflow's id, starting with `wf_`.
- `name` (string): Its name.
- `status` (enum): `draft`, `active`, `paused` or `archived`. Only an active workflow starts runs.
- `collection_id` (string): The checklist whose completion starts a run.
- `steps` (array): Its steps in order, each with its kind (`trigger`, `check`, `extract`, `verify`, `screen`, `decide`, `route`, `notify`, `wait` or `request`), what it does and the policies it checks against.
- `version` (integer): The published version new runs start on. A run keeps the version it started on.
- `has_draft` (boolean): Whether it has changes not activated yet.
- `reasoning` (object): How much the reasoning agent decides: `suggest`, `decide_clear` or `automatic`, the outcomes it may set, whether it may ask the person for more, and its instructions.
- `runs` (object): Its runs: in all, this week, under way and failed.
- `start_link` (string): The link that starts a run when a person opens it.

**A workflow**

```json
{
  "id": "wf_3Kd8Pn2",
  "object": "workflow",
  "mode": "live",
  "name": "Mortgage review",
  "description": "Checks a mortgage applicant's documents, screens them and decides the clear cases.",
  "status": "active",
  "trigger": { "label": "Checklist complete", "detail": "Mortgage application" },
  "collection_id": "col_5Gk3Tm7",
  "steps": [
    { "id": "stp_1Hq4Va7", "kind": "trigger", "label": "Checklist complete", "detail": "When every required item of Mortgage application is in", "policy_ids": [] },
    { "id": "stp_5Kw9Ld2", "kind": "check", "label": "Check every document", "detail": "Changes and fraud, with the verdict", "policy_ids": ["pol_8Hm3Qr5"] },
    { "id": "stp_3Nr6Ty8", "kind": "screen", "label": "Screen the applicant", "detail": "Sanctions, politically exposed persons and watch lists", "policy_ids": [] },
    { "id": "stp_8Bc2Gm4", "kind": "decide", "label": "Decide", "detail": "The reasoning agent decides the clear cases; the rest go to the mortgage team", "policy_ids": [] },
    { "id": "stp_6Px1Sw9", "kind": "notify", "label": "Tell the team", "detail": "Email mortgages@harbourline.example when a case needs a person", "policy_ids": [] }
  ],
  "version": 7,
  "has_draft": false,
  "reasoning": {
    "level": "decide_clear",
    "outcomes": ["approved"],
    "may_request": true,
    "instructions": "Approve only when income covers the repayment at least three times. Send every self-employed applicant to a person."
  },
  "runs": { "total": 412, "this_week": 15, "under_way": 4, "failed": 0 },
  "last_run_at": "2026-11-27T08:51:12Z",
  "updated_at": "2026-11-18T13:20:44Z",
  "updated_by": "Ines Moreau",
  "origin": "template",
  "start_link": "https://r.kontiga.com/w/mortgage-review"
}
```

## List workflows

The steps cases run through on their own, with their status and runs.

`GET /v1/workflows`. Who may: Owner, Admin, Analyst, Developer and Viewer. CLI: `kontiga workflows list`. MCP tool: `list_workflows`.

**Parameters**

**Returns** list of workflows: The workflows with their steps.

API:

```bash
curl -X GET https://api.kontiga.com/v1/workflows \
  -H "Authorization: Bearer $KONTIGA_API_KEY"
```

CLI:

```bash
kontiga workflows list
```

MCP tool `list_workflows`:

```json
{
  "name": "list_workflows",
  "arguments": {}
}
```

TypeScript:

```typescript
import Kontiga from "@kontiga/sdk";

const kontiga = new Kontiga(); // reads KONTIGA_API_KEY
const result = await kontiga.workflows.list();
```

Python:

```python
from kontiga import Kontiga

kontiga = Kontiga()  # reads KONTIGA_API_KEY
result = kontiga.workflows.list()
```

Go:

```go
client := kontiga.NewClient() // reads KONTIGA_API_KEY
result, err := client.Workflows.List(ctx)
if err != nil {
	return err
}
```

Java:

```java
Kontiga kontiga = Kontiga.fromEnv(); // reads KONTIGA_API_KEY
var result = kontiga.workflows().list();
```

.NET:

```csharp
var kontiga = new KontigaClient(); // reads KONTIGA_API_KEY
var result = await kontiga.Workflows.ListAsync();
```

PHP:

```php
$kontiga = new \Kontiga\Client(); // reads KONTIGA_API_KEY
$result = $kontiga->workflows->list();
```

Ruby:

```ruby
require "kontiga"

kontiga = Kontiga::Client.new # reads KONTIGA_API_KEY
result = kontiga.workflows.list
```

Rust:

```rust
let kontiga = kontiga::Client::from_env()?; // reads KONTIGA_API_KEY
let result = kontiga
    .workflows()
    .list()
    .await?;
```

Response, 200 OK:

```json
{
  "items": [
    {
      "id": "wf_3Kd8Pn2",
      "object": "workflow",
      "name": "Mortgage review",
      "status": "active",
      "autonomy": "acts",
      "runs_this_week": 15,
      "waiting_runs": 4
    },
    {
      "id": "wf_6Gn2Rt8",
      "object": "workflow",
      "name": "Tenancy check",
      "status": "draft",
      "autonomy": "suggests",
      "runs_this_week": 0,
      "waiting_runs": 0
    }
  ],
  "next_cursor": null
}
```

## List workflows with their runs

Every workflow with what starts it, its steps, its version, how much the reasoning agent decides, and its runs this week.

`GET /v1/workflows/overview`. Who may: Owner, Admin, Analyst, Developer and Viewer. CLI: `kontiga workflows overview [--search <text>] [--status <draft|active|paused|archived>]`. MCP tool: `list_workflows_with_runs`.

**Parameters**
- `search` (string): Words in the name or the description. At most 200 characters.
- `status` (enum): Only workflows in this status. One of `draft`, `active`, `paused`, `archived`.

**Returns** list of workflow summaries: Each workflow with its trigger, steps, version, reasoning settings and run counts.

API:

```bash
curl -X GET "https://api.kontiga.com/v1/workflows/overview?status=active" \
  -H "Authorization: Bearer $KONTIGA_API_KEY"
```

CLI:

```bash
kontiga workflows overview --status active
```

MCP tool `list_workflows_with_runs`:

```json
{
  "name": "list_workflows_with_runs",
  "arguments": {
    "status": "active"
  }
}
```

TypeScript:

```typescript
import Kontiga from "@kontiga/sdk";

const kontiga = new Kontiga(); // reads KONTIGA_API_KEY
const result = await kontiga.workflows.overview({
  status: "active",
});
```

Python:

```python
from kontiga import Kontiga

kontiga = Kontiga()  # reads KONTIGA_API_KEY
result = kontiga.workflows.overview(status="active")
```

Go:

```go
client := kontiga.NewClient() // reads KONTIGA_API_KEY
result, err := client.Workflows.Overview(ctx, &kontiga.WorkflowsOverviewParams{
	Status: "active",
})
if err != nil {
	return err
}
```

Java:

```java
Kontiga kontiga = Kontiga.fromEnv(); // reads KONTIGA_API_KEY
var result = kontiga.workflows().overview(WorkflowsOverviewParams.builder()
    .status("active")
    .build());
```

.NET:

```csharp
var kontiga = new KontigaClient(); // reads KONTIGA_API_KEY
var result = await kontiga.Workflows.OverviewAsync(new WorkflowsOverviewOptions
{
    Status = "active",
});
```

PHP:

```php
$kontiga = new \Kontiga\Client(); // reads KONTIGA_API_KEY
$result = $kontiga->workflows->overview([
    'status' => 'active',
]);
```

Ruby:

```ruby
require "kontiga"

kontiga = Kontiga::Client.new # reads KONTIGA_API_KEY
result = kontiga.workflows.overview(status: "active")
```

Rust:

```rust
let kontiga = kontiga::Client::from_env()?; // reads KONTIGA_API_KEY
let result = kontiga
    .workflows()
    .overview(kontiga::workflows::OverviewParams {
        status: "active".into(),
        ..Default::default()
    })
    .await?;
```

Response, 200 OK:

```json
{
  "items": [{
      "id": "wf_3Kd8Pn2",
      "object": "workflow",
      "mode": "live",
      "name": "Mortgage review",
      "description": "Checks a mortgage applicant's documents, screens them and decides the clear cases.",
      "status": "active",
      "trigger": { "label": "Checklist complete", "detail": "Mortgage application" },
      "collection_id": "col_5Gk3Tm7",
      "steps": [
        { "id": "stp_1Hq4Va7", "kind": "trigger", "label": "Checklist complete", "detail": "When every required item of Mortgage application is in", "policy_ids": [] },
        { "id": "stp_5Kw9Ld2", "kind": "check", "label": "Check every document", "detail": "Changes and fraud, with the verdict", "policy_ids": ["pol_8Hm3Qr5"] },
        { "id": "stp_3Nr6Ty8", "kind": "screen", "label": "Screen the applicant", "detail": "Sanctions, politically exposed persons and watch lists", "policy_ids": [] },
        { "id": "stp_8Bc2Gm4", "kind": "decide", "label": "Decide", "detail": "The reasoning agent decides the clear cases; the rest go to the mortgage team", "policy_ids": [] },
        { "id": "stp_6Px1Sw9", "kind": "notify", "label": "Tell the team", "detail": "Email mortgages@harbourline.example when a case needs a person", "policy_ids": [] }
      ],
      "version": 7,
      "has_draft": false,
      "reasoning": {
        "level": "decide_clear",
        "outcomes": ["approved"],
        "may_request": true,
        "instructions": "Approve only when income covers the repayment at least three times. Send every self-employed applicant to a person."
      },
      "runs": { "total": 412, "this_week": 15, "under_way": 4, "failed": 0 },
      "last_run_at": "2026-11-27T08:51:12Z",
      "updated_at": "2026-11-18T13:20:44Z",
      "updated_by": "Ines Moreau",
      "origin": "template",
      "start_link": "https://r.kontiga.com/w/mortgage-review"
    }],
  "next_cursor": null
}
```

## Read a workflow

One workflow's steps in order, what each does with a case, and the policies each step checks against.

`GET /v1/workflows/{workflow_id}`. Who may: Owner, Admin, Analyst, Developer and Viewer. CLI: `kontiga workflows get <workflow_id>`. MCP tool: `get_workflow`.

**Parameters**
- `workflow_id` (id (wf_), required): The workflow to read. In the path.

**Returns** workflow: The workflow as it stands.

API:

```bash
curl -X GET https://api.kontiga.com/v1/workflows/wf_3Kd8Pn2 \
  -H "Authorization: Bearer $KONTIGA_API_KEY"
```

CLI:

```bash
kontiga workflows get wf_3Kd8Pn2
```

MCP tool `get_workflow`:

```json
{
  "name": "get_workflow",
  "arguments": {
    "workflow_id": "wf_3Kd8Pn2"
  }
}
```

TypeScript:

```typescript
import Kontiga from "@kontiga/sdk";

const kontiga = new Kontiga(); // reads KONTIGA_API_KEY
const result = await kontiga.workflows.get("wf_3Kd8Pn2");
```

Python:

```python
from kontiga import Kontiga

kontiga = Kontiga()  # reads KONTIGA_API_KEY
result = kontiga.workflows.get("wf_3Kd8Pn2")
```

Go:

```go
client := kontiga.NewClient() // reads KONTIGA_API_KEY
result, err := client.Workflows.Get(ctx, "wf_3Kd8Pn2")
if err != nil {
	return err
}
```

Java:

```java
Kontiga kontiga = Kontiga.fromEnv(); // reads KONTIGA_API_KEY
var result = kontiga.workflows().get("wf_3Kd8Pn2");
```

.NET:

```csharp
var kontiga = new KontigaClient(); // reads KONTIGA_API_KEY
var result = await kontiga.Workflows.GetAsync("wf_3Kd8Pn2");
```

PHP:

```php
$kontiga = new \Kontiga\Client(); // reads KONTIGA_API_KEY
$result = $kontiga->workflows->get('wf_3Kd8Pn2');
```

Ruby:

```ruby
require "kontiga"

kontiga = Kontiga::Client.new # reads KONTIGA_API_KEY
result = kontiga.workflows.get("wf_3Kd8Pn2")
```

Rust:

```rust
let kontiga = kontiga::Client::from_env()?; // reads KONTIGA_API_KEY
let result = kontiga
    .workflows()
    .get("wf_3Kd8Pn2".into())
    .await?;
```

Response, 200 OK:

```json
{
  "id": "wf_3Kd8Pn2",
  "object": "workflow",
  "mode": "live",
  "name": "Mortgage review",
  "description": "Checks a mortgage applicant's documents, screens them and decides the clear cases.",
  "status": "active",
  "trigger": { "label": "Checklist complete", "detail": "Mortgage application" },
  "collection_id": "col_5Gk3Tm7",
  "steps": [
    { "id": "stp_1Hq4Va7", "kind": "trigger", "label": "Checklist complete", "detail": "When every required item of Mortgage application is in", "policy_ids": [] },
    { "id": "stp_5Kw9Ld2", "kind": "check", "label": "Check every document", "detail": "Changes and fraud, with the verdict", "policy_ids": ["pol_8Hm3Qr5"] },
    { "id": "stp_3Nr6Ty8", "kind": "screen", "label": "Screen the applicant", "detail": "Sanctions, politically exposed persons and watch lists", "policy_ids": [] },
    { "id": "stp_8Bc2Gm4", "kind": "decide", "label": "Decide", "detail": "The reasoning agent decides the clear cases; the rest go to the mortgage team", "policy_ids": [] },
    { "id": "stp_6Px1Sw9", "kind": "notify", "label": "Tell the team", "detail": "Email mortgages@harbourline.example when a case needs a person", "policy_ids": [] }
  ],
  "version": 7,
  "has_draft": false,
  "reasoning": {
    "level": "decide_clear",
    "outcomes": ["approved"],
    "may_request": true,
    "instructions": "Approve only when income covers the repayment at least three times. Send every self-employed applicant to a person."
  },
  "runs": { "total": 412, "this_week": 15, "under_way": 4, "failed": 0 },
  "last_run_at": "2026-11-27T08:51:12Z",
  "updated_at": "2026-11-18T13:20:44Z",
  "updated_by": "Ines Moreau",
  "origin": "template",
  "start_link": "https://r.kontiga.com/w/mortgage-review"
}
```

## Read a workflow in full

One workflow: its steps with the policies each checks against, the reasoning agent's settings, its versions and changes, and what stops it being activated.

`GET /v1/workflows/{workflow_id}/overview`. Who may: Owner, Admin, Analyst, Developer and Viewer. CLI: `kontiga workflows describe <workflow_id>`. MCP tool: `describe_workflow`.

**Parameters**
- `workflow_id` (id (wf_), required): The workflow to read in full. In the path.

**Returns** workflow in full: The workflow with its steps, reasoning settings, history and problems.

API:

```bash
curl -X GET https://api.kontiga.com/v1/workflows/wf_3Kd8Pn2/overview \
  -H "Authorization: Bearer $KONTIGA_API_KEY"
```

CLI:

```bash
kontiga workflows describe wf_3Kd8Pn2
```

MCP tool `describe_workflow`:

```json
{
  "name": "describe_workflow",
  "arguments": {
    "workflow_id": "wf_3Kd8Pn2"
  }
}
```

TypeScript:

```typescript
import Kontiga from "@kontiga/sdk";

const kontiga = new Kontiga(); // reads KONTIGA_API_KEY
const result = await kontiga.workflows.describe("wf_3Kd8Pn2");
```

Python:

```python
from kontiga import Kontiga

kontiga = Kontiga()  # reads KONTIGA_API_KEY
result = kontiga.workflows.describe("wf_3Kd8Pn2")
```

Go:

```go
client := kontiga.NewClient() // reads KONTIGA_API_KEY
result, err := client.Workflows.Describe(ctx, "wf_3Kd8Pn2")
if err != nil {
	return err
}
```

Java:

```java
Kontiga kontiga = Kontiga.fromEnv(); // reads KONTIGA_API_KEY
var result = kontiga.workflows().describe("wf_3Kd8Pn2");
```

.NET:

```csharp
var kontiga = new KontigaClient(); // reads KONTIGA_API_KEY
var result = await kontiga.Workflows.DescribeAsync("wf_3Kd8Pn2");
```

PHP:

```php
$kontiga = new \Kontiga\Client(); // reads KONTIGA_API_KEY
$result = $kontiga->workflows->describe('wf_3Kd8Pn2');
```

Ruby:

```ruby
require "kontiga"

kontiga = Kontiga::Client.new # reads KONTIGA_API_KEY
result = kontiga.workflows.describe("wf_3Kd8Pn2")
```

Rust:

```rust
let kontiga = kontiga::Client::from_env()?; // reads KONTIGA_API_KEY
let result = kontiga
    .workflows()
    .describe("wf_3Kd8Pn2".into())
    .await?;
```

Response, 200 OK:

```json
{
  "id": "wf_3Kd8Pn2",
  "object": "workflow",
  "mode": "live",
  "name": "Mortgage review",
  "status": "active",
  "collection_id": "col_5Gk3Tm7",
  "steps": [
    { "id": "stp_1Hq4Va7", "kind": "trigger", "label": "Checklist complete", "detail": "When every required item of Mortgage application is in", "policy_ids": [] },
    { "id": "stp_5Kw9Ld2", "kind": "check", "label": "Check every document", "detail": "Changes and fraud, with the verdict", "policy_ids": ["pol_8Hm3Qr5"] },
    { "id": "stp_3Nr6Ty8", "kind": "screen", "label": "Screen the applicant", "detail": "Sanctions, politically exposed persons and watch lists", "policy_ids": [] },
    { "id": "stp_8Bc2Gm4", "kind": "decide", "label": "Decide", "detail": "The reasoning agent decides the clear cases; the rest go to the mortgage team", "policy_ids": [] },
    { "id": "stp_6Px1Sw9", "kind": "notify", "label": "Tell the team", "detail": "Email mortgages@harbourline.example when a case needs a person", "policy_ids": [] }
  ],
  "version": 7,
  "has_draft": false,
  "reasoning": {
    "level": "decide_clear",
    "outcomes": ["approved"],
    "may_request": true,
    "instructions": "Approve only when income covers the repayment at least three times. Send every self-employed applicant to a person."
  },
  "history": [
    { "at": "2026-11-18T13:20:44Z", "who": "Ines Moreau", "what": "Activated version 7", "version": 7 },
    { "at": "2026-11-18T13:12:09Z", "who": "Ines Moreau", "what": "Added the step Tell the team", "version": null }
  ],
  "problems": [],
  "definition": {
    "nodes": [
      { "id": "start", "type": "start", "position": { "x": 0, "y": 120 }, "data": { "label": "Start" } },
      { "id": "docs", "type": "documentCollection", "position": { "x": 340, "y": 120 }, "data": { "label": "Your documents", "collectionId": "col_5Gk3Tm7" } },
      { "id": "ok", "type": "approve", "position": { "x": 680, "y": 120 }, "data": { "label": "APPROVE" } }
    ],
    "edges": [
      { "id": "e1", "source": "start", "target": "docs" },
      { "id": "e2", "source": "docs", "target": "ok" }
    ],
    "settings": { "title": "Your mortgage application", "subtitle": "Send us a few documents and we will be in touch.", "theme": "professional" },
    "secrets": [],
    "policies": { "docs": ["pol_8Hm3Qr5"] },
    "explanations": {}
  },
  "start_link": "https://r.kontiga.com/w/mortgage-review",
  "imported": null,
  "invitations": []
}
```

## List workflow runs

The runs of the workspace's workflows, newest first: the case, where each run is or how it ended, and the outcome.

`GET /v1/workflow_runs`. Who may: Owner, Admin, Analyst, Developer and Viewer. CLI: `kontiga workflow-runs list [--workflow-id <workflow_id>] [--state <running|waiting|completed|failed>] [--limit <n>]`. MCP tool: `list_workflow_runs`.

**Parameters**
- `workflow_id` (id (wf_)): Only the runs of this workflow.
- `state` (enum): Only runs in this state. One of `running`, `waiting`, `completed`, `failed`.
- `limit` (integer): How many to answer, 1 to 200.

**Returns** list of workflow runs: The runs, newest first, each with its case, step, state and outcome.

API:

```bash
curl -X GET "https://api.kontiga.com/v1/workflow_runs?workflow_id=wf_3Kd8Pn2&limit=50" \
  -H "Authorization: Bearer $KONTIGA_API_KEY"
```

CLI:

```bash
kontiga workflow-runs list --workflow-id wf_3Kd8Pn2 --limit 50
```

MCP tool `list_workflow_runs`:

```json
{
  "name": "list_workflow_runs",
  "arguments": {
    "workflow_id": "wf_3Kd8Pn2",
    "limit": 50
  }
}
```

TypeScript:

```typescript
import Kontiga from "@kontiga/sdk";

const kontiga = new Kontiga(); // reads KONTIGA_API_KEY
const result = await kontiga.workflowRuns.list({
  workflow_id: "wf_3Kd8Pn2",
  limit: 50,
});
```

Python:

```python
from kontiga import Kontiga

kontiga = Kontiga()  # reads KONTIGA_API_KEY
result = kontiga.workflow_runs.list(workflow_id="wf_3Kd8Pn2", limit=50)
```

Go:

```go
client := kontiga.NewClient() // reads KONTIGA_API_KEY
result, err := client.WorkflowRuns.List(ctx, &kontiga.WorkflowRunsListParams{
	WorkflowId: "wf_3Kd8Pn2",
	Limit:      50,
})
if err != nil {
	return err
}
```

Java:

```java
Kontiga kontiga = Kontiga.fromEnv(); // reads KONTIGA_API_KEY
var result = kontiga.workflowRuns().list(WorkflowRunsListParams.builder()
    .workflowId("wf_3Kd8Pn2")
    .limit(50)
    .build());
```

.NET:

```csharp
var kontiga = new KontigaClient(); // reads KONTIGA_API_KEY
var result = await kontiga.WorkflowRuns.ListAsync(new WorkflowRunsListOptions
{
    WorkflowId = "wf_3Kd8Pn2",
    Limit = 50,
});
```

PHP:

```php
$kontiga = new \Kontiga\Client(); // reads KONTIGA_API_KEY
$result = $kontiga->workflowRuns->list([
    'workflow_id' => 'wf_3Kd8Pn2',
    'limit' => 50,
]);
```

Ruby:

```ruby
require "kontiga"

kontiga = Kontiga::Client.new # reads KONTIGA_API_KEY
result = kontiga.workflow_runs.list(workflow_id: "wf_3Kd8Pn2", limit: 50)
```

Rust:

```rust
let kontiga = kontiga::Client::from_env()?; // reads KONTIGA_API_KEY
let result = kontiga
    .workflow_runs()
    .list(kontiga::workflow_runs::ListParams {
        workflow_id: "wf_3Kd8Pn2".into(),
        limit: 50,
        ..Default::default()
    })
    .await?;
```

Response, 200 OK:

```json
{
  "items": [
    {
      "id": "run_4Jc7Mq2",
      "object": "workflow_run",
      "workflow_id": "wf_3Kd8Pn2",
      "version": 7,
      "case_id": "case_7Kq2Xw9",
      "case_reference": "APP-20418",
      "case_title": "Mortgage application, 14 Harbour Row",
      "person_name": "Marta Kowalczyk",
      "state": "waiting",
      "step_id": "stp_8Bc2Gm4",
      "step_label": "Decide",
      "status": "Waiting for a person: a finding on the October payslip",
      "outcome": null,
      "decided_by": null,
      "started_at": "2026-11-24T09:42:03Z",
      "ended_at": null
    },
    {
      "id": "run_9Ra1Kv6",
      "object": "workflow_run",
      "workflow_id": "wf_3Kd8Pn2",
      "version": 7,
      "case_id": "case_2Wq5Hn8",
      "case_reference": "APP-20397",
      "case_title": "Mortgage application, 3 Quay Street",
      "person_name": "Rowan Example",
      "state": "completed",
      "step_id": null,
      "step_label": null,
      "status": "Approved by the reasoning agent",
      "outcome": "approved",
      "decided_by": "Reasoning agent",
      "started_at": "2026-11-23T15:10:44Z",
      "ended_at": "2026-11-23T15:12:30Z"
    }
  ],
  "next_cursor": null
}
```

## List workflow templates

The workflow templates Kontiga keeps, for lenders, insurers, letting agents, onboarding and hiring; choosing one makes a draft copy.

`GET /v1/workflow_templates`. Who may: Owner, Admin, Analyst, Developer and Viewer. CLI: `kontiga workflow-templates list`. MCP tool: `list_workflow_templates`.

**Parameters**

**Returns** list of workflow templates: Each template with who it is for and its steps.

API:

```bash
curl -X GET https://api.kontiga.com/v1/workflow_templates \
  -H "Authorization: Bearer $KONTIGA_API_KEY"
```

CLI:

```bash
kontiga workflow-templates list
```

MCP tool `list_workflow_templates`:

```json
{
  "name": "list_workflow_templates",
  "arguments": {}
}
```

TypeScript:

```typescript
import Kontiga from "@kontiga/sdk";

const kontiga = new Kontiga(); // reads KONTIGA_API_KEY
const result = await kontiga.workflowTemplates.list();
```

Python:

```python
from kontiga import Kontiga

kontiga = Kontiga()  # reads KONTIGA_API_KEY
result = kontiga.workflow_templates.list()
```

Go:

```go
client := kontiga.NewClient() // reads KONTIGA_API_KEY
result, err := client.WorkflowTemplates.List(ctx)
if err != nil {
	return err
}
```

Java:

```java
Kontiga kontiga = Kontiga.fromEnv(); // reads KONTIGA_API_KEY
var result = kontiga.workflowTemplates().list();
```

.NET:

```csharp
var kontiga = new KontigaClient(); // reads KONTIGA_API_KEY
var result = await kontiga.WorkflowTemplates.ListAsync();
```

PHP:

```php
$kontiga = new \Kontiga\Client(); // reads KONTIGA_API_KEY
$result = $kontiga->workflowTemplates->list();
```

Ruby:

```ruby
require "kontiga"

kontiga = Kontiga::Client.new # reads KONTIGA_API_KEY
result = kontiga.workflow_templates.list
```

Rust:

```rust
let kontiga = kontiga::Client::from_env()?; // reads KONTIGA_API_KEY
let result = kontiga
    .workflow_templates()
    .list()
    .await?;
```

Response, 200 OK:

```json
{
  "items": [
    {
      "id": "wft_mortgage-review",
      "object": "workflow_template",
      "name": "Mortgage review",
      "description": "Collect, check and screen a mortgage applicant, then decide.",
      "segment": "Lenders",
      "steps": [
        { "kind": "trigger", "label": "Checklist complete", "detail": "When every required item is in" },
        { "kind": "check", "label": "Check every document", "detail": "Changes and fraud, with the verdict" },
        { "kind": "screen", "label": "Screen the applicant", "detail": "Sanctions and watch lists" },
        { "kind": "decide", "label": "Decide", "detail": "A person decides" }
      ]
    },
    {
      "id": "wft_motor-claim",
      "object": "workflow_template",
      "name": "Motor claim",
      "description": "Collect the claim documents and photos, check them and route large claims.",
      "segment": "Insurers",
      "steps": [
        { "kind": "trigger", "label": "Claim submitted", "detail": "When the claimant sends the form" },
        { "kind": "check", "label": "Check every document", "detail": "Changes and fraud, with the verdict" },
        { "kind": "route", "label": "Large claims", "detail": "Over 5,000 to a senior handler" }
      ]
    }
  ],
  "next_cursor": null
}
```

## Create a workflow

Makes a draft workflow from a template, from the steps of a description, or blank to build step by step. A draft starts no runs until it is activated.

`POST /v1/workflows`. Who may: Owner and Admin. CLI: `kontiga workflows create --name <name> --from <template|description|canvas> [--template-id <id>] [--description <text>] [--collection-id <col_id>] [--steps <json>] [--nodes <json>] [--edges <json>] [--settings <json>] [--explanations <json>]`. MCP tool: `create_workflow`.

**Parameters**
- `name` (string, required): Its name. At most 80 characters.
- `from` (enum, required): `template` copies a template; `description` saves what the planner proposed; `canvas` starts blank with a start link and an Approve step.
- `template_id` (id (wft_)): For `template`: the template to copy.
- `description` (string): What it is for. At most 400 characters.
- `collection_id` (id (col_)): The checklist whose completion starts a run.
- `steps` (array of object): For `description`: the steps in order, each with `kind`, `label`, `detail` and `policy_ids`. At most 30 items.
- `nodes` (array of object): For `description`: the canvas's steps in Bynn's format, `{id, type, position, data}`. At most 100 items.
- `edges` (array of object): For `description`: the canvas's connections, `{id, source, target}`. At most 200 items.
- `settings` (record): What the end customer's page shows: `title`, `subtitle` and `theme`.
- `explanations` (record): Why each step is there, by node id, as the planner wrote it.

**Returns** workflow in full: The new draft workflow.

API:

```bash
curl -X POST https://api.kontiga.com/v1/workflows \
  -H "Authorization: Bearer $KONTIGA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Mortgage review",
    "from": "template",
    "template_id": "wft_mortgage-review",
    "collection_id": "col_5Gk3Tm7"
  }'
```

CLI:

```bash
kontiga workflows create \
  --name 'Mortgage review' \
  --from template \
  --template-id wft_mortgage-review \
  --collection-id col_5Gk3Tm7
```

MCP tool `create_workflow`:

```json
{
  "name": "create_workflow",
  "arguments": {
    "name": "Mortgage review",
    "from": "template",
    "template_id": "wft_mortgage-review",
    "collection_id": "col_5Gk3Tm7"
  }
}
```

TypeScript:

```typescript
import Kontiga from "@kontiga/sdk";

const kontiga = new Kontiga(); // reads KONTIGA_API_KEY
const result = await kontiga.workflows.create({
  name: "Mortgage review",
  from: "template",
  template_id: "wft_mortgage-review",
  collection_id: "col_5Gk3Tm7",
});
```

Python:

```python
from kontiga import Kontiga

kontiga = Kontiga()  # reads KONTIGA_API_KEY
result = kontiga.workflows.create(
    name="Mortgage review",
    from_="template",
    template_id="wft_mortgage-review",
    collection_id="col_5Gk3Tm7",
)
```

Go:

```go
client := kontiga.NewClient() // reads KONTIGA_API_KEY
result, err := client.Workflows.Create(ctx, &kontiga.WorkflowsCreateParams{
	Name:         "Mortgage review",
	From:         "template",
	TemplateId:   "wft_mortgage-review",
	CollectionId: "col_5Gk3Tm7",
})
if err != nil {
	return err
}
```

Java:

```java
Kontiga kontiga = Kontiga.fromEnv(); // reads KONTIGA_API_KEY
var result = kontiga.workflows().create(WorkflowsCreateParams.builder()
    .name("Mortgage review")
    .from("template")
    .templateId("wft_mortgage-review")
    .collectionId("col_5Gk3Tm7")
    .build());
```

.NET:

```csharp
var kontiga = new KontigaClient(); // reads KONTIGA_API_KEY
var result = await kontiga.Workflows.CreateAsync(new WorkflowsCreateOptions
{
    Name = "Mortgage review",
    From = "template",
    TemplateId = "wft_mortgage-review",
    CollectionId = "col_5Gk3Tm7",
});
```

PHP:

```php
$kontiga = new \Kontiga\Client(); // reads KONTIGA_API_KEY
$result = $kontiga->workflows->create([
    'name' => 'Mortgage review',
    'from' => 'template',
    'template_id' => 'wft_mortgage-review',
    'collection_id' => 'col_5Gk3Tm7',
]);
```

Ruby:

```ruby
require "kontiga"

kontiga = Kontiga::Client.new # reads KONTIGA_API_KEY
result = kontiga.workflows.create(
  name: "Mortgage review",
  from: "template",
  template_id: "wft_mortgage-review",
  collection_id: "col_5Gk3Tm7"
)
```

Rust:

```rust
let kontiga = kontiga::Client::from_env()?; // reads KONTIGA_API_KEY
let result = kontiga
    .workflows()
    .create(kontiga::workflows::CreateParams {
        name: "Mortgage review".into(),
        from: "template".into(),
        template_id: "wft_mortgage-review".into(),
        collection_id: "col_5Gk3Tm7".into(),
        ..Default::default()
    })
    .await?;
```

Response, 201 Created:

```json
{
  "id": "wf_3Kd8Pn2",
  "object": "workflow",
  "mode": "live",
  "name": "Mortgage review",
  "status": "active",
  "collection_id": "col_5Gk3Tm7",
  "steps": [
    { "id": "stp_1Hq4Va7", "kind": "trigger", "label": "Checklist complete", "detail": "When every required item of Mortgage application is in", "policy_ids": [] },
    { "id": "stp_5Kw9Ld2", "kind": "check", "label": "Check every document", "detail": "Changes and fraud, with the verdict", "policy_ids": ["pol_8Hm3Qr5"] },
    { "id": "stp_3Nr6Ty8", "kind": "screen", "label": "Screen the applicant", "detail": "Sanctions, politically exposed persons and watch lists", "policy_ids": [] },
    { "id": "stp_8Bc2Gm4", "kind": "decide", "label": "Decide", "detail": "The reasoning agent decides the clear cases; the rest go to the mortgage team", "policy_ids": [] },
    { "id": "stp_6Px1Sw9", "kind": "notify", "label": "Tell the team", "detail": "Email mortgages@harbourline.example when a case needs a person", "policy_ids": [] }
  ],
  "version": 7,
  "has_draft": false,
  "reasoning": {
    "level": "decide_clear",
    "outcomes": ["approved"],
    "may_request": true,
    "instructions": "Approve only when income covers the repayment at least three times. Send every self-employed applicant to a person."
  },
  "history": [
    { "at": "2026-11-18T13:20:44Z", "who": "Ines Moreau", "what": "Activated version 7", "version": 7 },
    { "at": "2026-11-18T13:12:09Z", "who": "Ines Moreau", "what": "Added the step Tell the team", "version": null }
  ],
  "problems": [],
  "definition": {
    "nodes": [
      { "id": "start", "type": "start", "position": { "x": 0, "y": 120 }, "data": { "label": "Start" } },
      { "id": "docs", "type": "documentCollection", "position": { "x": 340, "y": 120 }, "data": { "label": "Your documents", "collectionId": "col_5Gk3Tm7" } },
      { "id": "ok", "type": "approve", "position": { "x": 680, "y": 120 }, "data": { "label": "APPROVE" } }
    ],
    "edges": [
      { "id": "e1", "source": "start", "target": "docs" },
      { "id": "e2", "source": "docs", "target": "ok" }
    ],
    "settings": { "title": "Your mortgage application", "subtitle": "Send us a few documents and we will be in touch.", "theme": "professional" },
    "secrets": [],
    "policies": { "docs": ["pol_8Hm3Qr5"] },
    "explanations": {}
  },
  "start_link": "https://r.kontiga.com/w/mortgage-review",
  "imported": null,
  "invitations": []
}
```

## Change a workflow

Saves a workflow's name, description and steps as a draft. An active workflow keeps running its published version until the draft is activated.

`PATCH /v1/workflows/{workflow_id}`. Who may: Owner and Admin. CLI: `kontiga workflows update <workflow_id> [--name <name>] [--description <text>] [--collection-id <col_id>] [--steps <json>]`. MCP tool: `update_workflow`.

**Parameters**
- `workflow_id` (id (wf_), required): The workflow to change. Changes are saved as a draft; runs keep their version until the draft is activated. In the path.
- `name` (string): A new name. At most 80 characters.
- `description` (string): A new description. At most 400 characters.
- `collection_id` (id (col_)): The checklist whose completion starts a run.
- `steps` (array of object): The steps in order. A step that keeps its `id` keeps its runs and its policy links. At most 30 items.

**Returns** workflow in full: The workflow with its draft saved.

API:

```bash
curl -X PATCH https://api.kontiga.com/v1/workflows/wf_3Kd8Pn2 \
  -H "Authorization: Bearer $KONTIGA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "steps": [
      {
        "kind": "trigger",
        "label": "Checklist complete",
        "detail": "When every required item of Mortgage application is in"
      },
      {
        "kind": "check",
        "label": "Check every document",
        "detail": "Changes and fraud, with the verdict",
        "policy_ids": [
          "pol_8Hm3Qr5"
        ]
      },
      {
        "kind": "decide",
        "label": "Decide",
        "detail": "A person decides"
      }
    ]
  }'
```

CLI:

```bash
kontiga workflows update wf_3Kd8Pn2 \
  --steps '[{"kind":"trigger","label":"Checklist complete","detail":"When every required item of Mortgage application is in"},{"kind":"check","label":"Check every document","detail":"Changes and fraud, with the verdict","policy_ids":["pol_8Hm3Qr5"]},{"kind":"decide","label":"Decide","detail":"A person decides"}]'
```

MCP tool `update_workflow`:

```json
{
  "name": "update_workflow",
  "arguments": {
    "workflow_id": "wf_3Kd8Pn2",
    "steps": [
      {
        "kind": "trigger",
        "label": "Checklist complete",
        "detail": "When every required item of Mortgage application is in"
      },
      {
        "kind": "check",
        "label": "Check every document",
        "detail": "Changes and fraud, with the verdict",
        "policy_ids": [
          "pol_8Hm3Qr5"
        ]
      },
      {
        "kind": "decide",
        "label": "Decide",
        "detail": "A person decides"
      }
    ]
  }
}
```

TypeScript:

```typescript
import Kontiga from "@kontiga/sdk";

const kontiga = new Kontiga(); // reads KONTIGA_API_KEY
const result = await kontiga.workflows.update("wf_3Kd8Pn2", {
  steps: [{ kind: "trigger", label: "Checklist complete", detail: "When every required item of Mortgage application is in" }, { kind: "check", label: "Check every document", detail: "Changes and fraud, with the verdict", policy_ids: ["pol_8Hm3Qr5"] }, { kind: "decide", label: "Decide", detail: "A person decides" }],
});
```

Python:

```python
from kontiga import Kontiga

kontiga = Kontiga()  # reads KONTIGA_API_KEY
result = kontiga.workflows.update("wf_3Kd8Pn2", steps=[{"kind": "trigger", "label": "Checklist complete", "detail": "When every required item of Mortgage application is in"}, {"kind": "check", "label": "Check every document", "detail": "Changes and fraud, with the verdict", "policy_ids": ["pol_8Hm3Qr5"]}, {"kind": "decide", "label": "Decide", "detail": "A person decides"}])
```

Go:

```go
client := kontiga.NewClient() // reads KONTIGA_API_KEY
result, err := client.Workflows.Update(ctx, "wf_3Kd8Pn2", &kontiga.WorkflowsUpdateParams{
	Steps: []any{map[string]any{"kind": "trigger", "label": "Checklist complete", "detail": "When every required item of Mortgage application is in"}, map[string]any{"kind": "check", "label": "Check every document", "detail": "Changes and fraud, with the verdict", "policy_ids": []string{"pol_8Hm3Qr5"}}, map[string]any{"kind": "decide", "label": "Decide", "detail": "A person decides"}},
})
if err != nil {
	return err
}
```

Java:

```java
Kontiga kontiga = Kontiga.fromEnv(); // reads KONTIGA_API_KEY
var result = kontiga.workflows().update("wf_3Kd8Pn2", WorkflowsUpdateParams.builder()
    .steps(List.of(Map.of("kind", "trigger", "label", "Checklist complete", "detail", "When every required item of Mortgage application is in"), Map.of("kind", "check", "label", "Check every document", "detail", "Changes and fraud, with the verdict", "policy_ids", List.of("pol_8Hm3Qr5")), Map.of("kind", "decide", "label", "Decide", "detail", "A person decides")))
    .build());
```

.NET:

```csharp
var kontiga = new KontigaClient(); // reads KONTIGA_API_KEY
var result = await kontiga.Workflows.UpdateAsync("wf_3Kd8Pn2", new WorkflowsUpdateOptions
{
    Steps = new object[] { new Dictionary<string, object> { ["kind"] = "trigger", ["label"] = "Checklist complete", ["detail"] = "When every required item of Mortgage application is in" }, new Dictionary<string, object> { ["kind"] = "check", ["label"] = "Check every document", ["detail"] = "Changes and fraud, with the verdict", ["policy_ids"] = new[] { "pol_8Hm3Qr5" } }, new Dictionary<string, object> { ["kind"] = "decide", ["label"] = "Decide", ["detail"] = "A person decides" } },
});
```

PHP:

```php
$kontiga = new \Kontiga\Client(); // reads KONTIGA_API_KEY
$result = $kontiga->workflows->update('wf_3Kd8Pn2', [
    'steps' => [['kind' => 'trigger', 'label' => 'Checklist complete', 'detail' => 'When every required item of Mortgage application is in'], ['kind' => 'check', 'label' => 'Check every document', 'detail' => 'Changes and fraud, with the verdict', 'policy_ids' => ['pol_8Hm3Qr5']], ['kind' => 'decide', 'label' => 'Decide', 'detail' => 'A person decides']],
]);
```

Ruby:

```ruby
require "kontiga"

kontiga = Kontiga::Client.new # reads KONTIGA_API_KEY
result = kontiga.workflows.update("wf_3Kd8Pn2", steps: [{ kind: "trigger", label: "Checklist complete", detail: "When every required item of Mortgage application is in" }, { kind: "check", label: "Check every document", detail: "Changes and fraud, with the verdict", policy_ids: ["pol_8Hm3Qr5"] }, { kind: "decide", label: "Decide", detail: "A person decides" }])
```

Rust:

```rust
let kontiga = kontiga::Client::from_env()?; // reads KONTIGA_API_KEY
let result = kontiga
    .workflows()
    .update("wf_3Kd8Pn2".into(), kontiga::workflows::UpdateParams {
        steps: vec![serde_json::json!({"kind":"trigger","label":"Checklist complete","detail":"When every required item of Mortgage application is in"}), serde_json::json!({"kind":"check","label":"Check every document","detail":"Changes and fraud, with the verdict","policy_ids":["pol_8Hm3Qr5"]}), serde_json::json!({"kind":"decide","label":"Decide","detail":"A person decides"})],
        ..Default::default()
    })
    .await?;
```

Response, 200 OK:

```json
{
  "id": "wf_3Kd8Pn2",
  "object": "workflow",
  "mode": "live",
  "name": "Mortgage review",
  "status": "active",
  "collection_id": "col_5Gk3Tm7",
  "steps": [
    { "id": "stp_1Hq4Va7", "kind": "trigger", "label": "Checklist complete", "detail": "When every required item of Mortgage application is in", "policy_ids": [] },
    { "id": "stp_5Kw9Ld2", "kind": "check", "label": "Check every document", "detail": "Changes and fraud, with the verdict", "policy_ids": ["pol_8Hm3Qr5"] },
    { "id": "stp_3Nr6Ty8", "kind": "screen", "label": "Screen the applicant", "detail": "Sanctions, politically exposed persons and watch lists", "policy_ids": [] },
    { "id": "stp_8Bc2Gm4", "kind": "decide", "label": "Decide", "detail": "The reasoning agent decides the clear cases; the rest go to the mortgage team", "policy_ids": [] },
    { "id": "stp_6Px1Sw9", "kind": "notify", "label": "Tell the team", "detail": "Email mortgages@harbourline.example when a case needs a person", "policy_ids": [] }
  ],
  "version": 7,
  "has_draft": false,
  "reasoning": {
    "level": "decide_clear",
    "outcomes": ["approved"],
    "may_request": true,
    "instructions": "Approve only when income covers the repayment at least three times. Send every self-employed applicant to a person."
  },
  "history": [
    { "at": "2026-11-18T13:20:44Z", "who": "Ines Moreau", "what": "Activated version 7", "version": 7 },
    { "at": "2026-11-18T13:12:09Z", "who": "Ines Moreau", "what": "Added the step Tell the team", "version": null }
  ],
  "problems": [],
  "definition": {
    "nodes": [
      { "id": "start", "type": "start", "position": { "x": 0, "y": 120 }, "data": { "label": "Start" } },
      { "id": "docs", "type": "documentCollection", "position": { "x": 340, "y": 120 }, "data": { "label": "Your documents", "collectionId": "col_5Gk3Tm7" } },
      { "id": "ok", "type": "approve", "position": { "x": 680, "y": 120 }, "data": { "label": "APPROVE" } }
    ],
    "edges": [
      { "id": "e1", "source": "start", "target": "docs" },
      { "id": "e2", "source": "docs", "target": "ok" }
    ],
    "settings": { "title": "Your mortgage application", "subtitle": "Send us a few documents and we will be in touch.", "theme": "professional" },
    "secrets": [],
    "policies": { "docs": ["pol_8Hm3Qr5"] },
    "explanations": {}
  },
  "start_link": "https://r.kontiga.com/w/mortgage-review",
  "imported": null,
  "invitations": []
}
```

## Save a workflow's canvas

Saves the steps and connections of the canvas as the draft, in Bynn's format. New secret values are taken out of the steps and kept apart. An active workflow keeps running its published version until the draft is activated.

`PUT /v1/workflows/{workflow_id}/definition`. Who may: Owner and Admin. CLI: `kontiga workflows save-definition <workflow_id> --nodes <json> --edges <json> [--settings <json>] [--name <name>] [--policies <json>]`. MCP tool: `save_workflow_definition`.

**Parameters**
- `workflow_id` (id (wf_), required): The workflow whose canvas to save as its draft. In the path.
- `nodes` (array of object, required): The steps, `{id, type, position, data}`, up to 100.
- `edges` (array of object, required): The connections, `{id, source, target, sourceHandle, targetHandle}`, up to 200.
- `settings` (record): What the end customer's page shows: `title`, `subtitle` and `theme`.
- `name` (string): A new name. At most 120 characters.
- `policies` (record): The policies each step checks against, by node id, up to 5 each.

**Returns** workflow in full: The workflow with its draft saved and its problems listed.

API:

```bash
curl -X PUT https://api.kontiga.com/v1/workflows/wf_3Kd8Pn2/definition \
  -H "Authorization: Bearer $KONTIGA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "nodes": [
      {
        "id": "start",
        "type": "start",
        "position": {
          "x": 0,
          "y": 120
        },
        "data": {
          "label": "Start"
        }
      },
      {
        "id": "docs",
        "type": "documentCollection",
        "position": {
          "x": 340,
          "y": 120
        },
        "data": {
          "label": "Your documents",
          "collectionId": "col_5Gk3Tm7"
        }
      },
      {
        "id": "ok",
        "type": "approve",
        "position": {
          "x": 680,
          "y": 120
        },
        "data": {
          "label": "APPROVE"
        }
      }
    ],
    "edges": [
      {
        "id": "e1",
        "source": "start",
        "target": "docs"
      },
      {
        "id": "e2",
        "source": "docs",
        "target": "ok"
      }
    ]
  }'
```

CLI:

```bash
kontiga workflows save-definition wf_3Kd8Pn2 \
  --nodes '[{"id":"start","type":"start","position":{"x":0,"y":120},"data":{"label":"Start"}},{"id":"docs","type":"documentCollection","position":{"x":340,"y":120},"data":{"label":"Your documents","collectionId":"col_5Gk3Tm7"}},{"id":"ok","type":"approve","position":{"x":680,"y":120},"data":{"label":"APPROVE"}}]' \
  --edges '[{"id":"e1","source":"start","target":"docs"},{"id":"e2","source":"docs","target":"ok"}]'
```

MCP tool `save_workflow_definition`:

```json
{
  "name": "save_workflow_definition",
  "arguments": {
    "workflow_id": "wf_3Kd8Pn2",
    "nodes": [
      {
        "id": "start",
        "type": "start",
        "position": {
          "x": 0,
          "y": 120
        },
        "data": {
          "label": "Start"
        }
      },
      {
        "id": "docs",
        "type": "documentCollection",
        "position": {
          "x": 340,
          "y": 120
        },
        "data": {
          "label": "Your documents",
          "collectionId": "col_5Gk3Tm7"
        }
      },
      {
        "id": "ok",
        "type": "approve",
        "position": {
          "x": 680,
          "y": 120
        },
        "data": {
          "label": "APPROVE"
        }
      }
    ],
    "edges": [
      {
        "id": "e1",
        "source": "start",
        "target": "docs"
      },
      {
        "id": "e2",
        "source": "docs",
        "target": "ok"
      }
    ]
  }
}
```

TypeScript:

```typescript
import Kontiga from "@kontiga/sdk";

const kontiga = new Kontiga(); // reads KONTIGA_API_KEY
const result = await kontiga.workflows.saveDefinition("wf_3Kd8Pn2", {
  nodes: [{ id: "start", type: "start", position: { x: 0, y: 120 }, data: { label: "Start" } }, { id: "docs", type: "documentCollection", position: { x: 340, y: 120 }, data: { label: "Your documents", collectionId: "col_5Gk3Tm7" } }, { id: "ok", type: "approve", position: { x: 680, y: 120 }, data: { label: "APPROVE" } }],
  edges: [{ id: "e1", source: "start", target: "docs" }, { id: "e2", source: "docs", target: "ok" }],
});
```

Python:

```python
from kontiga import Kontiga

kontiga = Kontiga()  # reads KONTIGA_API_KEY
result = kontiga.workflows.save_definition(
    "wf_3Kd8Pn2",
    nodes=[{"id": "start", "type": "start", "position": {"x": 0, "y": 120}, "data": {"label": "Start"}}, {"id": "docs", "type": "documentCollection", "position": {"x": 340, "y": 120}, "data": {"label": "Your documents", "collectionId": "col_5Gk3Tm7"}}, {"id": "ok", "type": "approve", "position": {"x": 680, "y": 120}, "data": {"label": "APPROVE"}}],
    edges=[{"id": "e1", "source": "start", "target": "docs"}, {"id": "e2", "source": "docs", "target": "ok"}],
)
```

Go:

```go
client := kontiga.NewClient() // reads KONTIGA_API_KEY
result, err := client.Workflows.SaveDefinition(ctx, "wf_3Kd8Pn2", &kontiga.WorkflowsSaveDefinitionParams{
	Nodes: []any{map[string]any{"id": "start", "type": "start", "position": map[string]any{"x": 0, "y": 120}, "data": map[string]any{"label": "Start"}}, map[string]any{"id": "docs", "type": "documentCollection", "position": map[string]any{"x": 340, "y": 120}, "data": map[string]any{"label": "Your documents", "collectionId": "col_5Gk3Tm7"}}, map[string]any{"id": "ok", "type": "approve", "position": map[string]any{"x": 680, "y": 120}, "data": map[string]any{"label": "APPROVE"}}},
	Edges: []any{map[string]any{"id": "e1", "source": "start", "target": "docs"}, map[string]any{"id": "e2", "source": "docs", "target": "ok"}},
})
if err != nil {
	return err
}
```

Java:

```java
Kontiga kontiga = Kontiga.fromEnv(); // reads KONTIGA_API_KEY
var result = kontiga.workflows().saveDefinition("wf_3Kd8Pn2", WorkflowsSaveDefinitionParams.builder()
    .nodes(List.of(Map.of("id", "start", "type", "start", "position", Map.of("x", 0, "y", 120), "data", Map.of("label", "Start")), Map.of("id", "docs", "type", "documentCollection", "position", Map.of("x", 340, "y", 120), "data", Map.of("label", "Your documents", "collectionId", "col_5Gk3Tm7")), Map.of("id", "ok", "type", "approve", "position", Map.of("x", 680, "y", 120), "data", Map.of("label", "APPROVE"))))
    .edges(List.of(Map.of("id", "e1", "source", "start", "target", "docs"), Map.of("id", "e2", "source", "docs", "target", "ok")))
    .build());
```

.NET:

```csharp
var kontiga = new KontigaClient(); // reads KONTIGA_API_KEY
var result = await kontiga.Workflows.SaveDefinitionAsync("wf_3Kd8Pn2", new WorkflowsSaveDefinitionOptions
{
    Nodes = new object[] { new Dictionary<string, object> { ["id"] = "start", ["type"] = "start", ["position"] = new Dictionary<string, object> { ["x"] = 0, ["y"] = 120 }, ["data"] = new Dictionary<string, object> { ["label"] = "Start" } }, new Dictionary<string, object> { ["id"] = "docs", ["type"] = "documentCollection", ["position"] = new Dictionary<string, object> { ["x"] = 340, ["y"] = 120 }, ["data"] = new Dictionary<string, object> { ["label"] = "Your documents", ["collectionId"] = "col_5Gk3Tm7" } }, new Dictionary<string, object> { ["id"] = "ok", ["type"] = "approve", ["position"] = new Dictionary<string, object> { ["x"] = 680, ["y"] = 120 }, ["data"] = new Dictionary<string, object> { ["label"] = "APPROVE" } } },
    Edges = new object[] { new Dictionary<string, object> { ["id"] = "e1", ["source"] = "start", ["target"] = "docs" }, new Dictionary<string, object> { ["id"] = "e2", ["source"] = "docs", ["target"] = "ok" } },
});
```

PHP:

```php
$kontiga = new \Kontiga\Client(); // reads KONTIGA_API_KEY
$result = $kontiga->workflows->saveDefinition('wf_3Kd8Pn2', [
    'nodes' => [['id' => 'start', 'type' => 'start', 'position' => ['x' => 0, 'y' => 120], 'data' => ['label' => 'Start']], ['id' => 'docs', 'type' => 'documentCollection', 'position' => ['x' => 340, 'y' => 120], 'data' => ['label' => 'Your documents', 'collectionId' => 'col_5Gk3Tm7']], ['id' => 'ok', 'type' => 'approve', 'position' => ['x' => 680, 'y' => 120], 'data' => ['label' => 'APPROVE']]],
    'edges' => [['id' => 'e1', 'source' => 'start', 'target' => 'docs'], ['id' => 'e2', 'source' => 'docs', 'target' => 'ok']],
]);
```

Ruby:

```ruby
require "kontiga"

kontiga = Kontiga::Client.new # reads KONTIGA_API_KEY
result = kontiga.workflows.save_definition(
  "wf_3Kd8Pn2",
  nodes: [{ id: "start", type: "start", position: { x: 0, y: 120 }, data: { label: "Start" } }, { id: "docs", type: "documentCollection", position: { x: 340, y: 120 }, data: { label: "Your documents", collectionId: "col_5Gk3Tm7" } }, { id: "ok", type: "approve", position: { x: 680, y: 120 }, data: { label: "APPROVE" } }],
  edges: [{ id: "e1", source: "start", target: "docs" }, { id: "e2", source: "docs", target: "ok" }]
)
```

Rust:

```rust
let kontiga = kontiga::Client::from_env()?; // reads KONTIGA_API_KEY
let result = kontiga
    .workflows()
    .save_definition("wf_3Kd8Pn2".into(), kontiga::workflows::SaveDefinitionParams {
        nodes: vec![serde_json::json!({"id":"start","type":"start","position":{"x":0,"y":120},"data":{"label":"Start"}}), serde_json::json!({"id":"docs","type":"documentCollection","position":{"x":340,"y":120},"data":{"label":"Your documents","collectionId":"col_5Gk3Tm7"}}), serde_json::json!({"id":"ok","type":"approve","position":{"x":680,"y":120},"data":{"label":"APPROVE"}})],
        edges: vec![serde_json::json!({"id":"e1","source":"start","target":"docs"}), serde_json::json!({"id":"e2","source":"docs","target":"ok"})],
        ..Default::default()
    })
    .await?;
```

Response, 200 OK:

```json
{
  "id": "wf_3Kd8Pn2",
  "object": "workflow",
  "mode": "live",
  "name": "Mortgage review",
  "status": "active",
  "collection_id": "col_5Gk3Tm7",
  "steps": [
    { "id": "stp_1Hq4Va7", "kind": "trigger", "label": "Checklist complete", "detail": "When every required item of Mortgage application is in", "policy_ids": [] },
    { "id": "stp_5Kw9Ld2", "kind": "check", "label": "Check every document", "detail": "Changes and fraud, with the verdict", "policy_ids": ["pol_8Hm3Qr5"] },
    { "id": "stp_3Nr6Ty8", "kind": "screen", "label": "Screen the applicant", "detail": "Sanctions, politically exposed persons and watch lists", "policy_ids": [] },
    { "id": "stp_8Bc2Gm4", "kind": "decide", "label": "Decide", "detail": "The reasoning agent decides the clear cases; the rest go to the mortgage team", "policy_ids": [] },
    { "id": "stp_6Px1Sw9", "kind": "notify", "label": "Tell the team", "detail": "Email mortgages@harbourline.example when a case needs a person", "policy_ids": [] }
  ],
  "version": 7,
  "has_draft": false,
  "reasoning": {
    "level": "decide_clear",
    "outcomes": ["approved"],
    "may_request": true,
    "instructions": "Approve only when income covers the repayment at least three times. Send every self-employed applicant to a person."
  },
  "history": [
    { "at": "2026-11-18T13:20:44Z", "who": "Ines Moreau", "what": "Activated version 7", "version": 7 },
    { "at": "2026-11-18T13:12:09Z", "who": "Ines Moreau", "what": "Added the step Tell the team", "version": null }
  ],
  "problems": [],
  "definition": {
    "nodes": [
      { "id": "start", "type": "start", "position": { "x": 0, "y": 120 }, "data": { "label": "Start" } },
      { "id": "docs", "type": "documentCollection", "position": { "x": 340, "y": 120 }, "data": { "label": "Your documents", "collectionId": "col_5Gk3Tm7" } },
      { "id": "ok", "type": "approve", "position": { "x": 680, "y": 120 }, "data": { "label": "APPROVE" } }
    ],
    "edges": [
      { "id": "e1", "source": "start", "target": "docs" },
      { "id": "e2", "source": "docs", "target": "ok" }
    ],
    "settings": { "title": "Your mortgage application", "subtitle": "Send us a few documents and we will be in touch.", "theme": "professional" },
    "secrets": [],
    "policies": { "docs": ["pol_8Hm3Qr5"] },
    "explanations": {}
  },
  "start_link": "https://r.kontiga.com/w/mortgage-review",
  "imported": null,
  "invitations": []
}
```

## Set what the end customer's page shows

The title and the line under it on the end customer's page, and its colour theme (Bynn's workflow properties).

`PATCH /v1/workflows/{workflow_id}/settings`. Who may: Owner and Admin. CLI: `kontiga workflows set-properties <workflow_id> [--title <text>] [--subtitle <text>] [--theme <default|professional|success|warning|danger|purple|teal>]`. MCP tool: `set_workflow_properties`.

**Parameters**
- `workflow_id` (id (wf_), required): The workflow. In the path.
- `title` (string): The title at the top of the end customer's page. At most 120 characters.
- `subtitle` (string): The line under it, shown as written. One sentence reads best. At most 2,000 characters.
- `theme` (enum): The page's two colours. One of `default`, `professional`, `success`, `warning`, `danger`, `purple`, `teal`.

**Returns** workflow in full: The workflow with its page settings.

API:

```bash
curl -X PATCH https://api.kontiga.com/v1/workflows/wf_3Kd8Pn2/settings \
  -H "Authorization: Bearer $KONTIGA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Your mortgage application",
    "subtitle": "Send us a few documents and we will be in touch.",
    "theme": "professional"
  }'
```

CLI:

```bash
kontiga workflows set-properties wf_3Kd8Pn2 \
  --title 'Your mortgage application' \
  --subtitle 'Send us a few documents and we will be in touch.' \
  --theme professional
```

MCP tool `set_workflow_properties`:

```json
{
  "name": "set_workflow_properties",
  "arguments": {
    "workflow_id": "wf_3Kd8Pn2",
    "title": "Your mortgage application",
    "subtitle": "Send us a few documents and we will be in touch.",
    "theme": "professional"
  }
}
```

TypeScript:

```typescript
import Kontiga from "@kontiga/sdk";

const kontiga = new Kontiga(); // reads KONTIGA_API_KEY
const result = await kontiga.workflows.setProperties("wf_3Kd8Pn2", {
  title: "Your mortgage application",
  subtitle: "Send us a few documents and we will be in touch.",
  theme: "professional",
});
```

Python:

```python
from kontiga import Kontiga

kontiga = Kontiga()  # reads KONTIGA_API_KEY
result = kontiga.workflows.set_properties(
    "wf_3Kd8Pn2",
    title="Your mortgage application",
    subtitle="Send us a few documents and we will be in touch.",
    theme="professional",
)
```

Go:

```go
client := kontiga.NewClient() // reads KONTIGA_API_KEY
result, err := client.Workflows.SetProperties(ctx, "wf_3Kd8Pn2", &kontiga.WorkflowsSetPropertiesParams{
	Title:    "Your mortgage application",
	Subtitle: "Send us a few documents and we will be in touch.",
	Theme:    "professional",
})
if err != nil {
	return err
}
```

Java:

```java
Kontiga kontiga = Kontiga.fromEnv(); // reads KONTIGA_API_KEY
var result = kontiga.workflows().setProperties("wf_3Kd8Pn2", WorkflowsSetPropertiesParams.builder()
    .title("Your mortgage application")
    .subtitle("Send us a few documents and we will be in touch.")
    .theme("professional")
    .build());
```

.NET:

```csharp
var kontiga = new KontigaClient(); // reads KONTIGA_API_KEY
var result = await kontiga.Workflows.SetPropertiesAsync("wf_3Kd8Pn2", new WorkflowsSetPropertiesOptions
{
    Title = "Your mortgage application",
    Subtitle = "Send us a few documents and we will be in touch.",
    Theme = "professional",
});
```

PHP:

```php
$kontiga = new \Kontiga\Client(); // reads KONTIGA_API_KEY
$result = $kontiga->workflows->setProperties('wf_3Kd8Pn2', [
    'title' => 'Your mortgage application',
    'subtitle' => 'Send us a few documents and we will be in touch.',
    'theme' => 'professional',
]);
```

Ruby:

```ruby
require "kontiga"

kontiga = Kontiga::Client.new # reads KONTIGA_API_KEY
result = kontiga.workflows.set_properties(
  "wf_3Kd8Pn2",
  title: "Your mortgage application",
  subtitle: "Send us a few documents and we will be in touch.",
  theme: "professional"
)
```

Rust:

```rust
let kontiga = kontiga::Client::from_env()?; // reads KONTIGA_API_KEY
let result = kontiga
    .workflows()
    .set_properties("wf_3Kd8Pn2".into(), kontiga::workflows::SetPropertiesParams {
        title: "Your mortgage application".into(),
        subtitle: "Send us a few documents and we will be in touch.".into(),
        theme: "professional".into(),
        ..Default::default()
    })
    .await?;
```

Response, 200 OK:

```json
{
  "id": "wf_3Kd8Pn2",
  "object": "workflow",
  "mode": "live",
  "name": "Mortgage review",
  "status": "active",
  "collection_id": "col_5Gk3Tm7",
  "steps": [
    { "id": "stp_1Hq4Va7", "kind": "trigger", "label": "Checklist complete", "detail": "When every required item of Mortgage application is in", "policy_ids": [] },
    { "id": "stp_5Kw9Ld2", "kind": "check", "label": "Check every document", "detail": "Changes and fraud, with the verdict", "policy_ids": ["pol_8Hm3Qr5"] },
    { "id": "stp_3Nr6Ty8", "kind": "screen", "label": "Screen the applicant", "detail": "Sanctions, politically exposed persons and watch lists", "policy_ids": [] },
    { "id": "stp_8Bc2Gm4", "kind": "decide", "label": "Decide", "detail": "The reasoning agent decides the clear cases; the rest go to the mortgage team", "policy_ids": [] },
    { "id": "stp_6Px1Sw9", "kind": "notify", "label": "Tell the team", "detail": "Email mortgages@harbourline.example when a case needs a person", "policy_ids": [] }
  ],
  "version": 7,
  "has_draft": false,
  "reasoning": {
    "level": "decide_clear",
    "outcomes": ["approved"],
    "may_request": true,
    "instructions": "Approve only when income covers the repayment at least three times. Send every self-employed applicant to a person."
  },
  "history": [
    { "at": "2026-11-18T13:20:44Z", "who": "Ines Moreau", "what": "Activated version 7", "version": 7 },
    { "at": "2026-11-18T13:12:09Z", "who": "Ines Moreau", "what": "Added the step Tell the team", "version": null }
  ],
  "problems": [],
  "definition": {
    "nodes": [
      { "id": "start", "type": "start", "position": { "x": 0, "y": 120 }, "data": { "label": "Start" } },
      { "id": "docs", "type": "documentCollection", "position": { "x": 340, "y": 120 }, "data": { "label": "Your documents", "collectionId": "col_5Gk3Tm7" } },
      { "id": "ok", "type": "approve", "position": { "x": 680, "y": 120 }, "data": { "label": "APPROVE" } }
    ],
    "edges": [
      { "id": "e1", "source": "start", "target": "docs" },
      { "id": "e2", "source": "docs", "target": "ok" }
    ],
    "settings": { "title": "Your mortgage application", "subtitle": "Send us a few documents and we will be in touch.", "theme": "professional" },
    "secrets": [],
    "policies": { "docs": ["pol_8Hm3Qr5"] },
    "explanations": {}
  },
  "start_link": "https://r.kontiga.com/w/mortgage-review",
  "imported": null,
  "invitations": []
}
```

## Set how much the reasoning agent decides

The reasoning agent's level on one workflow: suggest only, decide the clear cases and send the rest to people, or fully automatic; with the outcomes it may set and its instructions.

`PATCH /v1/workflows/{workflow_id}/reasoning`. Who may: Owner and Admin. CLI: `kontiga workflows set-reasoning <workflow_id> --level <suggest|decide_clear|automatic> [--outcomes <approved,rejected>] [--may-request] [--instructions <text>]`. MCP tool: `set_workflow_reasoning`.

**Parameters**
- `workflow_id` (id (wf_), required): The workflow. In the path.
- `level` (enum, required): `suggest`: it recommends and a person decides every case. `decide_clear`: it decides the cases it is sure of and sends the rest to people. `automatic`: it decides every case. A case with an open policy finding always waits for a person.
- `outcomes` (array of enum): The outcomes it may set itself. One of `approved`, `rejected`. At most 2 items.
- `may_request` (boolean): Let it ask the end customer for a missing or better document.
- `instructions` (string): Its rules, in your own words. At most 4,000 characters.

**Returns** workflow in full: The workflow with its reasoning settings.

API:

```bash
curl -X PATCH https://api.kontiga.com/v1/workflows/wf_3Kd8Pn2/reasoning \
  -H "Authorization: Bearer $KONTIGA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "level": "decide_clear",
    "outcomes": [
      "approved"
    ],
    "may_request": true,
    "instructions": "Approve only when income covers the repayment at least three times. Send every self-employed applicant to a person."
  }'
```

CLI:

```bash
kontiga workflows set-reasoning wf_3Kd8Pn2 \
  --level decide_clear \
  --outcomes approved \
  --may-request \
  --instructions 'Approve only when income covers the repayment at least three times. Send every self-employed applicant to a person.'
```

MCP tool `set_workflow_reasoning`:

```json
{
  "name": "set_workflow_reasoning",
  "arguments": {
    "workflow_id": "wf_3Kd8Pn2",
    "level": "decide_clear",
    "outcomes": [
      "approved"
    ],
    "may_request": true,
    "instructions": "Approve only when income covers the repayment at least three times. Send every self-employed applicant to a person."
  }
}
```

TypeScript:

```typescript
import Kontiga from "@kontiga/sdk";

const kontiga = new Kontiga(); // reads KONTIGA_API_KEY
const result = await kontiga.workflows.setReasoning("wf_3Kd8Pn2", {
  level: "decide_clear",
  outcomes: ["approved"],
  may_request: true,
  instructions: "Approve only when income covers the repayment at least three times. Send every self-employed applicant to a person.",
});
```

Python:

```python
from kontiga import Kontiga

kontiga = Kontiga()  # reads KONTIGA_API_KEY
result = kontiga.workflows.set_reasoning(
    "wf_3Kd8Pn2",
    level="decide_clear",
    outcomes=["approved"],
    may_request=True,
    instructions="Approve only when income covers the repayment at least three times. Send every self-employed applicant to a person.",
)
```

Go:

```go
client := kontiga.NewClient() // reads KONTIGA_API_KEY
result, err := client.Workflows.SetReasoning(ctx, "wf_3Kd8Pn2", &kontiga.WorkflowsSetReasoningParams{
	Level:        "decide_clear",
	Outcomes:     []string{"approved"},
	MayRequest:   true,
	Instructions: "Approve only when income covers the repayment at least three times. Send every self-employed applicant to a person.",
})
if err != nil {
	return err
}
```

Java:

```java
Kontiga kontiga = Kontiga.fromEnv(); // reads KONTIGA_API_KEY
var result = kontiga.workflows().setReasoning("wf_3Kd8Pn2", WorkflowsSetReasoningParams.builder()
    .level("decide_clear")
    .outcomes(List.of("approved"))
    .mayRequest(true)
    .instructions("Approve only when income covers the repayment at least three times. Send every self-employed applicant to a person.")
    .build());
```

.NET:

```csharp
var kontiga = new KontigaClient(); // reads KONTIGA_API_KEY
var result = await kontiga.Workflows.SetReasoningAsync("wf_3Kd8Pn2", new WorkflowsSetReasoningOptions
{
    Level = "decide_clear",
    Outcomes = new[] { "approved" },
    MayRequest = true,
    Instructions = "Approve only when income covers the repayment at least three times. Send every self-employed applicant to a person.",
});
```

PHP:

```php
$kontiga = new \Kontiga\Client(); // reads KONTIGA_API_KEY
$result = $kontiga->workflows->setReasoning('wf_3Kd8Pn2', [
    'level' => 'decide_clear',
    'outcomes' => ['approved'],
    'may_request' => true,
    'instructions' => 'Approve only when income covers the repayment at least three times. Send every self-employed applicant to a person.',
]);
```

Ruby:

```ruby
require "kontiga"

kontiga = Kontiga::Client.new # reads KONTIGA_API_KEY
result = kontiga.workflows.set_reasoning(
  "wf_3Kd8Pn2",
  level: "decide_clear",
  outcomes: ["approved"],
  may_request: true,
  instructions: "Approve only when income covers the repayment at least three times. Send every self-employed applicant to a person."
)
```

Rust:

```rust
let kontiga = kontiga::Client::from_env()?; // reads KONTIGA_API_KEY
let result = kontiga
    .workflows()
    .set_reasoning("wf_3Kd8Pn2".into(), kontiga::workflows::SetReasoningParams {
        level: "decide_clear".into(),
        outcomes: vec!["approved".into()],
        may_request: true,
        instructions: "Approve only when income covers the repayment at least three times. Send every self-employed applicant to a person.".into(),
        ..Default::default()
    })
    .await?;
```

Response, 200 OK:

```json
{
  "id": "wf_3Kd8Pn2",
  "object": "workflow",
  "mode": "live",
  "name": "Mortgage review",
  "status": "active",
  "collection_id": "col_5Gk3Tm7",
  "steps": [
    { "id": "stp_1Hq4Va7", "kind": "trigger", "label": "Checklist complete", "detail": "When every required item of Mortgage application is in", "policy_ids": [] },
    { "id": "stp_5Kw9Ld2", "kind": "check", "label": "Check every document", "detail": "Changes and fraud, with the verdict", "policy_ids": ["pol_8Hm3Qr5"] },
    { "id": "stp_3Nr6Ty8", "kind": "screen", "label": "Screen the applicant", "detail": "Sanctions, politically exposed persons and watch lists", "policy_ids": [] },
    { "id": "stp_8Bc2Gm4", "kind": "decide", "label": "Decide", "detail": "The reasoning agent decides the clear cases; the rest go to the mortgage team", "policy_ids": [] },
    { "id": "stp_6Px1Sw9", "kind": "notify", "label": "Tell the team", "detail": "Email mortgages@harbourline.example when a case needs a person", "policy_ids": [] }
  ],
  "version": 7,
  "has_draft": false,
  "reasoning": {
    "level": "decide_clear",
    "outcomes": ["approved"],
    "may_request": true,
    "instructions": "Approve only when income covers the repayment at least three times. Send every self-employed applicant to a person."
  },
  "history": [
    { "at": "2026-11-18T13:20:44Z", "who": "Ines Moreau", "what": "Activated version 7", "version": 7 },
    { "at": "2026-11-18T13:12:09Z", "who": "Ines Moreau", "what": "Added the step Tell the team", "version": null }
  ],
  "problems": [],
  "definition": {
    "nodes": [
      { "id": "start", "type": "start", "position": { "x": 0, "y": 120 }, "data": { "label": "Start" } },
      { "id": "docs", "type": "documentCollection", "position": { "x": 340, "y": 120 }, "data": { "label": "Your documents", "collectionId": "col_5Gk3Tm7" } },
      { "id": "ok", "type": "approve", "position": { "x": 680, "y": 120 }, "data": { "label": "APPROVE" } }
    ],
    "edges": [
      { "id": "e1", "source": "start", "target": "docs" },
      { "id": "e2", "source": "docs", "target": "ok" }
    ],
    "settings": { "title": "Your mortgage application", "subtitle": "Send us a few documents and we will be in touch.", "theme": "professional" },
    "secrets": [],
    "policies": { "docs": ["pol_8Hm3Qr5"] },
    "explanations": {}
  },
  "start_link": "https://r.kontiga.com/w/mortgage-review",
  "imported": null,
  "invitations": []
}
```

## Activate a workflow

Publishes the workflow's draft as a new version, or resumes a paused one, so new cases start runs on it. Refused with every problem listed.

`POST /v1/workflows/{workflow_id}/activate`. Who may: Owner and Admin. CLI: `kontiga workflows activate <workflow_id> [--note <text>]`. MCP tool: `activate_workflow`.

**Parameters**
- `workflow_id` (id (wf_), required): The workflow to activate. It is refused with every problem listed when its draft cannot run. In the path.
- `note` (string): What changed, kept with the version. At most 200 characters.

**Returns** workflow in full: The workflow, active, on its new version.

API:

```bash
curl -X POST https://api.kontiga.com/v1/workflows/wf_3Kd8Pn2/activate \
  -H "Authorization: Bearer $KONTIGA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "note": "Adds the email to the mortgage team."
  }'
```

CLI:

```bash
kontiga workflows activate wf_3Kd8Pn2 \
  --note 'Adds the email to the mortgage team.'
```

MCP tool `activate_workflow`:

```json
{
  "name": "activate_workflow",
  "arguments": {
    "workflow_id": "wf_3Kd8Pn2",
    "note": "Adds the email to the mortgage team."
  }
}
```

TypeScript:

```typescript
import Kontiga from "@kontiga/sdk";

const kontiga = new Kontiga(); // reads KONTIGA_API_KEY
const result = await kontiga.workflows.activate("wf_3Kd8Pn2", {
  note: "Adds the email to the mortgage team.",
});
```

Python:

```python
from kontiga import Kontiga

kontiga = Kontiga()  # reads KONTIGA_API_KEY
result = kontiga.workflows.activate("wf_3Kd8Pn2", note="Adds the email to the mortgage team.")
```

Go:

```go
client := kontiga.NewClient() // reads KONTIGA_API_KEY
result, err := client.Workflows.Activate(ctx, "wf_3Kd8Pn2", &kontiga.WorkflowsActivateParams{
	Note: "Adds the email to the mortgage team.",
})
if err != nil {
	return err
}
```

Java:

```java
Kontiga kontiga = Kontiga.fromEnv(); // reads KONTIGA_API_KEY
var result = kontiga.workflows().activate("wf_3Kd8Pn2", WorkflowsActivateParams.builder()
    .note("Adds the email to the mortgage team.")
    .build());
```

.NET:

```csharp
var kontiga = new KontigaClient(); // reads KONTIGA_API_KEY
var result = await kontiga.Workflows.ActivateAsync("wf_3Kd8Pn2", new WorkflowsActivateOptions
{
    Note = "Adds the email to the mortgage team.",
});
```

PHP:

```php
$kontiga = new \Kontiga\Client(); // reads KONTIGA_API_KEY
$result = $kontiga->workflows->activate('wf_3Kd8Pn2', [
    'note' => 'Adds the email to the mortgage team.',
]);
```

Ruby:

```ruby
require "kontiga"

kontiga = Kontiga::Client.new # reads KONTIGA_API_KEY
result = kontiga.workflows.activate("wf_3Kd8Pn2", note: "Adds the email to the mortgage team.")
```

Rust:

```rust
let kontiga = kontiga::Client::from_env()?; // reads KONTIGA_API_KEY
let result = kontiga
    .workflows()
    .activate("wf_3Kd8Pn2".into(), kontiga::workflows::ActivateParams {
        note: "Adds the email to the mortgage team.".into(),
        ..Default::default()
    })
    .await?;
```

Response, 200 OK:

```json
{
  "id": "wf_3Kd8Pn2",
  "object": "workflow",
  "mode": "live",
  "name": "Mortgage review",
  "status": "active",
  "collection_id": "col_5Gk3Tm7",
  "steps": [
    { "id": "stp_1Hq4Va7", "kind": "trigger", "label": "Checklist complete", "detail": "When every required item of Mortgage application is in", "policy_ids": [] },
    { "id": "stp_5Kw9Ld2", "kind": "check", "label": "Check every document", "detail": "Changes and fraud, with the verdict", "policy_ids": ["pol_8Hm3Qr5"] },
    { "id": "stp_3Nr6Ty8", "kind": "screen", "label": "Screen the applicant", "detail": "Sanctions, politically exposed persons and watch lists", "policy_ids": [] },
    { "id": "stp_8Bc2Gm4", "kind": "decide", "label": "Decide", "detail": "The reasoning agent decides the clear cases; the rest go to the mortgage team", "policy_ids": [] },
    { "id": "stp_6Px1Sw9", "kind": "notify", "label": "Tell the team", "detail": "Email mortgages@harbourline.example when a case needs a person", "policy_ids": [] }
  ],
  "version": 7,
  "has_draft": false,
  "reasoning": {
    "level": "decide_clear",
    "outcomes": ["approved"],
    "may_request": true,
    "instructions": "Approve only when income covers the repayment at least three times. Send every self-employed applicant to a person."
  },
  "history": [
    { "at": "2026-11-18T13:20:44Z", "who": "Ines Moreau", "what": "Activated version 7", "version": 7 },
    { "at": "2026-11-18T13:12:09Z", "who": "Ines Moreau", "what": "Added the step Tell the team", "version": null }
  ],
  "problems": [],
  "definition": {
    "nodes": [
      { "id": "start", "type": "start", "position": { "x": 0, "y": 120 }, "data": { "label": "Start" } },
      { "id": "docs", "type": "documentCollection", "position": { "x": 340, "y": 120 }, "data": { "label": "Your documents", "collectionId": "col_5Gk3Tm7" } },
      { "id": "ok", "type": "approve", "position": { "x": 680, "y": 120 }, "data": { "label": "APPROVE" } }
    ],
    "edges": [
      { "id": "e1", "source": "start", "target": "docs" },
      { "id": "e2", "source": "docs", "target": "ok" }
    ],
    "settings": { "title": "Your mortgage application", "subtitle": "Send us a few documents and we will be in touch.", "theme": "professional" },
    "secrets": [],
    "policies": { "docs": ["pol_8Hm3Qr5"] },
    "explanations": {}
  },
  "start_link": "https://r.kontiga.com/w/mortgage-review",
  "imported": null,
  "invitations": []
}
```

## Pause a workflow

Stops new cases starting runs on the workflow. Runs under way finish on the version they started on.

`POST /v1/workflows/{workflow_id}/pause`. Who may: Owner and Admin. CLI: `kontiga workflows pause <workflow_id>`. MCP tool: `pause_workflow`.

**Parameters**
- `workflow_id` (id (wf_), required): The workflow to pause. Runs under way finish. In the path.

**Returns** workflow in full: The workflow, paused.

API:

```bash
curl -X POST https://api.kontiga.com/v1/workflows/wf_3Kd8Pn2/pause \
  -H "Authorization: Bearer $KONTIGA_API_KEY"
```

CLI:

```bash
kontiga workflows pause wf_3Kd8Pn2
```

MCP tool `pause_workflow`:

```json
{
  "name": "pause_workflow",
  "arguments": {
    "workflow_id": "wf_3Kd8Pn2"
  }
}
```

TypeScript:

```typescript
import Kontiga from "@kontiga/sdk";

const kontiga = new Kontiga(); // reads KONTIGA_API_KEY
const result = await kontiga.workflows.pause("wf_3Kd8Pn2");
```

Python:

```python
from kontiga import Kontiga

kontiga = Kontiga()  # reads KONTIGA_API_KEY
result = kontiga.workflows.pause("wf_3Kd8Pn2")
```

Go:

```go
client := kontiga.NewClient() // reads KONTIGA_API_KEY
result, err := client.Workflows.Pause(ctx, "wf_3Kd8Pn2")
if err != nil {
	return err
}
```

Java:

```java
Kontiga kontiga = Kontiga.fromEnv(); // reads KONTIGA_API_KEY
var result = kontiga.workflows().pause("wf_3Kd8Pn2");
```

.NET:

```csharp
var kontiga = new KontigaClient(); // reads KONTIGA_API_KEY
var result = await kontiga.Workflows.PauseAsync("wf_3Kd8Pn2");
```

PHP:

```php
$kontiga = new \Kontiga\Client(); // reads KONTIGA_API_KEY
$result = $kontiga->workflows->pause('wf_3Kd8Pn2');
```

Ruby:

```ruby
require "kontiga"

kontiga = Kontiga::Client.new # reads KONTIGA_API_KEY
result = kontiga.workflows.pause("wf_3Kd8Pn2")
```

Rust:

```rust
let kontiga = kontiga::Client::from_env()?; // reads KONTIGA_API_KEY
let result = kontiga
    .workflows()
    .pause("wf_3Kd8Pn2".into())
    .await?;
```

Response, 200 OK:

```json
{
  "id": "wf_3Kd8Pn2",
  "object": "workflow",
  "mode": "live",
  "name": "Mortgage review",
  "status": "active",
  "collection_id": "col_5Gk3Tm7",
  "steps": [
    { "id": "stp_1Hq4Va7", "kind": "trigger", "label": "Checklist complete", "detail": "When every required item of Mortgage application is in", "policy_ids": [] },
    { "id": "stp_5Kw9Ld2", "kind": "check", "label": "Check every document", "detail": "Changes and fraud, with the verdict", "policy_ids": ["pol_8Hm3Qr5"] },
    { "id": "stp_3Nr6Ty8", "kind": "screen", "label": "Screen the applicant", "detail": "Sanctions, politically exposed persons and watch lists", "policy_ids": [] },
    { "id": "stp_8Bc2Gm4", "kind": "decide", "label": "Decide", "detail": "The reasoning agent decides the clear cases; the rest go to the mortgage team", "policy_ids": [] },
    { "id": "stp_6Px1Sw9", "kind": "notify", "label": "Tell the team", "detail": "Email mortgages@harbourline.example when a case needs a person", "policy_ids": [] }
  ],
  "version": 7,
  "has_draft": false,
  "reasoning": {
    "level": "decide_clear",
    "outcomes": ["approved"],
    "may_request": true,
    "instructions": "Approve only when income covers the repayment at least three times. Send every self-employed applicant to a person."
  },
  "history": [
    { "at": "2026-11-18T13:20:44Z", "who": "Ines Moreau", "what": "Activated version 7", "version": 7 },
    { "at": "2026-11-18T13:12:09Z", "who": "Ines Moreau", "what": "Added the step Tell the team", "version": null }
  ],
  "problems": [],
  "definition": {
    "nodes": [
      { "id": "start", "type": "start", "position": { "x": 0, "y": 120 }, "data": { "label": "Start" } },
      { "id": "docs", "type": "documentCollection", "position": { "x": 340, "y": 120 }, "data": { "label": "Your documents", "collectionId": "col_5Gk3Tm7" } },
      { "id": "ok", "type": "approve", "position": { "x": 680, "y": 120 }, "data": { "label": "APPROVE" } }
    ],
    "edges": [
      { "id": "e1", "source": "start", "target": "docs" },
      { "id": "e2", "source": "docs", "target": "ok" }
    ],
    "settings": { "title": "Your mortgage application", "subtitle": "Send us a few documents and we will be in touch.", "theme": "professional" },
    "secrets": [],
    "policies": { "docs": ["pol_8Hm3Qr5"] },
    "explanations": {}
  },
  "start_link": "https://r.kontiga.com/w/mortgage-review",
  "imported": null,
  "invitations": []
}
```

## Invite a person to start a workflow

Sends one person the workflow's start link by email or SMS, in the language you choose, with your own reference to find the run again. The link is valid for 30 days.

`POST /v1/workflows/{workflow_id}/invitations`. Who may: Owner and Admin. CLI: `kontiga workflows invite <workflow_id> --channel <email|sms> --recipient <address> [--reference <text>] [--locale <en|pt|es|ar|zht|zhs|fr|de|ja|hi|ru|sv>]`. MCP tool: `invite_to_workflow`.

**Parameters**
- `workflow_id` (id (wf_), required): An active workflow with a start link. In the path.
- `channel` (enum, required): How the link reaches them. One of `email`, `sms`.
- `recipient` (string, required): Their email address, or their phone number with its country code. At most 255 characters.
- `reference` (string): Your own reference, given back with the run. At most 255 characters.
- `locale` (enum): The language of the message. One of `en`, `pt`, `es`, `ar`, `zht`, `zhs`, `fr`, `de`, `ja`, `hi`, `ru`, `sv`.

**Returns** workflow invitation: The invitation, with its link and when it expires.

API:

```bash
curl -X POST https://api.kontiga.com/v1/workflows/wf_3Kd8Pn2/invitations \
  -H "Authorization: Bearer $KONTIGA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "channel": "email",
    "recipient": "saoirse.brennan@mailbox.example",
    "reference": "CUST-55201",
    "locale": "en"
  }'
```

CLI:

```bash
kontiga workflows invite wf_3Kd8Pn2 \
  --channel email \
  --recipient saoirse.brennan@mailbox.example \
  --reference CUST-55201 \
  --locale en
```

MCP tool `invite_to_workflow`:

```json
{
  "name": "invite_to_workflow",
  "arguments": {
    "workflow_id": "wf_3Kd8Pn2",
    "channel": "email",
    "recipient": "saoirse.brennan@mailbox.example",
    "reference": "CUST-55201",
    "locale": "en"
  }
}
```

TypeScript:

```typescript
import Kontiga from "@kontiga/sdk";

const kontiga = new Kontiga(); // reads KONTIGA_API_KEY
const result = await kontiga.workflows.invite("wf_3Kd8Pn2", {
  channel: "email",
  recipient: "saoirse.brennan@mailbox.example",
  reference: "CUST-55201",
  locale: "en",
});
```

Python:

```python
from kontiga import Kontiga

kontiga = Kontiga()  # reads KONTIGA_API_KEY
result = kontiga.workflows.invite(
    "wf_3Kd8Pn2",
    channel="email",
    recipient="saoirse.brennan@mailbox.example",
    reference="CUST-55201",
    locale="en",
)
```

Go:

```go
client := kontiga.NewClient() // reads KONTIGA_API_KEY
result, err := client.Workflows.Invite(ctx, "wf_3Kd8Pn2", &kontiga.WorkflowsInviteParams{
	Channel:   "email",
	Recipient: "saoirse.brennan@mailbox.example",
	Reference: "CUST-55201",
	Locale:    "en",
})
if err != nil {
	return err
}
```

Java:

```java
Kontiga kontiga = Kontiga.fromEnv(); // reads KONTIGA_API_KEY
var result = kontiga.workflows().invite("wf_3Kd8Pn2", WorkflowsInviteParams.builder()
    .channel("email")
    .recipient("saoirse.brennan@mailbox.example")
    .reference("CUST-55201")
    .locale("en")
    .build());
```

.NET:

```csharp
var kontiga = new KontigaClient(); // reads KONTIGA_API_KEY
var result = await kontiga.Workflows.InviteAsync("wf_3Kd8Pn2", new WorkflowsInviteOptions
{
    Channel = "email",
    Recipient = "saoirse.brennan@mailbox.example",
    Reference = "CUST-55201",
    Locale = "en",
});
```

PHP:

```php
$kontiga = new \Kontiga\Client(); // reads KONTIGA_API_KEY
$result = $kontiga->workflows->invite('wf_3Kd8Pn2', [
    'channel' => 'email',
    'recipient' => 'saoirse.brennan@mailbox.example',
    'reference' => 'CUST-55201',
    'locale' => 'en',
]);
```

Ruby:

```ruby
require "kontiga"

kontiga = Kontiga::Client.new # reads KONTIGA_API_KEY
result = kontiga.workflows.invite(
  "wf_3Kd8Pn2",
  channel: "email",
  recipient: "saoirse.brennan@mailbox.example",
  reference: "CUST-55201",
  locale: "en"
)
```

Rust:

```rust
let kontiga = kontiga::Client::from_env()?; // reads KONTIGA_API_KEY
let result = kontiga
    .workflows()
    .invite("wf_3Kd8Pn2".into(), kontiga::workflows::InviteParams {
        channel: "email".into(),
        recipient: "saoirse.brennan@mailbox.example".into(),
        reference: "CUST-55201".into(),
        locale: "en".into(),
        ..Default::default()
    })
    .await?;
```

Response, 201 Created:

```json
{
  "id": "wfi_5Hb8Ns3",
  "object": "workflow_invitation",
  "workflow_id": "wf_3Kd8Pn2",
  "channel": "email",
  "recipient": "saoirse.brennan@mailbox.example",
  "reference": "CUST-55201",
  "locale": "en",
  "status": "sent",
  "url": "https://r.kontiga.com/w/mortgage-review?i=wfi_5Hb8Ns3",
  "created_at": "2026-11-27T11:05:00Z",
  "expires_at": "2026-12-27T11:05:00Z",
  "sent_by": "Ines Moreau"
}
```

## Duplicate a workflow

Makes a draft copy of a workflow, its steps, policies and reasoning settings included, to change without touching the original. A workflow imported from Bynn keeps what the import brought (its metadata, row connections and other keys, and the collections its steps ask for), so the copy exports as the original does, under its own id.

`POST /v1/workflows/{workflow_id}/duplicate`. Who may: Owner and Admin. CLI: `kontiga workflows duplicate <workflow_id> [--name <name>]`. MCP tool: `duplicate_workflow`.

**Parameters**
- `workflow_id` (id (wf_), required): The workflow to copy. In the path.
- `name` (string): The copy's name. At most 80 characters.

**Returns** workflow in full: The new draft copy.

API:

```bash
curl -X POST https://api.kontiga.com/v1/workflows/wf_3Kd8Pn2/duplicate \
  -H "Authorization: Bearer $KONTIGA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Mortgage review, self-employed"
  }'
```

CLI:

```bash
kontiga workflows duplicate wf_3Kd8Pn2 \
  --name 'Mortgage review, self-employed'
```

MCP tool `duplicate_workflow`:

```json
{
  "name": "duplicate_workflow",
  "arguments": {
    "workflow_id": "wf_3Kd8Pn2",
    "name": "Mortgage review, self-employed"
  }
}
```

TypeScript:

```typescript
import Kontiga from "@kontiga/sdk";

const kontiga = new Kontiga(); // reads KONTIGA_API_KEY
const result = await kontiga.workflows.duplicate("wf_3Kd8Pn2", {
  name: "Mortgage review, self-employed",
});
```

Python:

```python
from kontiga import Kontiga

kontiga = Kontiga()  # reads KONTIGA_API_KEY
result = kontiga.workflows.duplicate("wf_3Kd8Pn2", name="Mortgage review, self-employed")
```

Go:

```go
client := kontiga.NewClient() // reads KONTIGA_API_KEY
result, err := client.Workflows.Duplicate(ctx, "wf_3Kd8Pn2", &kontiga.WorkflowsDuplicateParams{
	Name: "Mortgage review, self-employed",
})
if err != nil {
	return err
}
```

Java:

```java
Kontiga kontiga = Kontiga.fromEnv(); // reads KONTIGA_API_KEY
var result = kontiga.workflows().duplicate("wf_3Kd8Pn2", WorkflowsDuplicateParams.builder()
    .name("Mortgage review, self-employed")
    .build());
```

.NET:

```csharp
var kontiga = new KontigaClient(); // reads KONTIGA_API_KEY
var result = await kontiga.Workflows.DuplicateAsync("wf_3Kd8Pn2", new WorkflowsDuplicateOptions
{
    Name = "Mortgage review, self-employed",
});
```

PHP:

```php
$kontiga = new \Kontiga\Client(); // reads KONTIGA_API_KEY
$result = $kontiga->workflows->duplicate('wf_3Kd8Pn2', [
    'name' => 'Mortgage review, self-employed',
]);
```

Ruby:

```ruby
require "kontiga"

kontiga = Kontiga::Client.new # reads KONTIGA_API_KEY
result = kontiga.workflows.duplicate("wf_3Kd8Pn2", name: "Mortgage review, self-employed")
```

Rust:

```rust
let kontiga = kontiga::Client::from_env()?; // reads KONTIGA_API_KEY
let result = kontiga
    .workflows()
    .duplicate("wf_3Kd8Pn2".into(), kontiga::workflows::DuplicateParams {
        name: "Mortgage review, self-employed".into(),
        ..Default::default()
    })
    .await?;
```

Response, 201 Created:

```json
{
  "id": "wf_3Kd8Pn2",
  "object": "workflow",
  "mode": "live",
  "name": "Mortgage review",
  "status": "active",
  "collection_id": "col_5Gk3Tm7",
  "steps": [
    { "id": "stp_1Hq4Va7", "kind": "trigger", "label": "Checklist complete", "detail": "When every required item of Mortgage application is in", "policy_ids": [] },
    { "id": "stp_5Kw9Ld2", "kind": "check", "label": "Check every document", "detail": "Changes and fraud, with the verdict", "policy_ids": ["pol_8Hm3Qr5"] },
    { "id": "stp_3Nr6Ty8", "kind": "screen", "label": "Screen the applicant", "detail": "Sanctions, politically exposed persons and watch lists", "policy_ids": [] },
    { "id": "stp_8Bc2Gm4", "kind": "decide", "label": "Decide", "detail": "The reasoning agent decides the clear cases; the rest go to the mortgage team", "policy_ids": [] },
    { "id": "stp_6Px1Sw9", "kind": "notify", "label": "Tell the team", "detail": "Email mortgages@harbourline.example when a case needs a person", "policy_ids": [] }
  ],
  "version": 7,
  "has_draft": false,
  "reasoning": {
    "level": "decide_clear",
    "outcomes": ["approved"],
    "may_request": true,
    "instructions": "Approve only when income covers the repayment at least three times. Send every self-employed applicant to a person."
  },
  "history": [
    { "at": "2026-11-18T13:20:44Z", "who": "Ines Moreau", "what": "Activated version 7", "version": 7 },
    { "at": "2026-11-18T13:12:09Z", "who": "Ines Moreau", "what": "Added the step Tell the team", "version": null }
  ],
  "problems": [],
  "definition": {
    "nodes": [
      { "id": "start", "type": "start", "position": { "x": 0, "y": 120 }, "data": { "label": "Start" } },
      { "id": "docs", "type": "documentCollection", "position": { "x": 340, "y": 120 }, "data": { "label": "Your documents", "collectionId": "col_5Gk3Tm7" } },
      { "id": "ok", "type": "approve", "position": { "x": 680, "y": 120 }, "data": { "label": "APPROVE" } }
    ],
    "edges": [
      { "id": "e1", "source": "start", "target": "docs" },
      { "id": "e2", "source": "docs", "target": "ok" }
    ],
    "settings": { "title": "Your mortgage application", "subtitle": "Send us a few documents and we will be in touch.", "theme": "professional" },
    "secrets": [],
    "policies": { "docs": ["pol_8Hm3Qr5"] },
    "explanations": {}
  },
  "start_link": "https://r.kontiga.com/w/mortgage-review",
  "imported": null,
  "invitations": []
}
```

## Archive a workflow

Retires a workflow: it starts no run by link, API or console. Runs under way finish, and its runs and versions stay readable.

`POST /v1/workflows/{workflow_id}/archive`. Who may: Owner and Admin. CLI: `kontiga workflows archive <workflow_id>`. MCP tool: `archive_workflow`.

**Parameters**
- `workflow_id` (id (wf_), required): The workflow to retire. In the path.

**Returns** workflow in full: The workflow, archived.

API:

```bash
curl -X POST https://api.kontiga.com/v1/workflows/wf_6Gn2Rt8/archive \
  -H "Authorization: Bearer $KONTIGA_API_KEY"
```

CLI:

```bash
kontiga workflows archive wf_6Gn2Rt8
```

MCP tool `archive_workflow`:

```json
{
  "name": "archive_workflow",
  "arguments": {
    "workflow_id": "wf_6Gn2Rt8"
  }
}
```

TypeScript:

```typescript
import Kontiga from "@kontiga/sdk";

const kontiga = new Kontiga(); // reads KONTIGA_API_KEY
const result = await kontiga.workflows.archive("wf_6Gn2Rt8");
```

Python:

```python
from kontiga import Kontiga

kontiga = Kontiga()  # reads KONTIGA_API_KEY
result = kontiga.workflows.archive("wf_6Gn2Rt8")
```

Go:

```go
client := kontiga.NewClient() // reads KONTIGA_API_KEY
result, err := client.Workflows.Archive(ctx, "wf_6Gn2Rt8")
if err != nil {
	return err
}
```

Java:

```java
Kontiga kontiga = Kontiga.fromEnv(); // reads KONTIGA_API_KEY
var result = kontiga.workflows().archive("wf_6Gn2Rt8");
```

.NET:

```csharp
var kontiga = new KontigaClient(); // reads KONTIGA_API_KEY
var result = await kontiga.Workflows.ArchiveAsync("wf_6Gn2Rt8");
```

PHP:

```php
$kontiga = new \Kontiga\Client(); // reads KONTIGA_API_KEY
$result = $kontiga->workflows->archive('wf_6Gn2Rt8');
```

Ruby:

```ruby
require "kontiga"

kontiga = Kontiga::Client.new # reads KONTIGA_API_KEY
result = kontiga.workflows.archive("wf_6Gn2Rt8")
```

Rust:

```rust
let kontiga = kontiga::Client::from_env()?; // reads KONTIGA_API_KEY
let result = kontiga
    .workflows()
    .archive("wf_6Gn2Rt8".into())
    .await?;
```

Response, 200 OK:

```json
{
  "id": "wf_3Kd8Pn2",
  "object": "workflow",
  "mode": "live",
  "name": "Mortgage review",
  "status": "active",
  "collection_id": "col_5Gk3Tm7",
  "steps": [
    { "id": "stp_1Hq4Va7", "kind": "trigger", "label": "Checklist complete", "detail": "When every required item of Mortgage application is in", "policy_ids": [] },
    { "id": "stp_5Kw9Ld2", "kind": "check", "label": "Check every document", "detail": "Changes and fraud, with the verdict", "policy_ids": ["pol_8Hm3Qr5"] },
    { "id": "stp_3Nr6Ty8", "kind": "screen", "label": "Screen the applicant", "detail": "Sanctions, politically exposed persons and watch lists", "policy_ids": [] },
    { "id": "stp_8Bc2Gm4", "kind": "decide", "label": "Decide", "detail": "The reasoning agent decides the clear cases; the rest go to the mortgage team", "policy_ids": [] },
    { "id": "stp_6Px1Sw9", "kind": "notify", "label": "Tell the team", "detail": "Email mortgages@harbourline.example when a case needs a person", "policy_ids": [] }
  ],
  "version": 7,
  "has_draft": false,
  "reasoning": {
    "level": "decide_clear",
    "outcomes": ["approved"],
    "may_request": true,
    "instructions": "Approve only when income covers the repayment at least three times. Send every self-employed applicant to a person."
  },
  "history": [
    { "at": "2026-11-18T13:20:44Z", "who": "Ines Moreau", "what": "Activated version 7", "version": 7 },
    { "at": "2026-11-18T13:12:09Z", "who": "Ines Moreau", "what": "Added the step Tell the team", "version": null }
  ],
  "problems": [],
  "definition": {
    "nodes": [
      { "id": "start", "type": "start", "position": { "x": 0, "y": 120 }, "data": { "label": "Start" } },
      { "id": "docs", "type": "documentCollection", "position": { "x": 340, "y": 120 }, "data": { "label": "Your documents", "collectionId": "col_5Gk3Tm7" } },
      { "id": "ok", "type": "approve", "position": { "x": 680, "y": 120 }, "data": { "label": "APPROVE" } }
    ],
    "edges": [
      { "id": "e1", "source": "start", "target": "docs" },
      { "id": "e2", "source": "docs", "target": "ok" }
    ],
    "settings": { "title": "Your mortgage application", "subtitle": "Send us a few documents and we will be in touch.", "theme": "professional" },
    "secrets": [],
    "policies": { "docs": ["pol_8Hm3Qr5"] },
    "explanations": {}
  },
  "start_link": "https://r.kontiga.com/w/mortgage-review",
  "imported": null,
  "invitations": []
}
```

## Restore an archived workflow

Takes a workflow out of the archive so it can be changed again. It comes back paused on its last version, or as a draft if it was never activated; activate it to start runs.

`POST /v1/workflows/{workflow_id}/restore`. Who may: Owner and Admin. CLI: `kontiga workflows restore <workflow_id>`. MCP tool: `restore_workflow`.

**Parameters**
- `workflow_id` (id (wf_), required): An archived workflow. In the path.

**Returns** workflow in full: The workflow, paused or a draft.

API:

```bash
curl -X POST https://api.kontiga.com/v1/workflows/wf_6Gn2Rt8/restore \
  -H "Authorization: Bearer $KONTIGA_API_KEY"
```

CLI:

```bash
kontiga workflows restore wf_6Gn2Rt8
```

MCP tool `restore_workflow`:

```json
{
  "name": "restore_workflow",
  "arguments": {
    "workflow_id": "wf_6Gn2Rt8"
  }
}
```

TypeScript:

```typescript
import Kontiga from "@kontiga/sdk";

const kontiga = new Kontiga(); // reads KONTIGA_API_KEY
const result = await kontiga.workflows.restore("wf_6Gn2Rt8");
```

Python:

```python
from kontiga import Kontiga

kontiga = Kontiga()  # reads KONTIGA_API_KEY
result = kontiga.workflows.restore("wf_6Gn2Rt8")
```

Go:

```go
client := kontiga.NewClient() // reads KONTIGA_API_KEY
result, err := client.Workflows.Restore(ctx, "wf_6Gn2Rt8")
if err != nil {
	return err
}
```

Java:

```java
Kontiga kontiga = Kontiga.fromEnv(); // reads KONTIGA_API_KEY
var result = kontiga.workflows().restore("wf_6Gn2Rt8");
```

.NET:

```csharp
var kontiga = new KontigaClient(); // reads KONTIGA_API_KEY
var result = await kontiga.Workflows.RestoreAsync("wf_6Gn2Rt8");
```

PHP:

```php
$kontiga = new \Kontiga\Client(); // reads KONTIGA_API_KEY
$result = $kontiga->workflows->restore('wf_6Gn2Rt8');
```

Ruby:

```ruby
require "kontiga"

kontiga = Kontiga::Client.new # reads KONTIGA_API_KEY
result = kontiga.workflows.restore("wf_6Gn2Rt8")
```

Rust:

```rust
let kontiga = kontiga::Client::from_env()?; // reads KONTIGA_API_KEY
let result = kontiga
    .workflows()
    .restore("wf_6Gn2Rt8".into())
    .await?;
```

Response, 200 OK:

```json
{
  "id": "wf_3Kd8Pn2",
  "object": "workflow",
  "mode": "live",
  "name": "Mortgage review",
  "status": "active",
  "collection_id": "col_5Gk3Tm7",
  "steps": [
    { "id": "stp_1Hq4Va7", "kind": "trigger", "label": "Checklist complete", "detail": "When every required item of Mortgage application is in", "policy_ids": [] },
    { "id": "stp_5Kw9Ld2", "kind": "check", "label": "Check every document", "detail": "Changes and fraud, with the verdict", "policy_ids": ["pol_8Hm3Qr5"] },
    { "id": "stp_3Nr6Ty8", "kind": "screen", "label": "Screen the applicant", "detail": "Sanctions, politically exposed persons and watch lists", "policy_ids": [] },
    { "id": "stp_8Bc2Gm4", "kind": "decide", "label": "Decide", "detail": "The reasoning agent decides the clear cases; the rest go to the mortgage team", "policy_ids": [] },
    { "id": "stp_6Px1Sw9", "kind": "notify", "label": "Tell the team", "detail": "Email mortgages@harbourline.example when a case needs a person", "policy_ids": [] }
  ],
  "version": 7,
  "has_draft": false,
  "reasoning": {
    "level": "decide_clear",
    "outcomes": ["approved"],
    "may_request": true,
    "instructions": "Approve only when income covers the repayment at least three times. Send every self-employed applicant to a person."
  },
  "history": [
    { "at": "2026-11-18T13:20:44Z", "who": "Ines Moreau", "what": "Activated version 7", "version": 7 },
    { "at": "2026-11-18T13:12:09Z", "who": "Ines Moreau", "what": "Added the step Tell the team", "version": null }
  ],
  "problems": [],
  "definition": {
    "nodes": [
      { "id": "start", "type": "start", "position": { "x": 0, "y": 120 }, "data": { "label": "Start" } },
      { "id": "docs", "type": "documentCollection", "position": { "x": 340, "y": 120 }, "data": { "label": "Your documents", "collectionId": "col_5Gk3Tm7" } },
      { "id": "ok", "type": "approve", "position": { "x": 680, "y": 120 }, "data": { "label": "APPROVE" } }
    ],
    "edges": [
      { "id": "e1", "source": "start", "target": "docs" },
      { "id": "e2", "source": "docs", "target": "ok" }
    ],
    "settings": { "title": "Your mortgage application", "subtitle": "Send us a few documents and we will be in touch.", "theme": "professional" },
    "secrets": [],
    "policies": { "docs": ["pol_8Hm3Qr5"] },
    "explanations": {}
  },
  "start_link": "https://r.kontiga.com/w/mortgage-review",
  "imported": null,
  "invitations": []
}
```

## Delete a workflow

Removes a workflow from the workspace. Approvals its runs are waiting on are cancelled; the cases it ran keep their documents, checks and outcomes.

`DELETE /v1/workflows/{workflow_id}`. Who may: Owner and Admin. CLI: `kontiga workflows delete <workflow_id>`. MCP tool: `delete_workflow`.

**Parameters**
- `workflow_id` (id (wf_), required): The workflow to remove. Its cases keep their documents, checks and outcomes. In the path.

**Returns** deleted workflow: The workflow removed, and how many waiting approvals were cancelled.

API:

```bash
curl -X DELETE https://api.kontiga.com/v1/workflows/wf_6Gn2Rt8 \
  -H "Authorization: Bearer $KONTIGA_API_KEY"
```

CLI:

```bash
kontiga workflows delete wf_6Gn2Rt8
```

MCP tool `delete_workflow`:

```json
{
  "name": "delete_workflow",
  "arguments": {
    "workflow_id": "wf_6Gn2Rt8"
  }
}
```

TypeScript:

```typescript
import Kontiga from "@kontiga/sdk";

const kontiga = new Kontiga(); // reads KONTIGA_API_KEY
const result = await kontiga.workflows.delete("wf_6Gn2Rt8");
```

Python:

```python
from kontiga import Kontiga

kontiga = Kontiga()  # reads KONTIGA_API_KEY
result = kontiga.workflows.delete("wf_6Gn2Rt8")
```

Go:

```go
client := kontiga.NewClient() // reads KONTIGA_API_KEY
result, err := client.Workflows.Delete(ctx, "wf_6Gn2Rt8")
if err != nil {
	return err
}
```

Java:

```java
Kontiga kontiga = Kontiga.fromEnv(); // reads KONTIGA_API_KEY
var result = kontiga.workflows().delete("wf_6Gn2Rt8");
```

.NET:

```csharp
var kontiga = new KontigaClient(); // reads KONTIGA_API_KEY
var result = await kontiga.Workflows.DeleteAsync("wf_6Gn2Rt8");
```

PHP:

```php
$kontiga = new \Kontiga\Client(); // reads KONTIGA_API_KEY
$result = $kontiga->workflows->delete('wf_6Gn2Rt8');
```

Ruby:

```ruby
require "kontiga"

kontiga = Kontiga::Client.new # reads KONTIGA_API_KEY
result = kontiga.workflows.delete("wf_6Gn2Rt8")
```

Rust:

```rust
let kontiga = kontiga::Client::from_env()?; // reads KONTIGA_API_KEY
let result = kontiga
    .workflows()
    .delete("wf_6Gn2Rt8".into())
    .await?;
```

Response, 200 OK:

```json
{
  "id": "wf_6Gn2Rt8",
  "object": "deleted_workflow",
  "name": "Tenancy check",
  "deleted": true,
  "cancelled_approvals": 0
}
```

## Import a workflow from Bynn

Reads a Bynn workflow definition (as Bynn's API returns it, as its editor exports it, or as it is stored) into a draft. Older key shapes are converted, and secret values are taken out of the steps and kept apart.

`POST /v1/workflows/import`. Who may: Owner and Admin. CLI: `kontiga workflows import --definition @workflow.json [--workflow-id <workflow_id>] [--name <name>]`. MCP tool: `import_bynn_workflow`.

**Parameters**
- `definition` (string, required): The workflow's JSON: as Bynn's API returns it, as its editor exports a file, or as Bynn stores it. The CLI reads it from the file you give. At most 1,100,000 characters.
- `workflow_id` (id (wf_)): A workflow whose draft it replaces. A new draft is made when left out.
- `name` (string): A name for it, in place of the file's. At most 120 characters.

**Returns** import result: The draft workflow, and what the import converted or kept as secrets.

API:

```bash
curl -X POST https://api.kontiga.com/v1/workflows/import \
  -H "Authorization: Bearer $KONTIGA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "definition": "{\"name\":\"Older claims workflow\",\"nodes\":[{\"id\":\"s\",\"type\":\"start\",\"position\":{\"x\":0,\"y\":120},\"data\":{\"label\":\"Start\"}}],\"connections\":[]}"
  }'
```

CLI:

```bash
kontiga workflows import \
  --definition '{"name":"Older claims workflow","nodes":[{"id":"s","type":"start","position":{"x":0,"y":120},"data":{"label":"Start"}}],"connections":[]}'
```

MCP tool `import_bynn_workflow`:

```json
{
  "name": "import_bynn_workflow",
  "arguments": {
    "definition": "{\"name\":\"Older claims workflow\",\"nodes\":[{\"id\":\"s\",\"type\":\"start\",\"position\":{\"x\":0,\"y\":120},\"data\":{\"label\":\"Start\"}}],\"connections\":[]}"
  }
}
```

TypeScript:

```typescript
import Kontiga from "@kontiga/sdk";

const kontiga = new Kontiga(); // reads KONTIGA_API_KEY
const result = await kontiga.workflows.import({
  definition: "{\"name\":\"Older claims workflow\",\"nodes\":[{\"id\":\"s\",\"type\":\"start\",\"position\":{\"x\":0,\"y\":120},\"data\":{\"label\":\"Start\"}}],\"connections\":[]}",
});
```

Python:

```python
from kontiga import Kontiga

kontiga = Kontiga()  # reads KONTIGA_API_KEY
result = kontiga.workflows.import_(definition="{\"name\":\"Older claims workflow\",\"nodes\":[{\"id\":\"s\",\"type\":\"start\",\"position\":{\"x\":0,\"y\":120},\"data\":{\"label\":\"Start\"}}],\"connections\":[]}")
```

Go:

```go
client := kontiga.NewClient() // reads KONTIGA_API_KEY
result, err := client.Workflows.Import(ctx, &kontiga.WorkflowsImportParams{
	Definition: "{\"name\":\"Older claims workflow\",\"nodes\":[{\"id\":\"s\",\"type\":\"start\",\"position\":{\"x\":0,\"y\":120},\"data\":{\"label\":\"Start\"}}],\"connections\":[]}",
})
if err != nil {
	return err
}
```

Java:

```java
Kontiga kontiga = Kontiga.fromEnv(); // reads KONTIGA_API_KEY
var result = kontiga.workflows().import_(WorkflowsImportParams.builder()
    .definition("{\"name\":\"Older claims workflow\",\"nodes\":[{\"id\":\"s\",\"type\":\"start\",\"position\":{\"x\":0,\"y\":120},\"data\":{\"label\":\"Start\"}}],\"connections\":[]}")
    .build());
```

.NET:

```csharp
var kontiga = new KontigaClient(); // reads KONTIGA_API_KEY
var result = await kontiga.Workflows.ImportAsync(new WorkflowsImportOptions
{
    Definition = "{\"name\":\"Older claims workflow\",\"nodes\":[{\"id\":\"s\",\"type\":\"start\",\"position\":{\"x\":0,\"y\":120},\"data\":{\"label\":\"Start\"}}],\"connections\":[]}",
});
```

PHP:

```php
$kontiga = new \Kontiga\Client(); // reads KONTIGA_API_KEY
$result = $kontiga->workflows->import([
    'definition' => '{"name":"Older claims workflow","nodes":[{"id":"s","type":"start","position":{"x":0,"y":120},"data":{"label":"Start"}}],"connections":[]}',
]);
```

Ruby:

```ruby
require "kontiga"

kontiga = Kontiga::Client.new # reads KONTIGA_API_KEY
result = kontiga.workflows.import(definition: "{\"name\":\"Older claims workflow\",\"nodes\":[{\"id\":\"s\",\"type\":\"start\",\"position\":{\"x\":0,\"y\":120},\"data\":{\"label\":\"Start\"}}],\"connections\":[]}")
```

Rust:

```rust
let kontiga = kontiga::Client::from_env()?; // reads KONTIGA_API_KEY
let result = kontiga
    .workflows()
    .import(kontiga::workflows::ImportParams {
        definition: "{\"name\":\"Older claims workflow\",\"nodes\":[{\"id\":\"s\",\"type\":\"start\",\"position\":{\"x\":0,\"y\":120},\"data\":{\"label\":\"Start\"}}],\"connections\":[]}".into(),
        ..Default::default()
    })
    .await?;
```

Response, 200 OK:

```json
{
  "object": "import_result",
  "shape": "file",
  "notes": [
    { "level": "change", "message": "The older key Claim Amount was read as claim_amount.", "node_id": "claim_form" },
    { "level": "warning", "message": "The header value of Send to the ledger is kept as a secret.", "node_id": "send_ledger" }
  ],
  "workflow": {
    "id": "wf_7Tm4Bx1",
    "object": "workflow",
    "name": "Older claims workflow",
    "status": "draft",
    "version": null,
    "has_draft": true,
    "origin": "import",
    "problems": []
  }
}
```

## Export a workflow in Bynn's format

The workflow's saved draft as Bynn's API returns it, as its editor exports a file, or as Bynn stores it. Secret values go in only when asked for; otherwise each is written as [hidden].

`POST /v1/workflows/{workflow_id}/export`. Who may: Owner and Admin. CLI: `kontiga workflows export <workflow_id> --shape <api|row|file> [--include-secrets] > workflow.json`. MCP tool: `export_bynn_workflow`.

**Parameters**
- `workflow_id` (id (wf_), required): The workflow to export. In the path.
- `shape` (enum, required): `api` as Bynn's API returns it, `file` as its editor exports it, `row` as Bynn stores it.
- `include_secrets` (boolean): Put the secret values in. Each is written as `[hidden]` otherwise.

**Returns** export: The JSON text, its file name, and how many secrets it holds.

API:

```bash
curl -X POST https://api.kontiga.com/v1/workflows/wf_3Kd8Pn2/export \
  -H "Authorization: Bearer $KONTIGA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "shape": "file"
  }'
```

CLI:

```bash
kontiga workflows export wf_3Kd8Pn2 --shape file
```

MCP tool `export_bynn_workflow`:

```json
{
  "name": "export_bynn_workflow",
  "arguments": {
    "workflow_id": "wf_3Kd8Pn2",
    "shape": "file"
  }
}
```

TypeScript:

```typescript
import Kontiga from "@kontiga/sdk";

const kontiga = new Kontiga(); // reads KONTIGA_API_KEY
const result = await kontiga.workflows.export("wf_3Kd8Pn2", {
  shape: "file",
});
```

Python:

```python
from kontiga import Kontiga

kontiga = Kontiga()  # reads KONTIGA_API_KEY
result = kontiga.workflows.export("wf_3Kd8Pn2", shape="file")
```

Go:

```go
client := kontiga.NewClient() // reads KONTIGA_API_KEY
result, err := client.Workflows.Export(ctx, "wf_3Kd8Pn2", &kontiga.WorkflowsExportParams{
	Shape: "file",
})
if err != nil {
	return err
}
```

Java:

```java
Kontiga kontiga = Kontiga.fromEnv(); // reads KONTIGA_API_KEY
var result = kontiga.workflows().export("wf_3Kd8Pn2", WorkflowsExportParams.builder()
    .shape("file")
    .build());
```

.NET:

```csharp
var kontiga = new KontigaClient(); // reads KONTIGA_API_KEY
var result = await kontiga.Workflows.ExportAsync("wf_3Kd8Pn2", new WorkflowsExportOptions
{
    Shape = "file",
});
```

PHP:

```php
$kontiga = new \Kontiga\Client(); // reads KONTIGA_API_KEY
$result = $kontiga->workflows->export('wf_3Kd8Pn2', [
    'shape' => 'file',
]);
```

Ruby:

```ruby
require "kontiga"

kontiga = Kontiga::Client.new # reads KONTIGA_API_KEY
result = kontiga.workflows.export("wf_3Kd8Pn2", shape: "file")
```

Rust:

```rust
let kontiga = kontiga::Client::from_env()?; // reads KONTIGA_API_KEY
let result = kontiga
    .workflows()
    .export("wf_3Kd8Pn2".into(), kontiga::workflows::ExportParams {
        shape: "file".into(),
        ..Default::default()
    })
    .await?;
```

Response, 200 OK:

```json
{
  "object": "export",
  "filename": "mortgage-review.json",
  "shape": "file",
  "json": "{\"name\":\"Mortgage review\",\"nodes\":[{\"id\":\"start\",\"type\":\"start\"}],\"connections\":[]}",
  "secrets": 1,
  "masked": true
}
```

## Draft a workflow from a description

Turns a few sentences about what should happen to a case into proposed steps, each with its reason. Nothing is saved.

`POST /v1/workflows/plan`. Who may: Owner and Admin. CLI: `kontiga workflows plan --description <text> [--language <ISO 639-1 code, e.g. it>] [--language-name <English name>] [--answers <json>]`. MCP tool: `plan_workflow`.

**Parameters**
- `description` (string, required): What should happen to a case: what arrives, what is checked, who decides and who is told. At most 2,000 characters.
- `language` (string): The language of the texts the end customer reads, such as `en` or `pt-BR`.
- `language_name` (string): The language's English name, needed only for a tag that cannot be named.
- `answers` (record): Answers to the questions an earlier call asked, as `{question id: chosen value}`. Call again with them.

**Returns** workflow proposal: A proposed name, the checklist that starts it and the steps, each with its reason, the questions it has, and any collection it drafted; nothing is saved.

API:

```bash
curl -X POST https://api.kontiga.com/v1/workflows/plan \
  -H "Authorization: Bearer $KONTIGA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "description": "New tenants send their ID and three payslips. Check them, and email the letting team when everything is in.",
    "language": "en"
  }'
```

CLI:

```bash
kontiga workflows plan \
  --description 'New tenants send their ID and three payslips. Check them, and email the letting team when everything is in.' \
  --language en
```

MCP tool `plan_workflow`:

```json
{
  "name": "plan_workflow",
  "arguments": {
    "description": "New tenants send their ID and three payslips. Check them, and email the letting team when everything is in.",
    "language": "en"
  }
}
```

TypeScript:

```typescript
import Kontiga from "@kontiga/sdk";

const kontiga = new Kontiga(); // reads KONTIGA_API_KEY
const result = await kontiga.workflows.plan({
  description: "New tenants send their ID and three payslips. Check them, and email the letting team when everything is in.",
  language: "en",
});
```

Python:

```python
from kontiga import Kontiga

kontiga = Kontiga()  # reads KONTIGA_API_KEY
result = kontiga.workflows.plan(description="New tenants send their ID and three payslips. Check them, and email the letting team when everything is in.", language="en")
```

Go:

```go
client := kontiga.NewClient() // reads KONTIGA_API_KEY
result, err := client.Workflows.Plan(ctx, &kontiga.WorkflowsPlanParams{
	Description: "New tenants send their ID and three payslips. Check them, and email the letting team when everything is in.",
	Language:    "en",
})
if err != nil {
	return err
}
```

Java:

```java
Kontiga kontiga = Kontiga.fromEnv(); // reads KONTIGA_API_KEY
var result = kontiga.workflows().plan(WorkflowsPlanParams.builder()
    .description("New tenants send their ID and three payslips. Check them, and email the letting team when everything is in.")
    .language("en")
    .build());
```

.NET:

```csharp
var kontiga = new KontigaClient(); // reads KONTIGA_API_KEY
var result = await kontiga.Workflows.PlanAsync(new WorkflowsPlanOptions
{
    Description = "New tenants send their ID and three payslips. Check them, and email the letting team when everything is in.",
    Language = "en",
});
```

PHP:

```php
$kontiga = new \Kontiga\Client(); // reads KONTIGA_API_KEY
$result = $kontiga->workflows->plan([
    'description' => 'New tenants send their ID and three payslips. Check them, and email the letting team when everything is in.',
    'language' => 'en',
]);
```

Ruby:

```ruby
require "kontiga"

kontiga = Kontiga::Client.new # reads KONTIGA_API_KEY
result = kontiga.workflows.plan(description: "New tenants send their ID and three payslips. Check them, and email the letting team when everything is in.", language: "en")
```

Rust:

```rust
let kontiga = kontiga::Client::from_env()?; // reads KONTIGA_API_KEY
let result = kontiga
    .workflows()
    .plan(kontiga::workflows::PlanParams {
        description: "New tenants send their ID and three payslips. Check them, and email the letting team when everything is in.".into(),
        language: "en".into(),
        ..Default::default()
    })
    .await?;
```

Response, 200 OK:

```json
{
  "object": "workflow_proposal",
  "name": "Tenancy check",
  "description": "Checks a new tenant's ID and income, and tells the letting team.",
  "collection_id": null,
  "steps": [
    { "kind": "trigger", "label": "Checklist complete", "detail": "When the tenant has sent everything", "why": "The tenant's documents start the check." },
    { "kind": "check", "label": "Check every document", "detail": "Changes and fraud, with the verdict", "why": "Payslips are the documents most often changed." },
    { "kind": "notify", "label": "Tell the letting team", "detail": "Email lettings@harbourline.example", "why": "You asked for the team to be told." }
  ],
  "notes": ["No checklist matches yet: one is drafted for you below."],
  "definition": { "name": "Tenancy check", "subtitle": "Send us a few documents for your new home.", "nodes": [], "edges": [] },
  "explanations": {},
  "language": "en",
  "language_name": "English",
  "questions": [],
  "new_collections": [
    { "ref": "new:tenant-documents", "name": "Tenant documents", "documents": 2 }
  ]
}
```

## Propose changes to a workflow

Turns a request in words into a set of changes to the canvas (steps to add, change, connect or remove), each with its reason. Nothing is saved: the member keeps the changes they want.

`POST /v1/workflows/{workflow_id}/improve`. Who may: Owner and Admin. CLI: `kontiga workflows improve <workflow_id> --request <text> [--nodes <json>] [--edges <json>]`. MCP tool: `improve_workflow`.

**Parameters**
- `workflow_id` (id (wf_), required): The workflow to change. In the path.
- `request` (string, required): What should change, in your own words. At most 2,000 characters.
- `nodes` (array of object): The canvas's steps with unsaved edits. At most 100 items.
- `edges` (array of object): The canvas's connections with unsaved edits. At most 200 items.

**Returns** change set: The proposed changes, each with its reason; nothing is saved.

API:

```bash
curl -X POST https://api.kontiga.com/v1/workflows/wf_3Kd8Pn2/improve \
  -H "Authorization: Bearer $KONTIGA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request": "Email our team when a case needs a person."
  }'
```

CLI:

```bash
kontiga workflows improve wf_3Kd8Pn2 \
  --request 'Email our team when a case needs a person.'
```

MCP tool `improve_workflow`:

```json
{
  "name": "improve_workflow",
  "arguments": {
    "workflow_id": "wf_3Kd8Pn2",
    "request": "Email our team when a case needs a person."
  }
}
```

TypeScript:

```typescript
import Kontiga from "@kontiga/sdk";

const kontiga = new Kontiga(); // reads KONTIGA_API_KEY
const result = await kontiga.workflows.improve("wf_3Kd8Pn2", {
  request: "Email our team when a case needs a person.",
});
```

Python:

```python
from kontiga import Kontiga

kontiga = Kontiga()  # reads KONTIGA_API_KEY
result = kontiga.workflows.improve("wf_3Kd8Pn2", request="Email our team when a case needs a person.")
```

Go:

```go
client := kontiga.NewClient() // reads KONTIGA_API_KEY
result, err := client.Workflows.Improve(ctx, "wf_3Kd8Pn2", &kontiga.WorkflowsImproveParams{
	Request: "Email our team when a case needs a person.",
})
if err != nil {
	return err
}
```

Java:

```java
Kontiga kontiga = Kontiga.fromEnv(); // reads KONTIGA_API_KEY
var result = kontiga.workflows().improve("wf_3Kd8Pn2", WorkflowsImproveParams.builder()
    .request("Email our team when a case needs a person.")
    .build());
```

.NET:

```csharp
var kontiga = new KontigaClient(); // reads KONTIGA_API_KEY
var result = await kontiga.Workflows.ImproveAsync("wf_3Kd8Pn2", new WorkflowsImproveOptions
{
    Request = "Email our team when a case needs a person.",
});
```

PHP:

```php
$kontiga = new \Kontiga\Client(); // reads KONTIGA_API_KEY
$result = $kontiga->workflows->improve('wf_3Kd8Pn2', [
    'request' => 'Email our team when a case needs a person.',
]);
```

Ruby:

```ruby
require "kontiga"

kontiga = Kontiga::Client.new # reads KONTIGA_API_KEY
result = kontiga.workflows.improve("wf_3Kd8Pn2", request: "Email our team when a case needs a person.")
```

Rust:

```rust
let kontiga = kontiga::Client::from_env()?; // reads KONTIGA_API_KEY
let result = kontiga
    .workflows()
    .improve("wf_3Kd8Pn2".into(), kontiga::workflows::ImproveParams {
        request: "Email our team when a case needs a person.".into(),
        ..Default::default()
    })
    .await?;
```

Response, 200 OK:

```json
{
  "object": "change_set",
  "summary": "Email the mortgage team when a case needs a person.",
  "changes": [
    {
      "op": "add_node",
      "node": { "id": "notify_team", "type": "email", "position": { "x": 1020, "y": 300 }, "data": { "label": "Tell the team", "parameters": { "recipient": "mortgages@harbourline.example", "subject": "Case {dossierID} needs a person", "body": "Case {dossierID} needs a person to look at it." } } },
      "reason": "You asked for the team to be told."
    },
    { "op": "connect", "source": "decide", "source_handle": "needs_attention", "target": "notify_team", "reason": "Only cases that need a person send the email." }
  ],
  "notes": []
}
```

## Start the workflow planner

Starts Build with AI (workflow_plan) or Improve with AI (workflow_improve) as a session: it works in steps you can follow, may stop to ask one to four questions, and proposes a workflow or a change set to keep, revise or leave. Nothing is saved until the proposal is kept and the draft saved.

`POST /v1/workflows/planner/sessions`. Who may: Owner and Admin. CLI: `kontiga workflows planner start --mode <workflow_plan|workflow_improve> --request <text> [--language <tag>] [--language-name <name>] [--workflow-id <wf_id>] [--nodes <json>] [--edges <json>]`. MCP tool: `start_workflow_planner`.

**Parameters**
- `mode` (enum, required): `workflow_plan` drafts a new workflow; `workflow_improve` proposes changes to one.
- `request` (string, required): What to draft or change, in your own words. At most 4,000 characters.
- `language` (string): The language of the texts the end customer reads.
- `language_name` (string): The language's English name.
- `workflow_id` (id (wf_)): For `workflow_improve`: the workflow.
- `nodes` (array of object): For `workflow_improve`: the canvas's steps with unsaved edits. At most 100 items.
- `edges` (array of object): For `workflow_improve`: the canvas's connections with unsaved edits. At most 200 items.

**Returns** workflow planner session: The session, working: its id, its first events and its usage. Read it with workflows.planner_session until it waits, proposes or ends.

API:

```bash
curl -X POST https://api.kontiga.com/v1/workflows/planner/sessions \
  -H "Authorization: Bearer $KONTIGA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "mode": "workflow_plan",
    "request": "New tenants send their ID and three payslips. Check them, and email the letting team when everything is in.",
    "language": "en"
  }'
```

CLI:

```bash
kontiga workflows planner start \
  --mode workflow_plan \
  --request 'New tenants send their ID and three payslips. Check them, and email the letting team when everything is in.' \
  --language en
```

MCP tool `start_workflow_planner`:

```json
{
  "name": "start_workflow_planner",
  "arguments": {
    "mode": "workflow_plan",
    "request": "New tenants send their ID and three payslips. Check them, and email the letting team when everything is in.",
    "language": "en"
  }
}
```

TypeScript:

```typescript
import Kontiga from "@kontiga/sdk";

const kontiga = new Kontiga(); // reads KONTIGA_API_KEY
const result = await kontiga.workflows.plannerStart({
  mode: "workflow_plan",
  request: "New tenants send their ID and three payslips. Check them, and email the letting team when everything is in.",
  language: "en",
});
```

Python:

```python
from kontiga import Kontiga

kontiga = Kontiga()  # reads KONTIGA_API_KEY
result = kontiga.workflows.planner_start(
    mode="workflow_plan",
    request="New tenants send their ID and three payslips. Check them, and email the letting team when everything is in.",
    language="en",
)
```

Go:

```go
client := kontiga.NewClient() // reads KONTIGA_API_KEY
result, err := client.Workflows.PlannerStart(ctx, &kontiga.WorkflowsPlannerStartParams{
	Mode:     "workflow_plan",
	Request:  "New tenants send their ID and three payslips. Check them, and email the letting team when everything is in.",
	Language: "en",
})
if err != nil {
	return err
}
```

Java:

```java
Kontiga kontiga = Kontiga.fromEnv(); // reads KONTIGA_API_KEY
var result = kontiga.workflows().plannerStart(WorkflowsPlannerStartParams.builder()
    .mode("workflow_plan")
    .request("New tenants send their ID and three payslips. Check them, and email the letting team when everything is in.")
    .language("en")
    .build());
```

.NET:

```csharp
var kontiga = new KontigaClient(); // reads KONTIGA_API_KEY
var result = await kontiga.Workflows.PlannerStartAsync(new WorkflowsPlannerStartOptions
{
    Mode = "workflow_plan",
    Request = "New tenants send their ID and three payslips. Check them, and email the letting team when everything is in.",
    Language = "en",
});
```

PHP:

```php
$kontiga = new \Kontiga\Client(); // reads KONTIGA_API_KEY
$result = $kontiga->workflows->plannerStart([
    'mode' => 'workflow_plan',
    'request' => 'New tenants send their ID and three payslips. Check them, and email the letting team when everything is in.',
    'language' => 'en',
]);
```

Ruby:

```ruby
require "kontiga"

kontiga = Kontiga::Client.new # reads KONTIGA_API_KEY
result = kontiga.workflows.planner_start(
  mode: "workflow_plan",
  request: "New tenants send their ID and three payslips. Check them, and email the letting team when everything is in.",
  language: "en"
)
```

Rust:

```rust
let kontiga = kontiga::Client::from_env()?; // reads KONTIGA_API_KEY
let result = kontiga
    .workflows()
    .planner_start(kontiga::workflows::PlannerStartParams {
        mode: "workflow_plan".into(),
        request: "New tenants send their ID and three payslips. Check them, and email the letting team when everything is in.".into(),
        language: "en".into(),
        ..Default::default()
    })
    .await?;
```

Response, 201 Created:

```json
{
  "id": "wfa_2Qp8Ld5",
  "object": "workflow_planner_session",
  "mode": "workflow_plan",
  "status": "working",
  "revision": 0,
  "events": [
    { "seq": 1, "kind": "start", "text": "Reading the request", "at": "2026-11-27T10:50:01Z" }
  ],
  "questions": null,
  "proposal": null,
  "made": [],
  "usage": { "steps": 1, "max_steps": 30, "input_tokens": 3120, "cached_tokens": 0, "output_tokens": 88, "thought_tokens": 0 },
  "error": null,
  "created_at": "2026-11-27T10:50:01Z",
  "updated_at": "2026-11-27T10:50:02Z"
}
```

## Read a workflow planner session

Where a workflow planner session stands: working with its progress and usage, waiting on questions, a proposal to review, or ended, with its error when it failed.

`GET /v1/workflows/planner/sessions/{session_id}`. Who may: Owner, Admin, Analyst, Developer and Viewer. CLI: `kontiga workflows planner get <session_id> [--since <seq>]`. MCP tool: `get_workflow_planner_session`.

**Parameters**
- `session_id` (id (wfa_), required): The session to read. In the path.
- `since` (integer, default 0): Answer only the events after this one.

**Returns** workflow planner session: Its status, the events after since, the questions while it waits, the proposal, the collections made on keeping it, the usage (steps of at most 30, tokens) and the error.

API:

```bash
curl -X GET "https://api.kontiga.com/v1/workflows/planner/sessions/wfa_2Qp8Ld5?since=4" \
  -H "Authorization: Bearer $KONTIGA_API_KEY"
```

CLI:

```bash
kontiga workflows planner get wfa_2Qp8Ld5 --since 4
```

MCP tool `get_workflow_planner_session`:

```json
{
  "name": "get_workflow_planner_session",
  "arguments": {
    "session_id": "wfa_2Qp8Ld5",
    "since": 4
  }
}
```

TypeScript:

```typescript
import Kontiga from "@kontiga/sdk";

const kontiga = new Kontiga(); // reads KONTIGA_API_KEY
const result = await kontiga.workflows.plannerSession("wfa_2Qp8Ld5", {
  since: 4,
});
```

Python:

```python
from kontiga import Kontiga

kontiga = Kontiga()  # reads KONTIGA_API_KEY
result = kontiga.workflows.planner_session("wfa_2Qp8Ld5", since=4)
```

Go:

```go
client := kontiga.NewClient() // reads KONTIGA_API_KEY
result, err := client.Workflows.PlannerSession(ctx, "wfa_2Qp8Ld5", &kontiga.WorkflowsPlannerSessionParams{
	Since: 4,
})
if err != nil {
	return err
}
```

Java:

```java
Kontiga kontiga = Kontiga.fromEnv(); // reads KONTIGA_API_KEY
var result = kontiga.workflows().plannerSession("wfa_2Qp8Ld5", WorkflowsPlannerSessionParams.builder()
    .since(4)
    .build());
```

.NET:

```csharp
var kontiga = new KontigaClient(); // reads KONTIGA_API_KEY
var result = await kontiga.Workflows.PlannerSessionAsync("wfa_2Qp8Ld5", new WorkflowsPlannerSessionOptions
{
    Since = 4,
});
```

PHP:

```php
$kontiga = new \Kontiga\Client(); // reads KONTIGA_API_KEY
$result = $kontiga->workflows->plannerSession('wfa_2Qp8Ld5', [
    'since' => 4,
]);
```

Ruby:

```ruby
require "kontiga"

kontiga = Kontiga::Client.new # reads KONTIGA_API_KEY
result = kontiga.workflows.planner_session("wfa_2Qp8Ld5", since: 4)
```

Rust:

```rust
let kontiga = kontiga::Client::from_env()?; // reads KONTIGA_API_KEY
let result = kontiga
    .workflows()
    .planner_session("wfa_2Qp8Ld5".into(), kontiga::workflows::PlannerSessionParams {
        since: 4,
        ..Default::default()
    })
    .await?;
```

Response, 200 OK:

```json
{
  "id": "wfa_2Qp8Ld5",
  "object": "workflow_planner_session",
  "mode": "workflow_plan",
  "status": "proposed",
  "revision": 1,
  "events": [
    { "seq": 5, "kind": "proposal", "text": "Proposed a workflow of 3 steps", "at": "2026-11-27T10:51:40Z" }
  ],
  "questions": null,
  "proposal": {
    "kind": "workflow",
    "name": "Tenancy check",
    "steps": [
      { "kind": "trigger", "label": "Checklist complete" },
      { "kind": "check", "label": "Check every document" },
      { "kind": "notify", "label": "Tell the letting team" }
    ],
    "new_collections": [{ "ref": "new:tenant-documents", "name": "Tenant documents" }]
  },
  "made": [],
  "usage": { "steps": 5, "max_steps": 30, "input_tokens": 15480, "cached_tokens": 8192, "output_tokens": 1820, "thought_tokens": 0 },
  "error": null,
  "updated_at": "2026-11-27T10:51:40Z"
}
```

## Answer the workflow planner

Answers the questions a waiting session asked, each with a listed choice or in your own words; the session works on with them.

`POST /v1/workflows/planner/sessions/{session_id}/answer`. Who may: Owner and Admin. CLI: `kontiga workflows planner answer <session_id> --answers <json>`. MCP tool: `answer_workflow_planner`.

**Parameters**
- `session_id` (id (wfa_), required): A session that is waiting. In the path.
- `answers` (array of object, required): One answer per question: `{id, choice}` with one of its options, or `{id, text}` in your own words. At most 10 items.

**Returns** workflow planner session: The session, working again with the answers.

API:

```bash
curl -X POST https://api.kontiga.com/v1/workflows/planner/sessions/wfa_2Qp8Ld5/answer \
  -H "Authorization: Bearer $KONTIGA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "answers": [
      {
        "id": "q1",
        "choice": "The letting team decides"
      }
    ]
  }'
```

CLI:

```bash
kontiga workflows planner answer wfa_2Qp8Ld5 \
  --answers '[{"id":"q1","choice":"The letting team decides"}]'
```

MCP tool `answer_workflow_planner`:

```json
{
  "name": "answer_workflow_planner",
  "arguments": {
    "session_id": "wfa_2Qp8Ld5",
    "answers": [
      {
        "id": "q1",
        "choice": "The letting team decides"
      }
    ]
  }
}
```

TypeScript:

```typescript
import Kontiga from "@kontiga/sdk";

const kontiga = new Kontiga(); // reads KONTIGA_API_KEY
const result = await kontiga.workflows.plannerAnswer("wfa_2Qp8Ld5", {
  answers: [{ id: "q1", choice: "The letting team decides" }],
});
```

Python:

```python
from kontiga import Kontiga

kontiga = Kontiga()  # reads KONTIGA_API_KEY
result = kontiga.workflows.planner_answer("wfa_2Qp8Ld5", answers=[{"id": "q1", "choice": "The letting team decides"}])
```

Go:

```go
client := kontiga.NewClient() // reads KONTIGA_API_KEY
result, err := client.Workflows.PlannerAnswer(ctx, "wfa_2Qp8Ld5", &kontiga.WorkflowsPlannerAnswerParams{
	Answers: []any{map[string]any{"id": "q1", "choice": "The letting team decides"}},
})
if err != nil {
	return err
}
```

Java:

```java
Kontiga kontiga = Kontiga.fromEnv(); // reads KONTIGA_API_KEY
var result = kontiga.workflows().plannerAnswer("wfa_2Qp8Ld5", WorkflowsPlannerAnswerParams.builder()
    .answers(List.of(Map.of("id", "q1", "choice", "The letting team decides")))
    .build());
```

.NET:

```csharp
var kontiga = new KontigaClient(); // reads KONTIGA_API_KEY
var result = await kontiga.Workflows.PlannerAnswerAsync("wfa_2Qp8Ld5", new WorkflowsPlannerAnswerOptions
{
    Answers = new object[] { new Dictionary<string, object> { ["id"] = "q1", ["choice"] = "The letting team decides" } },
});
```

PHP:

```php
$kontiga = new \Kontiga\Client(); // reads KONTIGA_API_KEY
$result = $kontiga->workflows->plannerAnswer('wfa_2Qp8Ld5', [
    'answers' => [['id' => 'q1', 'choice' => 'The letting team decides']],
]);
```

Ruby:

```ruby
require "kontiga"

kontiga = Kontiga::Client.new # reads KONTIGA_API_KEY
result = kontiga.workflows.planner_answer("wfa_2Qp8Ld5", answers: [{ id: "q1", choice: "The letting team decides" }])
```

Rust:

```rust
let kontiga = kontiga::Client::from_env()?; // reads KONTIGA_API_KEY
let result = kontiga
    .workflows()
    .planner_answer("wfa_2Qp8Ld5".into(), kontiga::workflows::PlannerAnswerParams {
        answers: vec![serde_json::json!({"id":"q1","choice":"The letting team decides"})],
        ..Default::default()
    })
    .await?;
```

Response, 200 OK:

```json
{
  "id": "wfa_2Qp8Ld5",
  "object": "workflow_planner_session",
  "mode": "workflow_plan",
  "status": "working",
  "revision": 0,
  "events": [
    { "seq": 1, "kind": "start", "text": "Reading the request", "at": "2026-11-27T10:50:01Z" }
  ],
  "questions": null,
  "proposal": null,
  "made": [],
  "usage": { "steps": 1, "max_steps": 30, "input_tokens": 3120, "cached_tokens": 0, "output_tokens": 88, "thought_tokens": 0 },
  "error": null,
  "created_at": "2026-11-27T10:50:01Z",
  "updated_at": "2026-11-27T10:50:02Z"
}
```

## Ask the workflow planner for changes

Sends a proposal back with what should change; the session works on it and proposes again.

`POST /v1/workflows/planner/sessions/{session_id}/revise`. Who may: Owner and Admin. CLI: `kontiga workflows planner revise <session_id> --message <text>`. MCP tool: `revise_workflow_planner`.

**Parameters**
- `session_id` (id (wfa_), required): A session that has proposed. In the path.
- `message` (string, required): What should change in the proposal. At most 2,000 characters.

**Returns** workflow planner session: The session, working again on the revision.

API:

```bash
curl -X POST https://api.kontiga.com/v1/workflows/planner/sessions/wfa_2Qp8Ld5/revise \
  -H "Authorization: Bearer $KONTIGA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "message": "Screen the tenant too."
  }'
```

CLI:

```bash
kontiga workflows planner revise wfa_2Qp8Ld5 \
  --message 'Screen the tenant too.'
```

MCP tool `revise_workflow_planner`:

```json
{
  "name": "revise_workflow_planner",
  "arguments": {
    "session_id": "wfa_2Qp8Ld5",
    "message": "Screen the tenant too."
  }
}
```

TypeScript:

```typescript
import Kontiga from "@kontiga/sdk";

const kontiga = new Kontiga(); // reads KONTIGA_API_KEY
const result = await kontiga.workflows.plannerRevise("wfa_2Qp8Ld5", {
  message: "Screen the tenant too.",
});
```

Python:

```python
from kontiga import Kontiga

kontiga = Kontiga()  # reads KONTIGA_API_KEY
result = kontiga.workflows.planner_revise("wfa_2Qp8Ld5", message="Screen the tenant too.")
```

Go:

```go
client := kontiga.NewClient() // reads KONTIGA_API_KEY
result, err := client.Workflows.PlannerRevise(ctx, "wfa_2Qp8Ld5", &kontiga.WorkflowsPlannerReviseParams{
	Message: "Screen the tenant too.",
})
if err != nil {
	return err
}
```

Java:

```java
Kontiga kontiga = Kontiga.fromEnv(); // reads KONTIGA_API_KEY
var result = kontiga.workflows().plannerRevise("wfa_2Qp8Ld5", WorkflowsPlannerReviseParams.builder()
    .message("Screen the tenant too.")
    .build());
```

.NET:

```csharp
var kontiga = new KontigaClient(); // reads KONTIGA_API_KEY
var result = await kontiga.Workflows.PlannerReviseAsync("wfa_2Qp8Ld5", new WorkflowsPlannerReviseOptions
{
    Message = "Screen the tenant too.",
});
```

PHP:

```php
$kontiga = new \Kontiga\Client(); // reads KONTIGA_API_KEY
$result = $kontiga->workflows->plannerRevise('wfa_2Qp8Ld5', [
    'message' => 'Screen the tenant too.',
]);
```

Ruby:

```ruby
require "kontiga"

kontiga = Kontiga::Client.new # reads KONTIGA_API_KEY
result = kontiga.workflows.planner_revise("wfa_2Qp8Ld5", message: "Screen the tenant too.")
```

Rust:

```rust
let kontiga = kontiga::Client::from_env()?; // reads KONTIGA_API_KEY
let result = kontiga
    .workflows()
    .planner_revise("wfa_2Qp8Ld5".into(), kontiga::workflows::PlannerReviseParams {
        message: "Screen the tenant too.".into(),
        ..Default::default()
    })
    .await?;
```

Response, 200 OK:

```json
{
  "id": "wfa_2Qp8Ld5",
  "object": "workflow_planner_session",
  "mode": "workflow_plan",
  "status": "working",
  "revision": 0,
  "events": [
    { "seq": 1, "kind": "start", "text": "Reading the request", "at": "2026-11-27T10:50:01Z" }
  ],
  "questions": null,
  "proposal": null,
  "made": [],
  "usage": { "steps": 1, "max_steps": 30, "input_tokens": 3120, "cached_tokens": 0, "output_tokens": 88, "thought_tokens": 0 },
  "error": null,
  "created_at": "2026-11-27T10:50:01Z",
  "updated_at": "2026-11-27T10:50:02Z"
}
```

## Keep the workflow planner's proposal

Keeps the proposal and ends the session. The collections a drafted workflow asks for are made now (all of them, or the ones named), and its steps take their ids. Saving the workflow stays the member's save.

`POST /v1/workflows/planner/sessions/{session_id}/accept`. Who may: Owner and Admin. CLI: `kontiga workflows planner accept <session_id> [--collection-refs <ref,ref>]`. MCP tool: `accept_workflow_planner`.

**Parameters**
- `session_id` (id (wfa_), required): A session that has proposed. Keeping it saves no workflow: create or save it after. In the path.
- `collection_refs` (array of string): The drafted collections to make now, by their `new:` reference. Every one when left out. At most 10 items.

**Returns** workflow planner session: The session, finished, with the collections it made and the proposal's steps naming them.

API:

```bash
curl -X POST https://api.kontiga.com/v1/workflows/planner/sessions/wfa_2Qp8Ld5/accept \
  -H "Authorization: Bearer $KONTIGA_API_KEY"
```

CLI:

```bash
kontiga workflows planner accept wfa_2Qp8Ld5
```

MCP tool `accept_workflow_planner`:

```json
{
  "name": "accept_workflow_planner",
  "arguments": {
    "session_id": "wfa_2Qp8Ld5"
  }
}
```

TypeScript:

```typescript
import Kontiga from "@kontiga/sdk";

const kontiga = new Kontiga(); // reads KONTIGA_API_KEY
const result = await kontiga.workflows.plannerAccept("wfa_2Qp8Ld5");
```

Python:

```python
from kontiga import Kontiga

kontiga = Kontiga()  # reads KONTIGA_API_KEY
result = kontiga.workflows.planner_accept("wfa_2Qp8Ld5")
```

Go:

```go
client := kontiga.NewClient() // reads KONTIGA_API_KEY
result, err := client.Workflows.PlannerAccept(ctx, "wfa_2Qp8Ld5")
if err != nil {
	return err
}
```

Java:

```java
Kontiga kontiga = Kontiga.fromEnv(); // reads KONTIGA_API_KEY
var result = kontiga.workflows().plannerAccept("wfa_2Qp8Ld5");
```

.NET:

```csharp
var kontiga = new KontigaClient(); // reads KONTIGA_API_KEY
var result = await kontiga.Workflows.PlannerAcceptAsync("wfa_2Qp8Ld5");
```

PHP:

```php
$kontiga = new \Kontiga\Client(); // reads KONTIGA_API_KEY
$result = $kontiga->workflows->plannerAccept('wfa_2Qp8Ld5');
```

Ruby:

```ruby
require "kontiga"

kontiga = Kontiga::Client.new # reads KONTIGA_API_KEY
result = kontiga.workflows.planner_accept("wfa_2Qp8Ld5")
```

Rust:

```rust
let kontiga = kontiga::Client::from_env()?; // reads KONTIGA_API_KEY
let result = kontiga
    .workflows()
    .planner_accept("wfa_2Qp8Ld5".into())
    .await?;
```

Response, 200 OK:

```json
{
  "id": "wfa_2Qp8Ld5",
  "object": "workflow_planner_session",
  "mode": "workflow_plan",
  "status": "finished",
  "events": [
    { "seq": 6, "kind": "accepted", "text": "Proposal kept", "at": "2026-11-27T10:52:15Z" }
  ],
  "made": [{ "ref": "new:tenant-documents", "collection_id": "col_4Dn9Xe3", "name": "Tenant documents" }],
  "error": null,
  "updated_at": "2026-11-27T10:52:15Z"
}
```

## Stop the workflow planner

Stops a session that is working, waiting or proposing; a session that has ended stays as it is.

`POST /v1/workflows/planner/sessions/{session_id}/cancel`. Who may: Owner and Admin. CLI: `kontiga workflows planner cancel <session_id>`. MCP tool: `cancel_workflow_planner`.

**Parameters**
- `session_id` (id (wfa_), required): The session to stop. A session that has ended is answered as it is. In the path.

**Returns** workflow planner session: The session, cancelled (or as it ended).

API:

```bash
curl -X POST https://api.kontiga.com/v1/workflows/planner/sessions/wfa_2Qp8Ld5/cancel \
  -H "Authorization: Bearer $KONTIGA_API_KEY"
```

CLI:

```bash
kontiga workflows planner cancel wfa_2Qp8Ld5
```

MCP tool `cancel_workflow_planner`:

```json
{
  "name": "cancel_workflow_planner",
  "arguments": {
    "session_id": "wfa_2Qp8Ld5"
  }
}
```

TypeScript:

```typescript
import Kontiga from "@kontiga/sdk";

const kontiga = new Kontiga(); // reads KONTIGA_API_KEY
const result = await kontiga.workflows.plannerCancel("wfa_2Qp8Ld5");
```

Python:

```python
from kontiga import Kontiga

kontiga = Kontiga()  # reads KONTIGA_API_KEY
result = kontiga.workflows.planner_cancel("wfa_2Qp8Ld5")
```

Go:

```go
client := kontiga.NewClient() // reads KONTIGA_API_KEY
result, err := client.Workflows.PlannerCancel(ctx, "wfa_2Qp8Ld5")
if err != nil {
	return err
}
```

Java:

```java
Kontiga kontiga = Kontiga.fromEnv(); // reads KONTIGA_API_KEY
var result = kontiga.workflows().plannerCancel("wfa_2Qp8Ld5");
```

.NET:

```csharp
var kontiga = new KontigaClient(); // reads KONTIGA_API_KEY
var result = await kontiga.Workflows.PlannerCancelAsync("wfa_2Qp8Ld5");
```

PHP:

```php
$kontiga = new \Kontiga\Client(); // reads KONTIGA_API_KEY
$result = $kontiga->workflows->plannerCancel('wfa_2Qp8Ld5');
```

Ruby:

```ruby
require "kontiga"

kontiga = Kontiga::Client.new # reads KONTIGA_API_KEY
result = kontiga.workflows.planner_cancel("wfa_2Qp8Ld5")
```

Rust:

```rust
let kontiga = kontiga::Client::from_env()?; // reads KONTIGA_API_KEY
let result = kontiga
    .workflows()
    .planner_cancel("wfa_2Qp8Ld5".into())
    .await?;
```

Response, 200 OK:

```json
{
  "id": "wfa_2Qp8Ld5",
  "object": "workflow_planner_session",
  "mode": "workflow_plan",
  "status": "cancelled",
  "events": [
    { "seq": 3, "kind": "cancelled", "text": "Stopped", "at": "2026-11-27T10:50:30Z" }
  ],
  "error": null,
  "updated_at": "2026-11-27T10:50:30Z"
}
```
