github.com – ghes-2.18
GitHub's v3 REST API.
- Homepage
- https://api.apis.guru/v2/specs/github.com:ghes-2.18/1.1.4.json
- Provider
- github.com:ghes-2.18 / ghes-2.18
- OpenAPI version
- 3.0.3
- Spec (JSON)
- https://api.apis.guru/v2/specs/github.com/ghes-2.18/1.1.4/openapi.json
- Spec (YAML)
- https://api.apis.guru/v2/specs/github.com/ghes-2.18/1.1.4/openapi.yaml
Tools (511)
Extracted live via the executor SDK.
-
activity.checkRepoIsStarredByAuthenticatedUser -
activity.deleteRepoSubscriptionThis endpoint should only be used to stop watching a repository. To control whether or not you wish to receive notifications from a repository, .
-
activity.deleteThreadSubscriptionMutes all future notifications for a conversation until you comment on the thread or get an @mention. If you are watching the repository of the thread, you will still receive notifications. To ignore future notifications for a repository you are watching, use the endpoint and set
ignoretotrue. -
activity.getFeedsGitHub Enterprise Server provides several timeline resources in format. The Feeds API lists all the feeds available to the authenticated user:
- Timeline: The GitHub Enterprise Server global public timeline
- User: The public timeline for any user, using
- Current user public: The public timeline for the authenticated user
- Current user: The private timeline for the authenticated user
- Current user actor: The private timeline for activity created by the authenticated user
- Current user organizations: The private timeline for the organizations the authenticated user is a member of.
- Security advisories: A collection of public announcements that provide information about security-related vulnerabilities in software on GitHub Enterprise Server.
Note: Private feeds are only returned when since current feed URIs use the older, non revocable auth tokens.
-
activity.getRepoSubscription -
activity.getThread -
activity.getThreadSubscriptionForAuthenticatedUserThis checks to see if the current user is subscribed to a thread. You can also .
Note that subscriptions are only generated if a user is participating in a conversation--for example, they've replied to the thread, were @mentioned, or manually subscribe to a thread.
-
activity.listEventsForAuthenticatedUserIf you are authenticated as the given user, you will see your private events. Otherwise, you'll only see public events.
-
activity.listNotificationsForAuthenticatedUserList all notifications for the current user, sorted by most recently updated.
-
activity.listOrgEventsForAuthenticatedUserThis is the user's organization dashboard. You must be authenticated as the user to view this.
-
activity.listPublicEventsWe delay the public events feed by five minutes, which means the most recent event returned by the public events API actually occurred at least five minutes ago.
-
activity.listPublicEventsForRepoNetwork -
activity.listPublicEventsForUser -
activity.listPublicOrgEvents -
activity.listReceivedEventsForUserThese are events that you've received by watching repos and following users. If you are authenticated as the given user, you will see private events. Otherwise, you'll only see public events.
-
activity.listReceivedPublicEventsForUser -
activity.listRepoEvents -
activity.listRepoNotificationsForAuthenticatedUserList all notifications for the current user.
-
activity.listReposStarredByAuthenticatedUserLists repositories the authenticated user has starred.
You can also find out when stars were created by passing the following custom via the
Acceptheader: -
activity.listReposStarredByUserLists repositories a user has starred.
You can also find out when stars were created by passing the following custom via the
Acceptheader: -
activity.listReposWatchedByUserLists repositories a user is watching.
-
activity.listStargazersForRepoLists the people that have starred the repository.
You can also find out when stars were created by passing the following custom via the
Acceptheader: -
activity.listWatchedReposForAuthenticatedUserLists repositories the authenticated user is watching.
-
activity.listWatchersForRepoLists the people watching the specified repository.
-
activity.markNotificationsAsReadMarks all notifications as "read" removes it from the . If the number of notifications is too large to complete in one request, you will receive a
202 Acceptedstatus and GitHub Enterprise Server will run an asynchronous process to mark notifications as "read." To check whether any "unread" notifications remain, you can use the endpoint and pass the query parameterall=false. -
activity.markRepoNotificationsAsReadMarks all notifications in a repository as "read" removes them from the . If the number of notifications is too large to complete in one request, you will receive a
202 Acceptedstatus and GitHub Enterprise Server will run an asynchronous process to mark notifications as "read." To check whether any "unread" notifications remain, you can use the endpoint and pass the query parameterall=false. -
activity.markThreadAsRead -
activity.setRepoSubscriptionIf you would like to watch a repository, set
subscribedtotrue. If you would like to ignore notifications made within a repository, setignoredtotrue. If you would like to stop watching a repository, completely. -
activity.setThreadSubscriptionIf you are watching a repository, you receive notifications for all threads by default. Use this endpoint to ignore future notifications for threads until you comment on the thread or get an @mention.
You can also use this endpoint to subscribe to threads that you are currently not receiving notifications for or to subscribed to threads that you have previously ignored.
Unsubscribing from a conversation in a repository that you are not watching is functionally equivalent to the endpoint.
-
activity.starRepoForAuthenticatedUserNote that you'll need to set
Content-Lengthto zero when calling out to this endpoint. For more information, see "." -
activity.unstarRepoForAuthenticatedUser -
apps.addRepoToInstallationAdd a single repository to an installation. The authenticated user must have admin access to the repository.
You must use a personal access token (which you can create via the or ) to access this endpoint.
-
apps.createContentAttachmentCreates an attachment under a content reference URL in the body or comment of an issue or pull request. Use the
idandrepositoryfull_nameof the content reference from the to create an attachment.The app must create a content attachment within six hours of the content reference URL being posted. See "" for details about content attachments.
You must use an to access this endpoint.
-
apps.createFromManifestUse this endpoint to complete the handshake necessary when implementing the . When you create a GitHub App with the manifest flow, you receive a temporary
codeused to retrieve the GitHub App'sid,pem(private key), andwebhook_secret. -
apps.createInstallationAccessTokenCreates an installation access token that enables a GitHub App to make authenticated API requests for the app's installation on an organization or individual account. Installation tokens expire one hour from the time you create them. Using an expired token produces a status code of
401 - Unauthorized, and requires creating a new installation token. By default the installation token has access to all repositories that the installation can access. To restrict the access to specific repositories, you can provide therepository_idswhen creating the token. When you omitrepository_ids, the response does not contain therepositorieskey.You must use a to access this endpoint.
-
apps.deleteInstallationUninstalls a GitHub App on a user, organization, or business account. You must use a to access this endpoint.
-
apps.getAuthenticatedReturns the GitHub App associated with the authentication credentials used. To see how many app installations are associated with this GitHub App, see the
installations_countin the response. For more details about your app's installations, see the "" endpoint.You must use a to access this endpoint.
-
apps.getBySlugNote: The
:app_slugis just the URL-friendly name of your GitHub App. You can find this on the settings page for your GitHub App (e.g.,https://github.com/settings/apps/:app_slug).If the GitHub App you specify is public, you can access this endpoint without authenticating. If the GitHub App you specify is private, you must authenticate with a or an to access this endpoint.
-
apps.getInstallationEnables an authenticated GitHub App to find an installation's information using the installation id. The installation's account type (
target_type) will be either an organization or a user account, depending which account the repository belongs to.You must use a to access this endpoint.
-
apps.getOrgInstallationEnables an authenticated GitHub App to find the organization's installation information.
You must use a to access this endpoint.
-
apps.getRepoInstallationEnables an authenticated GitHub App to find the repository's installation information. The installation's account type will be either an organization or a user account, depending which account the repository belongs to.
You must use a to access this endpoint.
-
apps.getUserInstallationEnables an authenticated GitHub App to find the user’s installation information.
You must use a to access this endpoint.
-
apps.listInstallationReposForAuthenticatedUserList repositories that the authenticated user has explicit permission (
:read,:write, or:admin) to access for an installation.The authenticated user has explicit permission to access repositories they own, repositories where they are a collaborator, and repositories that they can access through an organization membership.
You must use a , created for a user who has authorized your GitHub App, to access this endpoint.
The access the user has to each repository is included in the hash under the
permissionskey. -
apps.listInstallationsYou must use a to access this endpoint.
The permissions the installation has are included under the
permissionskey. -
apps.listInstallationsForAuthenticatedUserLists installations of your GitHub App that the authenticated user has explicit permission (
:read,:write, or:admin) to access.You must use a , created for a user who has authorized your GitHub App, to access this endpoint.
The authenticated user has explicit permission to access repositories they own, repositories where they are a collaborator, and repositories that they can access through an organization membership.
You can find the permissions for the installation under the
permissionskey. -
apps.listReposAccessibleToInstallationList repositories that an app installation can access.
You must use an to access this endpoint.
-
apps.removeRepoFromInstallationRemove a single repository from an installation. The authenticated user must have admin access to the repository.
You must use a personal access token (which you can create via the or ) to access this endpoint.
-
checks.createNote: The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty
pull_requestsarray.Creates a new check run for a specific commit in a repository. Your GitHub App must have the
checks:writepermission to create check runs.In a check suite, GitHub limits the number of check runs with the same name to 1000. Once these check runs exceed 1000, GitHub will start to automatically delete older check runs.
-
checks.createSuiteNote: The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty
pull_requestsarray and anullvalue forhead_branch.By default, check suites are automatically created when you create a . You only need to use this endpoint for manually creating check suites when you've disabled automatic creation using "". Your GitHub App must have the
checks:writepermission to create check suites. -
checks.getNote: The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty
pull_requestsarray.Gets a single check run using its
id. GitHub Apps must have thechecks:readpermission on a private repository or pull access to a public repository to get check runs. OAuth Apps and authenticated users must have thereposcope to get check runs in a private repository. -
checks.getSuiteNote: The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty
pull_requestsarray and anullvalue forhead_branch.Gets a single check suite using its
id. GitHub Apps must have thechecks:readpermission on a private repository or pull access to a public repository to get check suites. OAuth Apps and authenticated users must have thereposcope to get check suites in a private repository. -
checks.listAnnotationsLists annotations for a check run using the annotation
id. GitHub Apps must have thechecks:readpermission on a private repository or pull access to a public repository to get annotations for a check run. OAuth Apps and authenticated users must have thereposcope to get annotations for a check run in a private repository. -
checks.listForRefNote: The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty
pull_requestsarray.Lists check runs for a commit ref. The
refcan be a SHA, branch name, or a tag name. GitHub Apps must have thechecks:readpermission on a private repository or pull access to a public repository to get check runs. OAuth Apps and authenticated users must have thereposcope to get check runs in a private repository. -
checks.listForSuiteNote: The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty
pull_requestsarray.Lists check runs for a check suite using its
id. GitHub Apps must have thechecks:readpermission on a private repository or pull access to a public repository to get check runs. OAuth Apps and authenticated users must have thereposcope to get check runs in a private repository. -
checks.listSuitesForRefNote: The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty
pull_requestsarray and anullvalue forhead_branch.Lists check suites for a commit
ref. Therefcan be a SHA, branch name, or a tag name. GitHub Apps must have thechecks:readpermission on a private repository or pull access to a public repository to list check suites. OAuth Apps and authenticated users must have thereposcope to get check suites in a private repository. -
checks.rerequestSuiteTriggers GitHub to rerequest an existing check suite, without pushing new code to a repository. This endpoint will trigger the event with the action
rerequested. When a check suite isrerequested, itsstatusis reset toqueuedand theconclusionis cleared.To rerequest a check suite, your GitHub App must have the
checks:readpermission on a private repository or pull access to a public repository. -
checks.setSuitesPreferencesChanges the default automatic flow when creating check suites. By default, a check suite is automatically created each time code is pushed to a repository. When you disable the automatic creation of check suites, you can manually . You must have admin permissions in the repository to set preferences for check suites.
-
checks.updateNote: The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty
pull_requestsarray.Updates a check run for a specific commit in a repository. Your GitHub App must have the
checks:writepermission to edit check runs. -
codesOfConduct.getAllCodesOfConduct -
codesOfConduct.getConductCode -
emojis.getLists all the emojis available to use on GitHub Enterprise Server.
-
enterpriseAdmin.addAuthorizedSshKeyNote: The request body for this operation must be submitted as
application/x-www-form-urlencodeddata. You can submit a parameter value as a string, or you can use a tool such ascurlto submit a parameter value as the contents of a text file. For more information, see the . -
enterpriseAdmin.createEnterpriseServerLicenseWhen you boot a GitHub instance for the first time, you can use the following endpoint to upload a license.
Note that you need to
POSTto to start the actual configuration process.When using this endpoint, your GitHub instance must have a password set. This can be accomplished two ways:
- If you're working directly with the API before accessing the web interface, you must pass in the password parameter to set your password.
- If you set up your instance via the web interface before accessing the API, your calls to this endpoint do not need the password parameter.
Note: The request body for this operation must be submitted as
application/x-www-form-urlencodeddata. You can submit a parameter value as a string, or you can use a tool such ascurlto submit a parameter value as the contents of a text file. For more information, see the . -
enterpriseAdmin.createGlobalWebhook -
enterpriseAdmin.createImpersonationOAuthToken -
enterpriseAdmin.createOrg -
enterpriseAdmin.createPreReceiveEnvironment -
enterpriseAdmin.createPreReceiveHook -
enterpriseAdmin.createUserIf an external authentication mechanism is used, the login name should match the login name in the external system. If you are using LDAP authentication, you should also for the user.
The login name will be normalized to only contain alphanumeric characters or single hyphens. For example, if you send
"octo_cat"as the login, a user named"octo-cat"will be created.If the login name or email address is already associated with an account, the server will return a
422response. -
enterpriseAdmin.deleteGlobalWebhook -
enterpriseAdmin.deleteImpersonationOAuthToken -
enterpriseAdmin.deletePersonalAccessTokenDeletes a personal access token. Returns a
403 - Forbiddenstatus when a personal access token is in use. For example, if you access this endpoint with the same personal access token that you are trying to delete, you will receive this error. -
enterpriseAdmin.deletePreReceiveEnvironmentIf you attempt to delete an environment that cannot be deleted, you will receive a
422 Unprocessable Entityresponse.The possible error messages are:
- Cannot modify or delete the default environment
- Cannot delete environment that has hooks
- Cannot delete environment when download is in progress
-
enterpriseAdmin.deletePreReceiveHook -
enterpriseAdmin.deletePublicKey -
enterpriseAdmin.deleteUserDeleting a user will delete all their repositories, gists, applications, and personal settings. is often a better option.
You can delete any user account except your own.
-
enterpriseAdmin.demoteSiteAdministratorYou can demote any user account except your own.
-
enterpriseAdmin.enableOrDisableMaintenanceModeNote: The request body for this operation must be submitted as
application/x-www-form-urlencodeddata. You can submit a parameter value as a string, or you can use a tool such ascurlto submit a parameter value as the contents of a text file. For more information, see the . -
enterpriseAdmin.getAllAuthorizedSshKeys -
enterpriseAdmin.getAllStats -
enterpriseAdmin.getCommentStats -
enterpriseAdmin.getConfigurationStatusThis endpoint allows you to check the status of the most recent configuration process:
Note that you may need to wait several seconds after you start a process before you can check its status.
The different statuses are:
-
enterpriseAdmin.getDownloadStatusForPreReceiveEnvironmentIn addition to seeing the download status at the "" endpoint, there is also this separate endpoint for just the download status.
-
enterpriseAdmin.getEnterpriseStatsGists -
enterpriseAdmin.getGlobalWebhook -
enterpriseAdmin.getHooksStatsGet hooks statistics
-
enterpriseAdmin.getIssueStats -
enterpriseAdmin.getLicenseInformation -
enterpriseAdmin.getMaintenanceStatusCheck your installation's maintenance status:
-
enterpriseAdmin.getMilestoneStats -
enterpriseAdmin.getOrgStats -
enterpriseAdmin.getPagesStats -
enterpriseAdmin.getPreReceiveEnvironment -
enterpriseAdmin.getPreReceiveHook -
enterpriseAdmin.getPreReceiveHookForOrg -
enterpriseAdmin.getPreReceiveHookForRepo -
enterpriseAdmin.getPullRequestStats -
enterpriseAdmin.getRepoStatsGet repository statistics
-
enterpriseAdmin.getSettings -
enterpriseAdmin.getUserStats -
enterpriseAdmin.listGlobalWebhooks -
enterpriseAdmin.listPersonalAccessTokensLists personal access tokens for all users, including admin users.
-
enterpriseAdmin.listPreReceiveEnvironments -
enterpriseAdmin.listPreReceiveHooks -
enterpriseAdmin.listPreReceiveHooksForOrgList all pre-receive hooks that are enabled or testing for this organization as well as any disabled hooks that can be configured at the organization level. Globally disabled pre-receive hooks that do not allow downstream configuration are not listed.
-
enterpriseAdmin.listPreReceiveHooksForRepoList all pre-receive hooks that are enabled or testing for this repository as well as any disabled hooks that are allowed to be enabled at the repository level. Pre-receive hooks that are disabled at a higher level and are not configurable will not be listed.
-
enterpriseAdmin.listPublicKeys -
enterpriseAdmin.pingGlobalWebhookThis will trigger a to be sent to the webhook.
-
enterpriseAdmin.promoteUserToBeSiteAdministratorNote that you'll need to set
Content-Lengthto zero when calling out to this endpoint. For more information, see "." -
enterpriseAdmin.removeAuthorizedSshKeyNote: The request body for this operation must be submitted as
application/x-www-form-urlencodeddata. You can submit a parameter value as a string, or you can use a tool such ascurlto submit a parameter value as the contents of a text file. For more information, see the . -
enterpriseAdmin.removePreReceiveHookEnforcementForOrgRemoves any overrides for this hook at the org level for this org.
-
enterpriseAdmin.removePreReceiveHookEnforcementForRepoDeletes any overridden enforcement on this repository for the specified hook.
Responds with effective values inherited from owner and/or global level.
-
enterpriseAdmin.setSettingsFor a list of the available settings, see the .
Note: The request body for this operation must be submitted as
application/x-www-form-urlencodeddata. You can submit a parameter value as a string, or you can use a tool such ascurlto submit a parameter value as the contents of a text file. For more information, see the . -
enterpriseAdmin.startConfigurationProcessThis endpoint allows you to start a configuration process at any time for your updated settings to take effect:
-
enterpriseAdmin.startPreReceiveEnvironmentDownloadTriggers a new download of the environment tarball from the environment's
image_url. When the download is finished, the newly downloaded tarball will overwrite the existing environment.If a download cannot be triggered, you will receive a
422 Unprocessable Entityresponse.The possible error messages are:
- Cannot modify or delete the default environment
- Can not start a new download when a download is in progress
-
enterpriseAdmin.suspendUserIf your GitHub instance uses , Active Directory LDAP-authenticated users cannot be suspended through this API. If you attempt to suspend an Active Directory LDAP-authenticated user through this API, it will return a
403response.You can suspend any user account except your own.
Note that, if you choose not to pass any parameters, you'll need to set
Content-Lengthto zero when calling out to this endpoint. For more information, see "." -
enterpriseAdmin.syncLdapMappingForTeamNote that this API call does not automatically initiate an LDAP sync. Rather, if a
201is returned, the sync job is queued successfully, and is performed when the instance is ready. -
enterpriseAdmin.syncLdapMappingForUserNote that this API call does not automatically initiate an LDAP sync. Rather, if a
201is returned, the sync job is queued successfully, and is performed when the instance is ready. -
enterpriseAdmin.unsuspendUserIf your GitHub instance uses , this API is disabled and will return a
403response. Active Directory LDAP-authenticated users cannot be unsuspended using the API. -
enterpriseAdmin.updateGlobalWebhookParameters that are not provided will be overwritten with the default value or removed if no default exists.
-
enterpriseAdmin.updateLdapMappingForTeamUpdates the (DN) of the LDAP entry to map to a team. must be enabled to map LDAP entries to a team. Use the endpoint to create a team with LDAP mapping.
If you pass the
hellcat-previewmedia type, you can also update the LDAP mapping of a child team. -
enterpriseAdmin.updateLdapMappingForUser -
enterpriseAdmin.updateOrgName -
enterpriseAdmin.updatePreReceiveEnvironmentYou cannot modify the default environment. If you attempt to modify the default environment, you will receive a
422 Unprocessable Entityresponse. -
enterpriseAdmin.updatePreReceiveHook -
enterpriseAdmin.updatePreReceiveHookEnforcementForOrgFor pre-receive hooks which are allowed to be configured at the org level, you can set
enforcementandallow_downstream_configuration -
enterpriseAdmin.updatePreReceiveHookEnforcementForRepoFor pre-receive hooks which are allowed to be configured at the repo level, you can set
enforcement -
enterpriseAdmin.updateUsernameForUser -
enterpriseAdmin.upgradeLicenseThis API upgrades your license and also triggers the configuration process.
Note: The request body for this operation must be submitted as
application/x-www-form-urlencodeddata. You can submit a parameter value as a string, or you can use a tool such ascurlto submit a parameter value as the contents of a text file. For more information, see the . -
gists.checkIsStarred -
gists.createAllows you to add a new gist with one or more files.
Note: Don't name your files "gistfile" with a numerical suffix. This is the format of the automatic naming scheme that Gist uses internally.
-
gists.createComment -
gists.delete -
gists.deleteComment -
gists.forkNote: This was previously
/gists/:gist_id/fork. -
gists.get -
gists.getComment -
gists.getRevision -
gists.listLists the authenticated user's gists or if called anonymously, this endpoint returns all public gists:
-
gists.listComments -
gists.listCommits -
gists.listForks -
gists.listForUserLists public gists for the specified user:
-
gists.listPublicList public gists sorted by most recently updated to least recently updated.
Note: With , you can fetch up to 3000 gists. For example, you can fetch 100 pages with 30 gists per page or 30 pages with 100 gists per page.
-
gists.listStarredList the authenticated user's starred gists:
-
gists.starNote that you'll need to set
Content-Lengthto zero when calling out to this endpoint. For more information, see "." -
gists.unstar -
gists.updateAllows you to update or delete a gist file and rename gist files. Files from the previous version of the gist that aren't explicitly changed during an edit are unchanged.
-
gists.updateComment -
git.createBlob -
git.createCommitCreates a new Git .
Signature verification object
The response will include a
verificationobject that describes the result of verifying the commit's signature. The following fields are included in theverificationobject:These are the possible values for
reasonin theverificationobject: -
git.createRefCreates a reference for your repository. You are unable to create new references for empty repositories, even if the commit SHA-1 hash used exists. Empty repositories are repositories without branches.
-
git.createTagNote that creating a tag object does not create the reference that makes a tag in Git. If you want to create an annotated tag in Git, you have to do this call to create the tag object, and then the
refs/tags/[tag]reference. If you want to create a lightweight tag, you only have to the tag reference - this call would be unnecessary.Signature verification object
The response will include a
verificationobject that describes the result of verifying the commit's signature. The following fields are included in theverificationobject:These are the possible values for
reasonin theverificationobject: -
git.createTreeThe tree creation API accepts nested entries. If you specify both a tree and a nested path modifying that tree, this endpoint will overwrite the contents of the tree with the new path contents, and create a new tree structure.
If you use this endpoint to add, delete, or modify the file contents in a tree, you will need to commit the tree and then update a branch to point to the commit. For more information see "" and "."
-
git.deleteRef -
git.getAllRefsReturns an array of all the references from your Git database, including notes and stashes if they exist on the server. Anything in the namespace is returned, not just
headsandtags. If there are no references to list, a404is returned.Note: You need to explicitly to trigger a merge commit creation. For more information, see "".
You can also request a sub-namespace. For example, to get all the tag references, you can call:
-
git.getBlobThe
contentin the response will always be Base64 encoded.Note: This API supports blobs up to 100 megabytes in size.
-
git.getCommitGets a Git .
Signature verification object
The response will include a
verificationobject that describes the result of verifying the commit's signature. The following fields are included in theverificationobject:These are the possible values for
reasonin theverificationobject: -
git.getTagSignature verification object
The response will include a
verificationobject that describes the result of verifying the commit's signature. The following fields are included in theverificationobject:These are the possible values for
reasonin theverificationobject: -
git.getTreeReturns a single tree using the SHA1 value for that tree.
If
truncatedistruein the response then the number of items in thetreearray exceeded our maximum limit. If you need to fetch more items, use the non-recursive method of fetching trees, and fetch one sub-tree at a time. -
git.updateRef -
gitignore.getAllTemplatesList all templates available to pass as an option when .
-
gitignore.getTemplateThe API also allows fetching the source of a single template. Use the raw to get the raw contents.
-
issues.addAssigneesAdds up to 10 assignees to an issue. Users already assigned to an issue are not replaced.
-
issues.addLabels -
issues.checkUserCanBeAssignedChecks if a user has permission to be assigned to an issue in this repository.
If the
assigneecan be assigned to issues in the repository, a204header with no content is returned.Otherwise a
404status code is returned. -
issues.createAny user with pull access to a repository can create an issue. If , the API returns a
410 Gonestatus.This endpoint triggers . Creating content too quickly using this endpoint may result in secondary rate limiting. See "" and "" for details.
-
issues.createCommentThis endpoint triggers . Creating content too quickly using this endpoint may result in secondary rate limiting. See "" and "" for details.
-
issues.createLabel -
issues.createMilestone -
issues.deleteComment -
issues.deleteLabel -
issues.deleteMilestone -
issues.getThe API returns a if the issue was to another repository. If the issue was transferred to or deleted from a repository where the authenticated user lacks read access, the API returns a
404 Not Foundstatus. If the issue was deleted from a repository where the authenticated user has read access, the API returns a410 Gonestatus. To receive webhook events for transferred and deleted issues, subscribe to the webhook.Note: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request. For this reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by the
pull_requestkey. Be aware that theidof a pull request returned from "Issues" endpoints will be an issue id. To find out the pull request id, use the "" endpoint. -
issues.getComment -
issues.getEvent -
issues.getLabel -
issues.getMilestone -
issues.listList issues assigned to the authenticated user across all visible repositories including owned repositories, member repositories, and organization repositories. You can use the
filterquery parameter to fetch issues that are not necessarily assigned to you.Note: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request. For this reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by the
pull_requestkey. Be aware that theidof a pull request returned from "Issues" endpoints will be an issue id. To find out the pull request id, use the "" endpoint. -
issues.listAssigneesLists the for issues in a repository.
-
issues.listCommentsIssue Comments are ordered by ascending ID.
-
issues.listCommentsForRepoBy default, Issue Comments are ordered by ascending ID.
-
issues.listEvents -
issues.listEventsForRepo -
issues.listEventsForTimeline -
issues.listForAuthenticatedUserList issues across owned and member repositories assigned to the authenticated user.
Note: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request. For this reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by the
pull_requestkey. Be aware that theidof a pull request returned from "Issues" endpoints will be an issue id. To find out the pull request id, use the "" endpoint. -
issues.listForOrgList issues in an organization assigned to the authenticated user.
Note: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request. For this reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by the
pull_requestkey. Be aware that theidof a pull request returned from "Issues" endpoints will be an issue id. To find out the pull request id, use the "" endpoint. -
issues.listForRepoList issues in a repository.
Note: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request. For this reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by the
pull_requestkey. Be aware that theidof a pull request returned from "Issues" endpoints will be an issue id. To find out the pull request id, use the "" endpoint. -
issues.listLabelsForMilestone -
issues.listLabelsForRepo -
issues.listLabelsOnIssue -
issues.listMilestones -
issues.lockUsers with push access can lock an issue or pull request's conversation.
Note that, if you choose not to pass any parameters, you'll need to set
Content-Lengthto zero when calling out to this endpoint. For more information, see "." -
issues.removeAllLabels -
issues.removeAssigneesRemoves one or more assignees from an issue.
-
issues.removeLabelRemoves the specified label from the issue, and returns the remaining labels on the issue. This endpoint returns a
404 Not Foundstatus if the label does not exist. -
issues.setLabelsRemoves any previous labels and sets the new labels for an issue.
-
issues.unlockUsers with push access can unlock an issue's conversation.
-
issues.updateIssue owners and users with push access can edit an issue.
-
issues.updateComment -
issues.updateMilestone -
licenses.get -
licenses.getAllCommonlyUsed -
licenses.getForRepoThis method returns the contents of the repository's license file, if one is detected.
Similar to , this method also supports for retrieving the raw license content or rendered license HTML.
-
markdown.render -
markdown.renderRawYou must send Markdown as plain text (using a
Content-Typeheader oftext/plainortext/x-markdown) to this endpoint, rather than using JSON format. In raw mode, is not supported and Markdown will be rendered in plain format like a README.md file. Markdown content must be 400 KB or less. -
meta.get -
meta.getOctocatGet the octocat as ASCII art
-
meta.getZenGet a random sentence from the Zen of GitHub
-
meta.rootGet Hypermedia links to resources accessible in GitHub's REST API
-
oauthAuthorizations.checkAuthorizationOAuth applications can use a special API method for checking OAuth token validity without running afoul of normal rate limits for failed login attempts. Authentication works differently with this particular endpoint. You must use when accessing it, where the username is the OAuth application
client_idand the password is itsclient_secret. Invalid tokens will return404 NOT FOUND. -
oauthAuthorizations.createAuthorizationDeprecation Notice: GitHub Enterprise Server will discontinue the , which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our . The will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the .
Warning: Apps must use the to obtain OAuth tokens that work with GitHub Enterprise Server SAML organizations. OAuth tokens created using the Authorizations API will be unable to access GitHub Enterprise Server SAML organizations. For more information, see the .
Creates OAuth tokens using . If you have two-factor authentication setup, Basic Authentication for this endpoint requires that you use a one-time password (OTP) and your username and password instead of tokens. For more information, see "."
To create tokens for a particular OAuth application using this endpoint, you must authenticate as the user you want to create an authorization for and provide the app's client ID and secret, found on your OAuth application's settings page. If your OAuth application intends to create multiple tokens for one user, use
fingerprintto differentiate between them.You can also create tokens on GitHub Enterprise Server from the page. Read more about these tokens in .
Organizations that enforce SAML SSO require personal access tokens to be allowed. Read more about allowing tokens in .
-
oauthAuthorizations.deleteAuthorizationDeprecation Notice: GitHub Enterprise Server will discontinue the , which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our . The will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the .
-
oauthAuthorizations.deleteGrantDeprecation Notice: GitHub Enterprise Server will discontinue the , which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our . The will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the .
Deleting an OAuth application's grant will also delete all OAuth tokens associated with the application for your user. Once deleted, the application has no access to your account and is no longer listed on .
-
oauthAuthorizations.getAuthorizationDeprecation Notice: GitHub Enterprise Server will discontinue the , which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our . The will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the .
-
oauthAuthorizations.getGrantDeprecation Notice: GitHub Enterprise Server will discontinue the , which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our . The will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the .
-
oauthAuthorizations.getOrCreateAuthorizationForAppDeprecation Notice: GitHub Enterprise Server will discontinue the , which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our . The will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the .
Warning: Apps must use the to obtain OAuth tokens that work with GitHub Enterprise Server SAML organizations. OAuth tokens created using the Authorizations API will be unable to access GitHub Enterprise Server SAML organizations. For more information, see the .
Creates a new authorization for the specified OAuth application, only if an authorization for that application doesn't already exist for the user. The URL includes the 20 character client ID for the OAuth app that is requesting the token. It returns the user's existing authorization for the application if one is present. Otherwise, it creates and returns a new one.
If you have two-factor authentication setup, Basic Authentication for this endpoint requires that you use a one-time password (OTP) and your username and password instead of tokens. For more information, see "."
Deprecation Notice: GitHub Enterprise Server will discontinue the , which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our . The will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the .
-
oauthAuthorizations.getOrCreateAuthorizationForAppAndFingerprintDeprecation Notice: GitHub Enterprise Server will discontinue the , which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our . The will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the .
Warning: Apps must use the to obtain OAuth tokens that work with GitHub Enterprise Server SAML organizations. OAuth tokens created using the Authorizations API will be unable to access GitHub Enterprise Server SAML organizations. For more information, see the .
This method will create a new authorization for the specified OAuth application, only if an authorization for that application and fingerprint do not already exist for the user. The URL includes the 20 character client ID for the OAuth app that is requesting the token.
fingerprintis a unique string to distinguish an authorization from others created for the same client ID and user. It returns the user's existing authorization for the application if one is present. Otherwise, it creates and returns a new one.If you have two-factor authentication setup, Basic Authentication for this endpoint requires that you use a one-time password (OTP) and your username and password instead of tokens. For more information, see "."
-
oauthAuthorizations.listAuthorizationsDeprecation Notice: GitHub Enterprise Server will discontinue the , which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our . The will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the .
-
oauthAuthorizations.listGrantsDeprecation Notice: GitHub Enterprise Server will discontinue the , which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our . The will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the .
You can use this API to list the set of OAuth applications that have been granted access to your account. Unlike the API, this API does not manage individual tokens. This API will return one entry for each OAuth application that has been granted access to your account, regardless of the number of tokens an application has generated for your user. The list of OAuth applications returned matches what is shown on . The
scopesreturned are the union of scopes authorized for the application. For example, if an application has one token withreposcope and another token withuserscope, the grant will return["repo", "user"]. -
oauthAuthorizations.resetAuthorizationOAuth applications can use this API method to reset a valid OAuth token without end user involvement. Applications must save the "token" property in the response, because changes take effect immediately. You must use when accessing it, where the username is the OAuth application
client_idand the password is itsclient_secret. Invalid tokens will return404 NOT FOUND. -
oauthAuthorizations.revokeAuthorizationForApplicationOAuth application owners can revoke a single token for an OAuth application. You must use for this method, where the username is the OAuth application
client_idand the password is itsclient_secret. -
oauthAuthorizations.revokeGrantForApplicationOAuth application owners can revoke a grant for their OAuth application and a specific user. You must use for this method, where the username is the OAuth application
client_idand the password is itsclient_secret. You must also provide a valid token as:access_tokenand the grant for the token's owner will be deleted.Deleting an OAuth application's grant will also delete all OAuth tokens associated with the application for the user. Once deleted, the application will have no access to the user's account and will no longer be listed on .
-
oauthAuthorizations.updateAuthorizationDeprecation Notice: GitHub Enterprise Server will discontinue the , which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our . The will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the .
If you have two-factor authentication setup, Basic Authentication for this endpoint requires that you use a one-time password (OTP) and your username and password instead of tokens. For more information, see "."
You can only send one of these scope keys at a time.
-
orgs.checkMembershipForUserCheck if a user is, publicly or privately, a member of the organization.
-
orgs.checkPublicMembershipForUser -
orgs.convertMemberToOutsideCollaboratorWhen an organization member is converted to an outside collaborator, they'll only have access to the repositories that their current team membership allows. The user will no longer be a member of the organization. For more information, see "".
-
orgs.createWebhookHere's how you can create a hook that posts payloads in JSON format:
-
orgs.deleteWebhook -
orgs.getTo see many of the organization response values, you need to be an authenticated organization owner with the
admin:orgscope. When the value oftwo_factor_requirement_enabledistrue, the organization requires all members, billing managers, and outside collaborators to enable .GitHub Apps with the
Organization planpermission can use this endpoint to retrieve information about an organization's GitHub Enterprise Server plan. See "" for details. For an example response, see 'Response with GitHub Enterprise Server plan information' below." -
orgs.getMembershipForAuthenticatedUser -
orgs.getMembershipForUserIn order to get a user's membership with an organization, the authenticated user must be an organization member. The
stateparameter in the response can be used to identify the user's membership status. -
orgs.getWebhookReturns a webhook configured in an organization. To get only the webhook
configproperties, see "." -
orgs.listLists all organizations, in the order that they were created on GitHub Enterprise Server.
Note: Pagination is powered exclusively by the
sinceparameter. Use the to get the URL for the next page of organizations. -
orgs.listForAuthenticatedUserList organizations for the authenticated user.
OAuth scope requirements
This only lists organizations that your authorization allows you to operate on in some way (e.g., you can list teams with
read:orgscope, you can publicize your organization membership withuserscope, etc.). Therefore, this API requires at leastuserorread:orgscope. OAuth requests with insufficient scope receive a403 Forbiddenresponse. -
orgs.listForUserList for the specified user.
This method only lists public memberships, regardless of authentication. If you need to fetch all of the organization memberships (public and private) for the authenticated user, use the API instead.
-
orgs.listMembersList all users who are members of an organization. If the authenticated user is also a member of this organization then both concealed and public members will be returned.
-
orgs.listMembershipsForAuthenticatedUser -
orgs.listOutsideCollaboratorsList all users who are outside collaborators of an organization.
-
orgs.listPublicMembersMembers of an organization can choose to have their membership publicized or not.
-
orgs.listWebhooks -
orgs.pingWebhookThis will trigger a to be sent to the hook.
-
orgs.removeMemberRemoving a user from this list will remove them from all teams and they will no longer have any access to the organization's repositories.
-
orgs.removeMembershipForUserIn order to remove a user's membership with an organization, the authenticated user must be an organization owner.
If the specified user is an active member of the organization, this will remove them from the organization. If the specified user has been invited to the organization, this will cancel their invitation. The specified user will receive an email notification in both cases.
-
orgs.removeOutsideCollaboratorRemoving a user from this list will remove them from all the organization's repositories.
-
orgs.removePublicMembershipForAuthenticatedUser -
orgs.setMembershipForUserOnly authenticated organization owners can add a member to the organization or update the member's role.
-
If the authenticated user is adding a member to the organization, the invited user will receive an email inviting them to the organization. The user's will be
pendinguntil they accept the invitation. -
Authenticated users can update a user's membership by passing the
roleparameter. If the authenticated user changes a member's role toadmin, the affected user will receive an email notifying them that they've been made an organization owner. If the authenticated user changes an owner's role tomember, no email will be sent.
Rate limits
To prevent abuse, the authenticated user is limited to 50 organization invitations per 24 hour period. If the organization is more than one month old or on a paid plan, the limit is 500 invitations per 24 hour period.
-
-
orgs.setPublicMembershipForAuthenticatedUserThe user can publicize their own membership. (A user cannot publicize the membership for another user.)
Note that you'll need to set
Content-Lengthto zero when calling out to this endpoint. For more information, see "." -
orgs.updateParameter Deprecation Notice: GitHub Enterprise Server will replace and discontinue
members_allowed_repository_creation_typein favor of more granular permissions. The new input parameters aremembers_can_create_public_repositories,members_can_create_private_repositoriesfor all organizations andmembers_can_create_internal_repositoriesfor organizations associated with an enterprise account using GitHub Enterprise Cloud or GitHub Enterprise Server 2.20+. For more information, see the .Enables an authenticated organization owner with the
admin:orgscope to update the organization's profile and member privileges. -
orgs.updateMembershipForAuthenticatedUser -
orgs.updateWebhookUpdates a webhook configured in an organization. When you update a webhook, the
secretwill be overwritten. If you previously had asecretset, you must provide the samesecretor set a newsecretor the secret will be removed. If you are only updating individual webhookconfigproperties, use "." -
projects.addCollaboratorAdds a collaborator to an organization project and sets their permission level. You must be an organization owner or a project
adminto add a collaborator. -
projects.createCard -
projects.createColumn -
projects.createForAuthenticatedUser -
projects.createForOrgCreates an organization project board. Returns a
404 Not Foundstatus if projects are disabled in the organization. If you do not have sufficient privileges to perform this action, a401 Unauthorizedor410 Gonestatus is returned. -
projects.createForRepoCreates a repository project board. Returns a
404 Not Foundstatus if projects are disabled in the repository. If you do not have sufficient privileges to perform this action, a401 Unauthorizedor410 Gonestatus is returned. -
projects.deleteDeletes a project board. Returns a
404 Not Foundstatus if projects are disabled. -
projects.deleteCard -
projects.deleteColumn -
projects.getGets a project by its
id. Returns a404 Not Foundstatus if projects are disabled. If you do not have sufficient privileges to perform this action, a401 Unauthorizedor410 Gonestatus is returned. -
projects.getCard -
projects.getColumn -
projects.getPermissionForUserReturns the collaborator's permission level for an organization project. Possible values for the
permissionkey:admin,write,read,none. You must be an organization owner or a projectadminto review a user's permission level. -
projects.listCards -
projects.listCollaboratorsLists the collaborators for an organization project. For a project, the list of collaborators includes outside collaborators, organization members that are direct collaborators, organization members with access through team memberships, organization members with access through default organization permissions, and organization owners. You must be an organization owner or a project
adminto list collaborators. -
projects.listColumns -
projects.listForOrgLists the projects in an organization. Returns a
404 Not Foundstatus if projects are disabled in the organization. If you do not have sufficient privileges to perform this action, a401 Unauthorizedor410 Gonestatus is returned. -
projects.listForRepoLists the projects in a repository. Returns a
404 Not Foundstatus if projects are disabled in the repository. If you do not have sufficient privileges to perform this action, a401 Unauthorizedor410 Gonestatus is returned. -
projects.listForUser -
projects.moveCard -
projects.moveColumn -
projects.removeCollaboratorRemoves a collaborator from an organization project. You must be an organization owner or a project
adminto remove a collaborator. -
projects.updateUpdates a project board's information. Returns a
404 Not Foundstatus if projects are disabled. If you do not have sufficient privileges to perform this action, a401 Unauthorizedor410 Gonestatus is returned. -
projects.updateCard -
projects.updateColumn -
pulls.checkIfMerged -
pulls.createDraft pull requests are available in public repositories with GitHub Free and GitHub Free for organizations, GitHub Pro, and legacy per-repository billing plans, and in public and private repositories with GitHub Team, GitHub Enterprise Server 2.17+, and GitHub Enterprise Cloud. You can create a new pull request. This endpoint triggers . Creating content too quickly using this endpoint may result in secondary rate limiting. See "" for details.
-
pulls.createReplyForReviewCommentCreates a reply to a review comment for a pull request. For the
comment_id, provide the ID of the review comment you are replying to. This must be the ID of a top-level review comment, not a reply to that comment. Replies to replies are not supported.This endpoint triggers . Creating content too quickly using this endpoint may result in secondary rate limiting. See "" and "" for details.
-
pulls.createReviewThis endpoint triggers . Creating content too quickly using this endpoint may result in secondary rate limiting. See "" and "" for details.
Pull request reviews created in the
PENDINGstate do not include thesubmitted_atproperty in the response.Note: To comment on a specific line in a file, you need to first determine the position of that line in the diff. The GitHub REST API v3 offers the
application/vnd.github.v3.diff. To see a pull request diff, add this media type to theAcceptheader of a call to the endpoint.The
positionvalue equals the number of lines down from the first "@@" hunk header in the file you want to add a comment. The line just below the "@@" line is position 1, the next line is position 2, and so on. The position in the diff continues to increase through lines of whitespace and additional hunks until the beginning of a new file. -
pulls.createReviewCommentAlternativeCreates a review comment in the pull request diff. To add a regular comment to a pull request timeline, see "."
Note: The position value equals the number of lines down from the first "@@" hunk header in the file you want to add a comment. The line just below the "@@" line is position 1, the next line is position 2, and so on. The position in the diff continues to increase through lines of whitespace and additional hunks until the beginning of a new file.
This endpoint triggers . Creating content too quickly using this endpoint may result in secondary rate limiting. See "" for details.
-
pulls.deletePendingReview -
pulls.deleteReviewCommentDeletes a review comment.
-
pulls.dismissReviewNote: To dismiss a pull request review on a , you must be a repository administrator or be included in the list of people or teams who can dismiss pull request reviews.
-
pulls.getDraft pull requests are available in public repositories with GitHub Free and GitHub Free for organizations, GitHub Pro, and legacy per-repository billing plans, and in public and private repositories with GitHub Team and GitHub Enterprise Cloud. For more information, see in the GitHub Help documentation.
Lists details of a pull request by providing its number.
When you get, , or a pull request, GitHub Enterprise Server 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. You can review the status of the test commit using the
mergeablekey. For more information, see "".The value of the
mergeableattribute can betrue,false, ornull. If the value isnull, then GitHub Enterprise Server has started a background job to compute the mergeability. After giving the job time to complete, resubmit the request. When the job finishes, you will see a non-nullvalue for themergeableattribute in the response. Ifmergeableistrue, thenmerge_commit_shawill be the SHA of the test merge commit.The value of the
merge_commit_shaattribute changes depending on the state of the pull request. Before merging a pull request, themerge_commit_shaattribute holds the SHA of the test merge commit. After merging a pull request, themerge_commit_shaattribute changes depending on how you merged the pull request:- If merged as a ,
merge_commit_sharepresents the SHA of the merge commit. - If merged via a ,
merge_commit_sharepresents the SHA of the squashed commit on the base branch. - If ,
merge_commit_sharepresents the commit that the base branch was updated to.
Pass the appropriate to fetch diff and patch formats.
- If merged as a ,
-
pulls.getReview -
pulls.getReviewCommentProvides details for a review comment.
-
pulls.listDraft pull requests are available in public repositories with GitHub Free and GitHub Free for organizations, GitHub Pro, and legacy per-repository billing plans, and in public and private repositories with GitHub Team, GitHub Enterprise Server 2.17+, and GitHub Enterprise Cloud.
-
pulls.listCommentsForReviewList comments for a specific pull request review.
-
pulls.listCommitsLists a maximum of 250 commits for a pull request. To receive a complete commit list for pull requests with more than 250 commits, use the endpoint.
-
pulls.listFilesNote: Responses include a maximum of 3000 files. The paginated response returns 30 files per page by default.
-
pulls.listRequestedReviewers -
pulls.listReviewCommentsLists all review comments for a pull request. By default, review comments are in ascending order by ID.
-
pulls.listReviewCommentsForRepoLists review comments for all pull requests in a repository. By default, review comments are in ascending order by ID.
-
pulls.listReviewsThe list of reviews returns in chronological order.
-
pulls.mergeMerge a pull request
-
pulls.removeRequestedReviewers -
pulls.requestReviewersRequest reviewers for a pull request
-
pulls.submitReview -
pulls.updateDraft pull requests are available in public repositories with GitHub Free and GitHub Free for organizations, GitHub Pro, and legacy per-repository billing plans, and in public and private repositories with GitHub Team, GitHub Enterprise Server 2.17+, and GitHub Enterprise Cloud.
-
pulls.updateBranchUpdates the pull request branch with the latest upstream changes by merging HEAD from the base branch into the pull request branch.
-
pulls.updateReviewUpdate the review summary comment with new text.
-
pulls.updateReviewCommentEnables you to edit a review comment.
-
rateLimit.getNote: Accessing this endpoint does not count against your REST API rate limit.
Note: The
rateobject is deprecated. If you're writing new API client code or updating existing code, you should use thecoreobject instead of therateobject. Thecoreobject contains the same information that is present in therateobject. -
reactions.createForCommitCommentCreate a reaction to a . A response with an HTTP
200status means that you already added the reaction type to this commit comment. -
reactions.createForIssueCreate a reaction to an . A response with an HTTP
200status means that you already added the reaction type to this issue. -
reactions.createForIssueCommentCreate a reaction to an . A response with an HTTP
200status means that you already added the reaction type to this issue comment. -
reactions.createForPullRequestReviewCommentCreate a reaction to a . A response with an HTTP
200status means that you already added the reaction type to this pull request review comment. -
reactions.createForTeamDiscussionCreate a reaction to a . OAuth access tokens require the
write:discussion. A response with an HTTP200status means that you already added the reaction type to this team discussion. -
reactions.createForTeamDiscussionCommentCreate a reaction to a . OAuth access tokens require the
write:discussion. A response with an HTTP200status means that you already added the reaction type to this team discussion comment. -
reactions.deleteOAuth access tokens require the
write:discussion, when deleting a or . -
reactions.listForCommitCommentList the reactions to a .
-
reactions.listForIssueList the reactions to an .
-
reactions.listForIssueCommentList the reactions to an .
-
reactions.listForPullRequestReviewCommentList the reactions to a .
-
reactions.listForTeamDiscussionList the reactions to a . OAuth access tokens require the
read:discussion. -
reactions.listForTeamDiscussionCommentList the reactions to a . OAuth access tokens require the
read:discussion. -
repos.acceptInvitation -
repos.addCollaboratorThis endpoint triggers . Creating content too quickly using this endpoint may result in secondary rate limiting. See "" and "" for details.
For more information the permission levels, see "".
Note that, if you choose not to pass any parameters, you'll need to set
Content-Lengthto zero when calling out to this endpoint. For more information, see "."The invitee will receive a notification that they have been invited to the repository, which they must accept or decline. They may do this via the notifications page, the email they receive, or by using the .
Rate limits
You are limited to sending 50 invitations to a repository per 24 hour period. Note there is no limit if you are inviting organization members to an organization repository.
-
repos.addStatusCheckContextsProtected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see in the GitHub Help documentation.
-
repos.addTeamAccessRestrictionsProtected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see in the GitHub Help documentation.
Grants the specified teams push access for this branch. You can also give push access to child teams.
-
repos.addUserAccessRestrictionsProtected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see in the GitHub Help documentation.
Grants the specified people push access for this branch.
-
repos.checkCollaboratorFor organization-owned repositories, the list of collaborators includes outside collaborators, organization members that are direct collaborators, organization members with access through team memberships, organization members with access through default organization permissions, and organization owners.
Team members will include the members of child teams.
-
repos.compareCommitsThe
baseheadparam is comprised of two parts:baseandhead. Both must be branch names inrepo. To compare branches across other repositories in the same network asrepo, use the format<USERNAME>:branch.The response from the API is equivalent to running the
git log base..headcommand; however, commits are returned in chronological order. Pass the appropriate to fetch diff and patch formats.The response also includes details on the files that were changed between the two commits. This includes the status of the change (for example, if a file was added, removed, modified, or renamed), and details of the change itself. For example, files with a
renamedstatus have aprevious_filenamefield showing the previous filename of the file, and files with amodifiedstatus have apatchfield showing the changes made to the file.Working with large comparisons
The response will include a comparison of up to 250 commits. If you are working with a larger commit range, you can use the to enumerate all commits in the range.
For comparisons with extremely large diffs, you may receive an error response indicating that the diff took too long to generate. You can typically resolve this error by using a smaller commit range.
Signature verification object
The response will include a
verificationobject that describes the result of verifying the commit's signature. The following fields are included in theverificationobject:These are the possible values for
reasonin theverificationobject: -
repos.createCommitCommentCreate a comment for a commit using its
:commit_sha.This endpoint triggers . Creating content too quickly using this endpoint may result in secondary rate limiting. See "" and "" for details.
-
repos.createCommitSignatureProtectionProtected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see in the GitHub Help documentation.
When authenticated with admin or owner permissions to the repository, you can use this endpoint to require signed commits on a branch. You must enable branch protection to require signed commits.
-
repos.createCommitStatusUsers with push access in a repository can create commit statuses for a given SHA.
Note: there is a limit of 1000 statuses per
shaandcontextwithin a repository. Attempts to create more than 1000 statuses will result in a validation error. -
repos.createDeployKeyYou can create a read-only deploy key.
-
repos.createDeploymentDeployments offer a few configurable parameters with certain defaults.
The
refparameter can be any named branch, tag, or SHA. At GitHub Enterprise Server we often deploy branches and verify them before we merge a pull request.The
environmentparameter allows deployments to be issued to different runtime environments. Teams often have multiple environments for verifying their applications, such asproduction,staging, andqa. This parameter makes it easier to track which environments have requested deployments. The default environment isproduction.The
auto_mergeparameter is used to ensure that the requested ref is not behind the repository's default branch. If the ref is behind the default branch for the repository, we will attempt to merge it for you. If the merge succeeds, the API will return a successful merge commit. If merge conflicts prevent the merge from succeeding, the API will return a failure response.By default, for every submitted context must be in a
successstate. Therequired_contextsparameter allows you to specify a subset of contexts that must besuccess, or to specify contexts that have not yet been submitted. You are not required to use commit statuses to deploy. If you do not require any contexts or create any commit statuses, the deployment will always succeed.The
payloadparameter is available for any extra information that a deployment system might need. It is a JSON text field that will be passed on when a deployment event is dispatched.The
taskparameter is used by the deployment system to allow different execution paths. In the web world this might bedeploy:migrationsto run schema changes on the system. In the compiled world this could be a flag to compile an application with debugging enabled.Users with
repoorrepo_deploymentscopes can create a deployment for a given ref.Merged branch response
You will see this response when GitHub automatically merges the base branch into the topic branch instead of creating a deployment. This auto-merge happens when:
- Auto-merge option is enabled in the repository
- Topic branch does not include the latest changes on the base branch, which is
masterin the response example - There are no merge conflicts
If there are no new commits in the base branch, a new request to create a deployment should give a successful response.
Merge conflict response
This error happens when the
auto_mergeoption is enabled and when the default branch (in this casemaster), can't be merged into the branch that's being deployed (in this casetopic-branch), due to merge conflicts.Failed commit status checks
This error happens when the
required_contextsparameter indicates that one or more contexts need to have asuccessstatus for the commit to be deployed, but one or more of the required contexts do not have a state ofsuccess. -
repos.createDeploymentStatusUsers with
pushaccess can create deployment statuses for a given deployment.GitHub Apps require
read & writeaccess to "Deployments" andread-onlyaccess to "Repo contents" (for private repos). OAuth Apps require therepo_deploymentscope. -
repos.createForAuthenticatedUserCreates a new repository for the authenticated user.
OAuth scope requirements
When using , authorizations must include:
public_reposcope orreposcope to create a public repository. Note: For GitHub AE, usereposcope to create an internal repository.reposcope to create a private repository.
-
repos.createForkCreate a fork for the authenticated user.
Note: Forking a Repository happens asynchronously. You may have to wait a short period of time before you can access the git objects. If this takes longer than 5 minutes, be sure to contact .
-
repos.createInOrgCreates a new repository in the specified organization. The authenticated user must be a member of the organization.
OAuth scope requirements
When using , authorizations must include:
public_reposcope orreposcope to create a public repository. Note: For GitHub AE, usereposcope to create an internal repository.reposcope to create a private repository
-
repos.createOrUpdateFileContentsCreates a new file or replaces an existing file in a repository.
-
repos.createPagesSiteConfigures a GitHub Enterprise Server Pages site. For more information, see "."
-
repos.createReleaseUsers with push access to the repository can create a release.
This endpoint triggers . Creating content too quickly using this endpoint may result in secondary rate limiting. See "" and "" for details.
-
repos.createUsingTemplateCreates a new repository using a repository template. Use the
template_ownerandtemplate_reporoute parameters to specify the repository to use as the template. The authenticated user must own or be a member of an organization that owns the repository. To check if a repository is available to use as a template, get the repository's information using the endpoint and check that theis_templatekey istrue.OAuth scope requirements
When using , authorizations must include:
public_reposcope orreposcope to create a public repository. Note: For GitHub AE, usereposcope to create an internal repository.reposcope to create a private repository
-
repos.createWebhookRepositories can have multiple webhooks installed. Each webhook should have a unique
config. Multiple webhooks can share the sameconfigas long as those webhooks do not have anyeventsthat overlap. -
repos.declineInvitation -
repos.deleteDeleting a repository requires admin access. If OAuth is used, the
delete_reposcope is required.If an organization owner has configured the organization to prevent members from deleting organization-owned repositories, you will get a
403 Forbiddenresponse. -
repos.deleteAccessRestrictionsProtected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see in the GitHub Help documentation.
Disables the ability to restrict who can push to this branch.
-
repos.deleteAdminBranchProtectionProtected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see in the GitHub Help documentation.
Removing admin enforcement requires admin or owner permissions to the repository and branch protection to be enabled.
-
repos.deleteBranchProtectionProtected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see in the GitHub Help documentation.
-
repos.deleteCommitComment -
repos.deleteCommitSignatureProtectionProtected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see in the GitHub Help documentation.
When authenticated with admin or owner permissions to the repository, you can use this endpoint to disable required signed commits on a branch. You must enable branch protection to require signed commits.
-
repos.deleteDeployKeyDeploy keys are immutable. If you need to update a key, remove the key and create a new one instead.
-
repos.deleteFileDeletes a file in a repository.
You can provide an additional
committerparameter, which is an object containing information about the committer. Or, you can provide anauthorparameter, which is an object containing information about the author.The
authorsection is optional and is filled in with thecommitterinformation if omitted. If thecommitterinformation is omitted, the authenticated user's information is used.You must provide values for both
nameandemail, whether you choose to useauthororcommitter. Otherwise, you'll receive a422status code. -
repos.deleteInvitation -
repos.deletePagesSite -
repos.deletePullRequestReviewProtectionProtected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see in the GitHub Help documentation.
-
repos.deleteReleaseUsers with push access to the repository can delete a release.
-
repos.deleteReleaseAsset -
repos.deleteWebhook -
repos.downloadTarballArchiveGets a redirect URL to download a tar archive for a repository. If you omit
:ref, the repository’s default branch (usuallymaster) will be used. Please make sure your HTTP framework is configured to follow redirects or you will need to use theLocationheader to make a secondGETrequest. Note: For private repositories, these links are temporary and expire after five minutes. -
repos.downloadZipballArchiveGets a redirect URL to download a zip archive for a repository. If you omit
:ref, the repository’s default branch (usuallymaster) will be used. Please make sure your HTTP framework is configured to follow redirects or you will need to use theLocationheader to make a secondGETrequest. Note: For private repositories, these links are temporary and expire after five minutes. -
repos.getWhen you pass the
scarlet-witch-previewmedia type, requests to get a repository will also return the repository's code of conduct if it can be detected from the repository's code of conduct file.The
parentandsourceobjects are present when the repository is a fork.parentis the repository this repository was forked from,sourceis the ultimate source for the network. -
repos.getAccessRestrictionsProtected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see in the GitHub Help documentation.
Lists who has access to this protected branch.
Note: Users, apps, and teams
restrictionsare only available for organization-owned repositories. -
repos.getAdminBranchProtectionProtected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see in the GitHub Help documentation.
-
repos.getAllStatusCheckContextsProtected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see in the GitHub Help documentation.
-
repos.getAllTopics -
repos.getBranch -
repos.getBranchProtectionProtected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see in the GitHub Help documentation.
-
repos.getCodeFrequencyStatsReturns a weekly aggregate of the number of additions and deletions pushed to a repository.
-
repos.getCollaboratorPermissionLevelChecks the repository permission of a collaborator. The possible repository permissions are
admin,write,read, andnone. -
repos.getCombinedStatusForRefUsers 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.
The most recent status for each context is returned, up to 100. This field if there are over 100 contexts.
Additionally, a combined
stateis returned. Thestateis one of:- failure if any of the contexts report as
errororfailure - pending if there are no statuses or a context is
pending - success if the latest status for all contexts is
success
- failure if any of the contexts report as
-
repos.getCommitReturns the contents of a single commit reference. You must have
readaccess 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 to fetch
diffandpatchformats. Diffs with binary data will have nopatchproperty.To return only the SHA-1 hash of the commit reference, you can provide the
shacustom in theAcceptheader. 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
verificationobject that describes the result of verifying the commit's signature. The following fields are included in theverificationobject:These are the possible values for
reasonin theverificationobject: -
repos.getCommitActivityStatsReturns the last year of commit activity grouped by week. The
daysarray is a group of commits per day, starting onSunday. -
repos.getCommitComment -
repos.getCommitSignatureProtectionProtected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see in the GitHub Help documentation.
When authenticated with admin or owner permissions to the repository, you can use this endpoint to check whether a branch requires signed commits. An enabled status of
trueindicates you must sign commits on this branch. For more information, see in GitHub Help.Note: You must enable branch protection to require signed commits.
-
repos.getContentGets the contents of a file or directory in a repository. Specify the file path or directory in
:path. If you omit:path, you will receive the contents of the repository's root directory. See the description below regarding what the API response includes for directories.Files and symlinks support for retrieving the raw content or rendered HTML (when supported). All content types support to ensure the content is returned in a consistent object format.
Note:
- To get a repository's contents recursively, you can .
- This API has an upper limit of 1,000 files for a directory. If you need to retrieve more files, use the .
- This API supports files up to 1 megabyte in size.
If the content is a directory
The response will be an array of objects, one object for each item in the directory. When listing the contents of a directory, submodules have their "type" specified as "file". Logically, the value should be "submodule". This behavior exists in API v3 . In the next major version of the API, the type will be returned as "submodule".
If the content is a symlink
If the requested
:pathpoints to a symlink, and the symlink's target is a normal file in the repository, then the API responds with the content of the file (in the format shown in the example. Otherwise, the API responds with an object describing the symlink itself.If the content is a submodule
The
submodule_git_urlidentifies the location of the submodule repository, and theshaidentifies a specific commit within the submodule repository. Git uses the given URL when cloning the submodule repository, and checks out the submodule at that specific commit.If the submodule repository is not hosted on github.com, the Git URLs (
git_urland_links["git"]) and the github.com URLs (html_urland_links["html"]) will have null values. -
repos.getContributorsStatsReturns the
totalnumber of commits authored by the contributor. In addition, the response includes a Weekly Hash (weeksarray) with the following information:w- Start of the week, given as a .a- Number of additionsd- Number of deletionsc- Number of commits
-
repos.getDeployKey -
repos.getDeployment -
repos.getDeploymentStatusUsers with pull access can view a deployment status for a deployment:
-
repos.getLatestPagesBuild -
repos.getLatestReleaseView the latest published full release for the repository.
The latest release is the most recent non-prerelease, non-draft release, sorted by the
created_atattribute. Thecreated_atattribute is the date of the commit used for the release, and not the date when the release was drafted or published. -
repos.getPages -
repos.getPagesBuild -
repos.getParticipationStatsReturns the total commit counts for the
ownerand total commit counts inall.allis everyone combined, including theownerin the last 52 weeks. If you'd like to get the commit counts for non-owners, you can subtractownerfromall.The array order is oldest week (index 0) to most recent week.
-
repos.getPullRequestReviewProtectionProtected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see in the GitHub Help documentation.
-
repos.getPunchCardStatsEach array contains the day number, hour number, and number of commits:
0-6: Sunday - Saturday0-23: Hour of day- Number of commits
For example,
[2, 14, 25]indicates that there were 25 total commits, during the 2:00pm hour on Tuesdays. All times are based on the time zone of individual commits. -
repos.getReadmeGets the preferred README for a repository.
READMEs support for retrieving the raw content or rendered HTML.
-
repos.getReadmeInDirectoryGets the README from a repository directory.
READMEs support for retrieving the raw content or rendered HTML.
-
repos.getReleaseNote: This returns an
upload_urlkey corresponding to the endpoint for uploading release assets. This key is a . -
repos.getReleaseAssetTo download the asset's binary content, set the
Acceptheader of the request to . The API will either redirect the client to the location, or stream it directly if possible. API clients should handle both a200or302response. -
repos.getReleaseByTagGet a published release with the specified tag.
-
repos.getStatusChecksProtectionProtected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see in the GitHub Help documentation.
-
repos.getTeamsWithAccessToProtectedBranchProtected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see in the GitHub Help documentation.
Lists the teams who have push access to this branch. The list includes child teams.
-
repos.getUsersWithAccessToProtectedBranchProtected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see in the GitHub Help documentation.
Lists the people who have push access to this branch.
-
repos.getWebhookReturns a webhook configured in a repository. To get only the webhook
configproperties, see "." -
repos.listBranches -
repos.listBranchesForHeadCommitProtected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see in the GitHub Help documentation.
Returns all branches where the given commit SHA is the HEAD, or latest commit for the branch.
-
repos.listCollaboratorsFor organization-owned repositories, the list of collaborators includes outside collaborators, organization members that are direct collaborators, organization members with access through team memberships, organization members with access through default organization permissions, and organization owners.
Team members will include the members of child teams.
-
repos.listCommentsForCommitUse the
:commit_shato specify the commit that will have its comments listed. -
repos.listCommitCommentsForRepoCommit Comments use . You can read more about the use of media types in the API .
Comments are ordered by ascending ID.
-
repos.listCommitsSignature verification object
The response will include a
verificationobject that describes the result of verifying the commit's signature. The following fields are included in theverificationobject:These are the possible values for
reasonin theverificationobject: -
repos.listCommitStatusesForRefUsers 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. -
repos.listContributorsLists contributors to the specified repository and sorts them by the number of commits per contributor in descending order. This endpoint may return information that is a few hours old because the GitHub REST API v3 caches contributor data to improve performance.
GitHub identifies contributors by author email address. This endpoint groups contribution counts by GitHub user, which includes all associated email addresses. To improve performance, only the first 500 author email addresses in the repository link to GitHub users. The rest will appear as anonymous contributors without associated GitHub user information.
-
repos.listDeployKeys -
repos.listDeploymentsSimple filtering of deployments is available via query parameters:
-
repos.listDeploymentStatusesUsers with pull access can view deployment statuses for a deployment:
-
repos.listForAuthenticatedUserLists repositories that the authenticated user has explicit permission (
:read,:write, or:admin) to access.The authenticated user has explicit permission to access repositories they own, repositories where they are a collaborator, and repositories that they can access through an organization membership.
-
repos.listForks -
repos.listForOrgLists repositories for the specified organization.
-
repos.listForUserLists public repositories for the specified user. Note: For GitHub AE, this endpoint will list internal repositories for the specified user.
-
repos.listInvitationsWhen authenticating as a user with admin rights to a repository, this endpoint will list all currently open repository invitations.
-
repos.listInvitationsForAuthenticatedUserWhen authenticating as a user, this endpoint will list all currently open repository invitations for that user.
-
repos.listLanguagesLists languages for the specified repository. The value shown for each language is the number of bytes of code written in that language.
-
repos.listPagesBuilds -
repos.listPublicLists all public repositories in the order that they were created.
Note:
- For GitHub Enterprise Server, this endpoint will only list repositories available to all users on the enterprise.
- Pagination is powered exclusively by the
sinceparameter. Use the to get the URL for the next page of repositories.
-
repos.listPullRequestsAssociatedWithCommitLists 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 endpoint.
-
repos.listReleaseAssets -
repos.listReleasesThis returns a list of releases, which does not include regular Git tags that have not been associated with a release. To get a list of Git tags, use the .
Information about published releases are available to everyone. Only users with push access will receive listings for draft releases.
-
repos.listTags -
repos.listTeams -
repos.listWebhooks -
repos.merge -
repos.pingWebhookThis will trigger a to be sent to the hook.
-
repos.removeCollaborator -
repos.removeStatusCheckContextsProtected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see in the GitHub Help documentation.
-
repos.removeStatusCheckProtectionProtected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see in the GitHub Help documentation.
-
repos.removeTeamAccessRestrictionsProtected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see in the GitHub Help documentation.
Removes the ability of a team to push to this branch. You can also remove push access for child teams.
-
repos.removeUserAccessRestrictionsProtected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see in the GitHub Help documentation.
Removes the ability of a user to push to this branch.
-
repos.replaceAllTopics -
repos.requestPagesBuildYou can request that your site be built from the latest revision on the default branch. This has the same effect as pushing a commit to your default branch, but does not require an additional commit. Manually triggering page builds can be helpful when diagnosing build warnings and failures.
Build requests are limited to one concurrent build per repository and one concurrent build per requester. If you request a build while another is still in progress, the second request will be queued until the first completes.
-
repos.setAdminBranchProtectionProtected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see in the GitHub Help documentation.
Adding admin enforcement requires admin or owner permissions to the repository and branch protection to be enabled.
-
repos.setStatusCheckContextsProtected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see in the GitHub Help documentation.
-
repos.setTeamAccessRestrictionsProtected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see in the GitHub Help documentation.
Replaces the list of teams that have push access to this branch. This removes all teams that previously had push access and grants push access to the new list of teams. Team restrictions include child teams.
-
repos.setUserAccessRestrictionsProtected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see in the GitHub Help documentation.
Replaces the list of people that have push access to this branch. This removes all people that previously had push access and grants push access to the new list of people.
-
repos.testPushWebhookThis will trigger the hook with the latest push to the current repository if the hook is subscribed to
pushevents. If the hook is not subscribed topushevents, the server will respond with 204 but no test POST will be generated.Note: Previously
/repos/:owner/:repo/hooks/:hook_id/test -
repos.transferA transfer request will need to be accepted by the new owner when transferring a personal repository to another user. The response will contain the original
owner, and the transfer will continue asynchronously. For more details on the requirements to transfer personal and organization-owned repositories, see . -
repos.updateNote: To edit a repository's topics, use the endpoint.
-
repos.updateBranchProtectionProtected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see in the GitHub Help documentation.
Protecting a branch requires admin or owner permissions to the repository.
Note: Passing new arrays of
usersandteamsreplaces their previous values.Note: The list of users, apps, and teams in total is limited to 100 items.
-
repos.updateCommitComment -
repos.updateInformationAboutPagesSiteUpdates information for a GitHub Enterprise Server Pages site. For more information, see ".
-
repos.updateInvitation -
repos.updatePullRequestReviewProtectionProtected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see in the GitHub Help documentation.
Updating pull request review enforcement requires admin or owner permissions to the repository and branch protection to be enabled.
Note: Passing new arrays of
usersandteamsreplaces their previous values. -
repos.updateReleaseUsers with push access to the repository can edit a release.
-
repos.updateReleaseAssetUsers with push access to the repository can edit a release asset.
-
repos.updateStatusCheckProtectionProtected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see in the GitHub Help documentation.
Updating required status checks requires admin or owner permissions to the repository and branch protection to be enabled.
-
repos.updateWebhookUpdates a webhook configured in a repository. If you previously had a
secretset, you must provide the samesecretor set a newsecretor the secret will be removed. If you are only updating individual webhookconfigproperties, use "." -
repos.uploadReleaseAssetThis endpoint makes use of to determine which URL to access. The endpoint you call to upload release assets is specific to your release. Use the
upload_urlreturned in the response of the to upload a release asset.You need to use an HTTP client which supports to make calls to this endpoint.
Most libraries will set the required
Content-Lengthheader automatically. Use the requiredContent-Typeheader to provide the media type of the asset. For a list of media types, see . For example:application/zipGitHub Enterprise Server expects the asset data in its raw binary form, rather than JSON. You will send the raw binary content of the asset as the request body. Everything else about the endpoint is the same as the rest of the API. For example, you'll still need to pass your authentication to be able to upload an asset.
When an upstream failure occurs, you will receive a
502 Bad Gatewaystatus. This may leave an empty asset with a state ofstarter. It can be safely deleted.Notes:
- GitHub Enterprise Server renames asset filenames that have special characters, non-alphanumeric characters, and leading or trailing periods. The "" endpoint lists the renamed filenames. For more information and help, contact .
- If you upload an asset with the same filename as another uploaded asset, you'll receive an error and must delete the old file before you can re-upload the new asset.
-
search.codeSearches for query terms inside of a file. This method returns up to 100 results .
When searching for code, you can get text match metadata for the file content and file path fields when you pass the
text-matchmedia type. For more details about how to receive highlighted search results, see .For example, if you want to find the definition of the
addClassfunction inside repository, your query would look something like this:q=addClass+in:file+language:js+repo:jquery/jqueryThis query searches for the keyword
addClasswithin a file's contents. The query limits the search to files where the language is JavaScript in thejquery/jqueryrepository.Considerations for code search
Due to the complexity of searching code, there are a few restrictions on how searches are performed:
- Only the default branch is considered. In most cases, this will be the
masterbranch. - Only files smaller than 384 KB are searchable.
- You must always include at least one search term when searching source code. For example, searching for is not valid, while is.
- Only the default branch is considered. In most cases, this will be the
-
search.commitsFind commits via various criteria on the default branch (usually
master). This method returns up to 100 results .When searching for commits, you can get text match metadata for the message field when you provide the
text-matchmedia type. For more details about how to receive highlighted search results, see .For example, if you want to find commits related to CSS in the repository. Your query would look something like this:
q=repo:octocat/Spoon-Knife+css -
search.issuesAndPullRequestsFind issues by state and keyword. This method returns up to 100 results .
When searching for issues, you can get text match metadata for the issue title, issue body, and issue comment body fields when you pass the
text-matchmedia type. For more details about how to receive highlighted search results, see .For example, if you want to find the oldest unresolved Python bugs on Windows. Your query might look something like this.
q=windows+label:bug+language:python+state:open&sort=created&order=ascThis query searches for the keyword
windows, within any open issue that is labeled asbug. The search runs across repositories whose primary language is Python. The results are sorted by creation date in ascending order, which means the oldest issues appear first in the search results.Note: For GitHub App requests, you can't retrieve a combination of issues and pull requests in a single query. Requests that don't include the
is:issueoris:pull-requestqualifier will receive an HTTP422 Unprocessable Entityresponse. To get results for both issues and pull requests, you must send separate queries for issues and pull requests. For more information about theisqualifier, see "." -
search.labelsFind labels in a repository with names or descriptions that match search keywords. Returns up to 100 results .
When searching for labels, you can get text match metadata for the label name and description fields when you pass the
text-matchmedia type. For more details about how to receive highlighted search results, see .For example, if you want to find labels in the
linguistrepository that matchbug,defect, orenhancement. Your query might look like this:q=bug+defect+enhancement&repository_id=64778136The labels that best match the query appear first in the search results.
-
search.reposFind repositories via various criteria. This method returns up to 100 results .
When searching for repositories, you can get text match metadata for the name and description fields when you pass the
text-matchmedia type. For more details about how to receive highlighted search results, see .For example, if you want to search for popular Tetris repositories written in assembly code, your query might look like this:
q=tetris+language:assembly&sort=stars&order=descThis query searches for repositories with the word
tetrisin the name, the description, or the README. The results are limited to repositories where the primary language is assembly. The results are sorted by stars in descending order, so that the most popular repositories appear first in the search results.When you include the
mercypreview header, you can also search for multiple topics by adding moretopic:instances. For example, your query might look like this:q=topic:ruby+topic:rails -
search.topicsFind topics via various criteria. Results are sorted by best match. This method returns up to 100 results . See "" for a detailed list of qualifiers.
When searching for topics, you can get text match metadata for the topic's short_description, description, name, or display_name field when you pass the
text-matchmedia type. For more details about how to receive highlighted search results, see .For example, if you want to search for topics related to Ruby that are featured on . Your query might look like this:
q=ruby+is:featuredThis query searches for topics with the keyword
rubyand limits the results to find only topics that are featured. The topics that are the best match for the query appear first in the search results. -
search.usersFind users via various criteria. This method returns up to 100 results .
When searching for users, you can get text match metadata for the issue login, email, and name fields when you pass the
text-matchmedia type. For more details about highlighting search results, see . For more details about how to receive highlighted search results, see .For example, if you're looking for a list of popular users, you might try this query:
q=tom+repos:%3E42+followers:%3E1000This query searches for users with the name
tom. The results are restricted to users with more than 42 repositories and over 1,000 followers. -
teams.addMemberLegacyThe "Add team member" endpoint (described below) is deprecated.
We recommend using the endpoint instead. It allows you to invite new organization members to your teams.
Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see in the GitHub Help documentation.
To add someone to a team, the authenticated user must be an organization owner or a team maintainer in the team they're changing. The person being added to the team must be a member of the team's organization.
Note: When you have team synchronization set up for a team with your organization's identity provider (IdP), you will see an error if you attempt to use the API for making changes to the team's membership. If you have access to manage group membership in your IdP, you can manage GitHub Enterprise Server team membership through your identity provider, which automatically adds and removes team members in an organization. For more information, see "."
Note that you'll need to set
Content-Lengthto zero when calling out to this endpoint. For more information, see "." -
teams.addOrUpdateMembershipForUserIf the user is already a member of the team's organization, this endpoint will add the user to the team. To add a membership between an organization member and a team, the authenticated user must be an organization owner or a team maintainer.
If the user is unaffiliated with the team's organization, this endpoint will send an invitation to the user via email. This newly-created membership will be in the "pending" state until the user accepts the invitation, at which point the membership will transition to the "active" state and the user will be added as a member of the team. To add a membership between an unaffiliated user and a team, the authenticated user must be an organization owner.
If the user is already a member of the team, this endpoint will update the role of the team member's role. To update the membership of a team member, the authenticated user must be an organization owner or a team maintainer.
-
teams.addOrUpdateProjectPermissionsAdds an organization project to a team. To add a project to a team or update the team's permission on a project, the authenticated user must have
adminpermissions for the project. The project and team must be part of the same organization. -
teams.addOrUpdateRepoPermissionsTo add a repository to a team or update the team's permission on a repository, the authenticated user must have admin access to the repository, and must be able to see the team. The repository must be owned by the organization, or a direct fork of a repository owned by the organization. You will get a
422 Unprocessable Entitystatus if you attempt to add a repository to a team that is not owned by the organization.Note that, if you choose not to pass any parameters, you'll need to set
Content-Lengthto zero when calling out to this endpoint. For more information, see "." -
teams.checkPermissionsForProjectChecks whether a team has
read,write, oradminpermissions for an organization project. If you pass thehellcat-previewmedia type, the response will include projects inherited from a parent team. -
teams.checkPermissionsForRepoNote: If you pass the
hellcat-previewmedia type, repositories inherited through a parent team will be checked.You can also get information about the specified repository, including what permissions the team grants on it, by passing the following custom via the
Acceptheader: -
teams.createTo create a team, the authenticated user must be a member or owner of
{org}. By default, organization members can create teams. Organization owners can limit team creation to organization owners. For more information, see "."When you create a new team, you automatically become a team maintainer without explicitly adding yourself to the optional array of
maintainers. For more information, see "". -
teams.createDiscussionCreates a new discussion post on a team's page. OAuth access tokens require the
write:discussion.This endpoint triggers . Creating content too quickly using this endpoint may result in secondary rate limiting. See "" for details.
-
teams.createDiscussionCommentCreates a new comment on a team discussion. OAuth access tokens require the
write:discussion.This endpoint triggers . Creating content too quickly using this endpoint may result in secondary rate limiting. See "" for details.
-
teams.deleteTo delete a team, the authenticated user must be an organization owner or team maintainer.
If you are an organization owner and you pass the
hellcat-previewmedia type, deleting a parent team will delete all of its child teams as well. -
teams.deleteDiscussionDelete a discussion from a team's page. OAuth access tokens require the
write:discussion. -
teams.deleteDiscussionCommentDeletes a comment on a team discussion. OAuth access tokens require the
write:discussion. -
teams.get -
teams.getByNameGets a team using the team's
slug. GitHub Enterprise Server generates theslugfrom the teamname.Note: You can also specify a team by
org_idandteam_idusing the routeGET /organizations/{org_id}/team/{team_id}. -
teams.getDiscussionGet a specific discussion on a team's page. OAuth access tokens require the
read:discussion. -
teams.getDiscussionCommentGet a specific comment on a team discussion. OAuth access tokens require the
read:discussion. -
teams.getMemberLegacyThe "Get team member" endpoint (described below) is deprecated.
We recommend using the endpoint instead. It allows you to get both active and pending memberships.
To list members in a team, the team must be visible to the authenticated user.
-
teams.getMembershipForUserIf you pass the
hellcat-previewmedia type, team members will include the members of child teams.To get a user's membership with a team, the team must be visible to the authenticated user.
Note: The response contains the
stateof the membership and the member'srole.The
rolefor organization owners is set tomaintainer. For more information aboutmaintainerroles, see . -
teams.listLists all teams in an organization that are visible to the authenticated user.
-
teams.listChildYou must use the
hellcat-previewmedia type to use this endpoint. -
teams.listDiscussionCommentsList all comments on a team discussion. OAuth access tokens require the
read:discussion. -
teams.listDiscussionsList all discussions on a team's page. OAuth access tokens require the
read:discussion. -
teams.listForAuthenticatedUserList all of the teams across all of the organizations to which the authenticated user belongs. This method requires
user,repo, orread:orgwhen authenticating via . -
teams.listMembersIf you pass the
hellcat-previewmedia type, team members will include the members of child teams.To list members in a team, the team must be visible to the authenticated user.
-
teams.listProjectsLists the organization projects for a team. If you are an site administrator for your Enterprise instance, you will be able to list all projects for the team. If you pass the
hellcat-previewmedia type, the response will include projects inherited from a parent team. -
teams.listReposNote: If you pass the
hellcat-previewmedia type, the response will include any repositories inherited through a parent team.If you are an site administrator for your Enterprise instance, you will be able to list all repositories for the team.
-
teams.removeMemberLegacyThe "Remove team member" endpoint (described below) is deprecated.
We recommend using the endpoint instead. It allows you to remove both active and pending memberships.
Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see in the GitHub Help documentation.
To remove a team member, the authenticated user must have 'admin' permissions to the team or be an owner of the org that the team is associated with. Removing a team member does not delete the user, it just removes them from the team.
Note: When you have team synchronization set up for a team with your organization's identity provider (IdP), you will see an error if you attempt to use the API for making changes to the team's membership. If you have access to manage group membership in your IdP, you can manage GitHub Enterprise Server team membership through your identity provider, which automatically adds and removes team members in an organization. For more information, see "."
-
teams.removeMembershipForUserTo remove a membership between a user and a team, the authenticated user must have 'admin' permissions to the team or be an owner of the organization that the team is associated with. Removing team membership does not delete the user, it just removes their membership from the team.
-
teams.removeProjectRemoves an organization project from a team. An organization owner or a team maintainer can remove any project from the team. To remove a project from a team as an organization member, the authenticated user must have
readaccess to both the team and project, oradminaccess to the team or project. Note: This endpoint removes the project from the team, but does not delete it. -
teams.removeRepoIf the authenticated user is an organization owner or a team maintainer, they can remove any repositories from the team. To remove a repository from a team as an organization member, the authenticated user must have admin access to the repository and must be able to see the team. NOTE: This does not delete the repository, it just removes it from the team.
-
teams.updateTo edit a team, the authenticated user must either be an organization owner or a team maintainer.
Note: With nested teams, the
privacyfor parent teams cannot besecret. -
teams.updateDiscussionEdits the title and body text of a discussion post. Only the parameters you provide are updated. OAuth access tokens require the
write:discussion. -
teams.updateDiscussionCommentEdits the body text of a discussion comment. OAuth access tokens require the
write:discussion. -
users.addEmailForAuthenticatedThis endpoint is accessible with the
userscope. -
users.checkFollowingForUser -
users.checkPersonIsFollowedByAuthenticated -
users.createGpgKeyForAuthenticatedAdds a GPG key to the authenticated user's GitHub account. Requires that you are authenticated via Basic Auth, or OAuth with at least
write:gpg_key. -
users.createPublicSshKeyForAuthenticatedAdds a public SSH key to the authenticated user's GitHub account. Requires that you are authenticated via Basic Auth, or OAuth with at least
write:public_key. -
users.deleteEmailForAuthenticatedThis endpoint is accessible with the
userscope. -
users.deleteGpgKeyForAuthenticatedRemoves a GPG key from the authenticated user's GitHub account. Requires that you are authenticated via Basic Auth or via OAuth with at least
admin:gpg_key. -
users.deletePublicSshKeyForAuthenticatedRemoves a public SSH key from the authenticated user's GitHub account. Requires that you are authenticated via Basic Auth or via OAuth with at least
admin:public_key. -
users.followNote that you'll need to set
Content-Lengthto zero when calling out to this endpoint. For more information, see "."Following a user requires the user to be logged in and authenticated with basic auth or OAuth with the
user:followscope. -
users.getAuthenticatedIf the authenticated user is authenticated through basic authentication or OAuth with the
userscope, then the response lists public and private profile information.If the authenticated user is authenticated through OAuth without the
userscope, then the response lists only public profile information. -
users.getByUsernameProvides publicly available information about someone with a GitHub account.
GitHub Apps with the
Planuser permission can use this endpoint to retrieve information about a user's GitHub Enterprise Server plan. The GitHub App must be authenticated as a user. See "" for details about authentication. For an example response, see 'Response with GitHub Enterprise Server plan information' below"The
emailkey in the following response is the publicly visible email address from your GitHub Enterprise Server . When setting up your profile, you can select a primary email address to be “public” which provides an email entry for this endpoint. If you do not set a public email address foremail, then it will have a value ofnull. You only see publicly visible email addresses when authenticated with GitHub Enterprise Server. For more information, see .The Emails API enables you to list all of your email addresses, and toggle a primary email to be visible publicly. For more information, see "".
-
users.getContextForUserProvides hovercard information when authenticated through basic auth or OAuth with the
reposcope. You can find out more about someone in relation to their pull requests, issues, repositories, and organizations.The
subject_typeandsubject_idparameters provide context for the person's hovercard, which returns more information than without the parameters. For example, if you wanted to find out more aboutoctocatwho owns theSpoon-Kniferepository via cURL, it would look like this: -
users.getGpgKeyForAuthenticatedView extended details for a single GPG key. Requires that you are authenticated via Basic Auth or via OAuth with at least
read:gpg_key. -
users.getPublicSshKeyForAuthenticatedView extended details for a single public SSH key. Requires that you are authenticated via Basic Auth or via OAuth with at least
read:public_key. -
users.listLists all users, in the order that they signed up on GitHub Enterprise Server. This list includes personal user accounts and organization accounts.
Note: Pagination is powered exclusively by the
sinceparameter. Use the to get the URL for the next page of users. -
users.listEmailsForAuthenticatedLists all of your email addresses, and specifies which one is visible to the public. This endpoint is accessible with the
user:emailscope. -
users.listFollowedByAuthenticatedLists the people who the authenticated user follows.
-
users.listFollowersForAuthenticatedUserLists the people following the authenticated user.
-
users.listFollowersForUserLists the people following the specified user.
-
users.listFollowingForUserLists the people who the specified user follows.
-
users.listGpgKeysForAuthenticatedLists the current user's GPG keys. Requires that you are authenticated via Basic Auth or via OAuth with at least
read:gpg_key. -
users.listGpgKeysForUserLists the GPG keys for a user. This information is accessible by anyone.
-
users.listPublicEmailsForAuthenticatedLists your publicly visible email address, which you can set with the endpoint. This endpoint is accessible with the
user:emailscope. -
users.listPublicKeysForUserLists the verified public SSH keys for a user. This is accessible by anyone.
-
users.listPublicSshKeysForAuthenticatedLists the public SSH keys for the authenticated user's GitHub account. Requires that you are authenticated via Basic Auth or via OAuth with at least
read:public_key. -
users.unfollowUnfollowing a user requires the user to be logged in and authenticated with basic auth or OAuth with the
user:followscope. -
users.updateAuthenticatedNote: If your email is set to private and you send an
emailparameter as part of this request to update your profile, your privacy settings are still enforced: the email address will not be displayed on your public profile or via the API. -
openapi.previewSpecPreview an OpenAPI document before adding it as a source
-
openapi.addSourceAdd an OpenAPI source and register its operations as tools