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": []
}{
"success": false,
"message": "<string>",
"error": "<string>"
}{
"success": false,
"message": "<string>",
"error": "<string>"
}{
"success": false,
"message": "<string>",
"error": "<string>"
}{
"message": "<string>",
"success": false
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Workflows
Create Workflow
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": []
}{
"success": false,
"message": "<string>",
"error": "<string>"
}{
"success": false,
"message": "<string>",
"error": "<string>"
}{
"success": false,
"message": "<string>",
"error": "<string>"
}{
"message": "<string>",
"success": false
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}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, passworkflow_idorworkflow_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.
Related
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.
Response
Workflow created successfully
Response after creating or patching a workflow.
Was this page helpful?

