Skip to main content
POST
/
workflows
/
import
Import a workflow
curl --request POST \
  --url https://core.cyberun.cloud/api/v1/workflows/import \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "workflow_slug": "sd-portrait-v2",
  "display_name": "SD 1.5 Portrait Generator",
  "workflow_json": {
    "5": {
      "class_type": "EmptyLatentImage",
      "inputs": {
        "width": 512,
        "height": 512,
        "batch_size": 1
      }
    },
    "6": {
      "class_type": "CLIPTextEncode",
      "inputs": {
        "text": "a portrait photo",
        "clip": [
          "4",
          0
        ]
      }
    }
  },
  "description": "<string>",
  "parameters": [
    {
      "key": "prompt",
      "label": "Positive Prompt",
      "node_id": "6",
      "field": "text",
      "target_path": "train.max_num_iterations",
      "description": "<string>",
      "required": true,
      "default": "<unknown>",
      "min": 123,
      "max": 123,
      "options": [
        "<string>"
      ],
      "accept": [
        "<string>"
      ],
      "source_key": "input_image"
    }
  ],
  "tool_type": "comfyui",
  "required_labels": [
    "gpu",
    "sd15"
  ],
  "task_timeout": 0,
  "max_retries": 0,
  "preferred_gpu": "RTX_4090",
  "default_dispatch_target": "agent",
  "min_vram_gb": 24,
  "required_models": [
    "checkpoints/sdxl-base.safetensors",
    "loras/style.safetensors"
  ]
}
'
{
  "id": "019abc12-3456-7890-abcd-ef1234567890"
}

Documentation Index

Fetch the complete documentation index at: https://docs.cyberun.cloud/llms.txt

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

Authorizations

Authorization
string
header
required

User session JWT (Bearer ). Must be paired with the X-Team-ID request header on team-scoped endpoints so the server knows which team's resources to operate on.

Headers

X-Team-ID
string<uuid>

UUID of the team to scope the request to. Used by dual-auth endpoints (runtime + scoped management):

  • JWT callers MUST send it — a user may belong to multiple teams and the runtime cannot otherwise know which one to operate on. Missing header → 400.
  • Credential callers (sk-, dk-) can omit it because the team is derived from the credential row itself. Any value sent is ignored.
Example:

"019abc12-4567-7890-abcd-ef1234567891"

Body

application/json
workflow_slug
string
required

Globally unique URL-friendly identifier for the workflow. Lowercase letters, numbers, and hyphens only.

Required string length: 2 - 100
Pattern: ^[a-z0-9]+(?:-[a-z0-9]+)*$
Example:

"sd-portrait-v2"

display_name
string
required

Human-readable name for this workflow template.

Required string length: 1 - 255
Example:

"SD 1.5 Portrait Generator"

workflow_json
object
required

Tool-specific workflow definition. For tool_type=comfyui, this is a ComfyUI API workflow JSON object. For tool_type=nerfstudio, this is a Nerfstudio 3DGS pipeline spec.

Example:
{
"5": {
"class_type": "EmptyLatentImage",
"inputs": {
"width": 512,
"height": 512,
"batch_size": 1
}
},
"6": {
"class_type": "CLIPTextEncode",
"inputs": {
"text": "a portrait photo",
"clip": ["4", 0]
}
}
}
description
string

Optional description of what this workflow does.

Maximum string length: 2000
parameters
object[]

Configurable parameters that can be overridden at run time. Each parameter maps a user-facing key to a tool-specific injection target. See ParameterDefInput for the mapping mechanism.

tool_type
enum<string>

Tool runtime used by this workflow:

  • comfyui: ComfyUI API workflow JSON (default, backward compatible).
  • nerfstudio: Nerfstudio 3DGS pipeline spec.
Available options:
comfyui,
nerfstudio
Example:

"comfyui"

required_labels
string[]

Labels that an agent must have in order to receive tasks from this workflow. All labels must match (AND logic). If empty or omitted, any agent can execute it.

Example:
["gpu", "sd15"]
task_timeout
integer
default:0

Maximum execution time in seconds after agent ACK. If the agent does not report completion within this time, the task is marked as failed and may be retried. 0 means use the gateway's default max timeout (typically 24 hours).

Required range: x >= 0
max_retries
integer
default:0

Maximum number of automatic retries on failure. When a task fails (agent disconnect, timeout, ComfyUI error), a new retry task is created automatically up to this limit. 0 means no retry.

Required range: x >= 0
preferred_gpu
string

Preferred GPU type for agent matching (e.g. "RTX_4090", "A100_80GB"). When set, the scheduler prioritises agents with this GPU type. If empty, any available GPU is accepted.

Maximum string length: 100
Example:

"RTX_4090"

default_dispatch_target
enum<string>

Default compute source for tasks created from this workflow. Can be overridden per-run. If not set, defaults to agent.

Available options:
agent,
comfy_cloud
Example:

"agent"

min_vram_gb
integer

Minimum GPU VRAM required (decimal GB) for an agent to run this workflow. The dispatcher's hard filter excludes agents whose advertised vram_total_gb is below this number. 0 means no requirement (default).

Required range: 0 <= x <= 2048
Example:

24

required_models
string[]

Model paths the workflow needs (relative to the runtime's models root, e.g. checkpoints/sdxl-base.safetensors). The dispatcher's hard filter excludes any agent missing one or more of these files. Empty / omitted means no requirement.

Maximum string length: 512
Example:
[
"checkpoints/sdxl-base.safetensors",
"loras/style.safetensors"
]

Response

Workflow imported (created or updated)

id
string<uuid>
required

UUID of the created or updated resource.

Example:

"019abc12-3456-7890-abcd-ef1234567890"