Versions
There are two stable versions of the GitHub API: the v3 version and the deprecated beta version. There are just a few differences between these two versions.
By default, all requests receive the v3 version. We encourage you to request a specific version via the Accept
header.
v3
The v3 API is stable and unchangeable. Please file a support issue if you have problems.
Some v3 functionality is deprecated and will be removed in the next major version of the API.
Differences from beta version
The v3 media type differs from the beta media type in just a few places:
Gist JSON
For Gists, the v3 media type renames the user
attribute to owner
.
Issue JSON
When an issue is not a pull request, the v3 media type omits the pull_request
attribute.
Repository JSON
For Repositories, the v3 media type omits the master_branch
attribute. API clients should use the default_branch
attribute to obtain the repository’s default branch.
User Emails JSON
For User Emails, the v3 media type returns an array of objects (instead of an array of strings).
v3 deprecations
The following functionality is deprecated. For backwards compatibility purposes, v3 will continue to provide this functionality. However, this deprecated functionality will be removed in the next major version of the API.
The recommendations below will help you prepare your application for the next major version of the API.
-
- Method: /gists/:id/fork
- Recommendation: Use /gists/:id/forks (plural) instead.
-
- Method: /legacy/issues/search/:owner/:repository/:state/:keyword
- Recommendation: Use v3 Issue Search API instead.
-
- Method: /legacy/repos/search/:keyword
- Recommendation: Use v3 Repository Search API instead.
-
- Method: /legacy/user/search/:keyword
- Recommendation: Use v3 User Search API instead.
-
- Method: /legacy/user/email/:email
- Recommendation: Use v3 User Search API instead.
-
- Method: /repos/:owner/:repo/hooks/:id/test
- Recommendation: Use /repos/:owner/:repo/hooks/:id/tests (plural) instead.
-
- Method: /teams/:id/members/:username
- Recommendation: Use Get Team Membership, Add Team Membership, and Remove Team Membership instead.
-
- Query parameters when POSTing to /repos/:owner/:repo/forks
- Recommendation: Use JSON to POST to this method instead.
-
- Query parameter value: Passing “watchers” as the value for the “sort” parameter in a GET request to /repos/:owner/:repo/forks
- Recommendation: Use stargazers as the value instead.
-
- Pull Request attribute: merge_commit_sha
- Recommendation: Do not use this attribute.
-
- Rate Limit attribute: rate
- Recommendation: Use resources[“core”] instead.
-
- Repository attribute: forks
- Recommendation: Use forks_count instead.
-
- Repository attribute: master_branch
- Recommendation: Use default_branch instead.
-
- Repository attribute: open_issues
- Recommendation: Use open_issues_count instead.
-
- Repository attribute: public
- Recommendation: When creating a repository, use the private attribute to indicate whether the repository should be public or private. Do not use the public attribute.
-
- Repository attribute: watchers
- Recommendation: Use watchers_count instead.
-
- User attribute: bio
- Recommendation: Do not use this attribute. It is obsolete.
-
- User attribute: plan[“collaborators”]
- Recommendation: Do not use this attribute. It is obsolete.
-
- User attribute: gravatar_id
- Recommendation: Use avatar_url instead.
-
- Feed attribute: current_user_organization_url
- Recommendation: Use current_user_organization_urls instead.
-
- Feed attribute: current_user_organization
- Recommendation: Use current_user_organizations instead.
-
- Pagination parameters
top
andsha
for method: /repos/:owner/:repo/commits - Recommendation: When fetching the list of commits for a repository
use the standard
per_page
andpage
parameters for pagination, instead ofper_page
,top
, andsha
.
- Pagination parameters
-
- Authorization attribute: token
- Recommendation: This attribute will return an empty string in the majority of the Authorizations API responses. Please see the deprecation blog post and the Authorizations API deprecation notice for full details.
beta (Deprecated)
The beta API is deprecated. Its current functionality is stable and unchangeable. Please file a support issue if you have problems.
Note: We recommend using the v3 API instead of the deprecated beta version of the API.
The beta media type differs from the v3 media type in just a few places. In most cases, migrating an application from the beta media type to the v3 media type is smooth and painless.
We will eventually retire the beta version, but we have no official retirement date to announce at the moment. When the time comes, rest assured that we'll announce the retirement with plenty of notice.
Breaking beta changes
June 15th, 2011:
-
gravatar_url
is being deprecated in favor ofavatar_url
for all responses that include users or orgs. A default size is no longer included in the URL. - Creating new gists (both anonymously and with an authenticated user)
should use
POST /gists
from now on.POST /users/:username/gists
is no longer supported.
June 1st, 2011:
- Removed support for PUT verb on update requests. Use POST or PATCH instead.
- Removed
.json
extension from all URLs. - No longer using the X-Next or X-Last headers. Pagination info is returned in the Link header instead.
- JSON-P response has completely changed to a more consistent format.
- Starring gists now uses PUT verb (instead of POST) and returns 204.
v2
We removed support for API v2 on June 12, 2012.
v1
We removed support for API v1 on June 12, 2012.