Workflows

Create a workflow template

This method creates a new workflow template. A workflow template is a predefined blueprint for a workflow that includes a set of tasks and their dependencies. It serves as a starting point for creating workflows, allowing users to quickly set up and execute common processes without having to define each task from scratch.

post/v1/workflow-templates

Request

  • Base URL
    https://api.emma.ms/external
  • Auth
    HTTP bearer

Request body

namestring required

Name of the workflow template

descriptionstring nullable

Description of the workflow template

contentType'Shell' required

Format of the content field, only Shell is supported for now

contentstring required

Content of the workflow template. For Shell contentType, it includes shell commands to execute.

status'PUBLISHED' | 'UNPUBLISHED' required

Status of the workflow template. Can be PUBLISHED or UNPUBLISHED

resourceTypesstring[]

Types of the resource. Use this instead of the deprecated resourceType. At least one of resourceTypes or resourceType is required.

resourceType'COMPUTE' | 'SPOT_COMPUTE'

Deprecated — use resourceTypes. At least one of resourceTypes or resourceType is required.

isContentValidboolean

Whether the content passed validation. Optional on write; defaults to true when omitted. Must be true when status is PUBLISHED.

contentExecutionTimeoutinteger

Maximum script execution time in minutes (1–30). Defaults to 10 when omitted.

forceDeleteOldestboolean nullable

PUT only, ignored on POST. When true and the workflow template has reached the 20-version limit, the server soft-deletes the oldest non-active version as part of the save. Otherwise, the request fails with 409 CONFLICT. Ignored on POST

Example request

{
  "name": "Example Workflow Template",
  "description": "This is an example workflow template.",
  "contentType": "Shell",
  "content": "echo Hello, World!",
  "status": "PUBLISHED",
  "resourceTypes": [
    "COMPUTE"
  ],
  "resourceType": "COMPUTE",
  "resourceParams": [
    {
      "name": "minCpuCores",
      "value": "4"
    }
  ],
  "tags": [
    {
      "key": "env",
      "value": "dev"
    }
  ],
  "contentParams": [
    {
      "name": "command1",
      "defaultValue": "echo Hello, World!",
      "mandatory": true,
      "description": "Database password used by the deployment script.",
      "hasDefaultValue": true,
      "vaultVersion": 1
    }
  ],
  "isContentValid": true,
  "contentExecutionTimeout": 10
}

Response

Workflow template created successfully

idinteger required

ID of the workflow template

namestring required

Name of the workflow template

descriptionstring nullable

Description of the workflow template

createdAtstring required

Date and time of the workflow template creation (ISO-8601, UTC, with milliseconds)

createdByNamestring required

Name of the user who created the workflow template

createdByIdinteger required

ID of the user who created the workflow template

modifiedAtstring required

Date and time when the workflow template was last edited (ISO-8601, UTC, with milliseconds)

modifiedByNamestring required

Name of the user who last edited the workflow template

modifiedByIdinteger required

ID of the user who last edited the workflow template

isDeletedboolean required

Indicates whether the workflow template is deleted

status'PUBLISHED' | 'UNPUBLISHED' required

Status of the workflow template. Can be PUBLISHED or UNPUBLISHED

resourceTypesstring[] required

Types of the resource.

resourceType'COMPUTE' | 'SPOT_COMPUTE' nullable

Deprecated — use resourceTypes. Mirrors the first resource type; present for backward compatibility. Null when no resource type is set.

activeVersionIdinteger nullable

ID of the active workflow version. null when the template has no versions — permanently so for built-in default templates (isDefault = true), which are excluded from versioning, and until the one-off backfill covers templates created before versioning was enabled.

activeVersionNamestring nullable

Name of the active workflow version. null under the same conditions as activeVersionId.

contentType'Shell' required

Format of the content field, only Shell is supported for now

contentstring required

Content of the workflow template. For Shell contentType, it includes shell commands to execute.

isContentValidboolean required

Indicates whether the content of the workflow template is valid. The content is validated against the contentType, e.g. for Shell contentType, the content is validated to be correct shell commands.

contentExecutionTimeoutinteger required

Maximum script execution time in minutes (1–30). Defaults to 10 when omitted on create/update.

isDefaultboolean required

Indicates whether this is a built-in default (system-provided) workflow template.

Example response

{
  "id": 123,
  "name": "Sample Workflow Template",
  "description": "This is a sample workflow template for demonstration purposes.",
  "createdAt": "2026-06-26T21:44:05.345Z",
  "createdByName": "Automation User",
  "createdById": 123,
  "modifiedAt": "2026-07-07T07:38:16.285Z",
  "modifiedByName": "Automation User",
  "modifiedById": 123,
  "status": "PUBLISHED",
  "resourceTypes": [
    "COMPUTE"
  ],
  "resourceType": "COMPUTE",
  "activeVersionId": 123,
  "activeVersionName": "v1",
  "resourceParams": [
    {
      "name": "minCpuCores",
      "value": "4"
    }
  ],
  "tags": [
    {
      "key": "env",
      "value": "dev"
    }
  ],
  "contentType": "Shell",
  "content": "echo Hello, World!",
  "isContentValid": true,
  "contentParams": [
    {
      "name": "command1",
      "defaultValue": "echo Hello, World!",
      "mandatory": true,
      "description": "Database password used by the deployment script.",
      "hasDefaultValue": true,
      "vaultVersion": 1
    }
  ],
  "contentExecutionTimeout": 10
}

Changes

No recorded changes to this operation across all 1 revision of this API.