---
title: "Create pipeline definition"
method: POST
path: "/projects/{project_id}/pipeline-definitions"
tags: ["Pipeline Definition"]
---

# Create pipeline definition

`POST /projects/{project_id}/pipeline-definitions`

## Request

- Base URL: `https://circleci.com/api/v2`
- URL: `https://circleci.com/api/v2/projects/{project_id}/pipeline-definitions`
- Auth: one of:
  - API key in header `Circle-Token`
  - HTTP bearer
  - HTTP basic
  - API key in query parameter `circle-token`

Create a pipeline definition for a given project. Currently only supported for pipeline definitions where `config_source.provider` is `github_app` or `github_server`. [Share feedback](https://circleci.canny.io/cloud-feature-requests/p/project-administration-apis) about our Project Administration APIs.

## Path parameters

- `project_id` string, required

## Request body

- CreatePipelineDefinitionRequest
  - `name` string, required: The name of the pipeline definition.
  - `description` string: The description of the pipeline definition.
  - `config_source` union, required
    - object: Config source for external providers (repo required)
      - `provider` 'github_app' | 'github_server', required: The integration provider for this resource. Supported external providers are `github_app` and `github_server`.
      - `repo` object, required
        - `external_id` string, required: External identifier for the repository, as defined by the respective version control provider.
      - `file_path` string, required: Path to CircleCI config YAML file to use for this pipeline definition.
    - object: Config source for CircleCI provider (no repo required)
      - `provider` 'circleci', required: The integration provider for this resource.
      - `file_path` string, required: Path to CircleCI config YAML file to use for this pipeline definition.
  - `checkout_source` object, required: The resource to be used when running the `checkout` command.
    - `provider` 'github_app' | 'github_server', required: The integration provider for this resource. Supported values are `github_app` and `github_server`.
    - `repo` object, required
      - `external_id` string, required: External identifier for the repository, as defined by the respective version control provider.

## Response `200`

Successful response.

- PipelineDefinition
  - `id` string, uuid: The unique ID of the pipeline definition.
  - `name` string: The name of the pipeline definition.
  - `description` string: The description of the pipeline definition.
  - `created_at` string, date-time: The date and time the pipeline definition was created.
  - `config_source` object: The resource that stores the CircleCI config YAML used for this pipeline definition.
    - `provider` string: The integration provider for this resource.
    - `repo` PipelineDefinitionRepo
      - `full_name` string: The fully-qualified name of the repository.
      - `external_id` string: External identifier for the repository, as defined by the respective version control provider.
    - `file_path` string: Path to CircleCI config YAML file to use for this pipeline definition.
  - `checkout_source` object: The resource to be used when running the `checkout` command.
    - `provider` string: The integration provider for this resource.
    - `repo` PipelineDefinitionRepo
      - `full_name` string: The fully-qualified name of the repository.
      - `external_id` string: External identifier for the repository, as defined by the respective version control provider.

## Other responses

- `400`: Unexpected request body provided.
- `401`: Credentials provided are invalid.
- `404`: Entity not found.
- `500`: Internal server error.

---

[API](https://skmtc.dev/circleci/apis/circleci-api.md) - [All operations](https://skmtc.dev/circleci/apis/circleci-api/llms.txt) - [OpenAPI document](https://skmtc.dev/circleci/apis/circleci-api/revisions/b9c0e0c24058?raw)
