{% extends "docs/base.html" %} {% block docs_content %}
Merge an open pull request into the target ref.
POST /api/v1/teams/{team_slug}/repos/{repo_slug}/pulls/{number}/merge
POST /api/v1/users/{username}/repos/{repo_slug}/pulls/{number}/merge
JSON body (optional optimistic concurrency checks):
message (optional, used when the merge produces a merge commit)expected_target_oid (optional)expected_source_oid (optional)curl --request POST \
--header "Authorization: Bearer $PEARING_API_TOKEN" \
--header "Content-Type: application/json" \
--data '{"message": "Merge feature into main", "expected_target_oid": "abc123"}' \
"$PEARING_API_URL/v1/teams/platform/repos/website/pulls/42/merge"
200 OK with merge metadata and updated pull, including creator, merger, and closer actor fields where applicable.
{
"pull": {
"uuid": "...",
"number": 42,
"status": "merged",
"merge_commit_oid": "def456"
},
"merge_mode": "merge_commit"
}
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 with error=repo_pull_already_merged when the pull is already merged.409 Conflict with error=repo_pull_merge_fast_forward_required when a fast-forward-only branch protection applies and the branches have diverged.409 Conflict with error=repo_pull_merge_content_conflict when a merge commit would have unresolved file conflicts. These responses include conflict_paths.409 Conflict with error=repo_pull_merge_stale for stale optimistic concurrency checks.500 Internal Server Error for merge execution failures.{
"error": "repo_pull_merge_content_conflict",
"detail": "Merge has unresolved file conflicts.",
"conflict_paths": ["README.md"]
}
Common auth errors are documented on the API overview page.