Pull Request API

The Pull Request API allows you to list, view, edit, create, and even merge pull requests. Comments on pull requests can be managed via the Issue Comments API.

Pull Requests use these custom media types. You can read more about the use of media types in the API here.

Pull Requests have these possible link relations:

self
The API location of this Pull Request.
html
The HTML location of this Pull Request.
comments
The API location of this Pull Request’s Issue comments.
review_comments
The API location of this Pull Request’s Review comments.

List pull requests

GET /repos/:owner/:repo/pulls

Parameters

state
Optional string - open or closed to filter by state. Default is open.
head
Optional string - Filter pulls by head user and branch name in the format of: user:ref-name. Example: github:new-script-format.
base
Optional string - Filter pulls by base branch name. Example: gh-pages.

Response

Status: 200 OK
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
[
  {
    "url": "https://api.github.com/octocat/Hello-World/pulls/1",
    "html_url": "https://github.com/octocat/Hello-World/pulls/1",
    "diff_url": "https://github.com/octocat/Hello-World/pulls/1.diff",
    "patch_url": "https://github.com/octocat/Hello-World/pulls/1.patch",
    "issue_url": "https://github.com/octocat/Hello-World/issue/1",
    "number": 1,
    "state": "open",
    "title": "new-feature",
    "body": "Please pull these awesome changes",
    "created_at": "2011-01-26T19:01:12Z",
    "updated_at": "2011-01-26T19:01:12Z",
    "closed_at": "2011-01-26T19:01:12Z",
    "merged_at": "2011-01-26T19:01:12Z",
    "head": {
      "label": "new-topic",
      "ref": "new-topic",
      "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
      "user": {
        "login": "octocat",
        "id": 1,
        "avatar_url": "https://github.com/images/error/octocat_happy.gif",
        "gravatar_id": "somehexcode",
        "url": "https://api.github.com/users/octocat"
      },
      "repo": {
        "id": 1296269,
        "owner": {
          "login": "octocat",
          "id": 1,
          "avatar_url": "https://github.com/images/error/octocat_happy.gif",
          "gravatar_id": "somehexcode",
          "url": "https://api.github.com/users/octocat"
        },
        "name": "Hello-World",
        "full_name": "octocat/Hello-World",
        "description": "This your first repo!",
        "private": false,
        "fork": false,
        "url": "https://api.github.com/repos/octocat/Hello-World",
        "html_url": "https://github.com/octocat/Hello-World",
        "clone_url": "https://github.com/octocat/Hello-World.git",
        "git_url": "git://github.com/octocat/Hello-World.git",
        "ssh_url": "git@github.com:octocat/Hello-World.git",
        "svn_url": "https://svn.github.com/octocat/Hello-World",
        "mirror_url": "git://git.example.com/octocat/Hello-World",
        "homepage": "https://github.com",
        "language": null,
        "forks": 9,
        "forks_count": 9,
        "watchers": 80,
        "watchers_count": 80,
        "size": 108,
        "master_branch": "master",
        "open_issues": 0,
        "pushed_at": "2011-01-26T19:06:43Z",
        "created_at": "2011-01-26T19:01:12Z",
        "updated_at": "2011-01-26T19:14:43Z"
      }
    },
    "base": {
      "label": "master",
      "ref": "master",
      "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
      "user": {
        "login": "octocat",
        "id": 1,
        "avatar_url": "https://github.com/images/error/octocat_happy.gif",
        "gravatar_id": "somehexcode",
        "url": "https://api.github.com/users/octocat"
      },
      "repo": {
        "id": 1296269,
        "owner": {
          "login": "octocat",
          "id": 1,
          "avatar_url": "https://github.com/images/error/octocat_happy.gif",
          "gravatar_id": "somehexcode",
          "url": "https://api.github.com/users/octocat"
        },
        "name": "Hello-World",
        "full_name": "octocat/Hello-World",
        "description": "This your first repo!",
        "private": false,
        "fork": false,
        "url": "https://api.github.com/repos/octocat/Hello-World",
        "html_url": "https://github.com/octocat/Hello-World",
        "clone_url": "https://github.com/octocat/Hello-World.git",
        "git_url": "git://github.com/octocat/Hello-World.git",
        "ssh_url": "git@github.com:octocat/Hello-World.git",
        "svn_url": "https://svn.github.com/octocat/Hello-World",
        "mirror_url": "git://git.example.com/octocat/Hello-World",
        "homepage": "https://github.com",
        "language": null,
        "forks": 9,
        "forks_count": 9,
        "watchers": 80,
        "watchers_count": 80,
        "size": 108,
        "master_branch": "master",
        "open_issues": 0,
        "pushed_at": "2011-01-26T19:06:43Z",
        "created_at": "2011-01-26T19:01:12Z",
        "updated_at": "2011-01-26T19:14:43Z"
      }
    },
    "_links": {
      "self": {
        "href": "https://api.github.com/octocat/Hello-World/pulls/1"
      },
      "html": {
        "href": "https://github.com/octocat/Hello-World/pull/1"
      },
      "comments": {
        "href": "https://api.github.com/octocat/Hello-World/issues/1/comments"
      },
      "review_comments": {
        "href": "https://api.github.com/octocat/Hello-World/pulls/1/comments"
      }
    },
    "user": {
      "login": "octocat",
      "id": 1,
      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
      "gravatar_id": "somehexcode",
      "url": "https://api.github.com/users/octocat"
    }
  }
]

