Merge pull

Merge an open pull request into the target ref.

Endpoints

POST /api/v1/teams/{team_slug}/repos/{repo_slug}/pulls/{number}/merge
POST /api/v1/users/{username}/repos/{repo_slug}/pulls/{number}/merge
Authenticated

Request

JSON body (optional optimistic concurrency checks):

  • expected_target_oid (optional)
  • expected_source_oid (optional)

Usage

curl --request POST \
  --header "Authorization: Bearer $GHIT_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{"expected_target_oid":"abc123"}' \
  "$GHIT_API_URL/v1/teams/platform/repos/website/pulls/42/merge"

Success

200 OK with merge metadata and updated pull.

{
  "pull": {
    "uuid": "...",
    "number": 42,
    "status": "merged",
    "merge_commit_oid": "def456"
  },
  "merge_mode": "merge"
}

Errors

  • 400 Bad Request when pull is not open or refs are invalid.
  • 403 Forbidden when caller lacks maintainer access to target repo.
  • 404 Not Found when repo or pull number is not found.
  • 409 Conflict for merge conflict or stale optimistic concurrency checks.
  • 500 Internal Server Error for merge execution failures.

Common auth errors are documented on the API overview page.