Skip to main content
POST
/
rest
/
workflows
curl --request POST \ --url https://api.promptlayer.com/rest/workflows \ --header 'Content-Type: application/json' \ --header 'X-API-KEY: <api-key>' \ --data ' { "name": "greeting-workflow", "commit_message": "Initial version", "nodes": [ { "name": "greeting", "node_type": "VARIABLE", "is_output_node": true, "configuration": { "value": { "type": "string", "value": "Hello, World!" } }, "dependencies": [] } ], "release_labels": [ "production" ] } '
{
  "success": true,
  "workflow_id": 123,
  "workflow_name": "greeting-workflow",
  "workflow_version_id": 456,
  "version_number": 1,
  "base_version": null,
  "release_labels": [
    "production"
  ],
  "nodes": [
    {
      "id": "node-uuid",
      "name": "greeting",
      "node_type": "VARIABLE",
      "is_output_node": true
    }
  ],
  "required_input_variables": {},
  "external_ids": []
}

Documentation Index

Fetch the complete documentation index at: https://docs.promptlayer.com/llms.txt

Use this file to discover all available pages before exploring further.

Create a new Workflow or create a new version of an existing Workflow programmatically. Use this endpoint when you want to define the full workflow graph, including nodes, edges, input variables, folder placement, release labels, and external IDs.

Behavior Notes

  • To create a new workflow, pass name; to create a new version, pass workflow_id or workflow_name.
  • Workflow nodes use the same building blocks as evaluation columns. See Node & Column Types.
  • Conditional edge and workflow authoring concepts are covered in Workflows.

Authorizations

X-API-KEY
string
header
required

Body

application/json

Request body for creating a new workflow or a new version of an existing workflow. Use name for a new workflow, or workflow_id/workflow_name to version an existing workflow.

nodes
object[]
required

Complete list of workflow nodes. At least one node must be marked is_output_node=true.

name
string | null

The name for a new workflow. If not provided, a name will be auto-generated.

Required string length: 1 - 255
workflow_id
integer | null

The ID of an existing workflow to create a new version for.

workflow_name
string | null

The name of an existing workflow to create a new version for.

folder_id
integer | null

The folder ID to place the workflow in.

commit_message
string | null

A message describing the changes in this version.

required_input_variables
object

A mapping of variable names to their types.

edges
object[] | null

Conditional edges between nodes.

release_labels
string[] | null

Labels to attach to this version.

external_ids
ExternalId · object[]

Identifiers from other systems.

Response

Workflow 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.