Create a workflow
Create a new workflow owned by the authenticated user.
Authentication: Required.
Common Use Cases:
- Save a newly built workflow
- Programmatically provision workflows
Note: Workflow names must be unique within your namespace. Creating a workflow with a name you already use returns a 400 validation error.
POST
/
workflows
Create a workflow
curl --request POST \
--url https://api.fal.ai/v1/workflows \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "my-image-workflow",
"title": "My Image Generation Workflow",
"contents": {
"name": "my-image-workflow",
"version": "1.0.0",
"nodes": {
"node_a1b2c3": {
"id": "node_a1b2c3",
"type": "run",
"app": "fal-ai/flux/dev",
"depends": [],
"input": {
"prompt": "$input.prompt"
},
"metadata": {
"position": {
"x": 300,
"y": 100
}
}
}
},
"output": {
"image": "$node_a1b2c3.images.0.url"
},
"schema": {
"input": {
"prompt": {
"type": "string"
}
},
"output": {
"image": {
"type": "string"
}
}
}
}
}
'import requests
url = "https://api.fal.ai/v1/workflows"
payload = {
"name": "my-image-workflow",
"title": "My Image Generation Workflow",
"contents": {
"name": "my-image-workflow",
"version": "1.0.0",
"nodes": { "node_a1b2c3": {
"id": "node_a1b2c3",
"type": "run",
"app": "fal-ai/flux/dev",
"depends": [],
"input": { "prompt": "$input.prompt" },
"metadata": { "position": {
"x": 300,
"y": 100
} }
} },
"output": { "image": "$node_a1b2c3.images.0.url" },
"schema": {
"input": { "prompt": { "type": "string" } },
"output": { "image": { "type": "string" } }
}
}
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'my-image-workflow',
title: 'My Image Generation Workflow',
contents: {
name: 'my-image-workflow',
version: '1.0.0',
nodes: {
node_a1b2c3: {
id: 'node_a1b2c3',
type: 'run',
app: 'fal-ai/flux/dev',
depends: [],
input: {prompt: '$input.prompt'},
metadata: {position: {x: 300, y: 100}}
}
},
output: {image: '$node_a1b2c3.images.0.url'},
schema: {input: {prompt: {type: 'string'}}, output: {image: {type: 'string'}}}
}
})
};
fetch('https://api.fal.ai/v1/workflows', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"workflow": {
"name": "my-image-workflow",
"title": "My Image Generation Workflow",
"user_nickname": "johndoe",
"created_at": "2025-01-15T12:00:00Z",
"is_public": false,
"contents": {
"name": "my-image-workflow",
"version": "1.0.0",
"nodes": {
"node_a1b2c3": {
"id": "node_a1b2c3",
"type": "run",
"app": "fal-ai/flux/dev",
"depends": [],
"input": {
"prompt": "$input.prompt"
},
"metadata": {
"position": {
"x": 300,
"y": 100
}
}
}
},
"output": {
"image": "$node_a1b2c3.images.0.url"
},
"schema": {
"input": {
"prompt": {
"type": "string"
}
},
"output": {
"image": {
"type": "string"
}
}
}
}
}
}{
"error": {
"type": "validation_error",
"message": "Invalid request parameters"
}
}{
"error": {
"type": "authorization_error",
"message": "Authentication required"
}
}{
"error": {
"type": "authorization_error",
"message": "Access denied"
}
}{
"error": {
"type": "rate_limited",
"message": "Rate limit exceeded"
}
}{
"error": {
"type": "server_error",
"message": "An unexpected error occurred"
}
}Authorizations
API key must be prefixed with "Key ", e.g. Authorization: Key YOUR_API_KEY
Body
application/json
Request body for creating a new workflow
Unique workflow name/slug within the user's namespace
Maximum string length:
128Pattern:
^[a-zA-Z0-9_-]+$Example:
"my-image-workflow"
Human-readable workflow title
Required string length:
1 - 256Example:
"My Image Generation Workflow"
The workflow definition/configuration object
Show child attributes
Show child attributes
Example:
{
"name": "my-image-workflow",
"version": "1.0.0",
"nodes": {
"node_a1b2c3": {
"id": "node_a1b2c3",
"type": "run",
"app": "fal-ai/flux/dev",
"depends": [],
"input": { "prompt": "$input.prompt" },
"metadata": { "position": { "x": 300, "y": 100 } }
}
},
"output": { "image": "$node_a1b2c3.images.0.url" },
"schema": {
"input": { "prompt": { "type": "string" } },
"output": { "image": { "type": "string" } }
}
}
Whether the workflow is publicly visible
Example:
false
Response
Successfully created workflow
Response containing a single workflow's details
The workflow details
Show child attributes
Show child attributes
Example:
{
"name": "my-image-workflow",
"title": "My Image Generation Workflow",
"user_nickname": "johndoe",
"created_at": "2024-01-15T10:30:00Z",
"is_public": true,
"contents": {
"nodes": {
"node_a1b2c3": {
"id": "node_a1b2c3",
"type": "model",
"app": "fal-ai/flux/dev",
"depends": [],
"input": { "prompt": "$input.prompt" },
"metadata": { "position": { "x": 300, "y": 100 } }
},
"output": {
"id": "output",
"type": "output",
"depends": ["node_a1b2c3"],
"fields": { "image": "$node_a1b2c3.images.0.url" },
"metadata": { "position": { "x": 600, "y": 100 } }
}
}
}
}
Was this page helpful?
Previous
Get
Get detailed information about a specific workflow, including its full contents/definition.
**Authentication:** Required.
**Common Use Cases:**
- Load a workflow for editing
- View workflow configuration
- Export workflow definition
Next
⌘I
Create a workflow
curl --request POST \
--url https://api.fal.ai/v1/workflows \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "my-image-workflow",
"title": "My Image Generation Workflow",
"contents": {
"name": "my-image-workflow",
"version": "1.0.0",
"nodes": {
"node_a1b2c3": {
"id": "node_a1b2c3",
"type": "run",
"app": "fal-ai/flux/dev",
"depends": [],
"input": {
"prompt": "$input.prompt"
},
"metadata": {
"position": {
"x": 300,
"y": 100
}
}
}
},
"output": {
"image": "$node_a1b2c3.images.0.url"
},
"schema": {
"input": {
"prompt": {
"type": "string"
}
},
"output": {
"image": {
"type": "string"
}
}
}
}
}
'import requests
url = "https://api.fal.ai/v1/workflows"
payload = {
"name": "my-image-workflow",
"title": "My Image Generation Workflow",
"contents": {
"name": "my-image-workflow",
"version": "1.0.0",
"nodes": { "node_a1b2c3": {
"id": "node_a1b2c3",
"type": "run",
"app": "fal-ai/flux/dev",
"depends": [],
"input": { "prompt": "$input.prompt" },
"metadata": { "position": {
"x": 300,
"y": 100
} }
} },
"output": { "image": "$node_a1b2c3.images.0.url" },
"schema": {
"input": { "prompt": { "type": "string" } },
"output": { "image": { "type": "string" } }
}
}
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'my-image-workflow',
title: 'My Image Generation Workflow',
contents: {
name: 'my-image-workflow',
version: '1.0.0',
nodes: {
node_a1b2c3: {
id: 'node_a1b2c3',
type: 'run',
app: 'fal-ai/flux/dev',
depends: [],
input: {prompt: '$input.prompt'},
metadata: {position: {x: 300, y: 100}}
}
},
output: {image: '$node_a1b2c3.images.0.url'},
schema: {input: {prompt: {type: 'string'}}, output: {image: {type: 'string'}}}
}
})
};
fetch('https://api.fal.ai/v1/workflows', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"workflow": {
"name": "my-image-workflow",
"title": "My Image Generation Workflow",
"user_nickname": "johndoe",
"created_at": "2025-01-15T12:00:00Z",
"is_public": false,
"contents": {
"name": "my-image-workflow",
"version": "1.0.0",
"nodes": {
"node_a1b2c3": {
"id": "node_a1b2c3",
"type": "run",
"app": "fal-ai/flux/dev",
"depends": [],
"input": {
"prompt": "$input.prompt"
},
"metadata": {
"position": {
"x": 300,
"y": 100
}
}
}
},
"output": {
"image": "$node_a1b2c3.images.0.url"
},
"schema": {
"input": {
"prompt": {
"type": "string"
}
},
"output": {
"image": {
"type": "string"
}
}
}
}
}
}{
"error": {
"type": "validation_error",
"message": "Invalid request parameters"
}
}{
"error": {
"type": "authorization_error",
"message": "Authentication required"
}
}{
"error": {
"type": "authorization_error",
"message": "Access denied"
}
}{
"error": {
"type": "rate_limited",
"message": "Rate limit exceeded"
}
}{
"error": {
"type": "server_error",
"message": "An unexpected error occurred"
}
}