---
title: "Merge pull request"
method: POST
path: "/v1/replica/{id}/pull-requests/merge"
tags: ["Pull requests"]
---

# Merge pull request

`POST /v1/replica/{id}/pull-requests/merge`

## Request

- Base URL: `https://api.replicas.dev`
- URL: `https://api.replicas.dev/v1/replica/{id}/pull-requests/merge`
- Auth: HTTP bearer

Merges a GitHub pull request when it is open and mergeable, or adds it to the merge queue when its base branch requires one. With `bypass_rules`, merges a blocked pull request with your GitHub account when it can bypass the branch's rules. Returns `403` when the organization's security policy blocks agent merges.

## Path parameters

- `id` string, uuid, required

## Headers

- `X-Replicas-Api-Version` '2026-10-07'

## Request body

- MergeWorkspacePullRequestRequest
  - `pr_url` string, uri, required
  - `merge_method` 'merge' | 'squash' | 'rebase': Defaults to merge_rules.default_merge_method. Ignored on merge queue branches, where the queue picks, unless bypassing rules.
  - `bypass_rules` boolean: Merge right away, skipping any merge queue, when the pull request is blocked and merge_rules.viewer_can_bypass is true. Merges as your GitHub account, so it needs a personal API key with GitHub connected.

## Response `200`

Success

- MergeWorkspacePullRequestResponse
  - `success` true, required
  - `queued` boolean, required: True when the pull request joined the merge queue instead of merging right away.

## Other responses

- `400`: Bad request - Missing or invalid parameters
- `401`: Unauthorized - Invalid or missing API key
- `403`: Forbidden - The authenticated account cannot access this resource
- `404`: Resource not found
- `409`: Conflict - Resource already exists or operation conflicts with current state
- `412`: Bypassing rules was requested without a personal API key
- `500`: Internal server error

---

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