---
title: "Create a pipeline."
method: POST
path: "/pipelines"
tags: ["Pipeline Operations"]
---

# Create a pipeline.

`POST /pipelines`

## Request

- Base URL: `https://replace-with-account.api.decodable.co/v1alpha2`
- URL: `https://replace-with-account.api.decodable.co/v1alpha2/pipelines`
- Auth: one of:
  - HTTP bearer
  - OAuth 2
    - Authorization code: `https://auth.decodable.co/authorize?audience=https://api.decodable.co/`
    - Token URL: `https://auth.decodable.co/oauth/token` scopes: `write:pipeline`
- TypeScript: <https://skmtc.dev/decodable/apis/decodable-control-plane/docs/pipelines/post.ts> (a function with typed inputs; its response is checked against the schema)

Requires permissions matching: 
- `pipeline:write:default.<name>`
- `stream:read-data:default.<stream-name>` on input streams
- `stream:write-data:default.<stream-name>` on output streams

## Request body

- SqlPipelineCommon: `kind: pipeline`, `spec_version: v1`. SQL pipeline fields only.
  - `name` string: The pipeline name.
  - `description` string: The pipeline description.
  - `sql` string: The pipeline SQL.
  - `snapshot_configuration` SnapshotConfiguration: The pipeline snapshot configuration.
    - `enabled` boolean: Whether or not to take snapshots.
    - `cron` string: A cron expression for scheduling the snapshot
    - `retention_period_seconds` number: A retention period for the created snapshots, in seconds.
  - `autoscale_configuration` AutoscaleConfiguration, nullable: The configuration for autoscale conditions.
    - `pause_conditions` object, nullable: A map of pause conditions and their given setting values.
    - `resume_conditions` object, nullable: A map of resume conditions and their given setting values.
  - `properties` SQLPipelineProperties
    - `secrets` string[]

## Response `201`

A pipeline creation response.

- Pipeline, nullable: The latest Flink configurations defined for this job. When this differs from `actual_system_flink_configuration`, restart the job to apply the latest configurations.
  - `id` string, required: An opaque ID, created by Decodable, that uniquely identifies a resource.
  - `name` string, required: The pipeline name.
  - `description` string: The pipeline description.
  - `type` 'JAVA' | 'PYTHON', required: The type of the custom pipeline. Consumers should be able to gracefully handle new values in future API versions.
  - `sql` string: The pipeline SQL.
  - `snapshot_configuration` SnapshotConfiguration: The pipeline snapshot configuration.
    - `enabled` boolean: Whether or not to take snapshots.
    - `cron` string: A cron expression for scheduling the snapshot
    - `retention_period_seconds` number: A retention period for the created snapshots, in seconds.
  - `autoscale_configuration` AutoscaleConfiguration, nullable: The configuration for autoscale conditions.
    - `pause_conditions` object, nullable: A map of pause conditions and their given setting values.
    - `resume_conditions` object, nullable: A map of resume conditions and their given setting values.
  - `properties` object
    - `secrets` string[]
    - `flink_version` string: The Flink version to run this custom pipeline on.
    - `additional_metrics` string[]
    - `flink_configuration` object: A key-value pair of additional Flink configuration to apply to the job
  - `job_file_sha` string: SHA512 hash of the job file. Must reference a file that was previously uploaded using the `/files` endpoints.
  - `job_arguments` string: Argument string input to the custom pipeline program.
  - `entry_class` string: Name of the entry class to run for this custom Java-based pipeline (optional). If not present, the class to run must be specified in the file `META-INF/MANIFEST.MF` within the job's JAR file, using the `Main-Class` property key.
  - `version` integer, required: A version number of a resource
  - `is_latest` boolean: describe if a versioned resource is the latest version
  - `active_version` integer, nullable: The active version of the pipeline
  - `latest_version` integer: The latest version of the pipeline
  - `last_runtime_error` RuntimeError: The pipeline last runtime error.
    - `message` string: last runtime error message
    - `raw_exception` string: raw exception from the underlying system
    - `timestamp` string, date-time: last runtime error timestamp
  - `last_activated_time` string, date-time: The date and time this object was last activated.
  - `target_state` 'RUNNING' | 'STOPPED'
  - `actual_state` 'UNKNOWN' | 'STARTING' | 'RUNNING' | 'FAILED' | 'FINISHED' | 'STOPPED' | 'PAUSING' | 'PAUSED'
  - `create_time` string, date-time, required: The date and time the resource was created.
  - `update_time` string, date-time: The date and time the resource was updated.
  - `requested_tasks` integer: the number of tasks to be allocated to an object when it is activated
  - `actual_tasks` integer: the number of tasks actively in use by an object
  - `requested_task_size` string, nullable: the task size to be allocated to an object when it is activated
  - `actual_task_size` string, nullable: the task size actively in use by an object

## Other responses

- `400`: An invalid request was received.
- `403`: Access denied: requesting user lacks a required permission.
- `409`: A conflicting resource already exists.
- `default`: An error has occurred.

---

[API](https://skmtc.dev/decodable/apis/decodable-control-plane.md) - [All operations](https://skmtc.dev/decodable/apis/decodable-control-plane/llms.txt) - [OpenAPI document](https://skmtc.dev/decodable/apis/decodable-control-plane/revisions/9718a3019da8?raw)