Get a single pull request

GET /repos/:owner/:repo/pulls/:number

Response

Status: 200 OK
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
{
  "url": "https://api.github.com/octocat/Hello-World/pulls/1",
  "html_url": "https://github.com/octocat/Hello-World/pulls/1",
  "diff_url": "https://github.com/octocat/Hello-World/pulls/1.diff",
  "patch_url": "https://github.com/octocat/Hello-World/pulls/1.patch",
  "issue_url": "https://github.com/octocat/Hello-World/issue/1",
  "number": 1,
  "state": "open",
  "title": "new-feature",
  "body": "Please pull these awesome changes",
  "created_at": "2011-01-26T19:01:12Z",
  "updated_at": "2011-01-26T19:01:12Z",
  "closed_at": "2011-01-26T19:01:12Z",
  "merged_at": "2011-01-26T19:01:12Z",
  "head": {
    "label": "new-topic",
    "ref": "new-topic",
    "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
    "user": {
      "login": "octocat",
      "id": 1,
      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
      "gravatar_id": "somehexcode",
      "url": "https://api.github.com/users/octocat"
    },
    "repo": {
      "id": 1296269,
      "owner": {
        "login": "octocat",
        "id": 1,
        "avatar_url": "https://github.com/images/error/octocat_happy.gif",
        "gravatar_id": "somehexcode",
        "url": "https://api.github.com/users/octocat"
      },
      "name": "Hello-World",
      "full_name": "octocat/Hello-World",
      "description": "This your first repo!",
      "private": false,
      "fork": false,
      "url": "https://api.github.com/repos/octocat/Hello-World",
      "html_url": "https://github.com/octocat/Hello-World",
      "clone_url": "https://github.com/octocat/Hello-World.git",
      "git_url": "git://github.com/octocat/Hello-World.git",
      "ssh_url": "git@github.com:octocat/Hello-World.git",
      "svn_url": "https://svn.github.com/octocat/Hello-World",
      "mirror_url": "git://git.example.com/octocat/Hello-World",
      "homepage": "https://github.com",
      "language": null,
      "forks": 9,
      "forks_count": 9,
      "watchers": 80,
      "watchers_count": 80,
      "size": 108,
      "master_branch": "master",
      "open_issues": 0,
      "pushed_at": "2011-01-26T19:06:43Z",
      "created_at": "2011-01-26T19:01:12Z",
      "updated_at": "2011-01-26T19:14:43Z"
    }
  },
  "base": {
    "label": "master",
    "ref": "master",
    "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
    "user": {
      "login": "octocat",
      "id": 1,
      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
      "gravatar_id": "somehexcode",
      "url": "https://api.github.com/users/octocat"
    },
    "repo": {
      "id": 1296269,
      "owner": {
        "login": "octocat",
        "id": 1,
        "avatar_url": "https://github.com/images/error/octocat_happy.gif",
        "gravatar_id": "somehexcode",
        "url": "https://api.github.com/users/octocat"
      },
      "name": "Hello-World",
      "full_name": "octocat/Hello-World",
      "description": "This your first repo!",
      "private": false,
      "fork": false,
      "url": "https://api.github.com/repos/octocat/Hello-World",
      "html_url": "https://github.com/octocat/Hello-World",
      "clone_url": "https://github.com/octocat/Hello-World.git",
      "git_url": "git://github.com/octocat/Hello-World.git",
      "ssh_url": "git@github.com:octocat/Hello-World.git",
      "svn_url": "https://svn.github.com/octocat/Hello-World",
      "mirror_url": "git://git.example.com/octocat/Hello-World",
      "homepage": "https://github.com",
      "language": null,
      "forks": 9,
      "forks_count": 9,
      "watchers": 80,
      "watchers_count": 80,
      "size": 108,
      "master_branch": "master",
      "open_issues": 0,
      "pushed_at": "2011-01-26T19:06:43Z",
      "created_at": "2011-01-26T19:01:12Z",
      "updated_at": "2011-01-26T19:14:43Z"
    }
  },
  "_links": {
    "self": {
      "href": "https://api.github.com/octocat/Hello-World/pulls/1"
    },
    "html": {
      "href": "https://github.com/octocat/Hello-World/pull/1"
    },
    "comments": {
      "href": "https://api.github.com/octocat/Hello-World/issues/1/comments"
    },
    "review_comments": {
      "href": "https://api.github.com/octocat/Hello-World/pulls/1/comments"
    }
  },
  "user": {
    "login": "octocat",
    "id": 1,
    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    "gravatar_id": "somehexcode",
    "url": "https://api.github.com/users/octocat"
  },
  "merge_commit_sha": "e5bd3914e2e596debea16f433f57875b5b90bcd6",
  "merged": false,
  "mergeable": true,
  "merged_by": {
    "login": "octocat",
    "id": 1,
    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    "gravatar_id": "somehexcode",
    "url": "https://api.github.com/users/octocat"
  },
  "comments": 10,
  "commits": 3,
  "additions": 100,
  "deletions": 3,
  "changed_files": 5
}

