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

# Create a reusable pipeline configuration

> Create a reusable pipeline configuration for a playbook. Do not create a new pipeline for every run. Create once, wait until it is ready, then execute it repeatedly with playbook-specific input.

Lifecycle: Playbook -> Pipeline -> Revision -> Run.

- Playbook defines the task type and run input/output schema.
- Pipeline stores reusable instructions, business rules, and connector configuration.
- Revision is the built executable version of the pipeline.
- Run executes a ready revision with one-off input.

Scheduling example, create once:

{
  "name": "Cafe rota",
  "playbookId": "scheduling",
  "instructions": "Business rules, staff context, constraints, preferences, and recurring scheduling rules.",
  "connectors": []
}

Then run many times with POST /v1/workspaces/{workspaceId}/pipelines/{pipelineId}/runs and input.dateRange.



## OpenAPI

````yaml /openapi.json post /v1/workspaces/{workspaceId}/pipelines
openapi: 3.1.0
info:
  title: Erna API
  version: 1.0.0
  description: >-
    AI business operations platform API.


    Erna uses a reusable pipeline lifecycle: Playbook -> Pipeline -> Revision ->
    Run.


    - A playbook defines the repeatable task type, generation behavior, and run
    input/output contract.

    - A pipeline stores reusable instructions and configuration for one
    playbook. Do not create a new pipeline for every execution.

    - A revision is the built executable version of a pipeline definition.

    - A run executes the latest ready revision with playbook-specific input.


    For scheduling, create one pipeline with the reusable business rules, staff
    context, and constraints. Then run that pipeline repeatedly with
    date-specific input such as { "input": { "dateRange": { "start":
    "2026-05-11", "end": "2026-05-17" } } }.
servers:
  - url: https://api.erna.ai
    description: Production
security:
  - bearerAuth: []
paths:
  /v1/workspaces/{workspaceId}/pipelines:
    post:
      tags:
        - Pipelines
      summary: Create a reusable pipeline configuration
      description: >-
        Create a reusable pipeline configuration for a playbook. Do not create a
        new pipeline for every run. Create once, wait until it is ready, then
        execute it repeatedly with playbook-specific input.


        Lifecycle: Playbook -> Pipeline -> Revision -> Run.


        - Playbook defines the task type and run input/output schema.

        - Pipeline stores reusable instructions, business rules, and connector
        configuration.

        - Revision is the built executable version of the pipeline.

        - Run executes a ready revision with one-off input.


        Scheduling example, create once:


        {
          "name": "Cafe rota",
          "playbookId": "scheduling",
          "instructions": "Business rules, staff context, constraints, preferences, and recurring scheduling rules.",
          "connectors": []
        }


        Then run many times with POST
        /v1/workspaces/{workspaceId}/pipelines/{pipelineId}/runs and
        input.dateRange.
      operationId: createPipeline
      parameters:
        - schema:
            type: string
            example: ws_123
          required: true
          name: workspaceId
          in: path
        - schema:
            type: string
            minLength: 1
            example: unique-idempotency-key
          required: true
          name: Idempotency-Key
          in: header
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePipelineRequest'
      responses:
        '202':
          description: Pipeline accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PipelineResponse'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  connector:
                    type: string
                  flow:
                    type: string
                  providerError:
                    type: string
                  details:
                    type: array
                    items:
                      type: object
                      properties:
                        path:
                          type: string
                        message:
                          type: string
                      required:
                        - path
                        - message
                  message:
                    type: string
                  reason:
                    type: string
                  runId:
                    type: string
                  requiredActions:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        type:
                          type: string
                          enum:
                            - connect_service
                        connector:
                          type: string
                        href:
                          type: string
                        request:
                          type: object
                          properties: {}
                          default: {}
                          additionalProperties: {}
                      required:
                        - id
                        - type
                        - connector
                        - href
                      additionalProperties: false
                  billing:
                    type: object
                    properties:
                      checkoutPath:
                        type: string
                    required:
                      - checkoutPath
                required:
                  - error
                additionalProperties: false
        '403':
          description: Missing write access
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  connector:
                    type: string
                  flow:
                    type: string
                  providerError:
                    type: string
                  details:
                    type: array
                    items:
                      type: object
                      properties:
                        path:
                          type: string
                        message:
                          type: string
                      required:
                        - path
                        - message
                  message:
                    type: string
                  reason:
                    type: string
                  runId:
                    type: string
                  requiredActions:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        type:
                          type: string
                          enum:
                            - connect_service
                        connector:
                          type: string
                        href:
                          type: string
                        request:
                          type: object
                          properties: {}
                          default: {}
                          additionalProperties: {}
                      required:
                        - id
                        - type
                        - connector
                        - href
                      additionalProperties: false
                  billing:
                    type: object
                    properties:
                      checkoutPath:
                        type: string
                    required:
                      - checkoutPath
                required:
                  - error
                additionalProperties: false
        '404':
          description: Workspace not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  connector:
                    type: string
                  flow:
                    type: string
                  providerError:
                    type: string
                  details:
                    type: array
                    items:
                      type: object
                      properties:
                        path:
                          type: string
                        message:
                          type: string
                      required:
                        - path
                        - message
                  message:
                    type: string
                  reason:
                    type: string
                  runId:
                    type: string
                  requiredActions:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        type:
                          type: string
                          enum:
                            - connect_service
                        connector:
                          type: string
                        href:
                          type: string
                        request:
                          type: object
                          properties: {}
                          default: {}
                          additionalProperties: {}
                      required:
                        - id
                        - type
                        - connector
                        - href
                      additionalProperties: false
                  billing:
                    type: object
                    properties:
                      checkoutPath:
                        type: string
                    required:
                      - checkoutPath
                required:
                  - error
                additionalProperties: false
      security:
        - bearerAuth: []
