LoopFour

Quickstart

Get your first workflow running in 5 minutes

Quickstart

This guide will help you create and run your first workflow in under 5 minutes.

Prerequisites

Step 1: Verify Your API Key

First, verify your API key is working by listing workflows:

curl http://localhost:3000/api/v1/workflows \
  -H "x-api-key: YOUR_API_KEY"

You should see:

{
  "success": true,
  "data": []
}

Step 2: Create a Workflow

Create a simple workflow that transforms input data:

curl -X POST http://localhost:3000/api/v1/workflows \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "My First Workflow",
    "description": "A simple echo workflow",
    "trigger": { "type": "api" },
    "steps": [{
      "id": "echo",
      "type": "transform",
      "name": "Echo Input",
      "config": {
        "mapping": {
          "message": "{{input.message}}",
          "timestamp": "{{now}}"
        }
      }
    }]
  }'

Response:

{
  "success": true,
  "data": {
    "id": "wf_abc123...",
    "name": "My First Workflow",
    "status": "draft",
    "version": 1,
    "trigger": { "type": "api" },
    "steps": [...],
    "createdAt": "2024-01-15T10:00:00.000Z",
    "updatedAt": "2024-01-15T10:00:00.000Z"
  }
}

Save the workflow id from the response - you'll need it for the next steps.

Step 3: Activate the Workflow

Workflows start in draft status and must be activated before they can run:

curl -X POST http://localhost:3000/api/v1/workflows/{WORKFLOW_ID}/activate \
  -H "x-api-key: YOUR_API_KEY"

Response:

{
  "success": true,
  "data": {
    "id": "wf_abc123...",
    "status": "active"
  }
}

Step 4: Run the Workflow

Now trigger your workflow with some input data:

curl -X POST http://localhost:3000/api/v1/workflows/{WORKFLOW_ID}/run \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "input": {
      "message": "Hello, Workflows!"
    }
  }'

Response:

{
  "success": true,
  "data": {
    "runId": "run_xyz789...",
    "status": "pending",
    "workflowId": "wf_abc123...",
    "workflowVersion": 1
  }
}

Step 5: Check the Run Status

Check the status of your workflow run:

curl http://localhost:3000/api/v1/runs/{RUN_ID} \
  -H "x-api-key: YOUR_API_KEY"

Response (completed):

{
  "success": true,
  "data": {
    "id": "run_xyz789...",
    "status": "completed",
    "output": {
      "message": "Hello, Workflows!",
      "timestamp": "2024-01-15T10:00:05.000Z"
    },
    "startedAt": "2024-01-15T10:00:00.000Z",
    "completedAt": "2024-01-15T10:00:05.000Z"
  }
}

What's Next?

You've successfully created and run your first workflow! Here's what to explore next:

On this page