> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kadoa.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Manage Workflows

> List, retrieve, and manage existing workflows

## List Workflows

<CodeGroup>
  ```typescript Node SDK theme={null}
  const workflows = await client.workflow.list({ limit: 100 });

  for (const workflow of workflows) {
    console.log(`${workflow.id}: ${workflow.name}`);
  }
  ```

  ```python Python SDK theme={null}
  workflows = client.workflow.list(limit=100)

  for workflow in workflows:
      print(f"{workflow.id}: {workflow.name}")
  ```

  ```bash REST API theme={null}
  curl -X GET "https://api.kadoa.com/v4/workflows" \
    -H "x-api-key: YOUR_API_KEY"
  ```
</CodeGroup>

## Get Workflow

<CodeGroup>
  ```typescript Node SDK theme={null}
  const workflow = await client.workflow.get({
    workflowId: 'YOUR_WORKFLOW_ID'
  });
  ```

  ```python Python SDK theme={null}
  workflow = client.workflow.get(workflow_id="YOUR_WORKFLOW_ID")
  ```

  ```bash REST API theme={null}
  curl -X GET "https://api.kadoa.com/v4/workflows/YOUR_WORKFLOW_ID" \
    -H "x-api-key: YOUR_API_KEY"
  ```
</CodeGroup>

## Pause & Resume

<CodeGroup>
  ```typescript Node SDK theme={null}
  // Pause
  await client.workflow.pause({ workflowId: 'YOUR_WORKFLOW_ID' });

  // Resume
  await client.workflow.resume({ workflowId: 'YOUR_WORKFLOW_ID' });
  ```

  ```python Python SDK theme={null}
  # Pause
  client.workflow.pause(workflow_id="YOUR_WORKFLOW_ID")

  # Resume
  client.workflow.resume(workflow_id="YOUR_WORKFLOW_ID")
  ```
</CodeGroup>

## Update

<CodeGroup>
  ```typescript Node SDK theme={null}
  await client.workflow.update({
    workflowId: 'YOUR_WORKFLOW_ID',
    name: 'New Name',
    interval: 'DAILY',
  });
  ```

  ```python Python SDK theme={null}
  client.workflow.update(
      workflow_id="YOUR_WORKFLOW_ID",
      name="New Name",
      interval="DAILY",
  )
  ```

  ```bash REST API theme={null}
  curl -X PATCH "https://api.kadoa.com/v4/workflows/YOUR_WORKFLOW_ID" \
    -H "x-api-key: YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"name": "New Name", "interval": "DAILY"}'
  ```
</CodeGroup>

## Delete

<Warning>
  This permanently deletes the workflow and all its data.
</Warning>

<CodeGroup>
  ```typescript Node SDK theme={null}
  await client.workflow.delete({ workflowId: 'YOUR_WORKFLOW_ID' });
  ```

  ```python Python SDK theme={null}
  client.workflow.delete(workflow_id="YOUR_WORKFLOW_ID")
  ```

  ```bash REST API theme={null}
  curl -X DELETE "https://api.kadoa.com/v4/workflows/YOUR_WORKFLOW_ID" \
    -H "x-api-key: YOUR_API_KEY"
  ```
</CodeGroup>

## Templates

Workflows can be linked to [templates](/docs/templates) that manage their prompt, schema, and notification settings. When linked, those fields become read-only on the workflow.

See [Templates](/docs/sdk/templates/overview) for linking, unlinking, and applying template updates via the API.

## Fetch Data

<CodeGroup>
  ```typescript Node SDK theme={null}
  const workflows = await client.workflow.list({ limit: 100 });

  for (const workflow of workflows) {
    const data = await client.extraction.fetchAllData({
      workflowId: workflow.id,
    });
    console.log(`${workflow.name}: ${data.length} records`);
  }
  ```

  ```python Python SDK theme={null}
  from kadoa_sdk import FetchDataOptions

  workflows = client.workflow.list(limit=100)

  for workflow in workflows:
      data = client.extraction.fetch_all_data(
          FetchDataOptions(workflow_id=workflow.id)
      )
      print(f"{workflow.name}: {len(data)} records")
  ```

  ```bash REST API theme={null}
  curl -X GET "https://api.kadoa.com/v4/workflows/YOUR_WORKFLOW_ID/data?limit=50&page=2" \
    -H "x-api-key: YOUR_API_KEY"
  ```
</CodeGroup>
