> ## Documentation Index
> Fetch the complete documentation index at: https://docs.frankieone.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create or update a workflow definition

> Forwards the request to the FLOW Workflow Engine to create or update a workflow definition. The request body and headers are forwarded as-is to the upstream service. When isDraft is true, the definition is saved as a draft (version -1). When isDraft is false, a new published version is created.



## OpenAPI

````yaml /specs/fc-core-bundled_generated.yaml put /v2/workflowDefinitions/{workflowDefinitionId}
openapi: 3.0.3
info:
  title: Core V2 API
  version: 2.0.0
  description: >-
    This is the APIs for V2 Core. It allows you to do common operations, such as
    read audit entries or get workflow lists.
  contact:
    name: FrankieOne
    url: https://www.frankieone.com/
    email: help@frankieone.com
servers:
  - url: https://api.uat.frankie.one
    description: UAT Environment API Base URL
  - url: https://api.frankie.one
    description: Production API Base URL
security:
  - Api-Key: []
tags:
  - name: Audit
    description: Manage audit entries
  - name: Customers
    description: Manage customer accounts
  - name: Users
    description: Manage users provisioned in child customer accounts
  - name: Request
    description: Retrieve background request results
  - name: Reports
    description: Generate and manage reports
  - name: Results
    description: Manage process results including redaction
  - name: Workflow Definitions
    description: Create and update workflow definitions
  - name: Status
    description: All valid customers will get a successful response.
  - name: Workflows
    description: Manage Workflows and Workflow Definitions
  - name: Tags
    description: Query tags and tag mappings on objects
paths:
  /v2/workflowDefinitions/{workflowDefinitionId}:
    parameters:
      - name: workflowDefinitionId
        in: path
        required: true
        description: The unique identifier of the workflow definition to create or update
        schema:
          type: string
          example: customer-verification-workflow
    put:
      tags:
        - Workflow Definitions
      summary: Create or update a workflow definition
      description: >-
        Forwards the request to the FLOW Workflow Engine to create or update a
        workflow definition. The request body and headers are forwarded as-is to
        the upstream service. When isDraft is true, the definition is saved as a
        draft (version -1). When isDraft is false, a new published version is
        created.
      operationId: upsertWorkflowDefinition
      parameters:
        - $ref: '#/components/parameters/Api-Key'
        - $ref: '#/components/parameters/X-Frankie-CustomerID'
        - $ref: '#/components/parameters/X-Frankie-CustomerChildID'
        - $ref: '#/components/parameters/X-Frankie-Channel'
        - $ref: '#/components/parameters/X-Frankie-Username'
        - $ref: '#/components/parameters/X-Frankie-RequestID'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Upsert-Workflow-Definition-Request'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Upsert-Workflow-Definition-Result'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                Invalid EntityId:
                  value:
                    errorCode: API-0400,
                    errorMsg: 'Multiple Errors: See Issues list'
                    details:
                      - issue: 'entityId in path must be of type uuid: "test"'
                        issueLocation: VALIDATE-entityId
                    requestId: 01HM5XJ7VASZ3EJMB1VQGTBFJ4
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                Invalid authentication:
                  value:
                    errorCode: AUTH-0002,
                    errorMsg: Unauthorized
                    details:
                      - issue: Invalid Authentication provided. Access denied.
                        issueLocation: request
                    requestId: 00000000S6MNG7624K2TDXT1E3
                No Api-Key:
                  value:
                    errorCode: AUTH-0401
                    errorMsg: Unauthorized
                    details:
                      - issue: No api key provided. Access denied.
                        issueLocation: request
                    requestId: 00000001S6MNG7624K2TDXT1E3
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '502':
          description: Bad Gateway
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: Service Unavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - Api-Key: []
        - jwt:
            - kyc:api