Mergability

Each time the pull request receives new commits, GitHub creates a merge commit to test whether the pull request can be automatically merged into the base branch. (This test commit is not added to the base branch or the head branch.) The merge_commit_sha attribute holds the SHA of the test merge commit; however, this attribute is deprecated and is scheduled for removal in the next version of the API. The Boolean mergeable attribute will remain to indicate whether the pull request can be automatically merged.

Alternative Response Formats

Pass the appropriate media type to fetch diff and patch formats.

Create a pull request

POST /repos/:owner/:repo/pulls

Input

title
Required string
body
Optional string
base
Required string - The branch (or git ref) you want your changes pulled into. This should be an existing branch on the current repository. You cannot submit a pull request to one repo that requests a merge to a base of another repo.
head
Required string - The branch (or git ref) where your changes are implemented.

NOTE: head and base can be either a sha or a branch name. Typically you would namespace head with a user like this: username:branch.

{
  "title": "Amazing new feature",
  "body": "Please pull this in!",
  "head": "octocat:new-feature",
  "base": "master"
}

Alternative Input

You can also create a Pull Request from an existing Issue by passing an Issue number instead of title and body.

issue
Required number - Issue number in this repository to turn into a Pull Request.
{
  "issue": "5",
  "head": "octocat:new-feature",
  "base": "master"
}

Response

