# Creates a new workflow record that does not already exist.

This method will auto-generate an ID and create a new workflow. If an ID is specified for the workflow, an error will be thrown.

Endpoint: POST /workflows/{tenantId}
Version: v1-2025-04-18
Security: knox-authorizer

## Security:

  - `knox-authorizer` (unknown)
    http bearer JWT

## Path parameters:

  - `tenantId` (string, required)
    The id of the tenant being accessed.

## Request body:

  - `application/json` (unknown)
    The workflow that you would like to be saved.

## Request fields (application/json):

  - `context_id` (string)
    If this is a contextual workflow, the ID

  - `context_service` (string)
    If this is a contextual workflow, the service that has this context

  - `date_trigger_options` (object, required)

  - `date_trigger_options.date_property` (string, required)
    The field to key off

  - `date_trigger_options.offset` (string)
    Enum: "after", "before", "on"

  - `date_trigger_options.time_interval` (string, required)
    Time interval relative to the specified date proeprty
    Enum: "days", "hours", "minutes", "months", "years"

  - `date_trigger_options.time_units` (number, required)
    Units of specified time interval to trigger relative to the date property

  - `days_before_re_enrollment_is_allowed` (number)
    The amount of time that must pass before a record can reparticipate in this workflow. If blank a record may never re-enroll.

  - `id` (string, required)
    The unique, string identifier of this workflow

  - `is_active` (boolean)
    Whether or not this workflow is active

  - `name` (string, required)
    The name of the workflow

  - `record_change_trigger_options` (object, required)

  - `record_change_trigger_options.ruleset` (object)
    A ruleset that filters thw workflow

  - `record_change_trigger_options.ruleset.all` (array)

  - `record_change_trigger_options.ruleset.all.all` (object)

  - `record_change_trigger_options.ruleset.all.any` (object)

  - `record_change_trigger_options.ruleset.all.fact` (string)
    The piece of data being examined

  - `record_change_trigger_options.ruleset.all.operator` (string)
    The operator
    Enum: "contains", "containsString", "doesNotContain", "equal", "greaterThan", "greaterThanInclusive", "in", "isBlank", "isNotBlank", "lessThan", "lessThanInclusive", "matchesPatter", "notContainsString", "notEqual", "notIn", "regex"

  - `record_change_trigger_options.ruleset.all.path` (string)
    The path of the value being tested

  - `record_change_trigger_options.ruleset.all.value` (string)

  - `record_change_trigger_options.ruleset.any` (array)

  - `record_change_trigger_options.ruleset.any.all` (object)

  - `record_change_trigger_options.ruleset.any.any` (object)

  - `record_change_trigger_options.ruleset.any.fact` (string)
    The piece of data being examined

  - `record_change_trigger_options.ruleset.any.operator` (string)
    The operator
    Enum: "contains", "containsString", "doesNotContain", "equal", "greaterThan", "greaterThanInclusive", "in", "isBlank", "isNotBlank", "lessThan", "lessThanInclusive", "matchesPatter", "notContainsString", "notEqual", "notIn", "regex"

  - `record_change_trigger_options.ruleset.any.path` (string)
    The path of the value being tested

  - `record_change_trigger_options.ruleset.any.value` (string)

  - `record_change_trigger_options.run_on_record_creation` (boolean)
    Whether to run when the record is created

  - `record_change_trigger_options.run_on_record_deletion` (boolean)
    Whether to run when the record is deleted

  - `record_change_trigger_options.run_on_record_modification` (boolean)
    Whether to run when the record is modified

  - `record_change_trigger_options.run_only_when_certain_fields_change` (array)
    If set the rule only triggers when certain fields change

  - `service` (string, required)
    The service that owns this workflow

  - `sys_bulk_load_at` (string)
    If this record was loaded via bulk, the timestamp when the record was processed

  - `sys_bulk_load_id` (string)
    If this record was loaded via bulk, the ID of the bulk load process

  - `sys_bulk_load_pk` (string)
    If this record was loaded via bulk, the tenant and key of the bulk load process used as a partition key

  - `sys_bulk_load_record_no` (number)
    If this record was loaded via bulk, the record number in the source file

  - `sys_bulk_load_source_file` (string)
    If this record was loaded via bulk, the source file

  - `sys_calculated_field_error` (string)
    The error associated with the calculated field

  - `sys_calculated_field_errors` (array)

  - `sys_calculated_field_errors.error` (string)

  - `sys_calculated_field_errors.field` (string)

  - `sys_configuration_snapshot_id` (string)
    If a snapshot was restored/applies to this record, the ID of the snapshot

  - `sys_context_key` (string, required)
    System use only

  - `sys_created_at` (string, required)
    The date/time that this record was created, expressed in ISO-8601 date format

  - `sys_created_by_id` (string, required)
    The ID of the user that created this record

  - `sys_deleted_by_id` (string)
    The ID of the user that deleted (or last tried to delete) this object

  - `sys_directive` (string)
    Means for passing directive information into an object processing logic

  - `sys_external_id` (string)
    The ID that a record has from an external system or data import

  - `sys_has_files_in_s3` (boolean)
    If true, this record has files in S3. If false, it doesnt, so no need to hit S3 upon deletion

  - `sys_last_bulk_data_operation_id` (string)
    If this record was last touched by a bulk data operation, the ID of that operation

  - `sys_last_bulk_data_operation_sys_version` (string)
    If this record was last touched by a bulk data operation, the sys_version at the time of that operation

  - `sys_last_modified_at` (string, required)
    The date/time that this record record was last modified, expressed in ISO-8601 date format

  - `sys_last_modified_by_id` (string, required)
    The ID of the user that last modified this record

  - `sys_last_security_context` (object)
    The security context of the last insert, modify, or delete performed on this item

  - `sys_locked` (boolean)
    If set, this record is locked and cannot be changed via the API

  - `sys_snapshot_base_version` (number)
    The version to use as a base when creating a configuration snapshot; if not set, 1 is used. Helpful when creating a sandbox

  - `sys_version` (number)
    A number representing the version of this record in the database

  - `trigger_type` (string, required)
    What triggers the workflow
    Enum: "date property", "record change"

  - `workflow_definition` (object, required)
    The workflow definition

