Skip to main content
PATCH
/
rest
/
workflows
/
{workflow_id_or_name}
curl --request PATCH \ --url https://api.promptlayer.com/rest/workflows/{workflow_id_or_name} \ --header 'Content-Type: application/json' \ --header 'X-API-KEY: <api-key>' \ --data ' { "commit_message": "Updated prompt template version", "nodes": { "response_generator": { "configuration": { "template": { "prompt_name": "response-v2", "label": "production" } } } } } '
{
  "success": true,
  "workflow_id": 123,
  "workflow_name": "greeting-workflow",
  "workflow_version_id": 456,
  "version_number": 3,
  "base_version": 2,
  "release_labels": [
    "staging"
  ],
  "nodes": [
    {
      "id": "node-uuid",
      "name": "greeting",
      "node_type": "VARIABLE",
      "is_output_node": true
    }
  ],
  "required_input_variables": {},
  "external_ids": []
}
{
  "success": false,
  "message": "<string>",
  "error": "<string>"
}
{
  "success": false,
  "message": "<string>",
  "error": "<string>"
}
{
  "success": false,
  "message": "<string>",
  "error": "<string>"
}
{
  "detail": [
    {
      "loc": [
        "<string>"
      ],
      "msg": "<string>",
      "type": "<string>"
    }
  ]
}
Partially update a Workflow by creating a new version from an existing base version. Use this endpoint when you want to change only selected nodes or version metadata without resending the complete workflow graph.

Behavior Notes

  • If base_version is omitted, PromptLayer patches from the latest version.
  • nodes are merged by name: unmentioned nodes are preserved, object values add or update nodes, and null removes a node.
  • Node configuration is deep-merged, while dependencies, required_input_variables, and edges are replaced when provided.
  • release_labels are moved or attached to the newly created version.

Authorizations

X-API-KEY
string
header
required

Path Parameters

workflow_id_or_name
string
required

The ID or name of the workflow to update.

Body

application/json

Request body for partially updating a workflow. The server fetches base_version (latest if omitted), merges node updates, and creates a new version.

base_version
integer | null

The version number to base changes on. Defaults to the latest version.

commit_message
string | null

A message describing the changes.

nodes
object | null

Node updates keyed by node name. Provide an object to add/update a node, or null to remove a node. Node configuration is deep-merged; dependencies are replaced.

required_input_variables
object | null

If provided, replaces the input variables entirely.

edges
object[] | null

If provided, replaces edges entirely. If omitted, existing edges are copied except edges that reference removed nodes.

release_labels
string[] | null

Labels to move or attach to the newly created workflow version.

Response

Workflow version created successfully

Response after creating or patching a workflow.

success
boolean
required

Indicates if the request was successful.

workflow_id
integer
required

The ID of the workflow.

workflow_name
string
required

The name of the workflow.

workflow_version_id
integer
required

The ID of the created workflow version.

version_number
integer
required

The version number.

external_ids
ExternalId · object[]
required

External ID mappings for the workflow.

base_version
integer | null

The base version this was created from (PATCH only).

release_labels
string[] | null

Labels attached to this version.

nodes
object[]

Summary of nodes in the workflow.

required_input_variables
object

Required input variables for the workflow.