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

# Create a new pipeline

> Create a brand-new pipeline (with its `pipelineStages`) for the given `type`. Setting `isDefault: true` switches the org's default pipeline to the newly-created one.



## OpenAPI

````yaml /api-reference/openapi.yaml post /api/pipelines/create
openapi: 3.0.3
info:
  title: Tether Relay and Tether API
  version: 1.0.0
  description: >-
    Route-derived OpenAPI contract generated from tether-relay backend sources.
    Regenerate with scripts/sync-openapi-from-backend.mjs.
servers:
  - url: https://your-instance.example.com
    description: Production
  - url: http://localhost:2212
    description: Local API service
security: []
tags:
  - name: AI
  - name: Applications
  - name: Approval
  - name: Auth
  - name: Automations
  - name: Calls
  - name: Campaigns
  - name: Contact Analytics
  - name: Contact Metrics
  - name: Contact Notes
  - name: Contacts
  - name: Conversation Monitor
  - name: Conversations
  - name: Departments
  - name: Email
  - name: Escalation Dashboard
  - name: Event Logs
  - name: Google Sheets
  - name: Marketplace
  - name: Messages
  - name: Notification Sounds
  - name: Notifications
  - name: Org Snapshots
  - name: Organizations
  - name: Outreach
  - name: Outreach Metrics
  - name: Outreach Sources
  - name: Pipelines
  - name: Processes
  - name: Prompts
  - name: Reminders
  - name: Sms
  - name: Templates
  - name: Traces
  - name: Training
  - name: Upload
  - name: User Snapshots
  - name: Users
  - name: Vertical
  - name: Webchats
  - name: Webhook
paths:
  /api/pipelines/create:
    post:
      tags:
        - Pipelines
      summary: Create a new pipeline
      description: >-
        Create a brand-new pipeline (with its `pipelineStages`) for the given
        `type`. Setting `isDefault: true` switches the org's default pipeline to
        the newly-created one.
      operationId: post_pipelines_create
      parameters:
        - in: query
          name: type
          required: false
          schema:
            type: string
            enum:
              - Contact
              - Application
            default: Contact
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePipelineRequest'
      responses:
        '201':
          description: Pipeline created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PipelineMutationResponse'
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PipelineErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PipelineErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PipelineErrorResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    CreatePipelineRequest:
      type: object
      properties:
        name:
          type: string
          description: Pipeline display name; required and unique within the organization.
        description:
          type: string
          description: Optional human-readable summary of the pipeline's purpose.
        isDefault:
          type: boolean
          description: >-
            When true, becomes the org's default pipeline for its `type` (the
            previous default loses the flag).
        stages:
          type: array
          description: >-
            Legacy stage list used when `pipelineStages` is not provided;
            entries are mapped to new pipeline stages by `newStage` name.
          items:
            $ref: '#/components/schemas/LegacyStageItem'
        pipelineStages:
          type: array
          description: >-
            Stage definitions with `name`, `color`, and `position` (sort order);
            takes precedence over `stages` and must be non-empty.
          items:
            $ref: '#/components/schemas/PipelineStageItem'
      required:
        - name
      additionalProperties: true
      example:
        name: EMEA sales pipeline
        description: EMEA-specific sales funnel
        isDefault: false
        pipelineStages:
          - name: New
            color: '#3B82F6'
            position: 0
          - name: Discovery
            color: '#8B5CF6'
            position: 1
    PipelineMutationResponse:
      type: object
      properties:
        message:
          type: string
        pipeline:
          $ref: '#/components/schemas/PipelineDto'
        contactsMigrated:
          type: object
          additionalProperties:
            type: number
      additionalProperties: true
      example:
        message: Pipeline updated
        pipeline:
          _id: 66f0a0b0c0d0e0f0a0b0c0d0
          name: Sales pipeline
          type: Contact
          isDefault: true
        contactsMigrated:
          New Lead -> New: 14
          Qualified Lead -> Qualified: 8
    PipelineErrorResponse:
      type: object
      properties:
        error:
          type: string
      additionalProperties: true
      example:
        error: Pipeline not found
    LegacyStageItem:
      type: object
      properties:
        oldStage:
          type: string
          description: >-
            Previous stage name; existing records with this `status` are
            migrated to `newStage`.
        newStage:
          type: string
          description: >-
            New stage name to apply; becomes the stored stage and the migrated
            `status` value.
        color:
          type: string
          description: Hex color used to render the stage chip in the pipeline UI.
      additionalProperties: true
      example:
        oldStage: New Lead
        newStage: New
        color: '#3B82F6'
    PipelineStageItem:
      type: object
      properties:
        _id:
          type: string
          description: >-
            Existing stage id; include to update/rename a stage, omit to create
            a new one.
        name:
          type: string
          description: Stage display name; must be unique within the pipeline.
        color:
          type: string
          description: Hex color used to render the stage chip in the pipeline UI.
        position:
          type: number
          description: >-
            Zero-based sort order within the pipeline; defaults to array index
            when omitted.
      additionalProperties: true
      example:
        _id: 67f0a0b0c0d0e0f0a0b0c0d0
        name: Qualified
        color: '#10B981'
        position: 1
    PipelineDto:
      type: object
      properties:
        _id:
          type: string
        name:
          type: string
        description:
          type: string
        organizationId:
          type: string
        type:
          type: string
          enum:
            - Contact
            - Application
        isDefault:
          type: boolean
        isActive:
          type: boolean
        stages:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
              color:
                type: string
            additionalProperties: true
        pipelineStageIds:
          type: array
          items:
            type: string
        pipelineStages:
          type: array
          items:
            $ref: '#/components/schemas/PipelineStageItem'
        createdBy:
          type: string
          description: User ID or populated user object
        updatedBy:
          type: string
          description: User ID or populated user object
      additionalProperties: true
      example:
        _id: 66f0a0b0c0d0e0f0a0b0c0d0
        name: Sales pipeline
        description: NA sales pipeline
        organizationId: 65a0e0e0e0e0e0e0e0e0e0e0
        type: Contact
        isDefault: true
        isActive: true
        stages:
          - name: New
            color: '#3B82F6'
          - name: Qualified
            color: '#10B981'
        pipelineStageIds:
          - 67f0a0b0c0d0e0f0a0b0c0d0
          - 67f0a0b0c0d0e0f0a0b0c0d1
        pipelineStages:
          - _id: 67f0a0b0c0d0e0f0a0b0c0d0
            name: New
            color: '#3B82F6'
            position: 0
          - _id: 67f0a0b0c0d0e0f0a0b0c0d1
            name: Qualified
            color: '#10B981'
            position: 1
        createdBy: 65b1f0a2c3d4e5f6a7b8c9d0
        updatedBy: 65b1f0a2c3d4e5f6a7b8c9d0
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````