Skip to main content
Create or update the draft for a workflow.

Overview

The Upsert Workflow Draft endpoint stages changes to a workflow without touching the live (published) version. Use it to iterate on a workflow’s definition, name, or description; the edits only take effect after you promote them (for example by calling Update Workflow with the draft definition and status: "PUBLISHED"). Each workflow has at most one draft at a time. Calling this endpoint again overwrites any existing draft.

Authentication

Requires a valid API key. No special permission scope is needed beyond a valid key.

Key Features

  • Safe Iteration: Edit a workflow without affecting the running version
  • Single Draft per Workflow: Upserts overwrite any existing draft
  • No Credit Cost: This endpoint is free to use
The workflow field follows the same shape as Create Workflow: { trigger, actions, edges }.
curl -X PUT "https://api.trigify.io/v1/workflows/wf_abc123/draft" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Summarise new posts to Slack (draft)",
    "description": "Experimenting with an extra scoring step",
    "workflow": {
      "trigger": { "kind": "workflows/new-post", "inputs": {} },
      "actions": [
        {
          "id": "agent-1",
          "kind": "generic_agent",
          "name": "Summarise Post",
          "inputs": {
            "outputFormat": "text",
            "model": "openai/gpt-5-mini",
            "prompt": "Summarise this post: {{ !ref($.trigger.outputs.text) }}"
          }
        },
        {
          "id": "slack-1",
          "kind": "slack_send_channel_message",
          "name": "Send Summary",
          "inputs": {
            "channel": "#social-alerts",
            "message": "{{ !ref($.agent-1.result.output) }}"
          }
        }
      ],
      "edges": [
        { "from": "$source", "to": "agent-1" },
        { "from": "agent-1", "to": "slack-1" }
      ]
    }
  }'

Path Parameters

ParameterTypeDescription
idstringThe unique workflow ID

Request Body

FieldTypeRequiredDefaultDescription
namestringYes-Draft name (1-255 characters)
descriptionstringNo""Free-form draft description
workflowobjectYes-Draft workflow definition. See Workflow Definition Shape

Example Response

{
  "message": "Draft upserted successfully",
  "success": true,
  "data": {
    "id": "wd_draft123",
    "workflow_id": "wf_abc123",
    "name": "Summarise new posts to Slack (draft)",
    "description": "Experimenting with an extra scoring step",
    "workflow": {
      "trigger": { "kind": "workflows/new-post", "inputs": {} },
      "actions": [
        { "id": "agent-1", "kind": "generic_agent", "name": "Summarise Post" },
        { "id": "slack-1", "kind": "slack_send_channel_message", "name": "Send Summary" }
      ],
      "edges": [
        { "from": "$source", "to": "agent-1" },
        { "from": "agent-1", "to": "slack-1" }
      ]
    },
    "last_modified": "2026-04-14T12:05:00.000Z",
    "is_synced": false,
    "created": "2026-04-14T11:00:00.000Z"
  }
}

Response Fields

FieldTypeDescription
messagestringHuman-readable status message
successbooleantrue on success
dataobjectThe draft (see below)
The data object contains:
FieldTypeDescription
idstringUnique draft identifier
workflow_idstringParent workflow ID
namestringDraft name
descriptionstringDraft description
workflowobjectDraft workflow definition (JSON)
last_modifiedstringISO 8601 last modification timestamp
is_syncedbooleanWhether the draft matches the live workflow
createdstringISO 8601 creation timestamp

Credit Usage

This endpoint is free and does not consume credits.