Status: 201 Created
Location: https://api.github.com/user/repo/pulls/1
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
{
  "url": "https://api.github.com/octocat/Hello-World/pulls/1",
  "html_url": "https://github.com/octocat/Hello-World/pulls/1",
  "diff_url": "https://github.com/octocat/Hello-World/pulls/1.diff",
  "patch_url": "https://github.com/octocat/Hello-World/pulls/1.patch",
  "issue_url": "https://github.com/octocat/Hello-World/issue/1",
  "number": 1,
  "state": "open",
  "title": "new-feature",
  "body": "Please pull these awesome changes",
  "created_at": "2011-01-26T19:01:12Z",
  "updated_at": "2011-01-26T19:01:12Z",
  "closed_at": "2011-01-26T19:01:12Z",
  "merged_at": "2011-01-26T19:01:12Z",
  "head": {
    "label": "new-topic",
    "ref": "new-topic",
    "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
    "user": {
      "login": "octocat",
      "id": 1,
      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
      "gravatar_id": "somehexcode",
      "url": "https://api.github.com/users/octocat"
    },
    "repo": {
      "id": 1296269,
      "owner": {
        "login": "octocat",
        "id": 1,
        "avatar_url": "https://github.com/images/error/octocat_happy.gif",
        "gravatar_id": "somehexcode",
        "url": "https://api.github.com/users/octocat"
      },
      "name": "Hello-World",
      "full_name": "octocat/Hello-World",
      "description": "This your first repo!",
      "private": false,
      "fork": false,
      "url": "https://api.github.com/repos/octocat/Hello-World",
      "html_url": "https://github.com/octocat/Hello-World",
      "clone_url": "https://github.com/octocat/Hello-World.git",
      "git_url": "git://github.com/octocat/Hello-World.git",
      "ssh_url": "git@github.com:octocat/Hello-World.git",
      "svn_url": "https://svn.github.com/octocat/Hello-World",
      "mirror_url": "git://git.example.com/octocat/Hello-World",
      "homepage": "https://github.com",
      "language": null,
      "forks": 9,
      "forks_count": 9,
      "watchers": 80,
      "watchers_count": 80,
      "size": 108,
      "master_branch": "master",
      "open_issues": 0,
      "pushed_at": "2011-01-26T19:06:43Z",
      "created_at": "2011-01-26T19:01:12Z",
      "updated_at": "2011-01-26T19:14:43Z"
    }
  },
  "base": {
    "label": "master",
    "ref": "master",
    "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
    "user": {
      "login": "octocat",
      "id": 1,
      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
      "gravatar_id": "somehexcode",
      "url": "https://api.github.com/users/octocat"
    },
    "repo": {
      "id": 1296269,
      "owner": {
        "login": "octocat",
        "id": 1,
        "avatar_url": "https://github.com/images/error/octocat_happy.gif",
        "gravatar_id": "somehexcode",
        "url": "https://api.github.com/users/octocat"
      },
      "name": "Hello-World",
      "full_name": "octocat/Hello-World",
      "description": "This your first repo!",
      "private": false,
      "fork": false,
      "url": "https://api.github.com/repos/octocat/Hello-World",
      "html_url": "https://github.com/octocat/Hello-World",
      "clone_url": "https://github.com/octocat/Hello-World.git",
      "git_url": "git://github.com/octocat/Hello-World.git",
      "ssh_url": "git@github.com:octocat/Hello-World.git",
      "svn_url": "https://svn.github.com/octocat/Hello-World",
      "mirror_url": "git://git.example.com/octocat/Hello-World",
      "homepage": "https://github.com",
      "language": null,
      "forks": 9,
      "forks_count": 9,
      "watchers": 80,
      "watchers_count": 80,
      "size": 108,
      "master_branch": "master",
      "open_issues": 0,
      "pushed_at": "2011-01-26T19:06:43Z",
      "created_at": "2011-01-26T19:01:12Z",
      "updated_at": "2011-01-26T19:14:43Z"
    }
  },
  "_links": {
    "self": {
      "href": "https://api.github.com/octocat/Hello-World/pulls/1"
    },
    "html": {
      "href": "https://github.com/octocat/Hello-World/pull/1"
    },
    "comments": {
      "href": "https://api.github.com/octocat/Hello-World/issues/1/comments"
    },
    "review_comments": {
      "href": "https://api.github.com/octocat/Hello-World/pulls/1/comments"
    }
  },
  "user": {
    "login": "octocat",
    "id": 1,
    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    "gravatar_id": "somehexcode",
    "url": "https://api.github.com/users/octocat"
  }
}

