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

# Workflows Overview (Legacy)

> Run many records through a saved multi-step enrichment pipeline with one API call.

> [!NOTE]
>
> This page documents the original routes, which keep working. For new integrations, use the `/v1` routes in [Workflows Overview](https://docs.sixtyfour.ai/api-reference/workflows/workflows-overview.md). [Legacy](https://docs.sixtyfour.ai/api-reference/legacy.md) maps each original route to its `/v1` replacement.

## Core Concepts

The Workflows API models pipelines as directed acyclic graphs (DAGs):

| Term | Description |
| - | - |
| Workflow | A reusable pipeline definition containing blocks and edges |
| Block | A processing step, such as webhook input, enrichment, filtering, or delivery. See [Workflow Blocks](https://docs.sixtyfour.ai/api-reference/workflows/workflow-blocks.md) |
| Edge | A connection between blocks that defines data flow |
| Run | One execution of a workflow, identified by its `job_id` |
| Template | A ready-made workflow definition from the Sixtyfour catalog. See [Templates](https://docs.sixtyfour.ai/api-reference/legacy/workflows-management.md#templates) |
| Schedule | A cron rule that starts runs automatically. See [Workflow Schedules](https://docs.sixtyfour.ai/api-reference/legacy/workflow-schedules.md) |

## Execution Flow

```mermaid theme={null}
flowchart LR
  A[List Workflows] --> B[Run Workflow]
  B --> C[Poll Live Status]
  C --> D[Download Results]
```

1. List workflows to find the `workflow_id` you want to run.
2. Run the workflow with input data and receive a `job_id`.
3. Poll live status every 10 seconds or slower until `overall_status` is no longer `queued`, `running`, or `finalizing`.
4. Download the result files (CSV, plus JSON or NDJSON when requested).

> [!NOTE]
>
> For workflows that start with a `webhook` block, see [Incoming Webhooks](https://docs.sixtyfour.ai/api-reference/webhooks/incoming.md). For recurring runs, see [Workflow Schedules](https://docs.sixtyfour.ai/api-reference/legacy/workflow-schedules.md).

## Quick start

> [!TIP]
>
> To build workflows without code, use the [Workflow Builder](https://app.sixtyfour.ai/workflows) in the Sixtyfour web app.

```bash cURL theme={null}
# 1. List available workflows
curl -X GET "https://api.sixtyfour.ai/workflows" \
  -H "x-api-key: YOUR_API_KEY"

# 2. Run a workflow with data
curl -X POST "https://api.sixtyfour.ai/workflows/run?workflow_id=WORKFLOW_ID" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "webhook_payload": [
      {"company_name": "Acme Corp", "website": "acme.com"}
    ]
  }'

# 3. Check status (use job_id from step 2)
curl -X GET "https://api.sixtyfour.ai/workflows/runs/JOB_ID/live_status" \
  -H "x-api-key: YOUR_API_KEY"

# 4. Download results
curl -X GET "https://api.sixtyfour.ai/workflows/runs/JOB_ID/results/download-links" \
  -H "x-api-key: YOUR_API_KEY"
```

```python Python theme={null}
import requests
import time

API_KEY = "YOUR_API_KEY"
BASE_URL = "https://api.sixtyfour.ai"
headers = {
    "x-api-key": API_KEY,
    "Content-Type": "application/json"
}

# 1. Run workflow
run_response = requests.post(
    f"{BASE_URL}/workflows/run?workflow_id=WORKFLOW_ID",
    headers=headers,
    json={
        "webhook_payload": [
            {"company_name": "Acme Corp", "website": "acme.com"},
            {"company_name": "TechStart", "website": "techstart.io"}
        ]
    }
)
run_response.raise_for_status()
job_id = run_response.json()["job_id"]
print(f"Workflow started: {job_id}")

# 2. Poll for completion
IN_PROGRESS = {"queued", "running", "finalizing"}
while True:
    status_response = requests.get(
        f"{BASE_URL}/workflows/runs/{job_id}/live_status",
        headers=headers
    )
    if status_response.status_code in (429, 503):
        time.sleep(int(status_response.headers.get("Retry-After", 10)))
        continue
    status_response.raise_for_status()
    status = status_response.json()

    print(f"Status: {status['overall_status']} ({status['overall_progress_percentage']:.1f}%)")

    if status["overall_status"] not in IN_PROGRESS:
        break

    time.sleep(10)

# 3. Download results
if status["overall_status"] == "completed":
    results_response = requests.get(
        f"{BASE_URL}/workflows/runs/{job_id}/results/download-links",
        headers=headers
    )
    for result in results_response.json():
        print(f"Download: {result['filename']} ({result['row_count']} rows)")
```

```javascript JavaScript theme={null}
const API_KEY = 'YOUR_API_KEY';
const BASE_URL = 'https://api.sixtyfour.ai';
const headers = { 'x-api-key': API_KEY, 'Content-Type': 'application/json' };

// 1. Run workflow
const runResponse = await fetch(
  `${BASE_URL}/workflows/run?workflow_id=WORKFLOW_ID`,
  {
    method: 'POST',
    headers,
    body: JSON.stringify({
      webhook_payload: [
        { company_name: 'Acme Corp', website: 'acme.com' },
        { company_name: 'TechStart', website: 'techstart.io' }
      ]
    })
  }
);
if (!runResponse.ok) throw new Error(`Failed to start: ${await runResponse.text()}`);
const { job_id } = await runResponse.json();
console.log(`Workflow started: ${job_id}`);

// 2. Poll for completion
const IN_PROGRESS = ['queued', 'running', 'finalizing'];
let status;
while (true) {
  const statusResponse = await fetch(
    `${BASE_URL}/workflows/runs/${job_id}/live_status`,
    { headers }
  );
  if (statusResponse.status === 429 || statusResponse.status === 503) {
    const retryAfter = Number(statusResponse.headers.get('Retry-After') ?? 10);
    await new Promise((r) => setTimeout(r, retryAfter * 1000));
    continue;
  }
  if (!statusResponse.ok) throw new Error(`Live status failed: ${statusResponse.status}`);
  status = await statusResponse.json();
  console.log(`Status: ${status.overall_status} (${status.overall_progress_percentage}%)`);
  if (!IN_PROGRESS.includes(status.overall_status)) break;
  await new Promise((r) => setTimeout(r, 10000));
}

// 3. Download results
if (status.overall_status === 'completed') {
  const resultsResponse = await fetch(
    `${BASE_URL}/workflows/runs/${job_id}/results/download-links`,
    { headers }
  );
  const results = await resultsResponse.json();
  results.forEach((r) => console.log(`Download: ${r.filename} (${r.row_count} rows)`));
}
```

## Uploading an input file

Workflows that start with a `read_csv` block read their rows from a file you upload first.

> [!TIP]
>
> Enriching a list of people or companies? Use [Bulk Intelligence](https://docs.sixtyfour.ai/api-reference/endpoint/bulk-intelligence.md): one call with file and config, no workflow or handle needed.

```http theme={null}
POST https://api.sixtyfour.ai/storage/csv/upload
```

Send the file as `multipart/form-data` with a single `file` part. Accepts `.csv`, `.json`, `.jsonl`, and `.ndjson` files up to 45 MB. Column names cannot start with `_`, except `_row_id`.

```bash cURL theme={null}
curl -X POST "https://api.sixtyfour.ai/storage/csv/upload" \
  -H "x-api-key: YOUR_API_KEY" \
  -F "file=@leads.csv"
```

The response returns a `handle_id`, valid only for your organization:

```json theme={null}
{
  "handle_id": "9b1f9d2e-4c3a-4f61-9a7e-2d8b5c1e0f43"
}
```

Pass `handle_id` as `specs_override.resource_handle_id` when you call `/workflows/run`. Runs of a `read_csv` workflow require it:

```bash cURL theme={null}
curl -X POST "https://api.sixtyfour.ai/workflows/run?workflow_id=WORKFLOW_ID" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "specs_override": { "resource_handle_id": "9b1f9d2e-4c3a-4f61-9a7e-2d8b5c1e0f43" } }'
```

## NDJSON input & output

Upload NDJSON or JSONL input the same way as CSV (see [Uploading an input file](#uploading-an-input-file)).

For NDJSON output, add `result_formats=ndjson` when running. CSV is always saved; NDJSON is added alongside it. NDJSON keeps numbers, booleans, and nested objects typed, where CSV writes every value as text (lists and objects as JSON).

```bash cURL theme={null}
# Request NDJSON output
curl -X POST "https://api.sixtyfour.ai/workflows/run?workflow_id=WORKFLOW_ID&result_formats=ndjson" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "specs_override": { "resource_handle_id": "9b1f9d2e-4c3a-4f61-9a7e-2d8b5c1e0f43" } }'

# Get the NDJSON download links: a JSON array of result files, each with a download_url
curl -X GET "https://api.sixtyfour.ai/workflows/runs/JOB_ID/results/download-links?format=ndjson" \
  -H "x-api-key: YOUR_API_KEY"

# Fetch the file from the returned download_url
curl -X GET "DOWNLOAD_URL" \
  -H "x-api-key: YOUR_API_KEY" \
  -o results.ndjson
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.