Pull requests
Get a pull request's merge options
How a pull request may merge now, as the merge box offers it to you: the methods it may merge by (the repository's, as the rules for its base allow them) and the one offered first (default_method); each method's default commit title and message, and why one cannot be used now (unavailable); whether it is behind its base, can fast-forward as it is, should be offered an update (suggest_update) or must be up to date (require_up_to_date); whether it goes through the merge queue; whether you may turn on auto-merge; whether deleting its branch starts ticked and is possible; and whether commits made merging it are signed off.
/repos/{owner}/{name}/pulls/{number}/merge-optionsmethods are the repository’s allowed methods, narrowed by the rules for the branch it merges into: required linear history leaves out merge. fast_forward lists unavailable until the branch contains its base’s head. merge and squash carry the commit message a merge would use if you wrote none. See Merging a pull request.
- Authentication: Optional. Public data can be read without a token; send one to see what is private.
- MCP tool:
pull_requestwithactionmerge_options, and the same inputs - Scope: An access token needs
pull_requests:read.
Path parameters
Section titled “Path parameters”| Name | Type | Required | Description |
|---|---|---|---|
owner |
string | Yes | The workspace that owns the repository. |
name |
string | Yes | The repository’s name. |
number |
integer | Yes | The number shown after the #. Issues and pull requests share one sequence. |
Example request
Section titled “Example request”curl https://api.g1t.sh/repos/flagon-io/hello/pulls/14/merge-options \ -H "Authorization: Bearer $G1T_TOKEN"Example response
Section titled “Example response”A successful request answers 200 with:
{ "methods": [ "merge", "squash", "rebase" ], "default_method": "squash", "options": [ { "method": "merge", "commit_title": "Merge pull request #14 from flagon-io/greet-caller", "commit_message": "Greeting should name the caller", "unavailable": null }, { "method": "squash", "commit_title": "Greeting should name the caller (#14)", "commit_message": "* Read the name from the first argument\n* Fall back to \"world\"", "unavailable": null }, { "method": "rebase", "commit_title": null, "commit_message": null, "unavailable": null } ], "behind": false, "can_fast_forward": false, "suggest_update": false, "require_up_to_date": false, "merge_queue": false, "auto_merge_allowed": true, "delete_branch_default": true, "can_delete_branch": true, "sign_off": false}Errors
Section titled “Errors”A failed request answers with one of these statuses and a body like {"error": {"code": "not_found", "message": "Repository not found."}}. See errors.
| Status | Code | When |
|---|---|---|
| 401 | unauthenticated |
A token is required, or the one sent is not valid. |
| 403 | forbidden |
The token is valid but not allowed to do this, such as a member-only change, or a token without the scope it needs. |
| 404 | not_found |
It does not exist, or you cannot see it. |
| 422 | invalid |
The input is not valid. message says which field and why. |