Update a pull request

PATCH /repos/:owner/:repo/pulls/:number

Input

title
Optional string
body
Optional string
state
Optional string - State of this Pull Request. Valid values are open and closed.
{
  "title": "new title",
  "body": "updated body",
  "state": "open"
}

Response

Status: 200 OK
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
{
  "url": "https://api.github.com/octocat/Hello-World/pulls/1",
  "html_url": "https://github.com/octocat/Hello-World/pulls/1",
  "diff_url": "https://github.com/octocat/Hello-World/pulls/1.diff",
  "patch_url": "https://github.com/octocat/Hello-World/pulls/1.patch",
  "issue_url": "https://github.com/octocat/Hello-World/issue/1",
  "number": 1,
  "state": "open",
  "title": "new-feature",
  "body": "Please pull these awesome changes",
  "created_at": "2011-01-26T19:01:12Z",
  "updated_at": "2011-01-26T19:01:12Z",
  "closed_at": "2011-01-26T19:01:12Z",
  "merged_at": "2011-01-26T19:01:12Z",
  "head": {
    "label": "new-topic",
    "ref": "new-topic",
    "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
    "user": {
      "login": "octocat",
      "id": 1,
      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
      "gravatar_id": "somehexcode",
      "url": "https://api.github.com/users/octocat"
    },
    "repo": {
      "id": 1296269,
      "owner": {
        "login": "octocat",
        "id": 1,
        "avatar_url": "https://github.com/images/error/octocat_happy.gif",
        "gravatar_id": "somehexcode",
        "url": "https://api.github.com/users/octocat"
      },
      "name": "Hello-World",
      "full_name": "octocat/Hello-World",
      "description": "This your first repo!",
      "private": false,
      "fork": false,
      "url": "https://api.github.com/repos/octocat/Hello-World",
      "html_url": "https://github.com/octocat/Hello-World",
      "clone_url": "https://github.com/octocat/Hello-World.git",
      "git_url": "git://github.com/octocat/Hello-World.git",
      "ssh_url": "git@github.com:octocat/Hello-World.git",
      "svn_url": "https://svn.github.com/octocat/Hello-World",
      "mirror_url": "git://git.example.com/octocat/Hello-World",
      "homepage": "https://github.com",
      "language": null,
      "forks": 9,
      "forks_count": 9,
      "watchers": 80,
      "watchers_count": 80,
      "size": 108,
      "master_branch": "master",
      "open_issues": 0,
      "pushed_at": "2011-01-26T19:06:43Z",
      "created_at": "2011-01-26T19:01:12Z",
      "updated_at": "2011-01-26T19:14:43Z"
    }
  },
  "base": {
    "label": "master",
    "ref": "master",
    "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
    "user": {
      "login": "octocat",
      "id": 1,
      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
      "gravatar_id": "somehexcode",
      "url": "https://api.github.com/users/octocat"
    },
    "repo": {
      "id": 1296269,
      "owner": {
        "login": "octocat",
        "id": 1,
        "avatar_url": "https://github.com/images/error/octocat_happy.gif",
        "gravatar_id": "somehexcode",
        "url": "https://api.github.com/users/octocat"
      },
      "name": "Hello-World",
      "full_name": "octocat/Hello-World",
      "description": "This your first repo!",
      "private": false,
      "fork": false,
      "url": "https://api.github.com/repos/octocat/Hello-World",
      "html_url": "https://github.com/octocat/Hello-World",
      "clone_url": "https://github.com/octocat/Hello-World.git",
      "git_url": "git://github.com/octocat/Hello-World.git",
      "ssh_url": "git@github.com:octocat/Hello-World.git",
      "svn_url": "https://svn.github.com/octocat/Hello-World",
      "mirror_url": "git://git.example.com/octocat/Hello-World",
      "homepage": "https://github.com",
      "language": null,
      "forks": 9,
      "forks_count": 9,
      "watchers": 80,
      "watchers_count": 80,
      "size": 108,
      "master_branch": "master",
      "open_issues": 0,
      "pushed_at": "2011-01-26T19:06:43Z",
      "created_at": "2011-01-26T19:01:12Z",
      "updated_at": "2011-01-26T19:14:43Z"
    }
  },
  "_links": {
    "self": {
      "href": "https://api.github.com/octocat/Hello-World/pulls/1"
    },
    "html": {
      "href": "https://github.com/octocat/Hello-World/pull/1"
    },
    "comments": {
      "href": "https://api.github.com/octocat/Hello-World/issues/1/comments"
    },
    "review_comments": {
      "href": "https://api.github.com/octocat/Hello-World/pulls/1/comments"
    }
  },
  "user": {
    "login": "octocat",
    "id": 1,
    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    "gravatar_id": "somehexcode",
    "url": "https://api.github.com/users/octocat"
  }
}