## Response 200:

  - `200` (unknown)
    The workflow was saved successfully.

## Response 200 fields (application/json):

  - `context_id` (string)
    If this is a contextual workflow, the ID

  - `context_service` (string)
    If this is a contextual workflow, the service that has this context

  - `date_trigger_options` (object, required)

  - `date_trigger_options.date_property` (string, required)
    The field to key off

  - `date_trigger_options.offset` (string)
    Enum: "after", "before", "on"

  - `date_trigger_options.time_interval` (string, required)
    Time interval relative to the specified date proeprty
    Enum: "days", "hours", "minutes", "months", "years"

  - `date_trigger_options.time_units` (number, required)
    Units of specified time interval to trigger relative to the date property

  - `days_before_re_enrollment_is_allowed` (number)
    The amount of time that must pass before a record can reparticipate in this workflow. If blank a record may never re-enroll.

  - `id` (string, required)
    The unique, string identifier of this workflow

  - `is_active` (boolean)
    Whether or not this workflow is active

  - `name` (string, required)
    The name of the workflow

  - `record_change_trigger_options` (object, required)

  - `record_change_trigger_options.ruleset` (object)
    A ruleset that filters thw workflow

  - `record_change_trigger_options.ruleset.all` (array)

  - `record_change_trigger_options.ruleset.all.all` (object)

  - `record_change_trigger_options.ruleset.all.any` (object)

  - `record_change_trigger_options.ruleset.all.fact` (string)
    The piece of data being examined

  - `record_change_trigger_options.ruleset.all.operator` (string)
    The operator
    Enum: "contains", "containsString", "doesNotContain", "equal", "greaterThan", "greaterThanInclusive", "in", "isBlank", "isNotBlank", "lessThan", "lessThanInclusive", "matchesPatter", "notContainsString", "notEqual", "notIn", "regex"

  - `record_change_trigger_options.ruleset.all.path` (string)
    The path of the value being tested

  - `record_change_trigger_options.ruleset.all.value` (string)

  - `record_change_trigger_options.ruleset.any` (array)

  - `record_change_trigger_options.ruleset.any.all` (object)

  - `record_change_trigger_options.ruleset.any.any` (object)

  - `record_change_trigger_options.ruleset.any.fact` (string)
    The piece of data being examined

  - `record_change_trigger_options.ruleset.any.operator` (string)
    The operator
    Enum: "contains", "containsString", "doesNotContain", "equal", "greaterThan", "greaterThanInclusive", "in", "isBlank", "isNotBlank", "lessThan", "lessThanInclusive", "matchesPatter", "notContainsString", "notEqual", "notIn", "regex"

  - `record_change_trigger_options.ruleset.any.path` (string)
    The path of the value being tested

  - `record_change_trigger_options.ruleset.any.value` (string)

  - `record_change_trigger_options.run_on_record_creation` (boolean)
    Whether to run when the record is created

  - `record_change_trigger_options.run_on_record_deletion` (boolean)
    Whether to run when the record is deleted

  - `record_change_trigger_options.run_on_record_modification` (boolean)
    Whether to run when the record is modified

  - `record_change_trigger_options.run_only_when_certain_fields_change` (array)
    If set the rule only triggers when certain fields change

  - `service` (string, required)
    The service that owns this workflow

  - `sys_bulk_load_at` (string)
    If this record was loaded via bulk, the timestamp when the record was processed

  - `sys_bulk_load_id` (string)
    If this record was loaded via bulk, the ID of the bulk load process

  - `sys_bulk_load_pk` (string)
    If this record was loaded via bulk, the tenant and key of the bulk load process used as a partition key

  - `sys_bulk_load_record_no` (number)
    If this record was loaded via bulk, the record number in the source file

  - `sys_bulk_load_source_file` (string)
    If this record was loaded via bulk, the source file

  - `sys_calculated_field_error` (string)
    The error associated with the calculated field

  - `sys_calculated_field_errors` (array)

  - `sys_calculated_field_errors.error` (string)

  - `sys_calculated_field_errors.field` (string)

  - `sys_configuration_snapshot_id` (string)
    If a snapshot was restored/applies to this record, the ID of the snapshot

  - `sys_context_key` (string, required)
    System use only

  - `sys_created_at` (string, required)
    The date/time that this record was created, expressed in ISO-8601 date format

  - `sys_created_by_id` (string, required)
    The ID of the user that created this record

  - `sys_deleted_by_id` (string)
    The ID of the user that deleted (or last tried to delete) this object

  - `sys_directive` (string)
    Means for passing directive information into an object processing logic

  - `sys_external_id` (string)
    The ID that a record has from an external system or data import

  - `sys_has_files_in_s3` (boolean)
    If true, this record has files in S3. If false, it doesnt, so no need to hit S3 upon deletion

  - `sys_last_bulk_data_operation_id` (string)
    If this record was last touched by a bulk data operation, the ID of that operation

  - `sys_last_bulk_data_operation_sys_version` (string)
    If this record was last touched by a bulk data operation, the sys_version at the time of that operation

  - `sys_last_modified_at` (string, required)
    The date/time that this record record was last modified, expressed in ISO-8601 date format

  - `sys_last_modified_by_id` (string, required)
    The ID of the user that last modified this record

  - `sys_last_security_context` (object)
    The security context of the last insert, modify, or delete performed on this item

  - `sys_locked` (boolean)
    If set, this record is locked and cannot be changed via the API

  - `sys_snapshot_base_version` (number)
    The version to use as a base when creating a configuration snapshot; if not set, 1 is used. Helpful when creating a sandbox

  - `sys_version` (number)
    A number representing the version of this record in the database

  - `trigger_type` (string, required)
    What triggers the workflow
    Enum: "date property", "record change"

  - `workflow_definition` (object, required)
    The workflow definition

