Enable auto-merge (merge when green)
PUT/api/repos/{owner}/{repo}/pulls/{number}/auto-merge
enableAutoMerge
Arms auto-merge on an open, non-draft pull request: the PR merges automatically — attributed to the arming account — the moment the merge gate (required checks, reviews, branch protection) reports mergeable. If the PR is already mergeable, it is merged immediately instead of being armed. A head push disarms it. Requires write access.
Requires authentication using a bearer token or a session cookie — see tokens and scopes.
curl
curl -X PUT 'https://neosource.dev/api/repos/OWNER/REPO/pulls/NUMBER/auto-merge' \
-H 'Authorization: Bearer $NEOSOURCE_TOKEN'fetch
fetch("https://neosource.dev/api/repos/OWNER/REPO/pulls/NUMBER/auto-merge", {
method: "PUT",
headers: {
Authorization: "Bearer $NEOSOURCE_TOKEN",
},
});Path parameters
ownerrequiredRepository owner or organization slug.
reporequiredRepository name.
numberrequiredChange request number.
Responses
200Auto-merge armed (or PR merged immediately)
application/json
Standard errors
Bodies documented once for the whole API — see standard errors.
- 400Bad Request — one of: invalid_input
- 401Authentication required
- 403Forbidden — one of: forbidden
- 404Not Found — one of: not_found
- 409Conflict — one of: already_exists, conflict, non_fast_forward, github_sync_active
- 423Locked — one of: busy
- 429Rate limited — retry after the `Retry-After` header
- 500Internal server error
- 503Service temporarily unavailable / at capacity — retry after the `Retry-After` header
- 504Gateway timeout — the request exceeded the server's handling budget