List commits on a pull request

GET /repos/:owner/:repo/pulls/:number/commits

Response

Status: 200 OK
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
[
  {
    "url": "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e",
    "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
    "commit": {
      "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e",
      "author": {
        "name": "Monalisa Octocat",
        "email": "support@github.com",
        "date": "2011-04-14T16:00:49Z"
      },
      "committer": {
        "name": "Monalisa Octocat",
        "email": "support@github.com",
        "date": "2011-04-14T16:00:49Z"
      },
      "message": "Fix all the bugs",
      "tree": {
        "url": "https://api.github.com/repos/octocat/Hello-World/tree/6dcb09b5b57875f334f61aebed695e2e4193db5e",
        "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e"
      }
    },
    "author": {
      "login": "octocat",
      "id": 1,
      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
      "gravatar_id": "somehexcode",
      "url": "https://api.github.com/users/octocat"
    },
    "committer": {
      "login": "octocat",
      "id": 1,
      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
      "gravatar_id": "somehexcode",
      "url": "https://api.github.com/users/octocat"
    },
    "parents": [
      {
        "url": "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e",
        "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e"
      }
    ]
  }
]

List pull requests files

GET /repos/:owner/:repo/pulls/:number/files

Response

Status: 200 OK
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
[
  {
    "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
    "filename": "file1.txt",
    "status": "added",
    "additions": 103,
    "deletions": 21,
    "changes": 124,
    "blob_url": "https://github.com/octocat/Hello-World/blob/6dcb09b5b57875f334f61aebed695e2e4193db5e/file1.txt",
    "raw_url": "https://github.com/octocat/Hello-World/raw/6dcb09b5b57875f334f61aebed695e2e4193db5e/file1.txt",
    "patch": "@@ -132,7 +132,7 @@ module Test @@ -1000,7 +1000,7 @@ module Test"
  }
]

Get if a pull request has been merged

GET /repos/:owner/:repo/pulls/:number/merge

Response if pull request has been merged

Status: 204 No Content
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999

Response if pull request has not been merged

Status: 404 Not Found
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999

Merge a pull request (Merge Button™)

PUT /repos/:owner/:repo/pulls/:number/merge

Input

commit_message
Optional string - The message that will be used for the merge commit

Response if merge was successful

Status: 200 OK
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
{
  "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
  "merged": true,
  "message": "Pull Request successfully merged"
}

Response if merge cannot be performed

Status: 405 Method not allowed
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
{
  "sha": null,
  "merged": false,
  "message": "Failure reason"
}

Custom media types

These are the supported media types for pull requests. You can read more about the use of media types in the API here.

application/vnd.github.VERSION.raw+json
application/vnd.github.VERSION.text+json
application/vnd.github.VERSION.html+json
application/vnd.github.VERSION.full+json