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

# Create a deal pipeline

> Creates a deal pipeline with its stages. A pipeline must include at least one ACTIVE, one WON, and one LOST stage. Returns the new pipeline with stage IDs (dps_) you can use when creating deals.



## OpenAPI

````yaml /openapi.v2.json post /pipelines
openapi: 3.1.1
info:
  title: Heffl API v2 (Beta)
  version: 2.0.0
  description: >-
    Heffl REST API v2 (beta) — resource-oriented endpoints with consistent
    response envelopes. Endpoints, schemas, and behavior may change until GA.
    See Agent workflows and ID prefixes guides for automation.
  contact:
    name: Heffl Support
    url: https://heffl.com/support
    email: support@heffl.com
servers:
  - url: https://api.heffl.com/api/v2
    description: Production API Server
security:
  - ApiKeyAuth: []
paths:
  /pipelines:
    post:
      tags:
        - Reference Data
      summary: Create a deal pipeline
      description: >-
        Creates a deal pipeline with its stages. A pipeline must include at
        least one ACTIVE, one WON, and one LOST stage. Returns the new pipeline
        with stage IDs (dps_) you can use when creating deals.
      operationId: reference.pipelines.create
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PipelineInput'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Pipeline'
        '400':
          description: Validation error or bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2ApiError'
        '401':
          description: Missing or invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2ApiError'
        '403':
          description: Insufficient permission
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2ApiError'
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2ApiError'
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2ApiError'
components:
  schemas:
    PipelineInput:
      type: object
      required:
        - name
        - stages
      properties:
        name:
          type: string
          description: Pipeline name
        icon:
          type: string
          description: Tabler icon name for the pipeline. Defaults to an icon.
        isActive:
          type: boolean
          description: Whether the pipeline is active. Defaults to true.
        stages:
          type: array
          description: >-
            Stages for the pipeline. Must include at least one ACTIVE, one WON,
            and one LOST stage.
          items:
            $ref: '#/components/schemas/PipelineStageInput'
    Pipeline:
      type: object
      required:
        - id
        - name
        - stages
      properties:
        id:
          type: string
          description: Pipeline ID (dpl_ prefix)
        name:
          type: string
          description: Pipeline name
        stages:
          type: array
          items:
            $ref: '#/components/schemas/PipelineStage'
    V2ApiError:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
            message:
              type: string
            details:
              type: object
    PipelineStageInput:
      type: object
      required:
        - name
        - position
      properties:
        name:
          type: string
          description: Stage name
        position:
          type: number
          description: Display order in the pipeline (lower comes first)
        probability:
          type: number
          description: Win probability percentage (0-100). Defaults to 0.
        rottingInDays:
          type: number
          description: >-
            Days a deal can sit in this stage before it is flagged as rotting.
            Defaults to 0 (disabled).
        type:
          type: string
          enum:
            - ACTIVE
            - WON
            - LOST
          description: >-
            Stage type. Defaults to ACTIVE. A pipeline must have at least one of
            each.
    PipelineStage:
      type: object
      required:
        - id
        - name
        - position
        - probability
        - type
      properties:
        id:
          type: string
          description: Pipeline stage ID (dps_ prefix)
        name:
          type: string
          description: Stage name
        position:
          type: number
          description: Display order in the pipeline
        probability:
          type: number
          description: Win probability percentage
        type:
          type: string
          enum:
            - ACTIVE
            - WON
            - LOST
          description: >-
            Stage type. Moving a deal to a WON or LOST stage updates deal
            status.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        API key for authentication. Get yours at
        app.heffl.com/settings/developers

````