---
title: "Modify an open pull/merge request branch"
method: POST
path: "/api/v2/agent/modifyPullRequestBranch"
tags: ["Agent"]
---

# Modify an open pull/merge request branch

`POST /api/v2/agent/modifyPullRequestBranch`

## Request

- Base URL: `https://zeropath.com`
- URL: `https://zeropath.com/api/v2/agent/modifyPullRequestBranch`
- Auth: API key in header `X-ZeroPath-API-Token-Id` and API key in header `X-ZeroPath-API-Token-Secret`

Queue the same PR/MR branch modification worker used by the PR scan bot. The API validates repository scope, requires PATCH_ISSUE on the repository, posts a progress comment on the pull/merge request, and edits that comment with the result when the worker finishes. Use this when the assistant must apply concrete code changes to an existing branch.

## Request body

- AgentModifyPullRequestBranchRequest
  - `organizationId` string: Organization ID (injected by MCP server)
  - `repositoryId` string, uuid, required: ZeroPath repository ID for the GitHub pull request or GitLab merge request
  - `prUrl` string, required: GitHub pull request or GitLab merge request URL whose source branch should be modified
  - `request` string, required: Concrete code change request to apply to the pull request branch

## Response `200`

Branch modification queued

- AgentModifyPullRequestBranchResponse
  - `status` 'queued', required: The branch modification job was queued
  - `jobId` string, uuid, required: Deferred PR bot job ID
  - `ackCommentId` string, required: VCS comment/note ID for the progress comment that will be edited with results
  - `prUrl` string, required: Pull request URL being modified
  - `headBranch` string, required: PR source branch accepted before the mutation worker runs
  - `headSha` string, required: PR source branch SHA accepted before the mutation worker runs
  - `message` string, required

## Other responses

- `400`: Error Response
- `401`: Error Response
- `404`: Error Response
- `409`: Error Response

---

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