## Response 200 headers (application/json):

  - `Access-Control-Allow-Headers` (string)

  - `Access-Control-Allow-Methods` (string)

  - `Access-Control-Allow-Origin` (string)

## Response 400:

  - `400` (unknown)
    The workflow you supplied was invalid.

## Response 400 headers:

  - `Access-Control-Allow-Headers` (string)

  - `Access-Control-Allow-Methods` (string)

  - `Access-Control-Allow-Origin` (string)

## Response 401:

  - `401` (unknown)
    Unauthorized.

## Response 401 headers:

  - `Access-Control-Allow-Headers` (string)

  - `Access-Control-Allow-Methods` (string)

  - `Access-Control-Allow-Origin` (string)

## Response 403:

  - `403` (unknown)
    Forbidden.

## Response 403 headers:

  - `Access-Control-Allow-Headers` (string)

  - `Access-Control-Allow-Methods` (string)

  - `Access-Control-Allow-Origin` (string)

## Response 404:

  - `404` (unknown)
    The resource could not be found

## Response 404 headers:

  - `Access-Control-Allow-Headers` (string)

  - `Access-Control-Allow-Methods` (string)

  - `Access-Control-Allow-Origin` (string)

## Response 409:

  - `409` (unknown)
    The workflow could not be saved because it refers to/depends on a non-existent object.

## Response 409 headers:

  - `Access-Control-Allow-Headers` (string)

  - `Access-Control-Allow-Methods` (string)

  - `Access-Control-Allow-Origin` (string)

## Response 429:

  - `429` (unknown)
    Limit exceeded... unable to add workflow based on tenant limits.

## Response 429 headers:

  - `Access-Control-Allow-Headers` (string)

  - `Access-Control-Allow-Methods` (string)

  - `Access-Control-Allow-Origin` (string)

## Response 500:

  - `500` (unknown)
    General server error.

## Response 500 headers:

  - `Access-Control-Allow-Headers` (string)

  - `Access-Control-Allow-Methods` (string)

  - `Access-Control-Allow-Origin` (string)

