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

# Start a workflow in a new chat

> Starts a workflow in an empty thread you manage: names the thread, adds the workflow's instructions to its own, and returns its first question.



## OpenAPI

````yaml post /api/chat/threads/{thread_id}/workflow
openapi: 3.1.0
info:
  title: Nx1 AI API
  description: |

    AI API for Nx1 Data Platform Management and Automated Data Tasks.

    Authentication is required via PSK in Authorization header.

    Default PSK is | [ask a friend] |
  version: 0.10.2
servers: []
security: []
paths:
  /api/chat/threads/{thread_id}/workflow:
    post:
      tags:
        - Chat
      summary: Start a workflow in a new chat
      description: >-
        Starts a workflow in an empty thread you manage: names the thread, adds
        the workflow's instructions to its own, and returns its first question.
      operationId: start_workflow_api_chat_threads__thread_id__workflow_post
      parameters:
        - name: thread_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Thread Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StartWorkflowRequest'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatWorkflowStarted'
        '403':
          description: You can't post in this chat.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Thread or workflow not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: >-
            Not now: the chat has messages, the step was sent, or the workflow
            is no longer available.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: An answer the form can't take.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal Server Error
      security:
        - OAuth2AuthorizationCodeBearer: []
        - APIKeyHeader: []
components:
  schemas:
    StartWorkflowRequest:
      properties:
        item_id:
          type: string
          format: uuid
          title: Item Id
          description: The workflow's registry artifact id.
      type: object
      required:
        - item_id
      title: StartWorkflowRequest
      description: Start a workflow in an empty thread, at its newest approved version.
    ChatWorkflowStarted:
      properties:
        progress:
          $ref: '#/components/schemas/ChatWorkflowProgress'
        thread:
          anyOf:
            - $ref: '#/components/schemas/ChatThreadResponse'
            - type: 'null'
      type: object
      required:
        - progress
      title: ChatWorkflowStarted
      description: A started workflow and the thread it named.
    ErrorResponse:
      properties:
        error:
          type: string
          title: Error
          description: A brief description of the error that occurred.
        code:
          type: integer
          title: Code
          description: The HTTP status code associated with the error.
          default: 500
      type: object
      required:
        - error
      title: ErrorResponse
    ChatWorkflowProgress:
      properties:
        item_id:
          type: string
          format: uuid
          title: Item Id
        version:
          anyOf:
            - type: string
            - type: 'null'
          title: Version
          description: The version it follows.
        title:
          type: string
          title: Title
        transcript:
          items:
            $ref: '#/components/schemas/WorkflowTranscriptEntry'
          type: array
          title: Transcript
        current:
          anyOf:
            - $ref: '#/components/schemas/ChatWorkflowQuestionOut'
            - type: 'null'
          description: The question waiting for an answer; null once done.
        total:
          type: integer
          title: Total
          description: Questions the workflow can ask.
        done:
          type: boolean
          title: Done
          default: false
        task:
          anyOf:
            - type: string
            - type: 'null'
          title: Task
          description: 'Once done: the message to send to the assistant.'
        available:
          type: boolean
          title: Available
          description: False when the version was withdrawn or is no longer yours to see.
          default: true
        can_continue:
          type: boolean
          title: Can Continue
          description: 'Whether you may answer: who started it, or a manager.'
          default: true
      type: object
      required:
        - item_id
        - title
        - total
      title: ChatWorkflowProgress
      description: Where a workflow conversation stands.
    ChatThreadResponse:
      properties:
        id:
          type: string
          title: Id
          description: Thread ID.
        title:
          anyOf:
            - type: string
            - type: 'null'
          title: Title
          description: Display title; null until the first message.
        status:
          $ref: '#/components/schemas/ChatThreadStatus'
          description: Active or archived.
        created_at:
          type: string
          format: date-time
          title: Created At
          description: When the thread was created.
        updated_at:
          type: string
          format: date-time
          title: Updated At
          description: Last activity in the thread.
        workspace_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Workspace Id
          description: The workspace the thread belongs to; null for a personal thread.
        created_by:
          type: string
          title: Created By
          description: Who started the thread.
        can_post:
          type: boolean
          title: Can Post
          description: Whether you can send messages in it.
        can_manage:
          type: boolean
          title: Can Manage
          description: Whether you can rename, archive or delete it.
        can_share:
          type: boolean
          title: Can Share
          description: Whether you can create share links for it.
        instructions:
          anyOf:
            - type: string
            - type: 'null'
          title: Instructions
          description: >-
            Standing instructions for the assistant, as Markdown. Added to the
            base prompt, never replacing it, and added to rather than replacing
            any the workspace sets. Cannot change which tools exist or which
            need approval.
        defaults:
          $ref: '#/components/schemas/ChatContextDefaults'
          description: What the assistant reaches for first in this thread.
        subject:
          anyOf:
            - $ref: '#/components/schemas/ChatSubject'
            - type: 'null'
          description: The item this thread is about, if it is bound to one.
      type: object
      required:
        - id
        - status
        - created_at
        - updated_at
        - created_by
        - can_post
        - can_manage
        - can_share
      title: ChatThreadResponse
      description: A chat thread as the thread list shows it, with what you may do with it.
    WorkflowTranscriptEntry:
      properties:
        key:
          type: string
          title: Key
        question:
          type: string
          title: Question
        answer:
          anyOf:
            - type: string
            - type: 'null'
          title: Answer
          description: Null when skipped.
      type: object
      required:
        - key
        - question
      title: WorkflowTranscriptEntry
      description: A question asked and how it was answered.
    ChatWorkflowQuestionOut:
      properties:
        key:
          type: string
          title: Key
        text:
          type: string
          title: Text
        type:
          type: string
          enum:
            - choice
            - text
            - number
            - date
            - yes_no
          title: Type
        choices:
          items:
            type: string
          type: array
          title: Choices
        allow_other:
          type: boolean
          title: Allow Other
        required:
          type: boolean
          title: Required
        placeholder:
          anyOf:
            - type: string
            - type: 'null'
          title: Placeholder
        number:
          type: integer
          title: Number
          description: 1-based, counting the questions asked so far.
      type: object
      required:
        - key
        - text
        - type
        - allow_other
        - required
        - number
      title: ChatWorkflowQuestionOut
      description: The question being asked.
    ChatThreadStatus:
      type: string
      enum:
        - regular
        - archived
      title: ChatThreadStatus
      description: Whether a thread is in the active list or archived.
    ChatContextDefaults:
      properties:
        trino_catalog:
          anyOf:
            - type: string
              maxLength: 128
              pattern: ^[A-Za-z0-9][A-Za-z0-9 ._:/-]{0,127}$
            - type: 'null'
          title: Trino Catalog
          description: Trino catalog to query unless the user names another.
        trino_schema:
          anyOf:
            - type: string
              maxLength: 128
              pattern: ^[A-Za-z0-9][A-Za-z0-9 ._:/-]{0,127}$
            - type: 'null'
          title: Trino Schema
          description: Schema within that catalog.
        datahub_domain:
          anyOf:
            - type: string
              maxLength: 128
              pattern: ^[A-Za-z0-9][A-Za-z0-9 ._:/-]{0,127}$
            - type: 'null'
          title: Datahub Domain
          description: DataHub domain to search first.
        decisions_workspace:
          anyOf:
            - type: string
              maxLength: 64
              pattern: ^[A-Za-z0-9][A-Za-z0-9 ._:/-]{0,127}$
            - type: 'null'
          title: Decisions Workspace
          description: Business-rules workspace to author and read rules in.
      type: object
      title: ChatContextDefaults
      description: |-
        What the assistant should reach for first, unless told otherwise.

        Every field names something owned by another system, so none of them
        are checked here — see "Pinned defaults are preferences" in
        `api.services.chat.context`. The portal offers pickers rather than
        free text, which is where a typo is actually prevented.
    ChatSubject:
      properties:
        type:
          $ref: '#/components/schemas/ChatSubjectType'
          description: What kind of item.
        id:
          type: string
          title: Id
          description: 'The item''s id: a UUID, or `workspace/key` for a decision.'
        label:
          anyOf:
            - type: string
            - type: 'null'
          title: Label
          description: The item's display name.
      type: object
      required:
        - type
        - id
      title: ChatSubject
      description: The item a bound thread is about.
    ChatSubjectType:
      type: string
      enum:
        - dataeng_query
        - dataeng_new
        - semantic_model
        - semantic_new
        - decision
        - data_access
        - registry_agent_test
        - dq_table
        - dq_new
        - function
        - function_new
        - ontology
        - ontology_new
        - feature_engineering
        - feature_engineering_new
        - airouter_builder
        - maintenance
        - spark_app
      title: ChatSubjectType
      description: What a bound thread is about.
  securitySchemes:
    OAuth2AuthorizationCodeBearer:
      type: oauth2
      flows:
        authorizationCode:
          scopes: {}
          authorizationUrl: >-
            https://sso-rapid.rapid.nx1cloud.com/realms/rapid/protocol/openid-connect/auth
          tokenUrl: >-
            https://sso-rapid.rapid.nx1cloud.com/realms/rapid/protocol/openid-connect/token
    APIKeyHeader:
      type: apiKey
      in: header
      name: Authorization-PSK

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.