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

# Create a new workflow draft

> POST /v1/projects/{project}/workflows



## OpenAPI

````yaml /openapi/v1.json post /projects/{project}/workflows
openapi: 3.1.0
info:
  title: HASP AI API
  version: '2026-07-12'
  description: >-
    The HASP Public AI API is the regulated-AI substrate for healthcare and
    other

    regulated industries — identity, policy, audit, compliance, and PHI handling

    for AI inference, exposed via two surfaces:


    - **Native (`/v1/ai/*`)**: HASP-native chat with full event taxonomy, run
    lifecycle,
      and PHI metadata.
    - **Anthropic-compat (`/v1/messages`)**: Drop-in replacement for
    `@anthropic-ai/sdk` —
      change only `baseURL`. All Gateway compliance checks (BAA, credits, PHI policy) apply.

    All requests require an API key (`Authorization: Bearer
    hasp_api_live_<key>`). See

    [Authentication](https://docs.usehasp.com/ai-api/authentication) for key
    management.
servers:
  - url: https://api.usehasp.com/v1
    description: Production
security:
  - http: []
paths:
  /projects/{project}/workflows:
    post:
      tags:
        - Workflow
      summary: Create a new workflow draft
      description: POST /v1/projects/{project}/workflows
      operationId: v1.workflows.store
      parameters:
        - name: project
          in: path
          required: true
          description: The project slug
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  maxLength: 255
                slug:
                  type:
                    - string
                    - 'null'
                  pattern: ^[a-z0-9]+(?:-[a-z0-9]+)*$
                  maxLength: 100
                description:
                  type:
                    - string
                    - 'null'
                  maxLength: 2000
                workflow_type:
                  type:
                    - string
                    - 'null'
                  enum:
                    - lookup
                    - update
                    - analytics
                    - export
                triggers:
                  type:
                    - array
                    - 'null'
                  items:
                    type: string
                steps:
                  type:
                    - array
                    - 'null'
                  items:
                    type: string
              required:
                - name
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
        '201':
          description: The newly created workflow draft.
          content:
            application/json:
              schema:
                type: object
                examples:
                  - data:
                      object: workflow
                      id: wf_01JQREQ7XZQK5N6PZ1VVXHYB8T
                      slug: patient-intake-routing
                      name: Patient Intake Routing
                      description: >-
                        Processes intake forms and routes to the correct care
                        team.
                      status: draft
                      version: 1
                      triggers: []
                      steps: []
                      project_id: 01JQREQ7XZQK5N6PZ1VVXHYB8U
                      created_at: '2026-05-01T09:00:00Z'
                      updated_at: '2026-05-01T09:00:00Z'
                properties:
                  data:
                    type: object
                    properties:
                      object:
                        type: string
                      id:
                        type: string
                      slug:
                        type: string
                      name:
                        type: string
                      description:
                        type:
                          - string
                          - 'null'
                      status:
                        type: string
                      version:
                        type: integer
                      triggers:
                        type: array
                        items: {}
                      steps:
                        type: array
                        items: {}
                      project_id:
                        type: string
                      created_at:
                        type:
                          - string
                          - 'null'
                      updated_at:
                        type:
                          - string
                          - 'null'
                    required:
                      - object
                      - id
                      - slug
                      - name
                      - description
                      - status
                      - version
                      - triggers
                      - steps
                      - project_id
                      - created_at
                      - updated_at
                required:
                  - data
        '401':
          description: Bearer token is missing, malformed, or revoked.
          content:
            application/json:
              schema:
                type: object
                example:
                  success: false
                  error:
                    type: authentication
                    code: INVALID_API_KEY
                    message: Bearer token is missing, malformed, or revoked.
                    param: null
                    details: null
                    retryable: false
                    request_id: 01JQREQ7XZQK5N6PZ1VVXHYB8T
                  meta:
                    request_id: 01JQREQ7XZQK5N6PZ1VVXHYB8T
        '403':
          description: >-
            The caller is authenticated but lacks the scope or capability this
            route requires.
          content:
            application/json:
              schema:
                type: object
                example:
                  success: false
                  error:
                    type: permission
                    code: MISSING_SCOPE
                    message: >-
                      The caller is authenticated but lacks the scope or
                      capability this route requires.
                    param: null
                    details: null
                    retryable: false
                    request_id: 01JQREQ7XZQK5N6PZ1VVXHYB8T
                  meta:
                    request_id: 01JQREQ7XZQK5N6PZ1VVXHYB8T
        '404':
          $ref: '#/components/responses/ModelNotFoundException'
        '422':
          $ref: '#/components/responses/ValidationException'
components:
  responses:
    ModelNotFoundException:
      description: Not found
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error overview.
            required:
              - message
    ValidationException:
      description: Validation error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Errors overview.
              errors:
                type: object
                description: A detailed description of each field that failed validation.
                additionalProperties:
                  type: array
                  items:
                    type: string
            required:
              - message
              - errors
  securitySchemes:
    http:
      type: http
      scheme: bearer

````