GitHub v3 REST API

Create a commit comment

Create a comment for a commit using its :commit_sha.

This endpoint triggers notifications. Creating content too quickly using this endpoint may result in secondary rate limiting. See “Secondary rate limits” and “Dealing with secondary rate limits” for details.

post
{protocol}://{hostname}/api/v3/repos/{owner}/{repo}/commits/{commit_sha}/comments

Path Parameters

ownerstringrequired
repostringrequired
commit_shastringrequired

commit_sha parameter

Body

application/json
bodystringrequired

The contents of the comment.

pathstring

Relative path of the file to comment on.

positioninteger

Line index in the diff to comment on.

lineinteger

Deprecated. Use position parameter instead. Line number in the file to comment on.

Response

application/json

Response

Commit Comment

Commit Comment

html_urlstring(uri)required
urlstring(uri)required
idintegerrequired
node_idstringrequired
bodystringrequired
pathstring | nullrequired
positioninteger | nullrequired
lineinteger | nullrequired
commit_idstringrequired
userobject | nullrequired

Simple User

Show Child Parameters
created_atstring(date-time)required
updated_atstring(date-time)required
author_associationstringrequired

How the author is associated with the repository.

Allowed values:COLLABORATORCONTRIBUTORFIRST_TIMERFIRST_TIME_CONTRIBUTORMANNEQUINMEMBERNONEOWNER

Example:OWNER

reactionsobject
Show Child Parameters
post/repos/{owner}/{repo}/commits/{commit_sha}/comments

Body

{ "body": "Great stuff", "path": "file1.txt", "position": 4, "line": 1 }
 
application/json

List pull requests associated with a commit

Lists the merged pull request that introduced the commit to the repository. If the commit is not present in the default branch, additionally returns open pull requests associated with the commit. The results may include open and closed pull requests. Additional preview headers may be required to see certain details for associated pull requests, such as whether a pull request is in a draft state. For more information about previews that might affect this endpoint, see the List pull requests endpoint.

get
{protocol}://{hostname}/api/v3/repos/{owner}/{repo}/commits/{commit_sha}/pulls

Query Parameters

per_pageinteger

Results per page (max 100)

Default:30

pageinteger

Page number of the results to fetch.

Default:1

Path Parameters

ownerstringrequired
repostringrequired
commit_shastringrequired

commit_sha parameter

Response

200 application/json

Response

Pull Request Simple

urlstring(uri)required

Example:https://api.github.com/repos/octocat/Hello-World/pulls/1347

idintegerrequired

Example:1

node_idstringrequired

Example:MDExOlB1bGxSZXF1ZXN0MQ==

html_urlstring(uri)required

Example:https://github.com/octocat/Hello-World/pull/1347

diff_urlstring(uri)required

Example:https://github.com/octocat/Hello-World/pull/1347.diff

patch_urlstring(uri)required

Example:https://github.com/octocat/Hello-World/pull/1347.patch

issue_urlstring(uri)required

Example:https://api.github.com/repos/octocat/Hello-World/issues/1347

commits_urlstring(uri)required

Example:https://api.github.com/repos/octocat/Hello-World/pulls/1347/commits

review_comments_urlstring(uri)required

Example:https://api.github.com/repos/octocat/Hello-World/pulls/1347/comments

review_comment_urlstringrequired

Example:https://api.github.com/repos/octocat/Hello-World/pulls/comments{/number}

comments_urlstring(uri)required

Example:https://api.github.com/repos/octocat/Hello-World/issues/1347/comments

statuses_urlstring(uri)required

Example:https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e

numberintegerrequired

Example:1347

statestringrequired

Example:open

lockedbooleanrequired

Example:true

titlestringrequired

Example:new-feature

userobject | nullrequired

Simple User

Show Child Parameters
bodystring | nullrequired

Example:Please pull these awesome changes

labelsarray[object]required
Show Child Parameters
milestoneobject | nullrequired

A collection of related issues and pull requests.

Show Child Parameters
active_lock_reasonstring | null

Example:too heated

created_atstring(date-time)required

Example:2011-01-26T19:01:12Z

updated_atstring(date-time)required

Example:2011-01-26T19:01:12Z

closed_atstring | null(date-time)required

Example:2011-01-26T19:01:12Z

merged_atstring | null(date-time)required

Example:2011-01-26T19:01:12Z

merge_commit_shastring | nullrequired

Example:e5bd3914e2e596debea16f433f57875b5b90bcd6

assigneeobject | nullrequired

Simple User

Show Child Parameters
assigneesarray | null[object]

Simple User

Show Child Parameters
requested_reviewersarray | null[object]

Simple User

Show Child Parameters
requested_teamsarray | null[object]

Groups of organization members that gives permissions on specified repositories.

Show Child Parameters
headobjectrequired
Show Child Parameters
baseobjectrequired
Show Child Parameters
_linksobjectrequired
Show Child Parameters
author_associationstringrequired

How the author is associated with the repository.

Allowed values:COLLABORATORCONTRIBUTORFIRST_TIMERFIRST_TIME_CONTRIBUTORMANNEQUINMEMBERNONEOWNER

Example:OWNER

draftboolean

Indicates whether or not the pull request is a draft.

Example:false

get/repos/{owner}/{repo}/commits/{commit_sha}/pulls
 
