Workflows
CRUD for workflow definitions.
GET /wp-json/pfw-workflow/v1/workflows
Lists all workflows visible to the current user.
Query parameters:
| Param | Type | Default | Description |
|---|---|---|---|
status | string | (all) | Filter: active, inactive, archived |
tag | string | (all) | Filter by tag slug |
q | string | (none) | Full-text search on title and description |
per_page | int | 20 | Max 100 |
page | int | 1 |
Response (200):
{
"status": "ok",
"data": {
"items": [
{ "id": 42, "slug": "thank-big-orders", "title": "Thank big orders", "status": "active", "trigger_type": "woocommerce.order_paid", "node_count": 5 }
],
"total": 1,
"page": 1,
"per_page": 20
}
}
GET /wp-json/pfw-workflow/v1/workflows/{id}
Returns one workflow with its full graph.
POST /wp-json/pfw-workflow/v1/workflows
Creates a new workflow. Body is the full workflow definition (the agent uses this to build workflows from a sentence).
PATCH /wp-json/pfw-workflow/v1/workflows/{id}
Updates one or more fields. Supports partial updates.
DELETE /wp-json/pfw-workflow/v1/workflows/{id}
Soft-deletes (moves to archived). Returns 200. To purge, repeat with ?force=true.
POST /wp-json/pfw-workflow/v1/workflows/{id}/activate
Toggles the workflow to active. Idempotent.
POST /wp-json/pfw-workflow/v1/workflows/{id}/run
Triggers the workflow with a custom payload. Equivalent to clicking Run now in the editor.
Body:
{ "payload": { "any": "json", "your": "trigger_expects" } }