components:
  parameters:
    Api-Key:
      name: api_key
      in: header
      schema:
        type: string
        example: 245c765b124a098d09ef8765....
      description: Your API key provided by FrankieOne
      required: true
    X-Frankie-CustomerID:
      name: X-Frankie-CustomerID
      in: header
      required: true
      schema:
        type: string
        example: 12345678-1234-1234-1234-123456789012
      description: Your Customer ID provided by FrankieOne
    X-Frankie-CustomerChildID:
      name: X-Frankie-CustomerChildID
      in: header
      required: false
      schema:
        type: string
        example: 87654321-4321-4321-4321-210987654321
      description: Your Customer Child ID provided by FrankieOne
    X-Frankie-Channel:
      name: X-Frankie-Channel
      in: header
      required: false
      schema:
        type: string
      description: >-
        Open string that can be used to define the "channel" the request comes
        in from. It can potentially be used in routing and risk calculations
        upon request. Default values that can be used are:  api portal smartui
        Any alphanumeric string is supported though. Anything over 64 characters
        will be truncated.
    X-Frankie-Username:
      name: X-Frankie-Username
      in: header
      description: Username provided by API caller
      required: false
      schema:
        type: string
        example: fred.flintstone@frankieone.com
    X-Frankie-RequestID:
      name: X-Frankie-RequestID
      in: header
      description: GUID identifier for request
      required: true
      schema:
        type: string
        example: 82988375-1F9C-40C7-8543-ECCA0D94CC7C
  schemas:
    Upsert-Workflow-Definition-Request:
      type: object
      description: Request body for creating or updating a workflow definition
      required:
        - id
        - name
        - tasks
      properties:
        id:
          type: string
          description: Unique identifier for the workflow
          example: customer-verification-workflow
        name:
          type: string
          description: Human-readable name for the workflow
          example: Customer Verification Workflow
        description:
          type: string
          description: Optional detailed description of the workflow
          example: Workflow to verify new customer identities
        owner:
          type: string
          description: Owner of the workflow
          default: SYSTEM
          example: SYSTEM
        isDraft:
          type: boolean
          description: true = save as draft (version -1), false = publish new version
          default: false
        isTemplate:
          type: boolean
          description: Whether the workflow is a template
          default: false
        tags:
          type: array
          description: Tags associated with the workflow
          items:
            type: string
          default: []
          example:
            - customer-verification
            - kyc
        initialState:
          type: object
          description: Initial state for the workflow execution
          additionalProperties: true
          default: {}
          example:
            name: John Doe
            age: 30
        defaultErrorHandling:
          $ref: '#/components/schemas/Workflow-Definition-Error-Handling-Config'
        variables:
          type: array
          description: >-
            Workflow-level variables that can be referenced in task
            configurations using template syntax, these would be validated into
            the initial state on workflow execution
          items:
            $ref: '#/components/schemas/Workflow-Definition-Variable'
        versions:
          type: array
          description: List of available versions for this workflow definition
          items:
            type: integer
          example:
            - 1
            - 2
            - 3
        version:
          description: The version number of this workflow definition
          type: integer
          example: 3
        versionId:
          type: string
          format: ulid
          description: Version Identifier to refer to
          example: 01KCNG5VAH4ZQC5T1H4A2ZZHWA
        createdAt:
          type: string
          format: date-time
          description: Timestamp when the workflow definition was first created
          example: '2023-01-01T12:00:00Z'
        updatedAt:
          type: string
          format: date-time
          description: Timestamp when the workflow definition was last updated
          example: '2023-01-02T14:30:00Z'
        createdBy:
          type: string
          description: User who created the workflow definition
          example: John Doe
        updatedBy:
          type: string
          description: User who last updated the workflow definition
          example: Jane Smith
        tasks:
          type: array
          description: Array of workflow tasks
          items:
            $ref: '#/components/schemas/Workflow-Definition-Task'
    Upsert-Workflow-Definition-Result:
      type: object
      required:
        - workflowDefinition
      properties:
        workflowDefinition:
          type: object
          description: The created or updated workflow definition
          properties:
            id:
              type: string
              description: Unique identifier for the workflow
              example: customer-verification-workflow
            name:
              type: string
              description: Human-readable name for the workflow
              example: Customer Verification Workflow
            description:
              type: string
              description: Description of the workflow
            owner:
              type: string
              description: Owner of the workflow
              example: SYSTEM
            isDraft:
              type: boolean
              description: Whether the workflow definition is a draft
            version:
              type: integer
              description: Version number. -1 for draft, positive integer for published
              example: 1
            versions:
              type: array
              description: List of available versions for this workflow definition
              items:
                type: integer
              example:
                - 1
                - 2
                - 3
            versionId:
              type: string
              format: ulid
              description: Version identifier
              example: 01KCNG5VAH4ZQC5T1H4A2ZZHWA
            tags:
              type: array
              description: Tags associated with the workflow
              items:
                type: string
            tasks:
              type: array
              description: Tasks in the workflow
              items:
                type: object
                additionalProperties: true
            variables:
              type: array
              description: Workflow-level variables
              items:
                type: object
                additionalProperties: true
            createdAt:
              type: string
              format: date-time
              description: Timestamp when the workflow definition was first created
              example: '2023-01-01T12:00:00Z'
            updatedAt:
              type: string
              format: date-time
              description: Timestamp when the workflow definition was last updated
              example: '2023-01-02T14:30:00Z'
            createdBy:
              type: string
              description: User who created the workflow definition
              example: John Doe
            updatedBy:
              type: string
              description: User who last updated the workflow definition
              example: Jane Smith
    Error:
      type: object
      x-examples:
        '400':
          requestId: 0123456789ABCDEFGHIJKLMNOP
          errorCode: API-0400
          errorMsg: Parsing credentials from "<invalid>" failed, because invalid.
          httpStatusCode: 400
        '401':
          requestId: 0123456789ABCDEFGHIJKLMNOP
          errorCode: API-0401
          errorMsg: Unauthenticated due to invalid credentials.
          httpStatusCode: 401
        '409':
          requestId: 0123456789ABCDEFGHIJKLMNOP
          errorCode: API-0409
          errorMsg: Conflict.
          httpStatusCode: 409
      allOf:
        - $ref: '#/components/schemas/Error-Base'
        - type: object
          properties:
            requestId:
              $ref: '#/components/schemas/Request-ID'
    Workflow-Definition-Error-Handling-Config:
      type: object
      description: Error handling configuration for workflow tasks
      properties:
        ignoreErrors:
          type: boolean
          description: Whether to ignore errors and continue execution
          default: false
        fallbackState:
          type: object
          description: State to set when an error occurs
          additionalProperties: true
        retryConfig:
          type: object
          description: Retry configuration for failed tasks
          properties:
            maxAttempts:
              type: integer
              description: Maximum number of retry attempts
              minimum: 1
              example: 3
            delayMs:
              type: integer
              description: Delay in milliseconds between retries
              minimum: 0
              example: 1000
            backoffFactor:
              type: number
              description: Multiplier applied to delay between successive retries
              minimum: 1
              example: 2
    Workflow-Definition-Variable:
      type: object
      description: Workflow variable definition
      required:
        - name
        - type
      properties:
        name:
          type: string
          description: Name of the variable
          example: customerEmail
        type:
          type: string
          description: Type of the variable
          default: STRING
          enum:
            - STRING
            - NUMBER
            - BOOLEAN
            - OBJECT
            - ARRAY
          example: STRING
        description:
          type: string
          description: Description of the variable
          example: Customer's email address
        example:
          type: string
          description: Example value of the variable
          example: customer@example.com
        default:
          type: string
          description: Default value of the variable if not provided
          example: ''
    Workflow-Definition-Task:
      type: object
      description: A task within a workflow definition
      required:
        - id
        - name
        - configuration
      properties:
        id:
          type: string
          description: Unique identifier for the task within the workflow
          example: verify-identity
        name:
          type: string
          description: Human-readable name for the task
          example: Verify Identity
        description:
          type: string
          description: Optional description of what the task does
          example: Runs identity verification checks against the customer
        errorHandling:
          $ref: '#/components/schemas/Workflow-Definition-Error-Handling-Config'
        configuration:
          $ref: '#/components/schemas/Workflow-Definition-Task-Configuration'
    Error-Base:
      type: object
      properties:
        errorCode:
          type: string
        errorMsg:
          type: string
        details:
          type: array
          items:
            $ref: '#/components/schemas/Issue'
    Request-ID:
      type: string
      example: 01HN9XHZN6MGXM9JXG50K59Q85
      description: The unique request identifier for the API call made.
    Workflow-Definition-Task-Configuration:
      type: object
      description: >
        Task configuration object. Discriminated by the 'type' field. Supported
        types: HTTP, BRANCH, LOOP, LOG, WAIT, SET_STATE, PARALLEL, NOTIFICATION,
        AGENT, SUBFLOW, FORM, RUN_WORKFLOW, STEP.
      required:
        - type
      properties:
        type:
          type: string
          description: The type of task to execute
          enum:
            - HTTP
            - BRANCH
            - LOOP
            - LOG
            - WAIT
            - SET_STATE
            - PARALLEL
            - NOTIFICATION
            - AGENT
            - SUBFLOW
            - FORM
            - RUN_WORKFLOW
            - STEP
      additionalProperties: true
    Issue:
      type: object
      properties:
        issue:
          type: string
          description: Description of the issue.
        issueLocation:
          type: string
          description: The location or context where the issue was identified.
        issueType:
          type: string
          description: The type or category of the issue.
  securitySchemes:
    Api-Key:
      type: apiKey
      in: header
      name: api_key
      description: ''
    jwt:
      type: http
      scheme: bearer
      bearerFormat: JWT

````