components:
  schemas:
    CreatePipelineRequest:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          description: Human-readable name for this reusable pipeline.
        playbookId:
          type: string
          enum:
            - scheduling
            - reporting
          description: >-
            Playbook that defines the reusable pipeline type and run input
            contract.
        instructions:
          type: string
          minLength: 1
          description: >-
            Reusable business rules and configuration used for every run of this
            pipeline. For scheduling, include staff context, constraints,
            preferences, and recurring rules here, not the one-off dateRange.
        connectors:
          type: array
          items:
            type: object
            properties:
              connector:
                type: string
                minLength: 1
                description: Connector identifier selected from the connector catalog.
              connectionId:
                type: string
                minLength: 1
                description: Stored connection id used by pipeline builds and runs.
            required:
              - connector
              - connectionId
            additionalProperties: false
          default: []
          description: >-
            Stored external connections available during pipeline builds and
            runs.
      required:
        - name
        - playbookId
        - instructions
      additionalProperties: false
    PipelineResponse:
      type: object
      properties:
        pipelineId:
          type: string
          description: Reusable pipeline id.
        name:
          type: string
          description: Human-readable reusable pipeline name.
        playbookId:
          type: string
          enum:
            - scheduling
            - reporting
          description: Playbook that owns this pipeline and defines its run input contract.
        status:
          type: string
          enum:
            - building
            - ready
            - failed
          description: >-
            Current pipeline build status. Only ready pipelines can be run, but
            schemas may be visible before the build completes.
        latestRevisionId:
          type:
            - string
            - 'null'
          description: >-
            Latest ready executable revision id, or null while the pipeline is
            building.
        error:
          description: Public error details when status is failed.
        links:
          type: object
          properties:
            self:
              type: string
            runs:
              type: string
            revisions:
              type: string
          required:
            - self
            - runs
            - revisions
          additionalProperties: false
        definition:
          type: object
          properties:
            playbookId:
              type: string
              enum:
                - scheduling
                - reporting
              description: >-
                Playbook that defines the reusable pipeline type and run input
                contract.
            instructions:
              type: string
              description: >-
                Reusable business rules and configuration used for every run of
                this pipeline. Do not put one-off run inputs such as a
                scheduling date range here.
            connectors:
              type: array
              items:
                type: object
                properties:
                  connector:
                    type: string
                    minLength: 1
                    description: Connector identifier selected from the connector catalog.
                  connectionId:
                    type: string
                    minLength: 1
                    description: Stored connection id used by pipeline builds and runs.
                required:
                  - connector
                  - connectionId
                additionalProperties: false
              description: >-
                Stored external connections available during pipeline builds and
                runs.
          required:
            - playbookId
            - instructions
            - connectors
          additionalProperties: false
        inputJsonSchema:
          type:
            - object
            - 'null'
          properties: {}
          additionalProperties: {}
          description: >-
            JSON Schema for the input object accepted by pipeline runs. Fetch
            pipeline detail before running and send matching data under the run
            request input property.
        outputJsonSchema:
          type:
            - object
            - 'null'
          properties: {}
          additionalProperties: {}
          description: JSON Schema for run output once a run completes.
        latestRun:
          type:
            - object
            - 'null'
          properties:
            runId:
              type: string
            status:
              type: string
              enum:
                - running
                - complete
                - failed
            createdAt:
              type: string
            updatedAt:
              type: string
            links:
              type: object
              properties:
                self:
                  type: string
              required:
                - self
              additionalProperties: false
          required:
            - runId
            - status
            - createdAt
            - updatedAt
            - links
          additionalProperties: false
          description: >-
            Latest pipeline run summary, if one exists. Fetch links.self to read
            full output or error details.
      required:
        - pipelineId
        - name
        - playbookId
        - status
        - latestRevisionId
        - links
        - definition
        - inputJsonSchema
        - outputJsonSchema
        - latestRun
      additionalProperties: false
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: OAuth2 access token or API key

````