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

# Add workflow

> Creates a project-owned workflow from tools, a default template or a copy of another project workflow.



## OpenAPI

````yaml /api-reference/openapi.json post /api/projects/{id}/workflows
openapi: 3.0.0
info:
  title: Open Attack Surface Management
  description: Open-source platform for cybersecurity Attack Surface Management (ASM)
  version: '1.0'
  contact: {}
servers:
  - url: https://{baseUrl}/api/v1
    variables:
      baseUrl:
        default: localhost:3000
        description: API server hostname with port (e.g. localhost:3000, api.example.com)
security: []
tags: []
externalDocs:
  description: Authentication Docs
  url: auth/docs
paths:
  /api/projects/{id}/workflows:
    post:
      tags:
        - Projects
      summary: Add workflow
      description: >-
        Creates a project-owned workflow from tools, a default template or a
        copy of another project workflow.
      operationId: ProjectsController_createWorkflow
      parameters:
        - name: id
          required: true
          in: path
          schema:
            type: string
        - name: X-Workspace-Id
          in: header
          description: Workspace ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateProjectWorkflowDto'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProjectWorkflow'
                allOf:
                  - $ref: '#/components/schemas/AppResponseSerialization'
components:
  schemas:
    CreateProjectWorkflowDto:
      type: object
      properties:
        name:
          type: string
        template:
          type: string
          description: File name of a default workflow to copy the jobs from
          example: vulnerability_scan_basic.yaml
        tools:
          type: array
          items:
            $ref: '#/components/schemas/ProjectToolInput'
        copyFromProjectWorkflowId:
          type: string
          description: Project workflow (binding) of any project to copy
        'on':
          description: 'When the workflow runs on its own: schedules and "assets added"'
          allOf:
            - $ref: '#/components/schemas/ProjectWorkflowOnDto'
    ProjectWorkflow:
      type: object
      properties:
        id:
          type: string
        createdAt:
          format: date-time
          type: string
        updatedAt:
          format: date-time
          type: string
        projectId:
          type: string
        workflow:
          $ref: '#/components/schemas/Workflow'
        workflowId:
          type: string
        triggers:
          type: array
          items:
            $ref: '#/components/schemas/ProjectWorkflowTrigger'
        lastRun:
          nullable: true
          type: object
          allOf:
            - $ref: '#/components/schemas/ProjectLastRunDto'
      required:
        - id
        - createdAt
        - updatedAt
        - projectId
        - workflow
        - workflowId
    AppResponseSerialization:
      type: object
      properties: {}
    ProjectToolInput:
      type: object
      properties:
        toolId:
          type: string
          description: Tool ID
        config:
          type: object
          description: Inline config override for this tool
        configProfileId:
          type: string
          description: Reference to a saved config profile
        category:
          description: 'Category to run the tool in (default: its first)'
          allOf:
            - $ref: '#/components/schemas/ToolCategory'
        input:
          type: array
          description: >-
            Kinds of data the tool takes, best first (default: its own inputs).
            Must be among the ones its category accepts.
          items:
            $ref: '#/components/schemas/DataKind'
        stage:
          type: number
          minimum: 1
          description: >-
            Pipeline stage, from 1. Tools of a stage run in parallel; the next
            stage waits for them. Default 1.
      required:
        - toolId
    ProjectWorkflowOnDto:
      type: object
      properties:
        schedule:
          type: array
          items:
            $ref: '#/components/schemas/ScheduleInputDto'
        assetsAdded:
          nullable: true
          description: Run when assets join the project; absent or null = never
          type: object
          allOf:
            - $ref: '#/components/schemas/AssetsAddedInputDto'
    Workflow:
      type: object
      properties:
        id:
          type: string
        createdAt:
          format: date-time
          type: string
        updatedAt:
          format: date-time
          type: string
        name:
          type: string
        content:
          $ref: '#/components/schemas/WorkflowContent'
        filePath:
          type: string
        isCanDelete:
          type: boolean
        isCanEdit:
          type: boolean
      required:
        - id
        - createdAt
        - updatedAt
        - name
        - content
        - filePath
        - isCanDelete
        - isCanEdit
    ProjectWorkflowTrigger:
      type: object
      properties:
        id:
          type: string
        createdAt:
          format: date-time
          type: string
        updatedAt:
          format: date-time
          type: string
        projectWorkflowId:
          type: string
        type:
          allOf:
            - $ref: '#/components/schemas/ProjectTriggerType'
        cron:
          type: string
          nullable: true
        config:
          $ref: '#/components/schemas/AssetsAddedTriggerConfig'
        enabled:
          type: boolean
        lastFiredAt:
          type: string
          format: date-time
          nullable: true
      required:
        - id
        - createdAt
        - updatedAt
        - projectWorkflowId
        - type
        - config
        - enabled
    ProjectLastRunDto:
      type: object
      properties:
        id:
          type: string
        createdAt:
          format: date-time
          type: string
        updatedAt:
          format: date-time
          type: string
        totalJobs:
          type: number
        status:
          type: string
          enum:
            - pending
            - in_progress
            - completed
            - failed
            - cancelled
            - skipped
        workflowName:
          type: string
        jobHistoryName:
          type: string
        jobRunType:
          type: string
          enum:
            - manual
            - scheduled
            - event
      required:
        - id
        - createdAt
        - updatedAt
        - totalJobs
        - status
        - workflowName
        - jobHistoryName
        - jobRunType
    ToolCategory:
      type: string
      enum:
        - subdomains
        - http_probe
        - ports_scanner
        - vulnerabilities
        - screenshot
        - url_discovery
    DataKind:
      type: string
      enum:
        - target
        - host
        - service
        - web
        - url
        - repository
        - vulnerability
    ScheduleInputDto:
      type: object
      properties:
        cron:
          type: string
          example: 0 2 * * 1
          description: 5-field cron expression, in UTC
        enabled:
          type: boolean
          default: true
          description: >-
            Off keeps the schedule in the workflow without running it. Omitted:
            a new schedule is on, an existing one keeps its state.
      required:
        - cron
    AssetsAddedInputDto:
      type: object
      properties:
        windowMinutes:
          type: number
          default: 10
          description: Minutes to gather new assets into one run
        maxAssets:
          type: number
          default: 200
          description: Most assets one run takes; more start further runs
        targetTypes:
          type: array
          description: Only assets of these target types; empty = all
          items:
            $ref: '#/components/schemas/TargetType'
        enabled:
          type: boolean
          default: true
          description: Off keeps the trigger in the workflow without running it
    WorkflowContent:
      type: object
      properties:
        'on':
          $ref: '#/components/schemas/On'
        jobs:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/WorkflowJob'
          description: Jobs keyed by a unique job id; `needs` references those same ids
        name:
          type: string
      required:
        - jobs
        - name
    ProjectTriggerType:
      type: string
      enum:
        - cron
        - assets_added
    AssetsAddedTriggerConfig:
      type: object
      properties:
        windowMinutes:
          type: number
          minimum: 0
          maximum: 1440
        maxAssets:
          type: number
          minimum: 1
          maximum: 5000
        targetTypes:
          type: array
          items:
            type: string
    TargetType:
      type: string
      enum:
        - DOMAIN
        - CIDR
        - IP
        - GIT_ORG
      description: The type of target (DOMAIN, CIDR, or IP)
    'On':
      type: object
      properties:
        target:
          type: array
          items:
            type: string
        schedule:
          type: array
          items:
            $ref: '#/components/schemas/ScheduleOn'
        assetsAdded:
          $ref: '#/components/schemas/AssetsAddedTriggerConfig'
    WorkflowJob:
      type: object
      properties:
        name:
          type: string
        run:
          type: string
        category:
          allOf:
            - $ref: '#/components/schemas/ToolCategory'
        input:
          type: array
          items:
            $ref: '#/components/schemas/DataKind'
        needs:
          type: array
          items:
            type: string
        allowFailure:
          type: boolean
        config:
          type: object
        configProfileId:
          type: string
      required:
        - run
    ScheduleOn:
      type: object
      properties:
        cron:
          type: string
          example: 0 2 * * 1
      required:
        - cron

````

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