200 application/json

Get a commit

Returns the contents of a single commit reference. You must have read access for the repository to use this endpoint.

Note: If there are more than 300 files in the commit diff, the response will include pagination link headers for the remaining files, up to a limit of 3000 files. Each page contains the static commit information, and the only changes are to the file listing.

You can pass the appropriate media type to fetch diff and patch formats. Diffs with binary data will have no patch property.

To return only the SHA-1 hash of the commit reference, you can provide the sha custom media type in the Accept header. You can use this endpoint to check if a remote reference’s SHA-1 hash is the same as your local reference’s SHA-1 hash by providing the local SHA-1 reference as the ETag.

Signature verification object

The response will include a verification object that describes the result of verifying the commit’s signature. The following fields are included in the verification object:

Name Type Description
verified boolean Indicates whether GitHub considers the signature in this commit to be verified.
reason string The reason for verified value. Possible values and their meanings are enumerated in table below.
signature string The signature that was extracted from the commit.
payload string The value that was signed.

These are the possible values for reason in the verification object:

Value Description
expired_key The key that made the signature is expired.
not_signing_key The “signing” flag is not among the usage flags in the GPG key that made the signature.
gpgverify_error There was an error communicating with the signature verification service.
gpgverify_unavailable The signature verification service is currently unavailable.
unsigned The object does not include a signature.
unknown_signature_type A non-PGP signature was found in the commit.
no_user No user was associated with the committer email address in the commit.
unverified_email The committer email address in the commit was associated with a user, but the email address is not verified on her/his account.
bad_email The committer email address in the commit is not included in the identities of the PGP key that made the signature.
unknown_key The key that made the signature has not been registered with any user’s account.
malformed_signature There was an error parsing the signature.
invalid The signature could not be cryptographically verified using the key whose key-id was found in the signature.
valid None of the above errors applied, so the signature is considered to be verified.
get
{protocol}://{hostname}/api/v3/repos/{owner}/{repo}/commits/{ref}

Query Parameters

pageinteger

Page number of the results to fetch.

Default:1

per_pageinteger

Results per page (max 100)

Default:30

Path Parameters

ownerstringrequired
repostringrequired
refstringrequired

ref parameter

Response

application/json

Response

Commit

Commit

urlstring(uri)required

Example:https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e

shastringrequired

Example:6dcb09b5b57875f334f61aebed695e2e4193db5e

node_idstringrequired

Example:MDY6Q29tbWl0NmRjYjA5YjViNTc4NzVmMzM0ZjYxYWViZWQ2OTVlMmU0MTkzZGI1ZQ==

html_urlstring(uri)required

Example:https://github.com/octocat/Hello-World/commit/6dcb09b5b57875f334f61aebed695e2e4193db5e

comments_urlstring(uri)required

Example:https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e/comments

commitobjectrequired
Show Child Parameters
authorobject | nullrequired

Simple User

Show Child Parameters
committerobject | nullrequired

Simple User

Show Child Parameters
parentsarray[object]required
Show Child Parameters
statsobject
Show Child Parameters
filesarray[object]

Diff Entry

Show Child Parameters
get/repos/{owner}/{repo}/commits/{ref}
 
application/json

Get the combined status for a specific reference

Users with pull access in a repository can access a combined view of commit statuses for a given ref. The ref can be a SHA, a branch name, or a tag name.

Additionally, a combined state is returned. The state is one of:

  • failure if any of the contexts report as error or failure
  • pending if there are no statuses or a context is pending
  • success if the latest status for all contexts is success
get
{protocol}://{hostname}/api/v3/repos/{owner}/{repo}/commits/{ref}/status

Query Parameters

per_pageinteger

Results per page (max 100)

Default:30

pageinteger

Page number of the results to fetch.

Default:1

Path Parameters

ownerstringrequired
repostringrequired
refstringrequired

ref parameter

Response

application/json

Response

Combined Commit Status

Combined Commit Status

statestringrequired
statusesarray[object]required
Show Child Parameters
shastringrequired
total_countintegerrequired
repositoryobjectrequired

Minimal Repository

Show Child Parameters
commit_urlstring(uri)required
urlstring(uri)required
get/repos/{owner}/{repo}/commits/{ref}/status
 
application/json

List commit statuses for a reference

Users with pull access in a repository can view commit statuses for a given ref. The ref can be a SHA, a branch name, or a tag name. Statuses are returned in reverse chronological order. The first status in the list will be the latest one.

This resource is also available via a legacy route: GET /repos/:owner/:repo/statuses/:ref.

get
{protocol}://{hostname}/api/v3/repos/{owner}/{repo}/commits/{ref}/statuses

Query Parameters

per_pageinteger

Results per page (max 100)

Default:30

pageinteger

Page number of the results to fetch.

Default:1

Path Parameters

ownerstringrequired
repostringrequired
refstringrequired

ref parameter

Response

application/json

Response

The status of a commit.

urlstringrequired
avatar_urlstring | nullrequired
idintegerrequired
node_idstringrequired
statestringrequired
descriptionstringrequired
target_urlstringrequired
contextstringrequired
created_atstringrequired
updated_atstringrequired
creatorobject | nullrequired

Simple User

Show Child Parameters
get/repos/{owner}/{repo}/commits/{ref}/statuses
 
application/json