---
title: "Open or merge the pipeline's setup PR"
method: POST
path: "/api/v1/pipelines/{pipelineId}/setup/pull-request"
tags: ["Pipelines"]
---

# Open or merge the pipeline's setup PR

`POST /api/v1/pipelines/{pipelineId}/setup/pull-request`

## Request

- Base URL: `https://app.khotan.com`
- URL: `https://app.khotan.com/api/v1/pipelines/{pipelineId}/setup/pull-request`
- Auth: one of:
  - HTTP bearer
  - API key in header `x-api-key`

Opens the setup PR from the pipeline's cursor/setup-<slug> branch into the default branch, or updates the open one, through Khotan's GitHub app. The setup script calls it when gh cannot. With merge: true, Khotan merges with a merge commit only when the caller is the running setup run's own key, the PR changes only the pipeline, its database package, bun.lock, khotan.bindings.json, and skills-lock.json, and every check on the head commit passed. A refused merge returns 409 with the guard's code and leaves the PR open.

## Path parameters

- `pipelineId` string, required

## Request body

- object
  - `title` string, required
  - `body` string, required
  - `merge` boolean: Merge the PR when every guard holds. Only the running setup run's own key can merge.

## Response `200`

The setup PR, and whether it merged.

- object
  - `url` string, required
  - `number` integer, required
  - `merged` boolean, required
  - `mergeCommitSha` string, nullable, required

## Other responses

- `400`: The request was malformed or failed validation.
- `401`: Authentication is missing or invalid.
- `403`: The caller is not permitted to perform this action.
- `404`: The resource was not found.
- `409`: Response.
- `429`: Too many requests; retry after the indicated delay.

---

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