Workflows
v1

Create Workflow

Create a workflow in the account from a definition you supply.

Pass a name, plus definition_version and definition. Build the definition out of the actions and triggers returned by Retrieve Workflow Action Definitions and Retrieve Workflow Trigger Definitions.

To start from a ready-made definition instead, take one from Retrieve Workflow Templates and replace its {{variables.<name>}} placeholders with the values for your account.

The workflow is always created disabled, and its definition is stored as sent without being validated — an incomplete or draft definition is accepted. Nothing runs until you enable it through Update Workflow, which is where the definition is validated.

Credit Note: Creating a workflow does not consume credits.

:::info Requires the workflows:write OAuth2 scope. :::

post/v1/workflows

Query parameters

account_idstring required

The Leadfeeder Account ID. The Account ID can be retrieved using the List Accounts endpoint.

Request body

Example request

{
  "data": {
    "attributes": {
      "name": "Route hot leads to Slack",
      "description": "Notifies #sales whenever a company lands on the Hot Leads list.",
      "workflow_type": "company",
      "definition_version": "V1",
      "definition": {
        "triggers": [
          {
            "name": "company_added_to_list",
            "filters": [
              {
                "attribute": "list_id",
                "op": "eq",
                "value": "42"
              }
            ],
            "options": {
              "type": "list"
            }
          }
        ],
        "steps": {
          "add_to_hot_leads": {
            "action_name": "add_organization_to_list",
            "options": {
              "list_id": "42"
            }
          },
          "notify_sales": {
            "action_name": "send_company_to_slack",
            "options": {
              "channel": "#sales"
            }
          }
        },
        "order": {
          "trigger": [
            "add_to_hot_leads"
          ],
          "add_to_hot_leads": [
            "notify_sales"
          ]
        }
      }
    }
  }
}

Response

The workflow was created. It is always created disabled.

Example response

{
  "data": {
    "type": "workflow",
    "id": "9f8b7c6d5e4f",
    "attributes": {
      "name": "Route hot leads to Slack",
      "description": "Notifies #sales whenever a company lands on the Hot Leads list.",
      "workflow_type": "company",
      "version": 3,
      "definition_version": "V1",
      "definition": {
        "triggers": [
          {
            "name": "company_added_to_list",
            "filters": [
              {
                "attribute": "list_id",
                "op": "eq",
                "value": "42"
              }
            ],
            "options": {
              "type": "list"
            }
          }
        ],
        "steps": {
          "add_to_hot_leads": {
            "action_name": "add_organization_to_list",
            "options": {
              "list_id": "42"
            }
          },
          "notify_sales": {
            "action_name": "send_company_to_slack",
            "options": {
              "channel": "#sales"
            }
          }
        },
        "order": {
          "trigger": [
            "add_to_hot_leads"
          ],
          "add_to_hot_leads": [
            "notify_sales"
          ]
        }
      },
      "disabled_at": "2026-08-01T10:00:00Z",
      "created_at": "2026-07-20T09:15:00Z",
      "updated_at": "2026-08-01T10:00:00Z",
      "app_url": "https://app.leadfeeder.com/z/123456/workflows/9f8b7c6d5e4f"
    },
    "relationships": {
      "created_by": {
        "id": "123456"
      },
      "disabled_by": {
        "id": "123456"
      },
      "run_stats": {
        "type": "workflow_run_stats",
        "id": "9f8b7c6d5e4f",
        "attributes": {
          "triggered_count": 128,
          "failed_count": 3,
          "last_run_at": "2026-08-05T14:22:31Z"
        }
      },
      "errors": [
        {
          "type": "workflow_error",
          "id": "7d3f1a90c2b4e6f8",
          "attributes": {
            "step_id": "notify_sales",
            "error_code": "connection_unauthorized",
            "error_message": "The Slack connection is no longer authorised.",
            "count": 12,
            "first_seen_at": "2026-07-29T08:03:00Z",
            "last_seen_at": "2026-08-05T14:22:31Z"
          }
        }
      ]
    }
  },
  "meta": {
    "request_id": "cf054205-dd8c-4473-8689-07c30fe0789f"
  }
}

Changes

Changed in 2 of the 15 revisions of this API.2

Of the 15 revisions, 1 has no diff computed.