; rel="last"
+
+As you might have guessed, the `rel="last"` information says that the last page
+is now 20. This is because we are asking for more information per page about
+our results.
+
+## Consuming the information
+
+You don't want to be making low-level curl calls just to be able to work with
+pagination, so let's write a little Ruby script that does everything we've
+just described above.
+
+As always, first we'll require [GitHub's Octokit.rb][octokit.rb] Ruby library, and
+pass in our [personal access token][personal token]:
+
+``` ruby
+require 'octokit'
+
+# !!! DO NOT EVER USE HARD-CODED VALUES IN A REAL APP !!!
+# Instead, set and test environment variables, like below
+client = Octokit::Client.new :access_token => ENV['MY_PERSONAL_TOKEN']
+```
+
+Next, we'll execute the search, using Octokit's `search_code` method. Unlike
+using `curl`, we can also immediately retrieve the number of results, so let's
+do that:
+
+``` ruby
+results = client.search_code('addClass user:mozilla')
+total_count = results.total_count
+```
+
+Now, let's grab the number of the last page, similar to `page=34>; rel="last"`
+information in the link header. Octokit.rb support pagination information through
+an implementation called "[Hypermedia link relations][hypermedia-relations]."
+We won't go into detail about what that is, but, suffice to say, each element
+in the `results` variable has a hash called `rels`, which can contain information
+about `:next`, `:last`, `:first`, and `:prev`, depending on which result you're
+on. These relations also contain information about the resulting URL, by calling
+`rels[:last].href`.
+
+Knowing this, let's grab the page number of the last result, and present all
+this information to the user:
+
+``` ruby
+last_response = client.last_response
+number_of_pages = last_response.rels[:last].href.match(/page=(\d+).*$/)[1]
+
+puts "There are #{total_count} results, on #{number_of_pages} pages!"
+```
+
+Finally, let's iterate through the results. You could do this with a loop `for i in 1..number_of_pages.to_i`,
+but instead, let's follow the `rels[:next]` headers to retrieve information from
+each page. For the sake of simplicity, let's just grab the file path of the first
+result from each page. To do this, we'll need a loop; and at the end of every loop,
+we'll retrieve the data set for the next page by following the `rels[:next]` information.
+The loop will finish when there is no `rels[:next]` information to consume (in other
+words, we are at `rels[:last]`). It might look something like this:
+
+``` ruby
+puts last_response.data.items.first.path
+until last_response.rels[:next].nil?
+ last_response = last_response.rels[:next].get
+ puts last_response.data.items.first.path
+end
+```
+
+Changing the number of items per page is extremely simple with Octokit.rb. Simply
+pass a `per_page` options hash to the initial client construction. After that,
+your code should remain intact:
+
+``` ruby
+require 'octokit'
+
+# !!! DO NOT EVER USE HARD-CODED VALUES IN A REAL APP !!!
+# Instead, set and test environment variables, like below
+client = Octokit::Client.new :access_token => ENV['MY_PERSONAL_TOKEN']
+
+results = client.search_code('addClass user:mozilla', :per_page => 100)
+total_count = results.total_count
+
+last_response = client.last_response
+number_of_pages = last_response.rels[:last].href.match(/page=(\d+).*$/)[1]
+
+puts last_response.rels[:last].href
+puts "There are #{total_count} results, on #{number_of_pages} pages!"
+
+puts "And here's the first path for every set"
+
+puts last_response.data.items.first.path
+until last_response.rels[:next].nil?
+ last_response = last_response.rels[:next].get
+ puts last_response.data.items.first.path
+end
+```
+
+## Constructing Pagination Links
+
+Normally, with pagination, your goal isn't to concatenate all of the possible
+results, but rather, to produce a set of navigation, like this:
+
+
+
+Let's sketch out a micro-version of what that might entail.
+
+From the code above, we already know we can get the `number_of_pages` in the
+paginated results from the first call:
+
+``` ruby
+require 'octokit'
+
+# !!! DO NOT EVER USE HARD-CODED VALUES IN A REAL APP !!!
+# Instead, set and test environment variables, like below
+client = Octokit::Client.new :access_token => ENV['MY_PERSONAL_TOKEN']
+
+results = client.search_code('addClass user:mozilla')
+total_count = results.total_count
+
+last_response = client.last_response
+number_of_pages = last_response.rels[:last].href.match(/page=(\d+).*$/)[1]
+
+puts last_response.rels[:last].href
+puts "There are #{total_count} results, on #{number_of_pages} pages!"
+```
+
+From there, we can construct a beautiful ASCII representation of the number boxes:
+``` ruby
+numbers = ""
+for i in 1..number_of_pages.to_i
+ numbers << "[#{i}] "
+end
+puts numbers
+```
+
+Let's simulate a user clicking on one of these boxes, by constructing a random
+number:
+
+``` ruby
+random_page = Random.new
+random_page = random_page.rand(1..number_of_pages.to_i)
+
+puts "A User appeared, and clicked number #{random_page}!"
+```
+
+Now that we have a page number, we can use Octokit to explicitly retrieve that
+individual page, by passing the `:page` option:
+
+``` ruby
+clicked_results = client.search_code('addClass user:mozilla', :page => random_page)
+```
+
+If we wanted to get fancy, we could also grab the previous and next pages, in
+order to generate links for back (`<<`) and forward (`>>`) elements:
+
+``` ruby
+prev_page_href = client.last_response.rels[:prev] ? client.last_response.rels[:prev].href : "(none)"
+next_page_href = client.last_response.rels[:next] ? client.last_response.rels[:next].href : "(none)"
+
+puts "The prev page link is #{prev_page_href}"
+puts "The next page link is #{next_page_href}"
+```
+
+[pagination]: /v3/#pagination
+[platform samples]: https://github.com/github/platform-samples/tree/master/api/ruby/traversing-with-pagination
+[octokit.rb]: https://github.com/octokit/octokit.rb
+[personal token]: https://help.github.com/articles/creating-an-access-token-for-command-line-use
+[hypermedia-relations]: https://github.com/octokit/octokit.rb#pagination
+[listing commits]: https://developer.github.com/v3/repos/commits/#list-commits-on-a-repository
diff --git a/content/guides/using-ssh-agent-forwarding.md b/content/guides/using-ssh-agent-forwarding.md
new file mode 100644
index 0000000000..6a19d0c804
--- /dev/null
+++ b/content/guides/using-ssh-agent-forwarding.md
@@ -0,0 +1,155 @@
+---
+title: Using SSH Agent Forwarding
+---
+
+# Using SSH agent forwarding
+
+{:toc}
+
+SSH agent forwarding can be used to make deploying to a server simple. It allows you to use your local SSH keys instead of leaving keys (without passphrases!) sitting on your server.
+
+If you've already set up an SSH key to interact with {{ site.data.variables.product.product_name }}, you're probably familiar with `ssh-agent`. It's a program that runs in the background and keeps your key loaded into memory, so that you don't need to enter your passphrase every time you need to use the key. The nifty thing is, you can choose to let servers access your local `ssh-agent` as if they were already running on the server. This is sort of like asking a friend to enter their password so that you can use their computer.
+
+Check out [Steve Friedl's Tech Tips guide][tech-tips] for a more detailed explanation of SSH agent forwarding.
+
+## Setting up SSH agent forwarding
+
+Ensure that your own SSH key is set up and working. You can use [our guide on generating SSH keys][generating-keys] if you've not done this yet.
+
+You can test that your local key works by entering `ssh -T git@github.com` in the terminal:
+
+``` command-line
+$ ssh -T git@github.com
+# Attempt to SSH in to github
+> Hi username! You've successfully authenticated, but GitHub does not provide
+> shell access.
+```
+
+We're off to a great start. Let's set up SSH to allow agent forwarding to your server.
+
+1. Using your favorite text editor, open up the file at `~/.ssh/config`. If this file doesn't exist, you can create it by entering `touch ~/.ssh/config` in the terminal.
+
+2. Enter the following text into the file, replacing `example.com` with your server's domain name or IP:
+
+ Host example.com
+ ForwardAgent yes
+
+{{#warning}}
+
+**Warning:** You may be tempted to use a wildcard like `Host *` to just apply this setting to all SSH connections. That's not really a good idea, as you'd be sharing your local SSH keys with *every* server you SSH into. They won't have direct access to the keys, but they will be able to use them *as you* while the connection is established. **You should only add servers you trust and that you intend to use with agent forwarding.**
+
+{{/warning}}
+
+## Testing SSH agent forwarding
+
+To test that agent forwarding is working with your server, you can SSH into your server and run `ssh -T git@github.com` once more. If all is well, you'll get back the same prompt as you did locally.
+
+If you're unsure if your local key is being used, you can also inspect the `SSH_AUTH_SOCK` variable on your server:
+
+``` command-line
+$ echo "$SSH_AUTH_SOCK"
+# Print out the SSH_AUTH_SOCK variable
+> /tmp/ssh-4hNGMk8AZX/agent.79453
+```
+
+If the variable is not set, it means that agent forwarding is not working:
+
+``` command-line
+$ echo "$SSH_AUTH_SOCK"
+# Print out the SSH_AUTH_SOCK variable
+> [No output]
+$ ssh -T git@github.com
+# Try to SSH to github
+> Permission denied (publickey).
+```
+
+## Troubleshooting SSH agent forwarding
+
+Here are some things to look out for when troubleshooting SSH agent forwarding.
+
+### You must be using an SSH URL to check out code
+
+SSH forwarding only works with SSH URLs, not HTTP(s) URLs. Check the *.git/config* file on your server and ensure the URL is an SSH-style URL like below:
+
+``` command-line
+[remote "origin"]
+ url = git@github.com:yourAccount/yourProject.git
+ fetch = +refs/heads/*:refs/remotes/origin/*
+```
+
+### Your SSH keys must work locally
+
+Before you can make your keys work through agent forwarding, they must work locally first. [Our guide on generating SSH keys][generating-keys] can help you set up your SSH keys locally.
+
+### Your system must allow SSH agent forwarding
+
+Sometimes, system configurations disallow SSH agent forwarding. You can check if a system configuration file is being used by entering the following command in the terminal:
+
+``` command-line
+$ ssh -v example.com
+# Connect to example.com with verbose debug output
+> OpenSSH_5.6p1, OpenSSL 0.9.8r 8 Feb 2011
+> debug1: Reading configuration data /Users/you/.ssh/config
+> debug1: Applying options for example.com
+> debug1: Reading configuration data /etc/ssh_config
+> debug1: Applying options for *
+$ exit
+# Returns to your local command prompt
+```
+
+In the example above, the file *~/.ssh/config* is loaded first, then */etc/ssh_config* is read. We can inspect that file to see if it's overriding our options by running the following commands:
+
+``` command-line
+$ cat /etc/ssh_config
+# Print out the /etc/ssh_config file
+> Host *
+> SendEnv LANG LC_*
+> ForwardAgent no
+```
+
+In this example, our */etc/ssh_config* file specifically says `ForwardAgent no`, which is a way to block agent forwarding. Deleting this line from the file should get agent forwarding working once more.
+
+### Your server must allow SSH agent forwarding on inbound connections
+
+Agent forwarding may also be blocked on your server. You can check that agent forwarding is permitted by SSHing into the server and running `sshd_config`. The output from this command should indicate that `AllowAgentForwarding` is set.
+
+### Your local `ssh-agent` must be running
+
+On most computers, the operating system automatically launches `ssh-agent` for you. On Windows, however, you need to do this manually. We have [a guide on how to start `ssh-agent` whenever you open Git Bash][autolaunch-ssh-agent].
+
+To verify that `ssh-agent` is running on your computer, type the following command in the terminal:
+
+``` command-line
+$ echo "$SSH_AUTH_SOCK"
+# Print out the SSH_AUTH_SOCK variable
+> /tmp/launch-kNSlgU/Listeners
+```
+
+### Your key must be available to `ssh-agent`
+
+You can check that your key is visible to `ssh-agent` by running the following command:
+
+``` command-line
+ssh-add -L
+```
+
+If the command says that no identity is available, you'll need to add your key:
+
+``` command-line
+$ ssh-add yourkey
+```
+
+{{#tip}}
+
+On Mac OS X, `ssh-agent` will "forget" this key, once it gets restarted during reboots. But you can import your SSH keys into Keychain using this command:
+
+``` command-line
+$ /usr/bin/ssh-add -K yourkey
+```
+
+{{/tip}}
+
+[tech-tips]: http://www.unixwiz.net/techtips/ssh-agent-forwarding.html
+[generating-keys]: https://help.github.com/articles/generating-ssh-keys
+[ssh-passphrases]: https://help.github.com/ssh-key-passphrases/
+[autolaunch-ssh-agent]: https://help.github.com/articles/working-with-ssh-key-passphrases#auto-launching-ssh-agent-on-msysgit
diff --git a/content/guides/working-with-comments.md b/content/guides/working-with-comments.md
new file mode 100644
index 0000000000..13a4266023
--- /dev/null
+++ b/content/guides/working-with-comments.md
@@ -0,0 +1,120 @@
+---
+title: Working with Comments
+---
+
+# Working with Comments
+
+{:toc}
+
+For any Pull Request, {{ site.data.variables.product.product_name }} provides three kinds of comment views:
+[comments on the Pull Request][PR comment] as a whole, [comments on a specific line][PR line comment] within the Pull Request,
+and [comments on a specific commit][commit comment] within the Pull Request.
+
+Each of these types of comments goes through a different portion of the {{ site.data.variables.product.product_name }} API.
+In this guide, we'll explore how you can access and manipulate each one. For every
+example, we'll be using [this sample Pull Request made][sample PR] on the "octocat"
+repository. As always, samples can be found in [our platform-samples repository][platform-samples].
+
+## Pull Request Comments
+
+To access comments on a Pull Request, you'll go through [the Issues API][issues].
+This may seem counterintuitive at first. But once you understand that a Pull
+Request is just an Issue with code, it makes sense to use the Issues API to
+create comments on a Pull Request.
+
+We'll demonstrate fetching Pull Request comments by creating a Ruby script using
+[Octokit.rb][octokit.rb]. You'll also want to create a [personal access token][personal token].
+
+The following code should help you get started accessing comments from a Pull Request
+using Octokit.rb:
+
+``` ruby
+require 'octokit'
+
+# !!! DO NOT EVER USE HARD-CODED VALUES IN A REAL APP !!!
+# Instead, set and test environment variables, like below
+client = Octokit::Client.new :access_token => ENV['MY_PERSONAL_TOKEN']
+
+client.issue_comments("octocat/Spoon-Knife", 1176).each do |comment|
+ username = comment[:user][:login]
+ post_date = comment[:created_at]
+ content = comment[:body]
+
+ puts "#{username} made a comment on #{post_date}. It says:\n'#{content}'\n"
+end
+```
+
+Here, we're specifically calling out to the Issues API to get the comments (`issue_comments`),
+providing both the repository's name (`octocat/Spoon-Knife`), and the Pull Request ID
+we're interested in (`1176`). After that, it's simply a matter of iterating through
+the comments to fetch information about each one.
+
+## Pull Request Comments on a Line
+
+Within the diff view, you can start a discussion on a particular aspect of a singular
+change made within the Pull Request. These comments occur on the individual lines
+within a changed file. The endpoint URL for this discussion comes from [the Pull Request Review API][PR Review API].
+
+The following code fetches all the Pull Request comments made on files, given a single Pull Request number:
+
+``` ruby
+require 'octokit'
+
+# !!! DO NOT EVER USE HARD-CODED VALUES IN A REAL APP !!!
+# Instead, set and test environment variables, like below
+client = Octokit::Client.new :access_token => ENV['MY_PERSONAL_TOKEN']
+
+client.pull_request_comments("octocat/Spoon-Knife", 1176).each do |comment|
+ username = comment[:user][:login]
+ post_date = comment[:created_at]
+ content = comment[:body]
+ path = comment[:path]
+ position = comment[:position]
+
+ puts "#{username} made a comment on #{post_date} for the file called #{path}, on line #{position}. It says:\n'#{content}'\n"
+end
+```
+
+You'll notice that it's incredibly similar to the example above. The difference
+between this view and the Pull Request comment is the focus of the conversation.
+A comment made on a Pull Request should be reserved for discussion or ideas on
+the overall direction of the code. A comment made as part of a Pull Request review should
+deal specifically with the way a particular change was implemented within a file.
+
+## Commit Comments
+
+The last type of comments occur specifically on individual commits. For this reason,
+they make use of [the commit comment API][commit comment API].
+
+To retrieve the comments on a commit, you'll want to use the SHA1 of the commit.
+In other words, you won't use any identifier related to the Pull Request. Here's an example:
+
+``` ruby
+require 'octokit'
+
+# !!! DO NOT EVER USE HARD-CODED VALUES IN A REAL APP !!!
+# Instead, set and test environment variables, like below
+client = Octokit::Client.new :access_token => ENV['MY_PERSONAL_TOKEN']
+
+client.commit_comments("octocat/Spoon-Knife", "cbc28e7c8caee26febc8c013b0adfb97a4edd96e").each do |comment|
+ username = comment[:user][:login]
+ post_date = comment[:created_at]
+ content = comment[:body]
+
+ puts "#{username} made a comment on #{post_date}. It says:\n'#{content}'\n"
+end
+```
+
+Note that this API call will retrieve single line comments, as well as comments made
+on the entire commit.
+
+[PR comment]: https://github.com/octocat/Spoon-Knife/pull/1176#issuecomment-24114792
+[PR line comment]: https://github.com/octocat/Spoon-Knife/pull/1176#discussion_r6252889
+[commit comment]: https://github.com/octocat/Spoon-Knife/commit/cbc28e7c8caee26febc8c013b0adfb97a4edd96e#commitcomment-4049848
+[sample PR]: https://github.com/octocat/Spoon-Knife/pull/1176
+[platform-samples]: https://github.com/github/platform-samples/tree/master/api/ruby/working-with-comments
+[issues]: https://developer.github.com/v3/issues/comments/
+[personal token]: https://help.github.com/articles/creating-an-access-token-for-command-line-use
+[octokit.rb]: https://github.com/octokit/octokit.rb
+[PR Review API]: https://developer.github.com/v3/pulls/comments/
+[commit comment API]: https://developer.github.com/v3/repos/comments/#get-a-single-commit-comment
diff --git a/content/index.md b/content/index.md
index 641a0932f1..1cf54f6892 100644
--- a/content/index.md
+++ b/content/index.md
@@ -1,75 +1,42 @@
---
-title: GitHub API
+title: GitHub Developer
+layout: overview
+hide_from_search: true
---
-# The GitHub API
-
-This describes the resources that make up the official GitHub API v3. If
-you have any problems or requests please contact
-[support](mailto:support@github.com?subject=APIv3).
-
-For the new API v3, start browsing the resources on the right >>
-
-View the [API Changelog](#changes) for information on existing and
-planned changes to the API.
-
-## Current Version
-
- Accept: application/vnd.github.beta+json
-
-The GitHub API version is currently in beta. [The `beta` mime type](/v3/mime/) property will
-be valid until sometime in 2012. A notice will be given closer to the
-actual date.
-
-We consider the beta API unbreakable, so please [file a support
-issue](https://github.com/contact) if you have problems.
-
-### Upcoming Version
-
- Accept: application/vnd.github.v3+json
-
-The API is expected to be finalized Real Soon Now.
-
-#### Expected Changes
-
-* All `*_url` attributes move to a `_links` object. See [Pull
- Requests](/v3/pulls/#get-a-single-pull-request) for an example.
-* The `/repos/:user/:repo/hooks/:id/test` action becomes
- `/repos/:user/:repo/hooks/:id/tests`.
-* The `/gists/:id/fork` action becomes `/gists/:id/forks`.
-* Gist forks/history objects become separate API calls.
-* Gist files object is not returned on Gist listings.
-* Commit schema will change to be [more consistent](https://gist.github.com/3a2e5779588e21b0c0f3).
-* `master_branch` becomes `default_branch`.
-* `integrate_branch` on the [repo API](/v3/repos/#get) will no longer be
- returned.
-* Use the `private` attribute when creating a private repository,
- instead of setting `public` to false.
-
-### Breaking Beta Changes
-
-##### August 7, 2012
-* Clarified watching/stargazing
-
-##### June 12, 2012:
-* Removed API v1 support
-* Removed API v2 support
-
-##### June 15th, 2011:
-
-* `gravatar_url` is being deprecated in favor of `avatar_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/:user/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.
+
+
+ Leverage the power of
+ GitHub in your app.
+
+
Get started with one of our guides, or jump straight into the API documentation.
+
Browse the documentation
+

+
+
+
+
+
Join the GitHub Developer Program.
+
The best way to integrate with GitHub. Learn more.
+
+
+
+
+
+ -
+
+
+
New to the GitHub API? With these guides you’ll be up and running in a snap.
+
+ -
+
+
+
We’ve got you covered. Use the GitHub API in your favorite language.
+
+ -
+
+
+
Are you stuck? Already tried our troubleshooting guide? Talk to a supportocat.
+
+
+
diff --git a/content/integrations-directory/getting-listed.md b/content/integrations-directory/getting-listed.md
new file mode 100644
index 0000000000..7a96f11057
--- /dev/null
+++ b/content/integrations-directory/getting-listed.md
@@ -0,0 +1,86 @@
+---
+title: Getting listed in the Integrations Directory
+---
+
+# Getting your integration listed
+
+{:toc}
+
+## Listing requirements
+
+### Provide the right contacts
+
+We want to be sure GitHub can contact your team, if needed. Specifically, we're asking for:
+
+* A technical support contact
+* A security contact
+* An escalation contact
+
+All three are for GitHub-use only. If there's an urgent issue that needs your attention, we'll contact your escalation contact and expect a response within one business day. A delayed response from your escalation contact may result in temporary or permanent de-listing of your integration from the directory.
+
+### Provide standard links
+
+We'd like to have a minimum set of links to include in every integration listing, so that our users have all the information they need. These are:
+
+- Pricing - If your integration costs money or has differed priced tiers of service, please include this URL.
+- Documentation - Please provide a URL with more information on how to use your integration.
+- Terms of service - Please provide the Terms of Service URL for users using your integration.
+- Privacy Policy - If different than Terms of Service, please include the URL here.
+- Support - Please provide a URL or email address for users to contact you directly.
+- Status - You should provide us a URL that will be updated when your application is down or experiencing problems. This could be a status site, a blog, a Twitter account, or more. This URL should be publicly accessible.
+- Installation - Provide the URL for direct installation for users. Note the OAuth requirement below.
+
+### Provide updates to your listing
+
+We want GitHub users to have consistent messaging within the Integrations Directory and your
+marketing site. As your product changes, keep your Integration Directory listing up to date. We ask that you refresh the information at least once a year. Please send updates to [partnerships@github.com](mailto:partnerships@github.com).
+
+### Provide categories for your listing
+
+Help GitHub users find your integration faster with the appropriate categories. Please send us your suggested categories for the listing from those available in the [Integrations Directory](https://github.com/integrations). If you don't see a category that fits quite right, just let us know. We reserve the right to change categories associated with the listing. If we do so, we'll do our best to keep you informed.
+
+If your integration supports both GitHub.com and GitHub Enterprise, please let us know.
+
+## Technical requirements
+
+### Use TLS
+
+Anytime you display GitHub data in your integration, use TLS. If you also use [webhooks](https://developer.github.com/webhooks/) to receive updated data from GitHub, use SSL/TLS there too.
+
+### Delete GitHub data once you lose access to the information
+
+Once you realize you've lost access to a user, organization, repository, or its related objects,
+delete that information in your system within 60 days.
+
+## Choose your type of listing
+
+We offer two types of listings: OAuth installation listings and "learn more" listings.
+
+### OAuth installation listing
+
+{{#tip}}
+
+This is our preferred type of listing wherever possible.
+
+{{/tip}}
+
+The OAuth installation listings are used so customers can immediately install your integration directly
+within GitHub's UI. To use this type of listing, provide a URL that will immediately redirect to
+GitHub's OAuth authorization flow.
+
+We are happy to help you identify if your integration can already support this. If you'd like a direct installation from the Integrations Directory, your provided installation URL should always forward the user immediately to an OAuth authorization screen. You should never add interstitial pages within that flow.
+
+### "Learn more" listing
+
+The "learn more" listing is used when a user cannot use GitHub OAuth to sign up for an account within
+your integration. You will provide a URL that will link a "learn more" button within your
+listing to your website. This type of listing is *only used when OAuth is not available before
+account creation*.
+
+## Send us your information
+
+In addition to this checklist, please follow the [Marketing Guidelines](/integrations-directory/marketing-guidelines/) as well. The best format for delivery is Markdown (.md) or plain text (.txt).
+
+Please attach images at the proper resolution. We aren't able to extract photos from PDFs or Word docs.
+
+Once you're ready, just send the materials over email to [partnerships@github.com](mailto:partnerships@github.com). Thanks! We're looking forward to reviewing your listing.
diff --git a/content/integrations-directory/index.md b/content/integrations-directory/index.md
new file mode 100644
index 0000000000..04385850e7
--- /dev/null
+++ b/content/integrations-directory/index.md
@@ -0,0 +1,10 @@
+---
+title: Integrations Directory
+layout: /integrations-directory.*
+---
+
+# Overview
+
+As one of our integrators, we're excited to tell the world about your GitHub integration at [https://github.com/integrations](https://github.com/integrations). To ensure the GitHub community has the best experience finding and using your integrations, we've outlined a [short list of requirements](/integrations-directory/getting-listed/) to follow.
+
+We're happy to chat about these if you have any questions. Feel free to reach out to [partnerships@github.com](mailto:partnerships@github.com) for additional detail.
diff --git a/content/integrations-directory/marketing-guidelines.md b/content/integrations-directory/marketing-guidelines.md
new file mode 100644
index 0000000000..cc713af89b
--- /dev/null
+++ b/content/integrations-directory/marketing-guidelines.md
@@ -0,0 +1,74 @@
+---
+title: Integrations Directory marketing guidelines
+---
+
+# Marketing guidelines
+
+{:toc}
+
+This document will help you write compelling and well-structured marketing materials to help GitHub users understand the value of your integration. The sections below outline the document structure for integration pages.
+
+## One line blurb
+
+This is a short sentence (70 characters max), that'll show up right below your logo. It can be used for a tagline or quick summary of the integration.
+
+## Description
+
+Write a single paragraph that describes your integration clearly and speaks directly to the audience (think “you” and “your” over “we” and “our”). Answer the following questions in your description:
+
+- What does it do?
+- How does it integrate with GitHub?
+- How does it empower developers?
+
+Keep this section short and sweet.
+
+**Example**
+
+> Sample CI helps you deploy your code with confidence by continuously running your test suite. Avoid bugs and avert deployment disasters by catching bugs before they reach your users. Sample CI can update the build status on your pull requests as they progress and can deploy successful builds to production automatically.
+
+## Images
+
+Images are optional. Well curated images will help people get a sense for how your integration works with GitHub. Use multiple images as an opportunity to tell a story about your integration's workflow.
+
+### Image guidelines
+- Images should show your product in action
+- When possible, show how your product integrates with GitHub
+- Use no more than four images
+- Images must be 1290x728 pixels (will appear as 645x364 pixels)
+
+## Features
+
+List some features to give people a better sense of what your integration offers. An ideal number is between three and six—pick the great ones.
+
+### Feature guidelines
+- Each feature should have a heading.
+- Does the feature have a name? What is it?
+- What does the feature do?
+- How does it help people build better software?
+- Does it interact with any external services (e.g., can deploy to Heroku, Engine Yard Cloud, etc.)?
+- Does your feature require any setup?
+
+**Example**
+
+> **Deploy anywhere, with confidence**
+
+> Deploying to production after a successful build is as easy as setting up a bit of configuration, and we’ll deploy your code to Heroku, Engine Yard Cloud, Nodejitsu, cloudControl, OpenShift, CloudFoundry, AppFog, and Amazon OpsWorks.
+
+> Using a custom deployment? Customize the build to deploy to your servers!
+
+## General tips
+- Do not use `H1` level headings.
+- Use `H3` for section headings, `H4` for subsections.
+- Avoid italics. Use bold for emphasis instead.
+- Use sentence case for titles.
+- Do not write in all caps to provide emphasis.
+- Write in [GitHub Flavored markdown](https://help.github.com/articles/github-flavored-markdown/).
+
+## Logo
+- Provide your integration logo as a 128x128 pixel PNG.
+- Negative space must be transparent.
+- Do not stretch or squish your logo to fill the space.
+- You'll need to attach this logo to your GitHub Application, before the listing is published.
+
+## Samples
+Feel free to look at existing listings in the Integrations Directory, such as [Gitter](https://github.com/integrations/gitter) or [ZenHub](https://github.com/integrations/zenhub).
diff --git a/content/libraries.md b/content/libraries.md
new file mode 100644
index 0000000000..2958416746
--- /dev/null
+++ b/content/libraries.md
@@ -0,0 +1,199 @@
+---
+title: Libraries
+layout: libraries
+---
+
+
+
Octokit comes in
+many flavors
+
Use the official Octokit library, or choose between any of the available third party libraries.
+
+

+
+
+# Third-party libraries
+
+## Android
+
+* [GithubAndroidSDK][githubandroidsdk]
+
+[githubandroidsdk]: https://github.com/gitskarios/GithubAndroidSdk
+
+## .NET
+
+* [IronGithub][irongithub]
+* [CSharp GitHub API][csharp]
+* [FSharp.GitHubApi][fsharp]
+
+[irongithub]: https://github.com/in2bits/IronGitHub
+[csharp]: https://github.com/sgrassie/csharp-github-api
+[fsharp]: https://github.com/saxonmatt/FSharp.GitHubApi
+
+## Clojure
+
+* [Tentacles][tentacles]
+
+[tentacles]: https://github.com/Raynes/tentacles
+
+## Dart
+
+* [github.dart][github.dart]
+
+[github.dart]: https://github.com/DirectMyFile/github.dart
+
+## Emacs Lisp
+
+* [gh.el][gh.el]
+
+[gh.el]: https://github.com/sigma/gh.el
+
+## Erlang
+
+* [Erlang GitHub API][erlang]
+* [octo.erl][octo-erl]
+
+[erlang]: https://github.com/onlyshk/erlang-github-api
+[octo-erl]: https://github.com/sdepold/octo.erl
+
+## Go
+
+* [go-github][]
+
+[go-github]: https://github.com/google/go-github
+
+## Haskell
+
+* [github][haskell-github]
+* [Haskell GitHub API][haskell]
+
+[haskell-github]: https://github.com/fpco/GitHub
+[haskell]: https://github.com/dmnpignaud/haskell-github-api
+
+## Java
+
+* The [GitHub Java API (org.eclipse.egit.github.core)](https://github.com/eclipse/egit-github/tree/master/org.eclipse.egit.github.core) library
+is part of the [GitHub Mylyn Connector](https://github.com/eclipse/egit-github) and aims to support the entire
+GitHub v3 API. Builds are available in [Maven Central](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22org.eclipse.egit.github.core%22).
+* [GitHub API for Java (org.kohsuke.github)](http://github-api.kohsuke.org/) defines an object oriented representation of the GitHub API.
+* [JCabi GitHub API](http://github.jcabi.com) is based on Java7 JSON API (JSR-353), simplifies tests with a runtime GitHub stub, and
+covers the entire API.
+
+## JavaScript
+
+* [Node-GitHub][mikedeboer-node-github]
+* [NodeJS GitHub library][octonode]
+* [gh3 client-side API v3 wrapper][gh3]
+* [GitHub.js wrapper around the GitHub API][github]
+* [Promise-Based CoffeeScript library for the browser or NodeJS][github-client]
+
+[mikedeboer-node-github]: https://github.com/mikedeboer/node-github
+[octonode]: https://github.com/pksunkara/octonode
+[gh3]: https://github.com/k33g/gh3
+[github]: https://github.com/michael/github
+[github-client]: https://github.com/philschatz/github-client
+
+## Julia
+
+* [GitHub.jl][github.jl]
+
+[github.jl]: https://github.com/WestleyArgentum/GitHub.jl
+
+## Objective-C
+
+* [UAGithubEngine][uagithubengine]
+
+[uagithubengine]: http://github.com/owainhunt/uagithubengine
+
+## OCaml
+
+* [ocaml-github][ocaml-github]
+
+[ocaml-github]: https://github.com/mirage/ocaml-github
+
+## Perl
+
+* [Pithub][pithub-github] ([CPAN][pithub-cpan])
+* [Net::GitHub][net-github-github] ([CPAN][net-github-cpan])
+
+[net-github-github]: https://github.com/fayland/perl-net-github
+[net-github-cpan]: http://search.cpan.org/dist/Net-GitHub/
+[pithub-github]: https://github.com/plu/Pithub
+[pithub-cpan]: http://metacpan.org/module/Pithub
+
+## PHP
+
+* [GitHub PHP Client][github-php-client]
+* [PHP GitHub API][php-github-api]
+* [GitHub API][github-api]
+* [GitHub Kohana Module][kohana]
+* [GitHub Joomla! Package][joomla]
+* [Github Nette Extension][kdyby-github]
+* [GitHub API Easy Access][milo-github-api]
+* [GitHub bridge for Laravel][github-laravel]
+* [PHP5.6|PHP7 Client & WebHook wrapper][flexyproject-githubapi]
+
+[github-php-client]: https://github.com/tan-tan-kanarek/github-php-client
+[php-github-api]: https://github.com/KnpLabs/php-github-api
+[github-api]: https://github.com/yiiext/github-api
+[kohana]: https://github.com/acoulton/github_v3_api
+[joomla]: https://github.com/joomla-framework/github-api
+[kdyby-github]: https://github.com/kdyby/github
+[milo-github-api]: https://github.com/milo/github-api
+[github-laravel]: https://github.com/GrahamCampbell/Laravel-GitHub
+[flexyproject-githubapi]: https://github.com/FlexyProject/GitHubAPI
+
+## Python
+
+* [PyGithub][jacquev6_pygithub]
+* [Pygithub3][pygithub3-api]
+* [libsaas][libsaas]
+* [github3.py][github3py]
+* [sanction][sanction]
+* [agithub][agithub]
+* [githubpy][githubpy]
+* [octohub][octohub]
+* [Github-Flask][github-flask]
+* [torngithub][torngithub]
+
+[jacquev6_pygithub]: https://github.com/jacquev6/PyGithub
+[pygithub3-api]: https://github.com/copitux/python-github3
+[libsaas]: https://github.com/ducksboard/libsaas
+[github3py]: https://github.com/sigmavirus24/github3.py
+[sanction]: https://github.com/demianbrecht/sanction
+[agithub]: https://github.com/jpaugh/agithub "Agnostic GitHub"
+[githubpy]: https://github.com/michaelliao/githubpy
+[octohub]: https://github.com/turnkeylinux/octohub
+[github-flask]: http://github-flask.readthedocs.org
+[torngithub]: https://github.com/jkeylu/torngithub
+
+## Ruby
+
+* [GitHub API Gem][ghapi]
+* [GitHub v3 API][ruby1]
+* [GitHub API Client][ruby2]
+* [Ghee][ghee]
+
+[ghapi]: https://github.com/peter-murach/github
+[ruby1]: https://github.com/jwilger/github-v3-api
+[ruby2]: https://github.com/okonski/github-api-client
+[ghee]: https://github.com/rauhryan/ghee
+
+## Scala
+
+* [Dispatch GitHub][dispatchgithub]
+* [Hubcat][hubcat]
+* [Buhtig][buhtig]
+
+[dispatchgithub]: https://github.com/andreazevedo/dispatch-github
+[hubcat]: https://github.com/softprops/hubcat
+[buhtig]: https://github.com/mdread/buhtig
+
+## Shell
+
+* [ok.sh][ok.sh]
+
+[ok.sh]: https://github.com/whiteinge/ok.sh
diff --git a/content/program.md b/content/program.md
new file mode 100644
index 0000000000..f51bc21db1
--- /dev/null
+++ b/content/program.md
@@ -0,0 +1,58 @@
+---
+title: GitHub Developer
+layout: developers
+---
+
+
+
+
It takes a community to design, build, and ship great software.
+
Building an application that integrates with GitHub? Register for our Developer Program! The possibilities are endless, and you enjoy the kudos.
+
Register now
+

+

+
+
+
+
+
+ -
+
+
+
Be the first to know about API changes and try out new features before they launch.
+
+ -
+
+
+
Build your own tools that seamlessly integrate with the place you push code every day.
+
+ -
+
+
+
Obtain developer licenses to build and test your application against GitHub Enterprise.
+
+
+
+
+
+
+
+
Have an integration that works with GitHub?
+
Awesome! We'd love to have you be part of the program. Here’s how you can spread the word:
+
+
+
+
+
+
Ready to join the GitHub Developer Program?
+
Membership is open to individual developers and companies who have:
+
+
+
diff --git a/content/search/search-index.json b/content/search/search-index.json
new file mode 100644
index 0000000000..708851ff81
--- /dev/null
+++ b/content/search/search-index.json
@@ -0,0 +1,26 @@
+<%
+ #build the JSON tree
+ if @config[:audience]
+ @preface = "/enterprise/#{@config[:audience]}"
+ end
+ @output = []
+ @items.select { |item| !item.attributes[:hide_from_search] }.each do |item|
+ next if item[:filename].nil? || !item[:filename].end_with?('.md')
+ @path = item[:filename].split('/')[1..-1].join('/')[0..-4]
+ @path.chomp!('/index') if @path.end_with?('/index')
+
+ @output.push({
+ :title => "#{clean_for_json(item[:title])}",
+ :url => "#{@preface}/#{@path}/",
+ :body => "#{clean_for_json(item.compiled_content)}"
+ })
+ end
+%>
+<%=
+ #output the generated tree
+ if ENV['RACK_ENV'] == "production"
+ JSON.generate(@output.sort{|a, b| a[:title] <=> b[:title]})
+ else
+ JSON.pretty_generate(@output.sort{|a, b| a[:title] <=> b[:title]})
+ end
+%>
diff --git a/content/v3.md b/content/v3.md
index 3e0b86dfbf..a387737d67 100644
--- a/content/v3.md
+++ b/content/v3.md
@@ -2,44 +2,45 @@
title: GitHub API v3
---
-# API v3
-
-This describes the resources that make up the official GitHub API v3. If
-you have any problems or requests please contact
-[support](mailto:support@github.com?subject=APIv3).
-
-* Schema
-* Client Errors
-* HTTP Verbs
-* Authentication
-* Pagination
-* Rate Limiting
-* Conditional Requests
-* Cross Origin Resource Sharing
-* JSON-P Callbacks
+# Overview
+
+This describes the resources that make up the official {{ site.data.variables.product.product_name }} API v3. If you have any problems or requests please contact
+[support][].
+
+{:toc}
+
+## Current Version
+
+By default, all requests receive the **v3** [version](/v3/versions) of the API.
+We encourage you to [explicitly request this version via the `Accept` header](/v3/media/#request-specific-version).
+
+ Accept: application/vnd.github.v3+json
## Schema
-All API access is over HTTPS, and accessed from the `api.github.com`
-domain (or through `yourdomain.com/api/v3/` for enterprise). All data is
+All API access is over HTTPS, and accessed from the `{{ site.data.variables.product.api_url_code }}`. All data is
sent and received as JSON.
-
-$ curl -i https://api.github.com
-
-HTTP/1.1 302 Found
-Server: nginx/1.0.12
-Date: Mon, 20 Feb 2012 11:15:49 GMT
-Content-Type: text/html;charset=utf-8
-Connection: keep-alive
-Status: 302 Found
-X-RateLimit-Limit: 5000
-ETag: "d41d8cd98f00b204e9800998ecf8427e"
-Location: http://developer.github.com
-X-RateLimit-Remaining: 4999
-Content-Length: 0
-
-
+``` command-line
+$ curl -i {{ site.data.variables.product.api_url_pre }}/users/octocat/orgs
+
+> HTTP/1.1 200 OK
+> Server: nginx
+> Date: Fri, 12 Oct 2012 23:33:14 GMT
+> Content-Type: application/json; charset=utf-8
+> Connection: keep-alive
+> Status: 200 OK
+> ETag: "a00049ba79152d03380c34652f2cb612"
+> X-GitHub-Media-Type: github.v3
+{% if page.version == 'dotcom' %}
+> X-RateLimit-Limit: 5000
+> X-RateLimit-Remaining: 4987
+> X-RateLimit-Reset: 1350085394
+{% endif %}
+> Content-Length: 5
+> Cache-Control: max-age=0, private, must-revalidate
+> X-Content-Type-Options: nosniff
+```
Blank fields are included as `null` instead of being omitted.
@@ -47,6 +48,79 @@ All timestamps are returned in ISO 8601 format:
YYYY-MM-DDTHH:MM:SSZ
+### Summary Representations
+
+When you fetch a list of resources, the response includes a _subset_ of the
+attributes for that resource. This is the "summary" representation of the
+resource. (Some attributes are computationally expensive for the API to provide.
+For performance reasons, the summary representation excludes those attributes.
+To obtain those attributes, fetch the "detailed" representation.)
+
+**Example**: When you get a list of repositories, you get the summary
+representation of each repository. Here, we fetch the list of repositories owned
+by the [octokit](https://github.com/octokit) organization:
+
+ GET /orgs/octokit/repos
+
+### Detailed Representations
+
+When you fetch an individual resource, the response typically includes _all_
+attributes for that resource. This is the "detailed" representation of the
+resource. (Note that authorization sometimes influences the amount of detail
+included in the representation.)
+
+**Example**: When you get an individual repository, you get the detailed
+representation of the repository. Here, we fetch the
+[octokit/octokit.rb](https://github.com/octokit/octokit.rb) repository:
+
+ GET /repos/octokit/octokit.rb
+
+The documentation provides an example response for each API method. The example
+response illustrates all attributes that are returned by that method.
+
+## Parameters
+
+Many API methods take optional parameters. For GET requests, any parameters not
+specified as a segment in the path can be passed as an HTTP query string
+parameter:
+
+``` command-line
+$ curl -i "{{ site.data.variables.product.api_url_pre }}/repos/vmg/redcarpet/issues?state=closed"
+```
+
+In this example, the 'vmg' and 'redcarpet' values are provided for the `:owner`
+and `:repo` parameters in the path while `:state` is passed in the query
+string.
+
+For POST, PATCH, PUT, and DELETE requests, parameters not included in the URL should be encoded as JSON
+with a Content-Type of 'application/json':
+
+``` command-line
+$ curl -i -u username -d '{"scopes":["public_repo"]}' {{ site.data.variables.product.api_url_pre }}/authorizations
+```
+
+## Root Endpoint
+
+You can issue a `GET` request to the root endpoint to get all the endpoint categories that the API supports:
+
+``` command-line
+$ curl {{ site.data.variables.product.api_url_pre }}
+```
+
+{% if page.version != 'dotcom' %}
+
+{{#tip}}
+
+**Tip:** For GitHub Enterprise, [as with all other endpoints](https://developer.github.com/v3/enterprise/#endpoint-urls), you'll need to pass in your GitHub Enterprise endpoint as the hostname, *as well as your username and password*:
+
+``` command-line
+$ curl https://hostname/api/v3/ -u username:password
+```
+
+{{/tip}}
+
+{% endif %}
+
## Client Errors
There are three possible types of client errors on API calls that
@@ -65,7 +139,7 @@ receive request bodies:
HTTP/1.1 400 Bad Request
Content-Length: 40
- {"message":"Body should be a JSON Hash"}
+ {"message":"Body should be a JSON object"}
3. Sending invalid fields will result in a `422 Unprocessable Entity`
response.
@@ -89,95 +163,162 @@ can tell what the problem is. There's also an error code to let you
know what is wrong with the field. These are the possible validation error
codes:
-missing
-: This means a resource does not exist.
-missing\_field
-: This means a required field on a resource has not been set.
+Error Name | Description
+-----------|-----------|
+`missing` | This means a resource does not exist.
+`missing_field` | This means a required field on a resource has not been set.
+`invalid` | This means the formatting of a field is invalid. The documentation for that resource should be able to give you more specific information.
+`already_exists` | This means another resource has the same value as this field. This can happen in resources that must have some unique key (such as Label names).
+
+Resources may also send custom validation errors (where `code` is `custom`). Custom errors will always have a `message` field describing the error, and most errors will also include a `documentation_url` field pointing to some content that might help you resolve the error.
+
+## HTTP Redirects
-invalid
-: This means the formatting of a field is invalid. The documentation
-for that resource should be able to give you more specific information.
+API v3 uses HTTP redirection where appropriate. Clients should assume that any
+request may result in a redirection. Receiving an HTTP redirection is *not* an
+error and clients should follow that redirect. Redirect responses will have a
+`Location` header field which contains the URI of the resource to which the
+client should repeat the requests.
-already\_exists
-: This means another resource has the same value as this field. This
-can happen in resources that must have some unique key (such as Label
-names).
+Status Code | Description
+-----------|-----------|
+`301` | Permanent redirection. The URI you used to make the request has been superseded by the one specified in the `Location` header field. This and all future requests to this resource should be directed to the new URI.
+`302`, `307` | Temporary redirection. The request should be repeated verbatim to the URI specified in the `Location` header field but clients should continue to use the original URI for future requests.
-If resources have custom validation errors, they will be documented with
-the resource.
+Other redirection status codes may be used in accordance with the HTTP 1.1 spec.
## HTTP Verbs
Where possible, API v3 strives to use appropriate HTTP verbs for each
action.
-HEAD
-: Can be issued against any resource to get just the HTTP header info.
+Verb | Description
+-----|-----------
+`HEAD` | Can be issued against any resource to get just the HTTP header info.
+`GET` | Used for retrieving resources.
+`POST` | Used for creating resources.
+`PATCH` | Used for updating resources with partial JSON data. For instance, an Issue resource has `title` and `body` attributes. A PATCH request may accept one or more of the attributes to update the resource. PATCH is a relatively new and uncommon HTTP verb, so resource endpoints also accept `POST` requests.
+`PUT` | Used for replacing resources or collections. For `PUT` requests with no `body` attribute, be sure to set the `Content-Length` header to zero.
+`DELETE` |Used for deleting resources.
-GET
-: Used for retrieving resources.
+## Authentication
-POST
-: Used for creating resources, or performing custom actions (such as
-merging a pull request).
+There are three ways to authenticate through {{ site.data.variables.product.product_name }} API v3. Requests that
+require authentication will return `404 Not Found`, instead of
+`403 Forbidden`, in some places. This is to prevent the accidental leakage
+of private repositories to unauthorized users.
-PATCH
-: Used for updating resources with partial JSON data. For instance, an
-Issue resource has `title` and `body` attributes. A PATCH request may
-accept one or more of the attributes to update the resource. PATCH is a
-relatively new and uncommon HTTP verb, so resource endpoints also accept
-POST requests.
+### Basic Authentication
-PUT
-: Used for replacing resources or collections. For PUT requests
-with no `body` attribute, be sure to set the `Content-Length` header to zero.
+``` command-line
+$ curl -u "username" {{ site.data.variables.product.api_url_pre }}
+```
-DELETE
-: Used for deleting resources.
+### OAuth2 Token (sent in a header)
-## Authentication
+``` command-line
+$ curl -H "Authorization: token OAUTH-TOKEN" {{ site.data.variables.product.api_url_pre }}
+```
-There are two ways to authenticate through GitHub API v3:
+### OAuth2 Token (sent as a parameter)
-Basic Authentication:
+``` command-line
+$ curl {{ site.data.variables.product.api_url_pre }}/?access_token=OAUTH-TOKEN
+```
-
-$ curl -u "username" https://api.github.com
-
+Read [more about OAuth2](/v3/oauth/). Note that OAuth2 tokens can be [acquired
+programmatically](/v3/oauth_authorizations/#create-a-new-authorization), for applications that
+are not websites.
-OAuth2 Token (sent in a header):
+### OAuth2 Key/Secret
-
-$ curl -H "Authorization: token OAUTH-TOKEN" https://api.github.com
-
+``` command-line
+$ curl '{{ site.data.variables.product.api_url_pre }}/users/whatever?client_id=xxxx&client_secret=yyyy'
+```
-OAuth2 Token (sent as a parameter):
+This should only be used in server to server scenarios. Don't leak your
+OAuth application's client secret to your users.
-
-$ curl https://api.github.com/?access_token=OAUTH-TOKEN
-
+{% if page.version == 'dotcom' %}
-Read [more about OAuth2](/v3/oauth/). Note that OAuth2 tokens can be [acquired
-programmatically](/v3/oauth/#create-a-new-authorization), for applications that
-are not websites.
+Read [more about unauthenticated rate limiting](#increasing-the-unauthenticated-rate-limit-for-oauth-applications).
+
+{% endif %}
+
+### Failed login limit
+
+Authenticating with invalid credentials will return `401 Unauthorized`:
+
+``` command-line
+$ curl -i {{ site.data.variables.product.api_url_pre }} -u foo:bar
+> HTTP/1.1 401 Unauthorized
+
+> {
+> "message": "Bad credentials",
+> "documentation_url": "https://developer.github.com/v3"
+> }
+```
-Requests that require authentication will return 404, instead of 403, in some places.
-This is to prevent the accidental leakage of private repositories to unauthorized
-users.
+After detecting several requests with invalid credentials within a short period,
+the API will temporarily reject all authentication attempts for that user
+(including ones with valid credentials) with `403 Forbidden`:
+
+``` command-line
+$ curl -i {{ site.data.variables.product.api_url_pre }} -u valid_username:valid_password
+> HTTP/1.1 403 Forbidden
+
+> {
+> "message": "Maximum number of login attempts exceeded. Please try again later.",
+> "documentation_url": "https://developer.github.com/v3"
+> }
+```
+
+## Hypermedia
+
+All resources may have one or more `*_url` properties linking to other
+resources. These are meant to provide explicit URLs so that proper API clients
+don't need to construct URLs on their own. It is highly recommended that API
+clients use these. Doing so will make future upgrades of the API easier for
+developers. All URLs are expected to be proper [RFC 6570][rfc] URI templates.
+
+You can then expand these templates using something like the [uri_template][uri]
+gem:
+
+ >> tmpl = URITemplate.new('/notifications{?since,all,participating}')
+ >> tmpl.expand
+ => "/notifications"
+
+ >> tmpl.expand :all => 1
+ => "/notifications?all=1"
+
+ >> tmpl.expand :all => 1, :participating => 1
+ => "/notifications?all=1&participating=1"
+
+[rfc]: http://tools.ietf.org/html/rfc6570
+[uri]: https://github.com/hannesg/uri_template
## Pagination
Requests that return multiple items will be paginated to 30 items by
-default. You can specify further pages with the `?page` parameter. For some
+default. You can specify further pages with the `?page` parameter. For some
resources, you can also set a custom page size up to 100 with the `?per_page` parameter.
+Note that for technical reasons not all endpoints respect the `?per_page` parameter,
+see [events](https://developer.github.com/v3/activity/events/) for example.
+
+``` command-line
+$ curl '{{ site.data.variables.product.api_url_pre }}/user/repos?page=2&per_page=100'
+```
+
+Note that page numbering is 1-based and that omitting the `?page`
+parameter will return the first page.
-
-$ curl https://api.github.com/user/repos?page=2&per_page=100
-
+For more information on pagination, check out our guide on [Traversing with Pagination][pagination-guide].
+
+### Link Header
The pagination info is included in [the Link
-header](http://www.w3.org/Protocols/9707-link-header.html). It is important to
+header](http://tools.ietf.org/html/rfc5988). It is important to
follow these Link header values instead of constructing your own URLs. In some
instances, such as in the [Commits
API](/v3/repos/commits/), pagination is based on
@@ -188,175 +329,299 @@ SHA1 and not on page number.
_Linebreak is included for readability._
+This `Link` response header contains one or more [Hypermedia](/v3/#hypermedia) link relations, some of which may require expansion as [URI templates](http://tools.ietf.org/html/rfc6570).
+
The possible `rel` values are:
-`next`
-: Shows the URL of the immediate next page of results.
+Name | Description
+-----------|-----------|
+`next` |The link relation for the immediate next page of results.
+`last` |The link relation for the last page of results.
+`first` |The link relation for the first page of results.
+`prev` |The link relation for the immediate previous page of results.
-`last`
-: Shows the URL of the last page of results.
+{% if page.version == 'dotcom' %}
-`first`
-: Shows the URL of the first page of results.
+## Rate Limiting
-`prev`
-: Shows the URL of the immediate previous page of results.
+For requests using Basic Authentication or OAuth, you can make up to 5,000
+requests per hour. For unauthenticated requests, the rate limit allows you to
+make up to 60 requests per hour. Unauthenticated requests are associated with your IP address,
+and not the user making requests. Note that [the Search API has custom rate limit
+rules](/v3/search/#rate-limit).
+
+You can check the returned HTTP headers of any API request to see your current
+rate limit status:
+
+``` command-line
+$ curl -i {{ site.data.variables.product.api_url_pre }}/users/whatever
+> HTTP/1.1 200 OK
+> Date: Mon, 01 Jul 2013 17:27:06 GMT
+> Status: 200 OK
+> X-RateLimit-Limit: 60
+> X-RateLimit-Remaining: 56
+> X-RateLimit-Reset: 1372700873
+```
+
+The headers tell you everything you need to know about your current rate limit status:
+
+Header Name | Description
+-----------|-----------|
+`X-RateLimit-Limit` | The maximum number of requests that the consumer is permitted to make per hour.
+`X-RateLimit-Remaining` | The number of requests remaining in the current rate limit window.
+`X-RateLimit-Reset` | The time at which the current rate limit window resets in [UTC epoch seconds](http://en.wikipedia.org/wiki/Unix_time).
+
+If you need the time in a different format, any modern programming language can get the job done. For example, if you open up the console on your web browser, you can easily get the reset time as a JavaScript Date object.
+
+``` javascript
+new Date(1372700873 * 1000)
+// => Mon Jul 01 2013 13:47:53 GMT-0400 (EDT)
+```
+
+Once you go over the rate limit you will receive an error response:
+
+``` command-line
+> HTTP/1.1 403 Forbidden
+> Date: Tue, 20 Aug 2013 14:50:41 GMT
+> Status: 403 Forbidden
+> X-RateLimit-Limit: 60
+> X-RateLimit-Remaining: 0
+> X-RateLimit-Reset: 1377013266
+
+> {
+> "message": "API rate limit exceeded for xxx.xxx.xxx.xxx. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)",
+> "documentation_url": "https://developer.github.com/v3/#rate-limiting"
+> }
+```
+
+You can also [check your rate limit status](/v3/rate_limit) without incurring an
+API hit.
+
-## Rate Limiting
+### Increasing the unauthenticated rate limit for OAuth applications
-We limit requests to API v3 to 5000 per hour. This is keyed off either your
-login, your OAuth token, or request IP. You can check the returned HTTP
-headers of any API request to see your current status:
+If your OAuth application needs to make unauthenticated calls with a higher rate limit, you can pass your app's client ID and secret as part of the query string.
-
-$ curl -i https://api.github.com/users/whatever
+``` command-line
+$ curl -i '{{ site.data.variables.product.api_url_pre }}/users/whatever?client_id=xxxx&client_secret=yyyy'
+> HTTP/1.1 200 OK
+> Date: Mon, 01 Jul 2013 17:27:06 GMT
+> Status: 200 OK
+> X-RateLimit-Limit: 5000
+> X-RateLimit-Remaining: 4966
+> X-RateLimit-Reset: 1372700873
+```
-HTTP/1.1 200 OK
-Status: 200 OK
-X-RateLimit-Limit: 5000
-X-RateLimit-Remaining: 4966
-
+This method should only be used for server-to-server calls. You should never
+share your client secret with anyone or include it in client-side browser code.
-You can also check your rate limit status without incurring an API hit.
+### Staying within the rate limit
- GET /rate_limit
+If you are using Basic Authentication or OAuth, and you are exceeding
+your rate limit, you can likely fix the issue by caching API responses
+and using [conditional requests](#conditional-requests).
-### Rate limit
+If you're using conditional requests and still exceeding your rate
+limit, please [contact us][support] to request a
+higher rate limit for your OAuth application.
-<%= headers 200 %>
-<%= json :rate => {:remaining => 4999, :limit => 5000} %>
+### Abuse Rate Limits
-
+To protect the quality of service from GitHub, additional rate limits may apply to some actions.
+For example, rapidly creating content, polling aggressively instead of using webhooks,
+making API calls with a high concurrency, or repeatedly requesting data that is computationally expensive
+may result in abuse rate limiting.
-#### Unauthenticated rate limited requests
+It is not intended for this rate limit to interfere with any legitimate use of
+the API. Your normal [rate limits](/v3/#rate-limiting) should be the only
+limit you target. Please [contact support][abuse-support] if your use is affected by
+this rate limit. To ensure you're acting as a good API citizen, check out our
+[Best Practices guidelines](/guides/best-practices-for-integrators/).
-If you need to make unauthenticated calls but need to use a higher rate limit
-associated with your OAuth application, you can send over your client ID and
-secret in the query string.
+If your application triggers this rate limit, you'll receive an informative
+response:
-
-$ curl -i https://api.github.com/users/whatever?client_id=xxxxxxxxxxxxxx&client_secret=yyyyyyyyyyyyyyyyyyyyy
+``` command-line
+> HTTP/1.1 403 Forbidden
+> Content-Type: application/json; charset=utf-8
+> Connection: close
-HTTP/1.1 200 OK
-Status: 200 OK
-X-RateLimit-Limit: 12500
-X-RateLimit-Remaining: 11966
-
+> {
+> "message": "You have triggered an abuse detection mechanism and have been temporarily blocked from content creation. Please retry your request again later.",
+> "documentation_url": "https://developer.github.com/v3#abuse-rate-limits"
+> }
+```
-This method should only be used for server-to-server calls. You should never
-share your client secret with anyone or include it in client-side browser code.
+{% endif %}
+
+## User Agent Required
-Please [contact us](https://github.com/contact) to request white listed access
-for your application. We prefer sites that setup OAuth applications for their
- users.
+All API requests MUST include a valid `User-Agent` header. Requests with no `User-Agent`
+header will be rejected. We request that you use your {{ site.data.variables.product.product_name }} username, or the name of your
+application, for the `User-Agent` header value. This allows us to contact you if there are problems.
-## Conditional Requests
+Here's an example:
-Most responses return `Last-Modified` and `Etag` headers. You can use the values
+``` command-line
+User-Agent: Awesome-Octocat-App
+```
+
+If you provide an invalid `User-Agent` header, you will receive a `403 Forbidden` response:
+
+``` command-line
+$ curl -iH 'User-Agent: ' {{ site.data.variables.product.api_url_pre }}/meta
+> HTTP/1.0 403 Forbidden
+> Connection: close
+> Content-Type: text/html
+
+> Request forbidden by administrative rules.
+> Please make sure your request has a User-Agent header.
+> Check https://developer.github.com for other possible causes.
+```
+
+## Conditional requests
+
+Most responses return an `ETag` header. Many responses also return a `Last-Modified` header. You can use the values
of these headers to make subsequent requests to those resources using the
-`If-Modified-Since` and `If-None-Match` headers, respectively. If the resource
-has not changed, the server will return a `304 Not Modified`. Also note: making
-a conditional request and receiving a 304 response does not count against your
-[Rate Limit](#rate-limiting), so we encourage you to use it whenever possible.
-
-
-$ curl -i https://api.github.com/user
-HTTP/1.1 200 OK
-Cache-Control: private, max-age=60
-ETag: "644b5b0155e6404a9cc4bd9d8b1ae730"
-Last-Modified: Thu, 05 Jul 2012 15:31:30 GMT
-Status: 200 OK
-Vary: Accept, Authorization, Cookie
-X-RateLimit-Limit: 5000
-X-RateLimit-Remaining: 4996
-
-$ curl -i https://api.github.com/user -H "If-Modified-Since: Thu, 05 Jul 2012 15:31:30 GMT"
-HTTP/1.1 304 Not Modified
-Cache-Control: private, max-age=60
-Last-Modified: Thu, 05 Jul 2012 15:31:30 GMT
-Status: 304 Not Modified
-Vary: Accept, Authorization, Cookie
-X-RateLimit-Limit: 5000
-X-RateLimit-Remaining: 4996
-
-$ curl -i https://api.github.com/user -H 'If-None-Match: "644b5b0155e6404a9cc4bd9d8b1ae730"'
-HTTP/1.1 304 Not Modified
-Cache-Control: private, max-age=60
-ETag: "644b5b0155e6404a9cc4bd9d8b1ae730"
-Last-Modified: Thu, 05 Jul 2012 15:31:30 GMT
-Status: 304 Not Modified
-Vary: Accept, Authorization, Cookie
-X-RateLimit-Limit: 5000
-X-RateLimit-Remaining: 4996
-
+`If-None-Match` and `If-Modified-Since` headers, respectively. If the resource
+has not changed, the server will return a `304 Not Modified`.
+
+{% if page.version == 'dotcom' %}
+
+{{#tip}}
+
+**Note**: Making a conditional request and receiving a 304 response does not
+count against your [Rate Limit](#rate-limiting), so we encourage you to use it
+whenever possible.
+
+{{/tip}}
+
+{% endif %}
+
+``` command-line
+$ curl -i {{ site.data.variables.product.api_url_pre }}/user
+> HTTP/1.1 200 OK
+> Cache-Control: private, max-age=60
+> ETag: "644b5b0155e6404a9cc4bd9d8b1ae730"
+> Last-Modified: Thu, 05 Jul 2012 15:31:30 GMT
+> Status: 200 OK
+> Vary: Accept, Authorization, Cookie
+{% if page.version == 'dotcom' %}
+> X-RateLimit-Limit: 5000
+> X-RateLimit-Remaining: 4996
+> X-RateLimit-Reset: 1372700873
+{% endif %}
+
+$ curl -i {{ site.data.variables.product.api_url_pre }}/user -H 'If-None-Match: "644b5b0155e6404a9cc4bd9d8b1ae730"'
+> HTTP/1.1 304 Not Modified
+> Cache-Control: private, max-age=60
+> ETag: "644b5b0155e6404a9cc4bd9d8b1ae730"
+> Last-Modified: Thu, 05 Jul 2012 15:31:30 GMT
+> Status: 304 Not Modified
+> Vary: Accept, Authorization, Cookie
+{% if page.version == 'dotcom' %}
+> X-RateLimit-Limit: 5000
+> X-RateLimit-Remaining: 4996
+> X-RateLimit-Reset: 1372700873
+{% endif %}
+
+$ curl -i {{ site.data.variables.product.api_url_pre }}/user -H "If-Modified-Since: Thu, 05 Jul 2012 15:31:30 GMT"
+> HTTP/1.1 304 Not Modified
+> Cache-Control: private, max-age=60
+> Last-Modified: Thu, 05 Jul 2012 15:31:30 GMT
+> Status: 304 Not Modified
+> Vary: Accept, Authorization, Cookie
+{% if page.version == 'dotcom' %}
+> X-RateLimit-Limit: 5000
+> X-RateLimit-Remaining: 4996
+> X-RateLimit-Reset: 1372700873
+{% endif %}
+```
## Cross Origin Resource Sharing
-The API supports Cross Origin Resource Sharing (CORS) for AJAX requests.
-you can read the [CORS W3C working draft](http://www.w3.org/TR/cors), or
+The API supports Cross Origin Resource Sharing (CORS) for AJAX requests from
+any origin.
+You can read the [CORS W3C Recommendation](http://www.w3.org/TR/cors/), or
[this intro](http://code.google.com/p/html5security/wiki/CrossOriginRequestSecurity) from the
HTML 5 Security Guide.
Here's a sample request sent from a browser hitting
-`http://some-site.com`:
-
- $ curl -i https://api.github.com -H "Origin: http://some-site.com"
- HTTP/1.1 302 Found
+`http://example.com`:
-Any domain that is registered as an OAuth Application is accepted.
-Here's a sample request for a browser hitting [Calendar About Nothing](http://calendaraboutnothing.com/):
-
- $ curl -i https://api.github.com -H "Origin: http://calendaraboutnothing.com"
- HTTP/1.1 302 Found
- Access-Control-Allow-Origin: http://calendaraboutnothing.com
- Access-Control-Expose-Headers: Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-OAuth-Scopes, X-Accepted-OAuth-Scopes
- Access-Control-Allow-Credentials: true
+``` command-line
+$ curl -i {{ site.data.variables.product.api_url_pre }} -H "Origin: http://example.com"
+HTTP/1.1 302 Found
+Access-Control-Allow-Origin: *
+Access-Control-Expose-Headers: ETag, Link, X-GitHub-OTP, {% if page.version == 'dotcom' %}X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset,{% endif %} X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
+Access-Control-Allow-Credentials: true
+```
This is what the CORS preflight request looks like:
- $ curl -i https://api.github.com -H "Origin: http://calendaraboutnothing.com" -X OPTIONS
- HTTP/1.1 204 No Content
- Access-Control-Allow-Origin: http://calendaraboutnothing.com
- Access-Control-Allow-Headers: Authorization, X-Requested-With
- Access-Control-Allow-Methods: GET, POST, PATCH, PUT, DELETE
- Access-Control-Expose-Headers: Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-OAuth-Scopes, X-Accepted-OAuth-Scopes
- Access-Control-Max-Age: 86400
- Access-Control-Allow-Credentials: true
+``` command-line
+$ curl -i {{ site.data.variables.product.api_url_pre }} -H "Origin: http://example.com" -X OPTIONS
+HTTP/1.1 204 No Content
+Access-Control-Allow-Origin: *
+Access-Control-Allow-Headers: Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-GitHub-OTP, X-Requested-With
+Access-Control-Allow-Methods: GET, POST, PATCH, PUT, DELETE
+Access-Control-Expose-Headers: ETag, Link, X-GitHub-OTP, {% if page.version == 'dotcom' %}X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset,{% endif %} X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
+Access-Control-Max-Age: 86400
+Access-Control-Allow-Credentials: true
+```
## JSON-P Callbacks
You can send a `?callback` parameter to any GET call to have the results
wrapped in a JSON function. This is typically used when browsers want
-to embed GitHub content in web pages by getting around cross domain
+to embed {{ site.data.variables.product.product_name }} content in web pages by getting around cross domain
issues. The response includes the same data output as the regular API,
plus the relevant HTTP Header information.
-
+``` command-line
$ curl https://api.github.com?callback=foo
-foo({
- "meta": {
- "status": 200,
- "X-RateLimit-Limit": "5000",
- "X-RateLimit-Remaining": "4966",
- "Link": [ // pagination headers and other links
- ["https://api.github.com?page=2", {"rel": "next"}]
- ]
- },
- "data": {
- // the data
- }
-})
-
-
-You can write a javascript handler to process the callback like this:
-
-function foo(response) {
- var meta = response.meta
- var data = response.data
- console.log(meta)
- console.log(data)
-}
+> /**/foo({
+> "meta": {
+> "status": 200,
+{% if page.version == 'dotcom' %}
+> "X-RateLimit-Limit": "5000",
+> "X-RateLimit-Remaining": "4966",
+> "X-RateLimit-Reset": "1372700873",
+{% endif %}
+> "Link": [ // pagination headers and other links
+> ["https://api.github.com?page=2", {"rel": "next"}]
+> ]
+> },
+> "data": {
+> // the data
+> }
+> })
+```
+
+You can write a JavaScript handler to process the callback. Here's a minimal example you can try out:
+
+
+
+
+
+
+
+ Open up your browser's console.
+
+
All of the headers are the same String value as the HTTP Headers with one
notable exception: Link. Link headers are pre-parsed for you and come
@@ -372,3 +637,47 @@ A link that looks like this:
["url1", {:rel => "next"}],
["url2", {:rel => "foo", :bar => "baz"}]] %>
+## Timezones
+
+Some requests allow for specifying timestamps or generate timestamps with time
+zone information. We apply the following rules, in order of priority, to
+determine timezone information for API calls.
+
+#### Explicitly provide an ISO 8601 timestamp with timezone information
+
+For API calls that allow for a timestamp to be specified, we use that exact
+timestamp. An example of this is the [Commits API](/v3/git/commits).
+
+These timestamps look something like `2014-02-27T15:05:06+01:00`. Also see
+[this example](https://developer.github.com/v3/git/commits/#example-input) for
+how these timestamps can be specified.
+
+#### Using the `Time-Zone` header
+
+It is possible to supply a `Time-Zone` header which defines a timezone according
+to the [list of names from the Olson database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
+
+``` command-line
+$ curl -H "Time-Zone: Europe/Amsterdam" -X POST {{ site.data.variables.product.api_url_pre }}/repos/github/linguist/contents/new_file.md
+```
+
+This means that we generate a timestamp for the moment your API call is made in
+the timezone this header defines. For example, the [Contents API](/v3/repos/contents/)
+generates a git commit for each addition or change and uses the current time
+as the timestamp. This header will determine the timezone used for generating
+that current timestamp.
+
+#### Using the last known timezone for the user
+
+If no `Time-Zone` header is specified and you make an authenticated call to the
+API, we use the last known timezone for the authenticated user. The last known
+timezone is updated whenever you browse the {{ site.data.variables.product.product_name }} website.
+
+#### UTC
+
+If the steps above don't result in any information, we use UTC as the timezone
+to create the git commit.
+
+[support]: https://github.com/contact?form[subject]=APIv3
+[abuse-support]: https://github.com/contact?form[subject]=API+Abuse+Rate+Limits
+[pagination-guide]: /guides/traversing-with-pagination
diff --git a/content/v3/activity.md b/content/v3/activity.md
new file mode 100644
index 0000000000..cdac1ca8a7
--- /dev/null
+++ b/content/v3/activity.md
@@ -0,0 +1,39 @@
+---
+title: Activity
+---
+# Activity
+
+Serving up the 'social' in Social Coding, the Activity APIs provide access to
+notifications, subscriptions, and timelines.
+
+## [Events][]
+
+The [Events API][Events] is a read-only interface to all the [event
+types][types] that power the various activity streams on {{ site.data.variables.product.product_name }}.
+
+## [Feeds][]
+
+List of [Atom feeds][Feeds] available for the authenticated user.
+
+## [Notifications][]
+
+Notifications of new comments are delivered to users. [The Notifications
+API][Notifications] lets you view these notifications and mark them as read.
+
+## [Starring][]
+
+[Repository Starring][Starring] is a feature that lets users bookmark repositories. Stars
+are shown next to repositories to show an approximate level of interest. Stars
+have no effect on notifications or the activity feed.
+
+## [Watching][]
+
+[Watching a Repository][Watching] registers the user to receive notifications on new
+discussions, as well as events in the user's activity feed.
+
+[Events]: /v3/activity/events/
+[types]: /v3/activity/events/types/
+[Feeds]: /v3/activity/feeds/
+[Notifications]: /v3/activity/notifications/
+[Starring]: /v3/activity/starring/
+[Watching]: /v3/activity/watching/
diff --git a/content/v3/activity/events.md b/content/v3/activity/events.md
new file mode 100644
index 0000000000..5541291631
--- /dev/null
+++ b/content/v3/activity/events.md
@@ -0,0 +1,95 @@
+---
+title: Events
+---
+
+# Events
+
+This is a read-only API to the {{ site.data.variables.product.product_name }} events. These events power the
+various activity streams on the site.
+
+{:toc}
+
+Events are optimized for polling with the "ETag" header. If no new events have
+been triggered, you will see a "304 Not Modified" response, and your current
+rate limit will be untouched. There is also an "X-Poll-Interval" header that
+specifies how often (in seconds) you are allowed to poll. In times of high
+server load, the time may increase. Please obey the header.
+
+``` command-line
+$ curl -I {{ site.data.variables.product.api_url_pre }}/users/tater/events
+> HTTP/1.1 200 OK
+> X-Poll-Interval: 60
+> ETag: "a18c3bded88eb5dbb5c849a489412bf3"
+
+# The quotes around the ETag value are important
+$ curl -I {{ site.data.variables.product.api_url_pre }}/users/tater/events \
+$ -H 'If-None-Match: "a18c3bded88eb5dbb5c849a489412bf3"'
+> HTTP/1.1 304 Not Modified
+> X-Poll-Interval: 60
+```
+
+Events support [pagination](/v3/#pagination),
+however the `per_page` option is unsupported. The fixed page size is 30 items.
+Fetching up to ten pages is supported, for a total of 300 events.
+
+Only events created within the past 90 days will be included in timelines. Events
+older than 90 days will not be included (even if the total number of events
+in the timeline is less than 300).
+
+All Events have the same response format:
+
+<%= headers 200, :pagination => default_pagination_rels %>
+<%= json(:event) { |h| [h] } %>
+
+## List public events
+
+ GET /events
+
+## List repository events
+
+ GET /repos/:owner/:repo/events
+
+## List issue events for a repository
+
+Repository issue events have a different format than other events,
+as documented in the [Issue Events API](https://developer.github.com/v3/issues/events/).
+
+ GET /repos/:owner/:repo/issues/events
+
+## List public events for a network of repositories
+
+ GET /networks/:owner/:repo/events
+
+## List public events for an organization
+
+ GET /orgs/:org/events
+
+## List events that a user has received
+
+These 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.
+
+ GET /users/:username/received_events
+
+## List public events that a user has received
+
+ GET /users/:username/received_events/public
+
+## List events performed by a user
+
+If you are authenticated as the given user, you will see your private
+events. Otherwise, you'll only see public events.
+
+ GET /users/:username/events
+
+## List public events performed by a user
+
+ GET /users/:username/events/public
+
+## List events for an organization
+
+This is the user's organization dashboard. You must be authenticated as
+the user to view this.
+
+ GET /users/:username/events/orgs/:org
diff --git a/content/v3/activity/events/types.md b/content/v3/activity/events/types.md
new file mode 100644
index 0000000000..9504e2de89
--- /dev/null
+++ b/content/v3/activity/events/types.md
@@ -0,0 +1,558 @@
+---
+title: Event Types & Payloads
+---
+
+# Event Types & Payloads
+
+Each event has a similar JSON schema, but a unique `payload` object that is
+determined by its event type.
+
+Event names are used by [repository webhooks](/v3/repos/hooks/) to specify
+which events the webhook should receive. The included payloads below are from webhook deliveries but
+match events returned by the [Events API](/v3/activity/events/) (except where noted). The Events API uses the CamelCased name (e.g. `CommitCommentEvent`) in the `type` field of an event object and does not include the `repository` or `sender` fields in the event payload object.
+
+
+**Note:** Some of these events may not be rendered in timelines, they're only
+created for various internal and webhook purposes.
+
+{:toc}
+
+## CommitCommentEvent
+
+Triggered when a [commit comment](/v3/repos/comments/#list-commit-comments-for-a-repository) is created.
+
+### Events API payload
+
+Key | Type | Description
+----|------|-------------
+`comment`|`object` | The [comment](/v3/repos/comments/#list-commit-comments-for-a-repository) itself.
+
+### Webhook event name
+
+`commit_comment`
+
+### Webhook payload example
+
+<%= webhook_payload "commit_comment" %>
+
+## CreateEvent
+
+Represents a created repository, branch, or tag.
+
+Note: webhooks will not receive this event for created repositories. Additionally, webhooks will not receive this event for tags if more than three tags are pushed at once.
+
+### Events API payload
+
+Key | Type | Description
+----|------|-------------
+`ref_type`|`string` | The object that was created. Can be one of "repository", "branch", or "tag"
+`ref`|`string` | The git ref (or `null` if only a repository was created).
+`master_branch`|`string` | The name of the repository's default branch (usually `master`).
+`description`|`string` | The repository's current description.
+
+### Webhook event name
+
+`create`
+
+### Webhook payload example
+
+<%= webhook_payload "create" %>
+
+## DeleteEvent
+
+Represents a [deleted branch or tag](/v3/git/refs/#delete-a-reference).
+
+Note: webhooks will not receive this event for tags if more than three tags are deleted at once.
+
+### Events API payload
+
+Key | Type | Description
+----|------|-------------
+`ref_type`|`string` | The object that was deleted. Can be "branch" or "tag".
+`ref`|`string` | The full git ref.
+
+### Webhook event name
+
+`delete`
+
+### Webhook payload example
+
+<%= webhook_payload "delete" %>
+
+## DeploymentEvent
+
+Represents a [deployment](/v3/repos/deployments/#list-deployments).
+
+Events of this type are not visible in timelines. These events are only used to trigger hooks.
+
+### Events API payload
+
+Key | Type | Description
+----|------|-------------
+`deployment` |`object` | The [deployment](/v3/repos/deployments/#list-deployments).
+`deployment`[`"sha"`] |`string` | The commit SHA for which this deployment was created.
+`deployment`[`"payload"`] |`string` | The optional extra information for this deployment.
+`deployment`[`"environment"`] |`string` | The optional environment to deploy to. Default: `"production"`
+`deployment`[`"description"`] |`string` | The optional human-readable description added to the deployment.
+`repository` |`object` | The [repository](/v3/repos/) for this deployment.
+
+### Webhook event name
+
+`deployment`
+
+### Webhook payload example
+
+<%= webhook_payload "deployment" %>
+
+## DeploymentStatusEvent
+
+Represents a [deployment status](/v3/repos/deployments/#list-deployment-statuses).
+
+Events of this type are not visible in timelines. These events are only used to trigger hooks.
+
+### Events API payload
+
+Key | Type | Description
+----|------|-------------
+`deployment_status` |`object` | The [deployment status](/v3/repos/deployments/#list-deployment-statuses).
+`deployment_status["state"]` |`string` | The new state. Can be `pending`, `success`, `failure`, or `error`.
+`deployment_status["target_url"]` |`string` | The optional link added to the status.
+`deployment_status["description"]`|`string` | The optional human-readable description added to the status.
+`deployment` |`object` | The [deployment](/v3/repos/deployments/#list-deployments) that this status is associated with.
+`repository` |`object` | The [repository](/v3/repos/) for this deployment.
+
+### Webhook event name
+
+`deployment_status`
+
+### Webhook payload example
+
+<%= webhook_payload "deployment_status" %>
+
+## DownloadEvent
+
+Triggered when a new [download](/v3/repos/downloads/) is created.
+
+Events of this type are **no longer created**, but it's possible that they exist in timelines of some users.
+
+### Events API payload
+
+Key | Type | Description
+----|------|-------------
+`download`|`object` | The [download](/v3/repos/downloads/) that was just created.
+
+### Webhook event name
+
+`download`
+
+## FollowEvent
+
+Triggered when a user [follows another user](/v3/users/followers/#follow-a-user).
+
+Events of this type are **no longer created**, but it's possible that they exist in timelines of some users.
+
+### Events API payload
+
+Key | Type | Description
+----|------|-------------
+`target`|`object` | The [user](/v3/users) that was just followed.
+
+### Webhook event name
+
+`follow`
+
+## ForkEvent
+
+Triggered when a user [forks a repository](/v3/repos/forks/#create-a-fork).
+
+### Events API payload
+
+Key | Type | Description
+----|------|-------------
+`forkee`|`object` | The created [repository](/v3/repos/).
+
+### Webhook event name
+
+`fork`
+
+### Webhook payload example
+
+<%= webhook_payload "fork" %>
+
+## ForkApplyEvent
+
+Triggered when a patch is applied in the Fork Queue.
+
+Events of this type are **no longer created**, but it's possible that they exist in timelines of some users.
+
+### Events API payload
+
+Key | Type | Description
+----|------|-------------
+`head`|`string` | The branch name the patch is applied to.
+`before`|`string` | SHA of the repository state before the patch.
+`after`|`string` | SHA of the repository state after the patch.
+
+### Webhook event name
+
+`fork_apply`
+
+## GistEvent
+
+Triggered when a [Gist](/v3/gists/) is created or updated.
+
+Events of this type are **no longer created**, but it's possible that they exist in timelines of some users.
+
+### Events API payload
+
+Key | Type | Description
+----|------|-------------
+`action`|`string` | The action that was performed. Can be "create" or "update"
+`gist`|`object` | The [gist](/v3/gists/) itself.
+
+### Webhook event name
+
+`gist`
+
+## GollumEvent
+
+Triggered when a Wiki page is created or updated.
+
+### Events API payload
+
+Key | Type | Description
+----|------|-------------
+`pages`|`array` | The pages that were updated.
+`pages[][page_name]`|`string` | The name of the page.
+`pages[][title]`|`string` | The current page title.
+`pages[][action]`|`string` | The action that was performed on the page. Can be "created" or "edited".
+`pages[][sha]`|`string` | The latest commit SHA of the page.
+`pages[][html_url]`|`string` | Points to the HTML wiki page.
+
+### Webhook event name
+
+`gollum`
+
+### Webhook payload example
+
+<%= webhook_payload "gollum" %>
+
+## IssueCommentEvent
+
+{% if page.version == 'dotcom' or page.version > 2.6 %}
+Triggered when an [issue comment](/v3/issues/comments/) is created, edited, or deleted.
+{% else %}
+Triggered when an [issue is commented on](/v3/issues/comments/).
+{% endif %}
+
+### Events API payload
+
+Key | Type | Description
+----|------|-------------
+`action`|`string` | The action that was performed on the comment. {% if page.version == 'dotcom' or page.version > 2.6 %}Can be one of "created", "edited", or "deleted".
+`changes`|`object` | The changes to the comment if the action was "edited".
+`changes[body][from]` |`string` | The previous version of the body if the action was "edited".{% else %}Currently, can only be "created".{% endif %}
+`issue`|`object` | The [issue](/v3/issues/) the comment belongs to.
+`comment`|`object` | The [comment](/v3/issues/comments/) itself.
+
+### Webhook event name
+
+`issue_comment`
+
+### Webhook payload example
+
+<%= webhook_payload "issue_comment" %>
+
+## IssuesEvent
+
+Triggered when an [issue](/v3/issues) is assigned, unassigned, labeled, unlabeled, opened, {% if page.version == 'dotcom' or page.version > 2.6 %}edited, {% endif %}closed, or reopened.
+
+### Events API payload
+
+Key | Type | Description
+----|------|-------------
+`action`|`string` | The action that was performed. Can be one of "assigned", "unassigned", "labeled", "unlabeled", "opened", {% if page.version == 'dotcom' or page.version > 2.6 %}"edited", {% endif %}"closed", or "reopened".
+`issue`|`object` | The [issue](/v3/issues) itself.{% if page.version == 'dotcom' or page.version > 2.6 %}
+`changes`|`object`| The changes to the issue if the action was "edited".
+`changes[title][from]`|`string` | The previous version of the title if the action was "edited".
+`changes[body][from]`|`string` | The previous version of the body if the action was "edited".{% endif %}
+`assignee`|`object` | The optional user who was assigned or unassigned from the issue.
+`label`|`object` | The optional label that was added or removed from the issue.
+
+### Webhook event name
+
+`issues`
+
+### Webhook payload example
+
+<%= webhook_payload "issues" %>
+
+## MemberEvent
+
+Triggered when a user is [added as a collaborator](/v3/repos/collaborators/#add-user-as-a-collaborator) to a repository.
+
+### Events API payload
+
+Key | Type | Description
+----|------|-------------
+`member`|`object` | The [user](/v3/users/) that was added.
+`action`|`string` | The action that was performed. Currently, can only be "added".
+
+### Webhook event name
+
+`member`
+
+### Webhook payload example
+
+<%= webhook_payload "member" %>
+
+## MembershipEvent
+
+Triggered when a user is added or removed from a team.
+
+Events of this type are not visible in timelines. These events are only used to trigger hooks.
+
+### Events API payload
+
+Key | Type | Description
+----|------|-------------
+`action` |`string` | The action that was performed. Can be "added" or "removed".
+`scope` |`string` | The scope of the membership. Currently, can only be "team".
+`member` |`object` | The [user](/v3/users/) that was added or removed.
+`team` |`object` | The [team](/v3/orgs/teams/) for the membership.
+
+### Webhook event name
+
+`membership`
+
+### Webhook payload example
+
+<%= webhook_payload "membership" %>
+
+## PageBuildEvent
+
+Represents an attempted build of a GitHub Pages site, whether successful or not.
+
+Triggered on push to a GitHub Pages enabled branch (`gh-pages` for project pages, `master` for user and organization pages).
+
+Events of this type are not visible in timelines. These events are only used to trigger hooks.
+
+### Events API payload
+
+Key | Type | Description
+----|------|------------
+`build` | `object` | The [page build](https://developer.github.com/v3/repos/pages/#list-pages-builds) itself.
+
+### Webhook event name
+
+`page_build`
+
+### Webhook payload example
+
+<%= webhook_payload "page_build" %>
+
+## PublicEvent
+
+Triggered when a private repository is [open sourced](/v3/repos/#edit). Without a doubt: the best {{ site.data.variables.product.product_name }} event.
+
+### Events API payload
+
+### Webhook event name
+
+`public`
+
+### Webhook payload example
+
+<%= webhook_payload "public" %>
+
+## PullRequestEvent
+
+Triggered when a [pull request](/v3/pulls) is assigned, unassigned, labeled, unlabeled, opened, {% if page.version == 'dotcom' or page.version > 2.6 %}edited, {% endif %}closed, reopened, or synchronized.
+
+### Events API payload
+
+Key | Type | Description
+----|------|-------------
+`action`|`string` | The action that was performed. Can be one of "assigned", "unassigned", "labeled", "unlabeled", "opened", {% if page.version == 'dotcom' or page.version > 2.6 %}"edited", {% endif %}"closed", or "reopened", or "synchronize". If the action is "closed" and the `merged` key is `false`, the pull request was closed with unmerged commits. If the action is "closed" and the `merged` key is `true`, the pull request was merged.
+`number`|`integer` | The pull request number.{% if page.version == 'dotcom' or page.version > 2.6 %}
+`changes`|`object`| The changes to the comment if the action was "edited".
+`changes[title][from]`|`string` | The previous version of the title if the action was "edited".
+`changes[body][from]`|`string` | The previous version of the body if the action was "edited".{% endif %}
+`pull_request`|`object` | The [pull request](/v3/pulls) itself.
+
+### Webhook event name
+
+`pull_request`
+
+### Webhook payload example
+
+<%= webhook_payload "pull_request" %>
+
+## PullRequestReviewCommentEvent
+
+{% if page.version == 'dotcom' or page.version > 2.6 %}
+Triggered when a [comment on a Pull Request's unified diff](/v3/pulls/comments) is created, edited, or deleted (in the Files Changed tab).
+{% else %}
+Triggered when a [Pull Request's unified diff is commented on](/v3/pulls/comments) (in the Files Changed tab).
+{% endif %}
+
+### Events API payload
+
+Key | Type | Description
+----|------|-------------
+`action`|`string` | The action that was performed on the comment. {% if page.version == 'dotcom' or page.version > 2.6 %}Can be one of "created", "edited", or "deleted".
+`changes`|`object`| The changes to the comment if the action was "edited".
+`changes[body][from]`|`string` | The previous version of the body if the action was "edited".{% else %}Currently, can only be "created".{% endif %}
+`pull_request`|`object` | The [pull request](/v3/pulls/) the comment belongs to.
+`comment`|`object` | The [comment](/v3/pulls/comments) itself.
+
+### Webhook event name
+
+`pull_request_review_comment`
+
+### Webhook payload example
+
+<%= webhook_payload "pull_request_review_comment" %>
+
+## PushEvent
+
+Triggered when a repository branch is pushed to. In addition to branch pushes, webhook [`push` events](/webhooks/#events) are also triggered when repository tags are pushed.
+
+{{#tip}}
+
+The Events API `PushEvent` payload is described in the table below. The example payload below that is from a webhook delivery and will differ from the Events API `PushEvent` payload.
+
+{{/tip}}
+
+### Events API payload
+
+Key | Type | Description
+----|------|-------------
+`ref`|`string` | The full Git ref that was pushed. Example: `"refs/heads/master"`.
+`head`|`string` | The SHA of the most recent commit on `ref` after the push.
+`before`|`string` | The SHA of the most recent commit on `ref` before the push.
+`size`|`integer` | The number of commits in the push.
+`distinct_size`|`integer` | The number of distinct commits in the push.
+`commits`|`array` | An array of commit objects describing the pushed commits. (The array includes a maximum of 20 commits. If necessary, you can use the [Commits API](/v3/repos/commits/) to fetch additional commits. This limit is applied to timeline events only and isn't applied to webhook deliveries.)
+`commits[][sha]`|`string` | The SHA of the commit.
+`commits[][message]`|`string` | The commit message.
+`commits[][author]`|`object` | The git author of the commit.
+`commits[][author][name]`|`string` | The git author's name.
+`commits[][author][email]`|`string` | The git author's email address.
+`commits[][url]`|`url` | Points to the commit API resource.
+`commits[][distinct]`|`boolean` | Whether this commit is distinct from any that have been pushed before.
+
+### Webhook event name
+
+`push`
+
+### Webhook payload example
+
+<%= webhook_payload "push" %>
+
+## ReleaseEvent
+
+Triggered when a [release](/v3/repos/releases/#get-a-single-release) is published.
+
+### Events API payload
+
+Key | Type | Description
+----|------|-------------
+`action`|`string` | The action that was performed. Currently, can only be "published".
+`release`|`object` | The [release](/v3/repos/releases/#get-a-single-release) itself.
+
+### Webhook event name
+
+`release`
+
+### Webhook payload example
+
+<%= webhook_payload "release" %>
+
+## RepositoryEvent
+
+Triggered when a repository is created{% if page.version == 'dotcom' or page.version > 2.6 %}, deleted, made public, or made private{% endif %}.
+
+Events of this type are not visible in timelines. These events are only used to trigger {% if page.version != 'dotcom' and page.version <= 2.6 %}organization {% endif %}hooks.
+
+### Events API payload
+
+Key | Type | Description
+----|------|-------------
+`action` |`string` | The action that was performed. {% if page.version == 'dotcom' or page.version > 2.6 %}This can be one of "created", "deleted", "publicized", or "privatized".{% else %}Currently, can only be "created".{% endif %}
+`repository`|`object` | The [repository](/v3/repos/) itself.
+
+### Webhook event name
+
+`repository`
+
+### Webhook payload example
+
+<%= webhook_payload "repository" %>
+
+## StatusEvent
+
+Triggered when the status of a Git commit changes.
+
+Events of this type are not visible in timelines. These events are only used to trigger hooks.
+
+### Events API payload
+
+Key | Type | Description
+----|------|-------------
+`sha`|`string` | The Commit SHA.
+`state`|`string` | The new state. Can be `pending`, `success`, `failure`, or `error`.
+`description`|`string` | The optional human-readable description added to the status.
+`target_url`|`string` | The optional link added to the status.
+`branches`|`array` | An array of branch objects containing the status' SHA. Each branch contains the given SHA, but the SHA may or may not be the head of the branch. The array includes a maximum of 10 branches.
+
+### Webhook event name
+
+`status`
+
+### Webhook payload example
+
+<%= webhook_payload "status" %>
+
+## TeamAddEvent
+
+Triggered when a [repository is added to a team](/v3/orgs/teams/#add-or-update-team-repository).
+
+Events of this type are not visible in timelines. These events are only used to trigger hooks.
+
+### Events API payload
+
+Key | Type | Description
+----|------|-------------
+`team`|`object` | The [team](/v3/orgs/teams/) that was modified. Note: older events may not include this in the payload.
+`repository`|`object` | The [repository](/v3/repos/) that was added to this team.
+
+### Webhook event name
+
+`team_add`
+
+### Webhook payload example
+
+<%= webhook_payload "team_add" %>
+
+## WatchEvent
+
+The WatchEvent is related to [starring a repository](/v3/activity/starring/#star-a-repository), not [watching](/v3/activity/watching/).
+See [this API blog post](/changes/2012-09-05-watcher-api/) for an explanation.
+
+The event’s actor is the [user](/v3/users/) who starred a repository, and the
+event’s repository is the [repository](/v3/repos/) that was starred.
+
+### Events API payload
+
+Key | Type | Description
+----|------|-------------
+`action`|`string` | The action that was performed. Currently, can only be `started`.
+
+### Webhook event name
+
+`watch`
+
+### Webhook payload example
+
+<%= webhook_payload "watch" %>
diff --git a/content/v3/activity/feeds.md b/content/v3/activity/feeds.md
new file mode 100644
index 0000000000..11c583fa9b
--- /dev/null
+++ b/content/v3/activity/feeds.md
@@ -0,0 +1,34 @@
+---
+title: Feeds
+---
+
+# Feeds
+
+{:toc}
+
+## List Feeds
+
+{{ site.data.variables.product.product_name }} provides several timeline resources in [Atom][] format. The Feeds API
+lists all the feeds available to the authenticated user:
+
+* **Timeline**: The {{ site.data.variables.product.product_name }} global public timeline
+* **User**: The public timeline for any user, using [URI template][]
+* **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.
+
+**Note**: Private feeds are only returned when [authenticating via Basic
+Auth][authenticating] since current feed URIs use the older, non revocable auth
+tokens.
+
+ GET /feeds
+
+### Response
+
+<%= headers 200 %>
+<%= json :feeds %>
+
+[Atom]: http://en.wikipedia.org/wiki/Atom_(standard)
+[authenticating]: /v3/#basic-authentication
+[URI template]: https://developer.github.com/v3/#hypermedia
diff --git a/content/v3/activity/notifications.md b/content/v3/activity/notifications.md
new file mode 100644
index 0000000000..b09ec649a7
--- /dev/null
+++ b/content/v3/activity/notifications.md
@@ -0,0 +1,222 @@
+---
+title: Notifications
+---
+
+# Notifications
+
+{:toc}
+
+Users receive notifications for conversations in repositories they watch
+including:
+
+* Issues and their comments
+* Pull Requests and their comments
+* Comments on any commits
+
+Notifications are also sent for conversations in unwatched repositories when the
+user is involved including:
+
+* **@mentions**
+* Issue assignments
+* Commits the user authors or commits
+* Any discussion in which the user actively participates
+
+All Notification API calls require the `notifications` or
+`repo` API scopes. Doing this will give read-only access to
+some Issue/Commit content. You will still need the "repo" scope to access
+Issues and Commits from their respective endpoints.
+
+Notifications come back as "threads". A Thread contains information about the
+current discussion of an Issue/PullRequest/Commit.
+
+Notifications are optimized for polling with the "Last-Modified" header. If
+there are no new notifications, you will see a "304 Not Modified" response,
+leaving your current rate limit untouched. There is an "X-Poll-Interval"
+header that specifies how often (in seconds) you are allowed to poll. In times
+of high server load, the time may increase. Please obey the header.
+
+``` command-line
+# Add authentication to your requests
+$ curl -I {{ site.data.variables.product.api_url_pre }}/notifications
+HTTP/1.1 200 OK
+Last-Modified: Thu, 25 Oct 2012 15:16:27 GMT
+X-Poll-Interval: 60
+
+# Pass the Last-Modified header exactly
+$ curl -I {{ site.data.variables.product.api_url_pre }}/notifications
+$ -H "If-Modified-Since: Thu, 25 Oct 2012 15:16:27 GMT"
+> HTTP/1.1 304 Not Modified
+> X-Poll-Interval: 60
+```
+
+## Notification Reasons
+
+When retrieving responses from the Notifications API, each payload has a key titled
+`reason`. These correspond to events that trigger a notification.
+
+Here's a list of potential `reason`s for receiving a notification:
+
+Reason Name | Description
+------------|------------
+`subscribed` | The notification arrived because you're watching the repository
+`manual` | The notification arrived because you've specifically decided to subscribe to the thread (via an Issue or Pull Request)
+`author` | The notification arrived because you've created the thread
+`comment` | The notification arrived because you've commented on the thread
+`mention` | The notification arrived because you were specifically **@mentioned** in the content
+`team_mention` | The notification arrived because you were on a team that was mentioned (like @org/team)
+`state_change` | The notification arrived because you changed the thread state (like closing an Issue or merging a Pull Request)
+`assign` | The notification arrived because you were assigned to the Issue
+
+Note that the `reason` is modified on a per-thread basis, and can change, if the
+`reason` on a later notification is different.
+
+For example, if you are the author of an issue, subsequent notifications on that
+issue will have a `reason` of `author`. If you're then **@mentioned** on the same
+issue, the notifications you fetch thereafter will have a `reason` of `mention`.
+The `reason` remains as `mention`, regardless of whether you're ever mentioned again.
+
+## List your notifications
+
+List all notifications for the current user, grouped by repository.
+
+ GET /notifications
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`all`|`boolean` | If `true`, show notifications marked as read. Default: `false`
+`participating`|`boolean` | If `true`, only shows notifications in which the user is directly participating or mentioned. Default: `false`
+`since`|`string` | Only show notifications updated after the given time. This is a timestamp in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. Default: `Time.now`
+`before`|`string` | Only show notifications updated before the given time. This is a timestamp in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.
+
+### Response
+
+{% if page.version == 'dotcom' or page.version > 2.5 %}
+<%= headers 200, :pagination => default_pagination_rels %>
+{% else %}
+<%= headers 200 %>
+{% endif %}
+<%= json(:thread) { |h| [h] } %>
+
+## List your notifications in a repository
+
+List all notifications for the current user.
+
+ GET /repos/:owner/:repo/notifications
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`all`|`boolean` | If `true`, show notifications marked as read. Default: `false`
+`participating`|`boolean` | If `true`, only shows notifications in which the user is directly participating or mentioned. Default: `false`
+`since`|`string` | Only show notifications updated after the given time. This is a timestamp in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. Default: `Time.now`
+`before`|`string` | Only show notifications updated before the given time. This is a timestamp in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.
+
+### Response
+
+{% if page.version == 'dotcom' or page.version > 2.5 %}
+<%= headers 200, :pagination => default_pagination_rels %>
+{% else %}
+<%= headers 200 %>
+{% endif %}
+<%= json(:thread) { |h| [h] } %>
+
+## Mark as read
+
+Marking a notification as "read" removes it from the [default view
+on {{ site.data.variables.product.product_name }}](https://github.com/notifications).
+
+ PUT /notifications
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`last_read_at`|`string` | Describes the last point that notifications were checked. Anything updated since this time will not be updated. This is a timestamp in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. Default: `Time.now`
+
+
+### Response
+
+<%= headers 205 %>
+
+## Mark notifications as read in a repository
+
+Marking all notifications in a repository as "read" removes them
+from the [default view on {{ site.data.variables.product.product_name }}](https://github.com/notifications).
+
+ PUT /repos/:owner/:repo/notifications
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`last_read_at`|`string` | Describes the last point that notifications were checked. Anything updated since this time will not be updated. This is a timestamp in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. Default: `Time.now`
+
+
+### Response
+
+<%= headers 205 %>
+
+## View a single thread
+
+ GET /notifications/threads/:id
+
+### Response
+
+<%= headers 200 %>
+<%= json(:thread) %>
+
+## Mark a thread as read
+
+ PATCH /notifications/threads/:id
+
+### Response
+
+<%= headers 205 %>
+
+## Get a Thread Subscription
+
+This checks to see if the current user is subscribed to a thread. You can also
+[get a Repository subscription](/v3/activity/watching/#get-a-repository-subscription).
+
+{{#tip}}
+
+Note that subscriptions are only generated if a user is participating in a conversation--for example, they've replied to the thread, were **@mention**ed, or manually subscribe to a thread.
+
+{{/tip}}
+
+ GET /notifications/threads/:id/subscription
+
+### Response
+
+<%= headers 200 %>
+<%= json :subscription %>
+
+## Set a Thread Subscription
+
+This lets you subscribe or unsubscribe from a conversation. Unsubscribing from a conversation mutes all future notifications (until you comment or get **@mention**ed once more).
+
+ PUT /notifications/threads/:id/subscription
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`subscribed`|`boolean`| Determines if notifications should be received from this thread
+`ignored`|`boolean`| Determines if all notifications should be blocked from this thread
+
+
+### Response
+
+<%= headers 200 %>
+<%= json :subscription %>
+
+## Delete a Thread Subscription
+
+ DELETE /notifications/threads/:id/subscription
+
+### Response
+
+<%= headers 204 %>
diff --git a/content/v3/activity/starring.md b/content/v3/activity/starring.md
new file mode 100644
index 0000000000..b32b1a7c0b
--- /dev/null
+++ b/content/v3/activity/starring.md
@@ -0,0 +1,106 @@
+---
+title: Starring
+---
+
+# Starring
+
+{:toc}
+
+Repository Starring is a feature that lets users bookmark repositories. Stars
+are shown next to repositories to show an approximate level of interest. Stars
+have no effect on notifications or the activity feed. For that, see [Repository
+Watching](/v3/activity/watching).
+
+### Starring vs. Watching
+
+In August 2012, we [changed the way watching
+works](https://github.com/blog/1204-notifications-stars) on {{ site.data.variables.product.product_name }}. Many API
+client applications may be using the original "watcher" endpoints for accessing
+this data. You can now start using the "star" endpoints instead (described
+below). Check out the [Watcher API Change post](/changes/2012-09-05-watcher-api/)
+for more details.
+
+## List Stargazers
+
+ GET /repos/:owner/:repo/stargazers
+
+### Response
+
+<%= headers 200, :pagination => default_pagination_rels %>
+<%= json(:user) { |h| [h] } %>
+
+### Alternative response with star creation timestamps
+
+You can also find out _when_ stars were created by passing the following custom [media type](/v3/media/) via the `Accept` header:
+
+ Accept: application/vnd.github.v3.star+json
+
+<%= headers 200, :pagination => default_pagination_rels %>
+<%= json(:stargazer_with_timestamps) { |hash| [hash] } %>
+
+## List repositories being starred
+
+List repositories being starred by a user.
+
+ GET /users/:username/starred
+
+List repositories being starred by the authenticated user.
+
+ GET /user/starred
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`sort`|`string` | One of `created` (when the repository was starred) or `updated` (when it was last pushed to). Default: `created`
+`direction`|`string` | One of `asc` (ascending) or `desc` (descending). Default: `desc`
+
+### Response
+
+<%= headers 200, :pagination => default_pagination_rels %>
+<%= json(:repo) { |h| [h] } %>
+
+### Alternative response with star creation timestamps
+
+You can also find out _when_ stars were created by passing the following custom [media type](/v3/media/) via the `Accept` header:
+
+ Accept: application/vnd.github.v3.star+json
+
+<%= headers 200, :pagination => default_pagination_rels %>
+<%= json(:starred_repo) { |hash| [hash] } %>
+
+## Check if you are starring a repository
+
+Requires for the user to be authenticated.
+
+ GET /user/starred/:owner/:repo
+
+### Response if this repository is starred by you
+
+<%= headers 204 %>
+
+### Response if this repository is not starred by you
+
+<%= headers 404 %>
+
+## Star a repository
+
+Requires for the user to be authenticated.
+
+ PUT /user/starred/:owner/:repo
+
+<%= fetch_content(:put_content_length) %>
+
+### Response
+
+<%= headers 204 %>
+
+## Unstar a repository
+
+Requires for the user to be authenticated.
+
+ DELETE /user/starred/:owner/:repo
+
+### Response
+
+<%= headers 204 %>
diff --git a/content/v3/activity/watching.md b/content/v3/activity/watching.md
new file mode 100644
index 0000000000..40b39b87bd
--- /dev/null
+++ b/content/v3/activity/watching.md
@@ -0,0 +1,132 @@
+---
+title: Watching
+---
+
+# Watching
+
+{:toc}
+
+Watching a Repository registers the user to receive notifications on new
+discussions, as well as events in the user's activity feed. See [Repository
+Starring](/v3/activity/starring) for simple repository bookmarks.
+
+### Watching vs. Starring
+
+In August 2012, we [changed the way watching
+works](https://github.com/blog/1204-notifications-stars) on GitHub. At the time
+of that change, many API clients were already using the existing "watcher"
+endpoints to access starring data. To avoid breaking those applications, the
+legacy "watcher" endpoints continue to provide starring data.
+
+To provide access to watching data, the v3 Watcher API uses the "subscription"
+endpoints described below. Check out the [Watcher API Change
+post](/changes/2012-09-05-watcher-api/) for more details.
+
+## List watchers
+
+ GET /repos/:owner/:repo/subscribers
+
+### Response
+
+<%= headers 200, :pagination => default_pagination_rels %>
+<%= json(:user) { |h| [h] } %>
+
+## List repositories being watched
+
+List repositories being watched by a user.
+
+ GET /users/:username/subscriptions
+
+List repositories being watched by the authenticated user.
+
+ GET /user/subscriptions
+
+### Response
+
+<%= headers 200, :pagination => default_pagination_rels %>
+<%= json(:repo) { |h| [h] } %>
+
+## Get a Repository Subscription
+
+ GET /repos/:owner/:repo/subscription
+
+### Response if you are subscribed to the repository
+
+<%= headers 200 %>
+<%= json :repo_subscription %>
+
+### Response if you are not subscribed to the repository
+
+<%= headers 404 %>
+
+## Set a Repository Subscription
+
+ PUT /repos/:owner/:repo/subscription
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`subscribed`|`boolean`| Determines if notifications should be received from this repository.
+`ignored`|`boolean`| Determines if all notifications should be blocked from this repository.
+
+{{#tip}}
+
+If you would like to watch a repository, set `subscribed` to `true`. If you would like to ignore notifications made within a repository, set `ignored` to `true`. If you would like to stop watching a repository, [delete the repository's subscription](#delete-a-repository-subscription) completely.
+
+{{/tip}}
+
+### Response
+
+<%= headers 200 %>
+<%= json :repo_subscription %>
+
+## Delete a Repository Subscription
+
+{{#tip}}
+
+This endpoint should only be used to stop watching a repository. To control whether or not you wish to receive notifications from a repository, [set the repository's subscription manually](#set-a-repository-subscription).
+
+{{/tip}}
+
+ DELETE /repos/:owner/:repo/subscription
+
+### Response
+
+<%= headers 204 %>
+
+## Check if you are watching a repository (LEGACY)
+
+Requires for the user to be authenticated.
+
+ GET /user/subscriptions/:owner/:repo
+
+### Response if this repository is watched by you
+
+<%= headers 204 %>
+
+### Response if this repository is not watched by you
+
+<%= headers 404 %>
+
+## Watch a repository (LEGACY)
+
+Requires the user to be authenticated.
+
+ PUT /user/subscriptions/:owner/:repo
+
+<%= fetch_content(:put_content_length) %>
+
+### Response
+
+<%= headers 204 %>
+
+## Stop watching a repository (LEGACY)
+
+Requires for the user to be authenticated.
+
+ DELETE /user/subscriptions/:owner/:repo
+
+### Response
+
+<%= headers 204 %>
diff --git a/content/v3/auth.md b/content/v3/auth.md
new file mode 100644
index 0000000000..ca387bfaa0
--- /dev/null
+++ b/content/v3/auth.md
@@ -0,0 +1,72 @@
+---
+title: Other Authentication Methods
+---
+
+# Other Authentication Methods
+
+{:toc}
+
+While the API provides multiple methods for authentication, we strongly
+recommend using [OAuth](/v3/oauth/) for production applications. The other
+methods provided are intended to be used for scripts or testing (i.e., cases
+where full OAuth would be overkill). Third party applications that rely on
+{{ site.data.variables.product.product_name }} for authentication should not ask for or collect {{ site.data.variables.product.product_name }} credentials.
+Instead, they should use the [OAuth web flow](/v3/oauth).
+
+## Basic Authentication
+
+The API supports Basic Authentication as defined in
+[RFC2617](http://www.ietf.org/rfc/rfc2617.txt) with a few slight differences.
+The main difference is that the RFC requires unauthenticated requests to be
+answered with `401 Unauthorized` responses. In many places, this would disclose
+the existence of user data. Instead, the {{ site.data.variables.product.product_name }} API responds with `404 Not Found`.
+This may cause problems for HTTP libraries that assume a `401 Unauthorized`
+response. The solution is to manually craft the `Authorization` header.
+
+### Via Username and Password
+
+To use Basic Authentication with the {{ site.data.variables.product.product_name }} API, simply send the username and
+password associated with the account.
+
+For example, if you're accessing the API via [cURL][curl], the following command
+would authenticate you if you replace `` with your {{ site.data.variables.product.product_name }} username.
+(cURL will prompt you to enter the password.)
+
+``` command-line
+$ curl -u username {{ site.data.variables.product.api_url_pre }}/user
+```
+
+### Via OAuth Tokens
+
+Alternatively, you can use [personal access
+tokens][personal-access-tokens] or OAuth tokens instead of your password.
+
+``` command-line
+$ curl -u username:token {{ site.data.variables.product.api_url_pre }}/user
+```
+
+This approach is useful if your tools only support Basic Authentication but you
+want to take advantage of OAuth access token security features.
+
+## Working with two-factor authentication
+
+For users with two-factor authentication enabled, Basic Authentication requires
+an extra step. When you attempt to authenticate with Basic Authentication, the
+server will respond with a `401` and an `X-GitHub-OTP: required; :2fa-type`
+header. This indicates that a two-factor authentication code is needed (in
+addition to the username and password). The `:2fa-type` in this header indicates
+whether the account receives its two-factor authentication codes via SMS or via
+an application.
+
+In addition to the Basic Authentication credentials, you must send the user's
+authentication code (i.e., one-time password) in the `X-GitHub-OTP` header.
+Because these authentication codes expire quickly, we recommend using the
+Authorizations API to [create an access token][create-access] and using that
+token to [authenticate via OAuth][oauth-auth] for most API access.
+
+Alternately, you can create access tokens from the Personal Access Token [settings page](https://github.com/settings/tokens).
+
+[create-access]: /v3/oauth_authorizations/#create-a-new-authorization
+[curl]: http://curl.haxx.se/
+[oauth-auth]: /v3/#authentication
+[personal-access-tokens]: https://github.com/blog/1509-personal-api-tokens
diff --git a/content/v3/changelog.md b/content/v3/changelog.md
index 5852a338a1..9a102517b7 100644
--- a/content/v3/changelog.md
+++ b/content/v3/changelog.md
@@ -2,4 +2,4 @@
title: GitHub API Changelog
---
-The API changelog can now be found on the [homepage](/). Please update your links.
+The API changelog can now be found [here](/changes). Please update your links.
diff --git a/content/v3/emojis.md b/content/v3/emojis.md
new file mode 100644
index 0000000000..b80e96eb51
--- /dev/null
+++ b/content/v3/emojis.md
@@ -0,0 +1,14 @@
+---
+title: Emojis
+---
+
+# Emojis
+
+Lists all the emojis available to use on {{ site.data.variables.product.product_name }}.
+
+ GET /emojis
+
+### Response
+
+<%= headers 200 %>
+<%= json(:emojis) %>
diff --git a/content/v3/enterprise.md b/content/v3/enterprise.md
new file mode 100644
index 0000000000..2bcd997e44
--- /dev/null
+++ b/content/v3/enterprise.md
@@ -0,0 +1,46 @@
+---
+title: Enterprise
+---
+
+# Enterprise <%= config[:latest_enterprise_version] %>
+
+{:toc}
+
+[GitHub Enterprise](https://enterprise.github.com/) supports the same powerful API available on GitHub.com as well as its own set of API endpoints. You can find a list of these endpoints on the sidebar, with the exception of the [User Administration][] API, which is within its own section.
+
+## Endpoint URLs
+
+All API endpoints—except [Management Console][] API endpoints—are prefixed with the following URL:
+
+``` command-line
+http(s)://hostname/api/v3/
+```
+
+[Management Console][] API endpoints are only prefixed with a hostname:
+
+``` command-line
+http(s)://hostname/
+```
+
+## Authentication
+
+Your Enterprise installation's API endpoints accept [the same authentication methods](http://developer.github.com/v3/#authentication) as the GitHub.com API. Specifically, you can authenticate yourself with **[OAuth tokens][]** (which can be created using the [Authorizations API][]) or **[basic authentication][]**.
+
+Every Enterprise API endpoint is only accessible to GitHub Enterprise site administrators, with the exception of the [Management Console][] API, which is only accessible via the [Management Console password][].
+
+[Authorizations API]: /v3/oauth_authorizations/#create-a-new-authorization
+[OAuth tokens]: /v3/oauth/
+[basic authentication]: /v3/#basic-authentication
+[Management Console]: /v3/enterprise/management_console/
+[User Administration]: /v3/users/administration/
+[Management Console password]: https://help.github.com/enterprise/admin/articles/accessing-the-management-console/
+
+## Releases
+
+The latest release for GitHub Enterprise is <%= config[:versions][0] %>. The GitHub APIs available to this release are located at />.
+
+Documentation for the API that's bundled with the GitHub Enterprise appliance is available for the following releases:
+
+<% config[:versions][1..-1].each do |version| %>
+* [API documentation for <%= version %>](https://developer.github.com/enterprise/<%= version %>/)
+<% end %>
diff --git a/content/v3/enterprise/admin_stats.md b/content/v3/enterprise/admin_stats.md
new file mode 100644
index 0000000000..2b91118bf3
--- /dev/null
+++ b/content/v3/enterprise/admin_stats.md
@@ -0,0 +1,44 @@
+---
+title: Admin Stats
+---
+
+# Admin Stats
+
+{:toc}
+
+The Admin Stats API provides a variety of metrics about your installation. *It is only available to [authenticated](/v3/#authentication) site administrators.* Normal users will receive a `404` response if they try to access it.
+
+Prefix all the endpoints for this API with the following URL:
+
+``` command-line
+http(s)://hostname/api/v3
+```
+
+## Get statistics
+
+### Request
+
+ GET /enterprise/stats/:type
+
+There are a variety of types to choose from:
+
+Type | Description
+-------------|-------------------------------------
+`issues` | The number of open and closed issues.
+`hooks` | The number of active and inactive hooks.
+`milestones` | The number of open and closed milestones.
+`orgs` | The number of organizations, teams, team members, and disabled organizations.
+`comments` | The number of comments on issues, pull requests, commits, and gists.
+`pages` | The number of GitHub Pages sites.
+`users` | The number of suspended and admin users.
+`gists` | The number of private and public gists.
+`pulls` | The number of merged, mergeable, and unmergeable pull requests.
+`repos` | The number of organization-owned repositories, root repositories, forks, pushed commits, and wikis.
+`all` | All of the statistics listed above.
+
+These statistics are cached and will be updated approximately every 10 minutes.
+
+### Response
+
+<%= headers 200 %>
+<%= json(:admin_stats) %>
diff --git a/content/v3/enterprise/ldap.md b/content/v3/enterprise/ldap.md
new file mode 100644
index 0000000000..b234a5c73b
--- /dev/null
+++ b/content/v3/enterprise/ldap.md
@@ -0,0 +1,79 @@
+---
+title: LDAP
+---
+
+# LDAP
+
+{:toc}
+
+You can use the LDAP API to update account relationships between a GitHub Enterprise user or team and its linked LDAP entry or queue a new synchronization.
+
+With the LDAP mapping endpoints, you're able to update the Distinguished Name (DN) that a user or team maps to. Note that the LDAP endpoints are generally only effective if your GitHub Enterprise appliance has [LDAP Sync enabled](https://help.github.com/enterprise/admin/guides/user-management/using-ldap). As of GitHub Enterprise 2.3.1, the [Update LDAP mapping for a user](#update-ldap-mapping-for-a-user) can be used when LDAP is enabled, even if LDAP Sync is disabled.
+
+## Update LDAP mapping for a user
+
+ PATCH /admin/ldap/users/:username/mapping
+
+### Body parameters
+
+Pass a JSON payload with the new LDAP Distinguished Name.
+
+#### Example
+
+``` json
+'{"ldap_dn": "uid=asdf,ou=users,dc=github,dc=com"}'
+```
+
+### Response
+
+<%= headers 200 %>
+<%= json :ldap_user_update %>
+
+## Sync LDAP mapping for a user
+
+{{#tip}}
+
+Note that this API call does not automatically initiate an LDAP sync. Rather, if a `201` is returned, the sync job is queued successfully, and is performed when the instance is ready.
+
+{{/tip}}
+
+ POST /admin/ldap/users/:username/sync
+
+### Response
+
+<%= headers 201 %>
+<%= json :ldap_sync_confirm %>
+
+## Update LDAP mapping for a team
+
+ PATCH /admin/ldap/teams/:team_id/mapping
+
+### Body parameters
+
+Pass a JSON payload with the new LDAP Distinguished Name.
+
+#### Example
+
+``` json
+'{"ldap_dn": "cn=Enterprise Ops,ou=teams,dc=github,dc=com"}'
+```
+
+### Response
+
+<%= headers 200 %>
+<%= json :ldap_team_update %>
+
+## Sync LDAP mapping for a team
+
+{{#tip}}
+
+Note that this API call does not automatically initiate an LDAP sync. Rather, if a `201` is returned, the sync job is queued successfully, and is performed when the instance is ready.
+
+{{/tip}}
+
+ POST /admin/ldap/teams/:team_id/sync
+
+### Response
+
+<%= headers 201 %>
+<%= json :ldap_sync_confirm %>
diff --git a/content/v3/enterprise/license.md b/content/v3/enterprise/license.md
new file mode 100644
index 0000000000..bdf5ba9d22
--- /dev/null
+++ b/content/v3/enterprise/license.md
@@ -0,0 +1,26 @@
+---
+title: License
+---
+
+# License
+
+{:toc}
+
+The License API provides information on your Enterprise license. *It is only available to [authenticated](/v3/#authentication) site administrators.* Normal users will receive a `404` response if they try to access it.
+
+Prefix all the endpoints for this API with the following URL:
+
+``` command-line
+http(s)://hostname/api/v3
+```
+
+## Get license information
+
+### Request
+
+ GET /enterprise/settings/license
+
+### Response
+
+<%= headers 200 %>
+<%= json(:licensing) %>
diff --git a/content/v3/enterprise/management_console.md b/content/v3/enterprise/management_console.md
new file mode 100644
index 0000000000..e2915032a7
--- /dev/null
+++ b/content/v3/enterprise/management_console.md
@@ -0,0 +1,286 @@
+---
+title: Management Console
+---
+
+# Management Console
+
+{:toc}
+
+The Management Console API helps you manage your GitHub Enterprise installation.
+
+{{#tip}}
+
+You must explicitly set the port number when making API calls to the Management Console. If SSL is enabled on your Enterprise instance, the port number is `8443`; otherwise, the port number is `8080`.
+
+If you don't want to provide a port number, you'll need to configure your tool to automatically follow redirects.
+
+You may also need to add the [`-k` flag](http://curl.haxx.se/docs/manpage.html#-k) when using `curl`, since GitHub Enterprise uses a self-signed certificate before you [add your own SSL certificate](https://help.github.com/enterprise/admin/guides/installation/dns-hostname-subdomain-isolation-and-ssl/#ssl).
+
+{{/tip}}
+
+## Authentication
+
+You need to pass your [Management Console password](https://help.github.com/enterprise/admin/articles/accessing-the-management-console/) as an authentication token to every Management Console API endpoint except [`/setup/api/start`](#upload-a-license-for-the-first-time).
+
+Use the `api_key` parameter to send this token with each request. For example:
+
+``` command-line
+$ curl -L 'https://hostname:admin_port/setup/api?api_key=your-amazing-password'
+```
+
+You can also use standard HTTP authentication to send this token. For example:
+
+``` command-line
+$ curl -L 'https://api_key:your-amazing-password@hostname:admin_port/setup/api'
+```
+
+## Upload a license for the first time
+
+When you boot a virtual machine for the first time, you can use the following endpoint to upload a license:
+
+ POST /setup/api/start
+
+Note that you need to POST to [`/setup/api/configure`](#start-a-configuration-process) to start the actual configuration process.
+
+{{#warning}}
+
+When using this endpoint, your Enterprise instance must have a password set. This can be accomplished two ways:
+
+1. If you're working directly with the API before accessing the web interface, you must pass in the password parameter to set your password.
+2. 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.
+
+{{/warning}}
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`license`|`string` | **Required**. The content of your *.ghl* license file.
+`password`|`string` | You **must** provide a password *only if* you are uploading your license for the first time. If you previously set a password through the web interface, you don't need this parameter.
+`settings`| `string`| Optional path to a JSON file containing your installation settings.
+
+For a list of the available settings, see [the `/setup/api/settings` endpoint](#retrieve-settings).
+
+### Response
+
+``` command-line
+> HTTP/1.1 202 Created
+> Location: http://hostname:admin_port/setup/api/configcheck
+```
+
+### Example
+
+``` command-line
+$ curl -L -X POST 'https://hostname:admin_port/setup/api/start' -F license=@/path/to/github-enterprise.ghl -F "password=your-amazing-password" -F settings=</path/to/settings.json
+```
+
+## Upgrade a license
+
+This API upgrades your license and also triggers the configuration process:
+
+ POST /setup/api/upgrade
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`license`|`string` | The content of your new *.ghl* license file.
+
+### Response
+
+``` command-line
+> HTTP/1.1 202 Accepted
+> Location: http://hostname:admin_port/setup/api/configcheck
+```
+
+### Example
+
+``` command-line
+$ curl -L -X POST 'https://api_key:your-amazing-password@hostname:admin_port/setup/api/upgrade'
+```
+
+## Check configuration status
+
+This endpoint allows you to check the status of the most recent configuration process:
+
+ GET /setup/api/configcheck
+
+Note that you may need to wait several seconds after you start a process before you can
+check its status.
+
+### Response
+
+<%= headers 200 %>
+<%= json(:config_statuses) %>
+
+The different statuses are:
+
+Status | Description
+--------------|----------------------------------
+`PENDING` | The job has not started yet
+`CONFIGURING` | The job is running
+`DONE` | The job has finished correctly
+`FAILED` | The job has finished unexpectedly
+
+### Example
+
+``` command-line
+$ curl -L 'https://api_key:your-amazing-password@hostname:admin_port/setup/api/configcheck'
+```
+
+## Start a configuration process
+
+This endpoint allows you to start a configuration process at any time for your updated settings to take effect:
+
+ POST /setup/api/configure
+
+### Response
+
+``` command-line
+> HTTP/1.1 202 Accepted
+> Location: http://hostname:admin_port/setup/api/configcheck
+```
+
+### Example
+
+``` command-line
+$ curl -L -X POST 'https://api_key:your-amazing-password@hostname:admin_port/setup/api/configure'
+```
+
+## Retrieve settings
+
+ GET /setup/api/settings
+
+### Response
+
+<%= headers 200 %>
+<%= json(:fetch_settings) %>
+
+### Example
+
+``` command-line
+$ curl -L 'https://api_key:your-amazing-password@hostname:admin_port/setup/api/settings'
+```
+
+## Modify settings
+
+ PUT /setup/api/settings
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`settings`|`string` | **Required**. A JSON string with the new settings.
+
+### Response
+
+``` command-line
+> HTTP/1.1 204 No Content
+```
+
+### Example
+
+``` command-line
+$ curl -L -X PUT 'https://api_key:your-amazing-password@hostname:admin_port/setup/api/settings' --data-urlencode "settings=`cat /path/to/settings.json`"
+```
+
+## Check maintenance status
+
+Check your installation's maintenance status:
+
+ GET /setup/api/maintenance
+
+### Response
+
+<%= headers 200 %>
+<%= json(:check_maintenance_status) %>
+
+### Example
+
+``` command-line
+$ curl -L 'https://api_key:your-amazing-password@hostname:admin_port/setup/api/maintenance'
+```
+
+## Enable or disable maintenance mode
+
+ POST /setup/api/maintenance
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`maintenance`|`string` | **Required**. A JSON string with the attributes `enabled` and `when`.
+
+The possible values for `enabled` are `true` and `false`. When it's `false`,
+the attribute `when` is ignored and the maintenance mode is turned off. `when` defines the time period when the maintenance was enabled.
+
+The possible values for `when` are `now` or any date parseable by
+[mojombo/chronic](https://github.com/mojombo/chronic).
+
+### Response
+
+<%= headers 200 %>
+<%= json(:set_maintenance_status) %>
+
+### Example
+
+``` command-line
+$ curl -L -X POST 'https://api_key:your-amazing-password@hostname:admin_port/setup/api/maintenance' -d 'maintenance={"enabled":true, "when":"now"}'
+```
+
+## Retrieve authorized SSH keys
+
+ GET /setup/api/settings/authorized-keys
+
+### Response
+
+<%= headers 200 %>
+<%= json(:get_authorized_ssh_keys) %>
+
+### Example
+
+``` command-line
+$ curl -L 'https://api_key:your-amazing-password@hostname:admin_port/setup/api/settings/authorized-keys'
+```
+
+## Add a new authorized SSH key
+
+ POST /setup/api/settings/authorized-keys
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`authorized_key`|`string` | **Required**. The path to the public SSH key.
+
+### Response
+
+<%= headers 201 %>
+<%= json(:get_authorized_ssh_keys) { |h| h.push({"key" => "ssh-rsa AAAAB3NzaC1yc2EAAAAB...", "pretty-print" => "ssh-rsa 01:14:0f:f2:0f:e2:fe:e8:f4:72:62:af:75:f7:1a:88:3e:04:92:64"}); h }%>
+
+### Example
+
+``` command-line
+$ curl -L -X POST 'https://api_key:your-amazing-password@hostname:admin_port/setup/api/settings/authorized-keys' -F authorized_key=@/path/to/key.pub
+```
+
+## Remove an authorized SSH key
+
+ DELETE /setup/api/settings/authorized-keys
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`authorized_key`|`string` | **Required**. The path to the public SSH key.
+
+### Response
+
+<%= headers 200 %>
+<%= json(:get_authorized_ssh_keys) { |h| h.shift; h } %>
+
+### Example
+
+``` command-line
+$ curl -L -X DELETE 'https://api_key:your-amazing-password@hostname:admin_port/setup/api/settings/authorized-keys' -F authorized_key=@/path/to/key.pub
+```
diff --git a/content/v3/enterprise/orgs.md b/content/v3/enterprise/orgs.md
new file mode 100644
index 0000000000..cc6013e48e
--- /dev/null
+++ b/content/v3/enterprise/orgs.md
@@ -0,0 +1,40 @@
+---
+title: Organization Administration
+---
+
+# Organization Administration
+
+{:toc}
+
+The Organization Administration API allows you to create organizations on a GitHub Enterprise appliance. *It is only available to [authenticated](/v3/#authentication) site administrators.* Normal users will receive a `404` response if they try to access it.
+
+Prefix all the endpoints for this API with the following URL:
+
+``` command-line
+http(s)://hostname/api/v3
+```
+
+## Create an organization
+
+ POST /admin/organizations
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`login`|`string` | **Required.** The organization's username.
+`admin`|`string`| **Required.** The login of the user who will manage this organization.
+`profile_name`|`string` | The organization's display name.
+
+#### Example
+
+<%= json \
+ :login => "github",
+ :profile_name => "GitHub, Inc.",
+ :admin => "monalisaoctocat"
+%>
+
+### Response
+
+<%= headers 201 %>
+<%= json :org %>
diff --git a/content/v3/enterprise/pre_receive_environments.md b/content/v3/enterprise/pre_receive_environments.md
new file mode 100644
index 0000000000..ac12fe2409
--- /dev/null
+++ b/content/v3/enterprise/pre_receive_environments.md
@@ -0,0 +1,193 @@
+---
+title: Pre-receive Environments
+---
+
+# Pre-receive Environments
+
+{{#tip}}
+
+
+
+ APIs for managing pre-receive hooks are currently available for developers to preview.
+ During the preview period, the APIs may change without advance notice.
+
+ To access the API you must provide a custom [media type](/v3/media) in the `Accept` header:
+
+ application/vnd.github.eye-scream-preview
+
+{{/tip}}
+
+{:toc}
+
+The Pre-receive Environments API allows you to create, list, update and delete environments for pre-receive hooks. *It is only available to [authenticated](/v3/#authentication) site administrators.* Normal users will receive a `404` response if they try to access it.
+
+Prefix all the endpoints for this API with the following URL:
+
+``` command-line
+http(s)://hostname/api/v3
+```
+
+## Object attributes
+
+### Pre-receive Environment
+
+| Name | Type | Description |
+|-----------------------|-----------|----------------------------------------------------------------------------|
+| `name` | `string` | The name of the environment as displayed in the UI. |
+| `image_url` | `string` | URL to the tarball that will be downloaded and extracted. |
+| `default_environment` | `boolean` | Whether this is the default environment that ships with GitHub Enterprise. |
+| `download` | `object` | This environment's download status. |
+| `hooks_count` | `integer` | The number of pre-receive hooks that use this environment. |
+
+### Pre-receive Environment Download
+
+| Name | Type | Description |
+|-----------------|----------|---------------------------------------------------------|
+| `state` | `string` | The state of the most recent download. |
+| `downloaded_at` | `string` | The time when the most recent download started. |
+| `message` | `string` | On failure, this will have any error messages produced. |
+
+Possible values for `state` are `not_started`, `in_progress`, `success`, `failed`.
+
+
+## Get a single pre-receive environment
+
+ GET /admin/pre-receive-environments/:id
+
+<%= headers 200 %>
+<%= json :pre_receive_environment %>
+
+## List pre-receive environments
+
+ GET /admin/pre_receive_environments
+
+<%= headers 200, :pagination => default_pagination_rels %>
+<%= json :pre_receive_environments %>
+
+## Create a pre-receive environment
+
+ POST /admin/pre_receive_environments
+
+### Parameters
+
+| Name | Type | Description |
+|-------------|----------|-------------------------------------------------------------------------|
+| `name` | `string` | **Required**. The new pre-receive environment's name. |
+| `image_url` | `string` | **Required**. URL from which to download a tarball of this environment. |
+
+<%= json \
+ :name => 'DevTools Hook Env',
+ :image_url => 'https://my_file_server/path/to/devtools_env.tar.gz'
+%>
+
+### Response
+
+<%= headers 201 %>
+<%= json :pre_receive_environment_create %>
+
+## Edit a pre-receive environment
+
+ PATCH /admin/pre_receive_environments/:id
+
+### Parameters
+
+| Name | Type | Description |
+|-------------|----------|-----------------------------------------------------------|
+| `name` | `string` | This pre-receive environment's new name. |
+| `image_url` | `string` | URL from which to download a tarball of this environment. |
+
+### Response
+<%= headers 200 %>
+<%= json :pre_receive_environment %>
+
+#### Client Errors
+
+If you attempt to modify the default environment, you will get a response like this:
+
+<%= headers 422 %>
+<%=
+ json :message => "Validation Failed",
+ :errors => [{
+ :resource => :PreReceiveEnvironment,
+ :code => :custom,
+ :message => 'Cannot modify or delete the default environment'
+ }]
+%>
+
+## Delete a pre-receive environment
+
+ DELETE /admin/pre_receive_environments/:id
+
+### Response
+
+<%= headers 204 %>
+
+#### Client Errors
+
+If you attempt to delete an environment that cannot be deleted, you will get a response like this:
+
+<%= headers 422 %>
+<%=
+ json :message => "Validation Failed",
+ :errors => [{
+ :resource => :PreReceiveEnvironment,
+ :code => :custom,
+ :message => 'Cannot modify or delete the default environment'
+ }]
+%>
+
+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_
+
+## Get a pre-receive environment's download status
+
+In addition to seeing the download status at the `/admin/pre-receive-environments/:id`, there is also a separate endpoint for just the status.
+
+ GET /admin/pre-receive-environments/:id/downloads/latest
+
+<%= headers 200 %>
+<%= json :pre_receive_environment_download_2 %>
+
+### Object attributes
+
+| Name | Type | Description |
+|-----------------|----------|---------------------------------------------------------|
+| `state` | `string` | The state of the most recent download. |
+| `downloaded_at` | `string` | The time when the most recent download started. |
+| `message` | `string` | On failure, this will have any error messages produced. |
+
+Possible values for `state` are `not_started`, `in_progress`, `success`, `failed`.
+
+## Trigger a pre-receive environment download
+
+Triggers 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.
+
+ POST /admin/pre_receive_environments/:id/downloads
+
+### Response
+
+<%= headers 202 %>
+<%= json :pre_receive_environment_download %>
+
+#### Client Errors
+
+If a download cannot be triggered, you will get a reponse like this:
+
+<%= headers 422 %>
+<%=
+ json :message => "Validation Failed",
+ :errors => [{
+ :resource => :PreReceiveEnvironment,
+ :code => :custom,
+ :message => 'Can not start a new download when a download is in progress'
+ }]
+%>
+
+The possible error messages are:
+
+- _Cannot modify or delete the default environment_
+- _Can not start a new download when a download is in progress_
+
diff --git a/content/v3/enterprise/pre_receive_hooks.md b/content/v3/enterprise/pre_receive_hooks.md
new file mode 100644
index 0000000000..876f242bbd
--- /dev/null
+++ b/content/v3/enterprise/pre_receive_hooks.md
@@ -0,0 +1,110 @@
+---
+title: Pre-receive Hooks
+---
+
+# Pre-receive Hooks
+
+{{#tip}}
+
+
+
+ APIs for managing pre-receive hooks are currently available for developers to preview.
+ During the preview period, the APIs may change without advance notice.
+
+ To access the API you must provide a custom [media type](/v3/media) in the `Accept` header:
+
+ application/vnd.github.eye-scream-preview
+
+{{/tip}}
+
+{:toc}
+
+The Pre-receive Hooks API allows you to create, list, update and delete
+pre-receive hooks. *It is only available to
+[authenticated](/v3/#authentication) site administrators.* Normal users
+will receive a `404` response if they try to access it.
+
+Prefix all the endpoints for this API with the following URL:
+
+``` command-line
+http(s)://hostname/api/v3
+```
+
+## Object attributes
+
+### Pre-receive Hook
+
+| Name | Type | Description |
+|----------------------------------|-----------|-----------------------------------------------------------------|
+| `name` | `string` | The name of the hook. |
+| `script` | `string` | The script that the hook runs. |
+| `script_repository` | `object` | The GitHub repository where the script is kept. |
+| `environment` | `object` | The pre-receive environment where the script is executed. |
+| `enforcement` | `string` | The state of enforcement for this hook. |
+| `allow_downstream_configuration` | `boolean` | Whether enforcement can be overridden at the org or repo level. |
+
+Possible values for *enforcement* are `enabled`, `disabled` and`testing`. `disabled` indicates the pre-receive hook will not run. `enabled` indicates it will run and reject
+any pushes that result in a non-zero status. `testing` means the script will run but will not cause any pushes to be rejected.
+
+## Get a single pre-receive hook
+
+ GET /admin/pre-receive-hooks/:id
+
+<%= headers 200 %> <%= json :pre_receive_hook %>
+
+## List pre-receive hooks
+
+ GET /admin/pre-receive-hooks
+
+<%= headers 200, :pagination => default_pagination_rels %>
+<%= json :pre_receive_hooks %>
+
+## Create a pre-receive hook
+
+ POST /admin/pre-receive-hooks
+
+### Parameters
+
+| Name | Type | Description |
+|----------------------------------|-----------|----------------------------------------------------------------------------------|
+| `name` | `string` | **Required** The name of the hook. |
+| `script` | `string` | **Required** The script that the hook runs. |
+| `script_repository` | `object` | **Required** The GitHub repository where the script is kept. |
+| `environment` | `object` | **Required** The pre-receive environment where the script is executed. |
+| `enforcement` | `string` | The state of enforcement for this hook. default: `disabled` |
+| `allow_downstream_configuration` | `boolean` | Whether enforcement can be overridden at the org or repo level. default: `false` |
+
+<%= json \
+ :name => "Check Commits",
+ :script => "scripts/commit_check.sh",
+ :enforcement => "disabled",
+ :allow_downstream_configuration => false,
+ :script_repository => { :full_name => "DevIT/hooks" },
+ :environment => { :id => 2 }
+%>
+
+### Response
+<%= headers 201 %>
+<%= json :pre_receive_hook %>
+
+## Edit a pre-receive hook
+
+ PATCH /admin/pre_receive_hooks/:id
+
+<%= json \
+ :name => "Check Commits",
+ :environment => { :id => 1 },
+ :allow_downstream_configuration => true
+%>
+
+### Response
+<%= headers 200 %>
+<%= json :pre_receive_hook_update %>
+
+## Delete a pre-receive hook
+
+ DELETE /admin/pre_receive_hooks/:id
+
+### Response
+
+<%= headers 204 %>
diff --git a/content/v3/enterprise/search_indexing.md b/content/v3/enterprise/search_indexing.md
new file mode 100644
index 0000000000..d62fd98056
--- /dev/null
+++ b/content/v3/enterprise/search_indexing.md
@@ -0,0 +1,48 @@
+---
+title: Search Indexing
+---
+
+# Search Indexing
+
+{:toc}
+
+The Search Indexing API allows you to queue up a variety of search indexing tasks. *It is only available to [authenticated](/v3/#authentication) site administrators.* Normal users will receive a `404` response if they try to access it.
+
+Prefix all the endpoints for this API with the following URL:
+
+``` command-line
+http(s)://hostname/api/v3
+```
+
+## Queue an indexing job
+
+ POST /staff/indexing_jobs
+
+### Input
+
+Name | Type | Description
+--------|---------|--------------
+`target`|`string` | **Required**. A string representing the item to index.
+
+You can index the following targets (replace `:owner` with the name of a user or organization account and `:repository` with the name of a repository):
+
+Target | Description
+----------------------------|---------------------------------------------------------------------
+`:owner` | A user or organization account.
+`:owner/:repository` | A repository.
+`:owner/*` | All of a user or organization's repositories.
+`:owner/:repository/issues` | All the issues in a repository.
+`:owner/*/issues` | All the issues in all of a user or organization's repositories.
+`:owner/:repository/code` | All the source code in a repository.
+`:owner/*/code` | All the source code in all of a user or organization's repositories.
+
+### Example
+
+``` command-line
+$ curl -u jwatson -X POST -H "Content-Type: application/json" -d '{"target": "kansaichris/japaning"}' "http://hostname/api/v3/staff/indexing_jobs"
+```
+
+### Response
+
+<%= headers 202 %>
+<%= json(:indexing_success) %>
diff --git a/content/v3/events.md b/content/v3/events.md
deleted file mode 100644
index a7329d8999..0000000000
--- a/content/v3/events.md
+++ /dev/null
@@ -1,68 +0,0 @@
----
-title: Events | GitHub API
----
-
-# Events
-
-This is a read-only API to the GitHub events. These events power the
-various activity streams on the site.
-
-Events support [pagination](/v3/#pagination),
-however the `per_page` option is unsupported. The fixed page size is 30 items.
-Fetching up to ten pages is supported, for a total of 300 events.
-
-All Events have the same response format:
-
-<%= headers 200, :pagination => true %>
-<%= json(:event) { |h| [h] } %>
-
-## List public events
-
- GET /events
-
-## List repository events
-
- GET /repos/:user/:repo/events
-
-## List issue events for a repository
-
- GET /repos/:user/:repo/issues/events
-
-## List public events for a network of repositories
-
- GET /networks/:user/:repo/events
-
-## List public events for an organization
-
- GET /orgs/:org/events
-
-## List events that a user has received
-
-These 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.
-
- GET /users/:user/received_events
-
-## List public events that a user has received
-
- GET /users/:user/received_events/public
-
-## List events performed by a user
-
-If you are authenticated as the given user, you will see your private
-events. Otherwise, you'll only see public events.
-
- GET /users/:user/events
-
-## List public events performed by a user
-
- GET /users/:user/events/public
-
-## List events for an organization
-
-This is the user's organization dashboard. You must be authenticated as
-the user to view this.
-
- GET /users/:user/events/orgs/:org
-
diff --git a/content/v3/events/types.md b/content/v3/events/types.md
deleted file mode 100644
index ac97fdde6b..0000000000
--- a/content/v3/events/types.md
+++ /dev/null
@@ -1,267 +0,0 @@
----
-title: Event types | GitHub API
----
-
-# Event Types
-
-Each event has a similar JSON schema, but a unique `payload` object that is
-determined by its event type. [Repository hook](/v3/repos/hooks/) names relate to event types, and will have the exact same payload. The only exception to this is the `push` hook, which has a larger, more detailed payload.
-
-This describes just the payload of an event. A full event will also
-show the user that performed the event (actor), the repository, and the
-organization (if applicable).
-
-Note that some of these events may not be rendered in timelines.
-They're only created for various internal and repository hooks.
-
-* CommitCommentEvent
-* CreateEvent
-* DeleteEvent
-* DownloadEvent
-* FollowEvent
-* ForkEvent
-* ForkApplyEvent
-* GistEvent
-* GollumEvent
-* IssueCommentEvent
-* IssuesEvent
-* MemberEvent
-* PublicEvent
-* PullRequestEvent
-* PullRequestReviewCommentEvent
-* PushEvent
-* TeamAddEvent
-* WatchEvent
-
-## CommitCommentEvent
-
-Hook name: `commit_comment`
-
-comment
-: **object** - The [comment](/v3/repos/comments/#list-commit-comments-for-a-repository) itself.
-
-## CreateEvent
-
-Represents a created repository, branch, or tag.
-
-Hook name: `create`
-
-ref\_type
-: **string** - The object that was created: "repository", "branch", or
-"tag"
-
-ref
-: **string** - The git ref (or `null` if only a repository was created).
-
-master\_branch
-: **string** - The name of the repository's master branch.
-
-description
-: **string** - The repository's current description.
-
-## DeleteEvent
-
-Represents a deleted branch or tag.
-
-Hook name: `delete`
-
-ref\_type
-: **string** - The object that was deleted: "branch" or "tag".
-
-ref
-: **string** - The full git ref.
-
-## DownloadEvent
-
-Hook name: `download`
-
-download
-: **object** - The [download](/v3/repos/downloads/) that was just
-created.
-
-## FollowEvent
-
-Hook name: `follow`
-
-target
-: **object** - The [user](/v3/users) that was just followed.
-
-## ForkEvent
-
-Hook name: `fork`
-
-forkee
-: **object** - The created [repository](/v3/repos/).
-
-## ForkApplyEvent
-
-Triggered when a patch is applied in the Fork Queue.
-
-Hook name: `fork_apply`
-
-head
-: **string** - The branch name the patch is applied to.
-
-before
-: **string** - SHA of the repo state before the patch.
-
-after
-: **string** - SHA of the repo state after the patch.
-
-## GistEvent
-
-Hook name: `gist`
-
-action
-: **string** - The action that was performed: "create" or "update"
-
-gist
-: **object** - The [gist](/v3/gists/) itself.
-
-## GollumEvent
-
-Hook name: `gollum`
-
-pages
-: **array** - The pages that were updated.
-
-pages[][page_name]
-: **string** - The name of the page.
-
-pages[][title]
-: **string** - The current page title.
-
-pages[][action]
-: **string** - The action that was performed on the page.
-
-pages[][sha]
-: **string** - The latest commit SHA of the page.
-
-pages[][html_url]
-: **string** - Points to the HTML wiki page.
-
-## IssueCommentEvent
-
-Hook name: `issue_comment`
-
-action
-: **string** - The action that was performed on the comment.
-
-issue
-: **object** - The [issue](/v3/issues/) the comment belongs to.
-
-comment
-: **object** - The [comment](/v3/issues/comments/) itself.
-
-## IssuesEvent
-
-Hook name: `issues`
-
-action
-: **string** - The action that was performed: "opened", "closed", or
-"reopened".
-
-issue
-: **object** - The [issue](/v3/issues) itself.
-
-## MemberEvent
-
-Triggered when a user is added as a collaborator to a repository.
-
-Hook name: `member`
-
-member
-: **object** - The [user](/v3/users/) that was added.
-
-action
-: **string** - The action that was performed: "added".
-
-## PublicEvent
-
-This is triggered when a private repo is open sourced. Without a doubt: the
-best GitHub event.
-
-Hook name: `public`
-
-(empty payload)
-
-## PullRequestEvent
-
-Hook name: `pull_request`
-
-action
-: **string** - The action that was performed: "opened", "closed",
-"synchronize", or "reopened".
-
-number
-: **integer** - The pull request number.
-
-pull\_request
-: **object** - The [pull request](/v3/pulls) itself.
-
-## PullRequestReviewCommentEvent
-
-Hook name: `pull_request_review_comment`
-
-comment
-: **object** - The [comment](/v3/repos/commits/#list-commit-comments-for-a-repository) itself.
-
-## PushEvent
-
-Hook name: `push`
-
-head
-: **string** - The SHA of the HEAD commit on the repository.
-
-ref
-: **string** - The full Git ref that was pushed. Example:
-"refs/heads/master"
-
-size
-: **integer** - The number of commits in the push.
-
-commits
-: **array** - The list of pushed commits.
-
-commits[][sha]
-: **string** - The SHA of the commit.
-
-commits[][message]
-: **string** - The commit message.
-
-commits[][author]
-: **object** - The git author of the commit.
-
-commits[][author][name]
-: **string** - The git author's name.
-
-commits[][author][email]
-: **string** - The git author's email address.
-
-commits[][url]
-: **url** - Points to the commit API resource.
-
-## TeamAddEvent
-
-Hook name: `team_add`
-
-team
-: **object** - The [team](/v3/orgs/teams/) that was modified. Note:
-older events may not include this in the payload.
-
-user
-: **object** - The [user](/v3/users/) that was added to this team.
-
-repo
-: **object** - The [repository](/v3/repos/) that was added to this team.
-
-## WatchEvent
-
-The event's actor is the watcher, and the event's repo is the watched
-repository.
-
-Hook name: `watch`
-
-action
-: **string** - The action that was performed.
-
diff --git a/content/v3/gists.md b/content/v3/gists.md
index 51f7f154b7..0f73102306 100644
--- a/content/v3/gists.md
+++ b/content/v3/gists.md
@@ -1,69 +1,118 @@
---
-title: Gists | GitHub API
+title: Gists
---
-# Gists API
+# Gists
+
+{:toc}
## Authentication
-You can read public gists and create them for anonymous users without a token; however, to read or write gists on a user's behalf the **gist** [oAuth scope][1] is required.
+You can read public gists and create them for anonymous users without a token; however, to read or write gists on a user's behalf the **gist** [OAuth scope][1] is required.
-
-## List gists
+## Truncation
+
+The Gist API provides up to one megabyte of content for each file in the gist. Each file returned for a gist through the API has a key called `truncated`. If `truncated` is `true`, the file is too large and only a portion of the contents were returned in `content`.
+
+If you need the full contents of the file, you can make a `GET` request to the URL specified by `raw_url`. Be aware that for files larger than ten megabytes, you'll need to clone the gist via the URL provided by `git_pull_url`.
+
+In addition to a specific file's contents being truncated, the entire files list may be truncated if the total number exceeds 300 files. If the top level `truncated` key is `true`, only the first 300 files have been returned in the files list. If you need to fetch all of the gist's files, you'll need to clone the gist via the URL provided by `git_pull_url`.
-List a user's gists:
+## List a user's gists
- GET /users/:user/gists
+List public gists for the specified user:
+
+ GET /users/:username/gists
List the authenticated user's gists or if called anonymously, this will
return all public gists:
GET /gists
-List all public gists:
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`since`|`string` | A timestamp in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. Only gists updated at or after this time are returned.
+
+### Response
+
+<%= headers 200, :pagination => default_pagination_rels %>
+<%= json(:gist) { |h| [h] } %>
+
+## List all public gists
+
+List all public gists sorted by most recently updated to least recently updated.
+
+Note: With [pagination](/v3/#pagination), 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.
GET /gists/public
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`since`|`string` | A timestamp in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. Only gists updated at or after this time are returned.
+
+### Response
+
+<%= headers 200, :pagination => default_pagination_rels %>
+<%= json(:gist) { |h| [h] } %>
+
+## List starred gists
+
List the authenticated user's starred gists:
GET /gists/starred
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`since`|`string` | A timestamp in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. Only gists updated at or after this time are returned.
+
### Response
-<%= headers 200, :pagination => true %>
+<%= headers 200, :pagination => default_pagination_rels %>
<%= json(:gist) { |h| [h] } %>
## Get a single gist
GET /gists/:id
+
+
### Response
<%= headers 200 %>
<%= json :full_gist %>
+## Get a specific revision of a gist
+
+ GET /gists/:id/:sha
+
+### Response
+
+<%= headers 200 %>
+<%= json :full_gist_version %>
+
## Create a gist
POST /gists
### Input
-description
-: _Optional_ **string**
-
-public
-: _Required_ **boolean**
+Name | Type | Description
+-----|------|--------------
+`files`|`object` | **Required**. Files that make up this gist.
+`description`|`string` | A description of the gist.
+`public`|`boolean` | Indicates whether the gist is public. Default: `false`
-files
-: _Required_ **hash** - Files that make up this gist. The key of which
-should be a _required_ **string** filename and the value another
-_required_ **hash** with parameters:
-
-content
-: _Required_ **string** - File contents.
+The keys in the `files` object are the `string` filename, and the value is another `object` with a key of `content`, and a value of the file contents. For example:
<%= json \
:description => "the description for this gist",
@@ -73,9 +122,15 @@ content
}
%>
+{{#tip}}
+
+**Note:** Don't name your files "gistfile" with a numerical suffix. This is the format of the automatic naming scheme that Gist uses internally.
+
+{{/tip}}
+
### Response
-<%= headers 201, :Location => "https://api.github.com/gists/1" %>
+<%= headers 201, :Location => get_resource(:full_gist)['url'] %>
<%= json :full_gist %>
## Edit a gist
@@ -84,23 +139,14 @@ content
### Input
-description
-: _Optional_ **string**
+Name | Type | Description
+-----|------|--------------
+`description`|`string` | A description of the gist.
+`files`|`object` | Files that make up this gist.
+`content`|`string` | Updated file contents.
+`filename`|`string` | New name for this file.
-files
-: _Optional_ **hash** - Files that make up this gist. The key of which
-should be an _optional_ **string** filename and the value another
-_optional_ **hash** with parameters:
-
- content
- : _Optional_ **string** - Updated file contents.
-
- filename
- : _Optional_ **string** - New name for this file.
-
-NOTE: All files from the previous version of the gist are carried over by
-default if not included in the hash. Deletes can be performed by
-including the filename with a null hash.
+The keys in the `files` object are the `string` filename. The value is another `object` with a key of `content` (indicating the new contents), or `filename` (indicating the new filename). For example:
<%= json \
:description => "the description for this gist",
@@ -111,15 +157,34 @@ including the filename with a null hash.
"delete_this_file.txt" => nil,
} %>
+{{#tip}}
+
+Note: All files from the previous version of the gist are carried over by default if not included in the object. Deletes can be performed by including the filename with a null object.
+
+{{/tip}}
+
+
### Response
<%= headers 200 %>
<%= json :full_gist %>
+
+## List gist commits
+
+ GET /gists/:id/commits
+
+### Response
+
+<%= headers 200, :pagination => { :next => 'https://api.github.com/resource?page=2' } %>
+<%= json(:gist_history) %>
+
## Star a gist
PUT /gists/:id/star
+<%= fetch_content(:put_content_length) %>
+
### Response
<%= headers 204 %>
@@ -146,13 +211,28 @@ including the filename with a null hash.
## Fork a gist
- POST /gists/:id/fork
+ POST /gists/:id/forks
+
+{{#tip}}
+
+**Note**: This was previously `/gists/:id/fork`.
+
+{{/tip}}
### Response
-<%= headers 201, :Location => "https://api.github.com/gists/2" %>
+<%= headers 201, :Location => get_resource(:gist)['url'] %>
<%= json(:gist) %>
+## List gist forks
+
+ GET /gists/:id/forks
+
+### Response
+
+<%= headers 200, :pagination => default_pagination_rels %>
+<%= json(:gist_forks) %>
+
## Delete a gist
DELETE /gists/:id
@@ -162,3 +242,11 @@ including the filename with a null hash.
<%= headers 204 %>
[1]: /v3/oauth/#scopes
+
+## Custom media types
+
+The following media types are supported when fetching gist contents. You can read more about the
+use of media types in the API [here](/v3/media/).
+
+ application/vnd.github.VERSION.raw
+ application/vnd.github.VERSION.base64
diff --git a/content/v3/gists/comments.md b/content/v3/gists/comments.md
index f1399ef732..91249c09f6 100644
--- a/content/v3/gists/comments.md
+++ b/content/v3/gists/comments.md
@@ -1,12 +1,14 @@
---
-title: Gist Comments | GitHub API
+title: Gist Comments
---
-# Gist Comments API
+# Comments
-Gist Comments leverage [these](#custom-mime-types) custom mime types.
-You can read more about the use of mime types in the API
-[here](/v3/mime/).
+{:toc}
+
+Gist Comments use [these custom media types](#custom-media-types).
+You can read more about the use of media types in the API
+[here](/v3/media/).
## List comments on a gist
@@ -14,12 +16,12 @@ You can read more about the use of mime types in the API
### Response
-<%= headers 200 %>
+<%= headers 200, :pagination => default_pagination_rels %>
<%= json(:gist_comment) { |h| [h] } %>
## Get a single comment
- GET /gists/comments/:id
+ GET /gists/:gist_id/comments/:id
### Response
@@ -30,27 +32,30 @@ You can read more about the use of mime types in the API
POST /gists/:gist_id/comments
-### Input
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`body`|`string` | **Required**. The comment text.
-body
-: _Required_ **string**
<%= json :body => 'Just commenting for the sake of commenting' %>
### Response
-<%= headers 201,
- :Location => "https://api.github.com/gists/comments/1" %>
+<%= headers 201, :Location => get_resource(:gist_comment)['url'] %>
<%= json :gist_comment %>
## Edit a comment
- PATCH /gists/comments/:id
+ PATCH /gists/:gist_id/comments/:id
### Input
-body
-: _Required_ **string**
+Name | Type | Description
+-----|------|--------------
+`body`|`string` | **Required**. The comment text.
+
<%= json :body => 'Just commenting for the sake of commenting' %>
@@ -61,16 +66,16 @@ body
## Delete a comment
- DELETE /gists/comments/:id
+ DELETE /gists/:gist_id/comments/:id
### Response
<%= headers 204 %>
-## Custom Mime Types
+## Custom media types
-These are the supported mime types for gist comments. You can read more about the
-use of mime types in the API [here](/v3/mime/).
+These are the supported media types for gist comments. You can read more about the
+use of media types in the API [here](/v3/media/).
application/vnd.github.VERSION.raw+json
application/vnd.github.VERSION.text+json
diff --git a/content/v3/git.md b/content/v3/git.md
index d542550529..a7ec1bd618 100644
--- a/content/v3/git.md
+++ b/content/v3/git.md
@@ -1,11 +1,11 @@
---
-title: Git | GitHub API
+title: Git Data
---
-# Git DB API
+# Git Data
The Git Database API gives you access to read and write raw Git objects
-to your Git database on GitHub and to list and update your references
+to your Git database on {{ site.data.variables.product.product_name }} and to list and update your references
(branch heads and tags).
This basically allows you to reimplement a lot of Git functionality over
@@ -13,14 +13,14 @@ our API - by creating raw objects directly into the database and updating
branch references you could technically do just about anything that Git
can do without having Git installed.
-Git DB API functions will return a 409 if the git repo for a Repository is empty
+Git DB API functions will return a `409 Conflict` if the git repository for a Repository is empty
or unavailable. This typically means it is being created still. [Contact
-Support](https://github.com/contact) if this response status persists.
+Support](https://github.com/contact?form[subject]=Commits API) if this response status persists.

For more information on the Git object database, please read the
-Git Internals chapter of
+[Git Internals](http://git-scm.com/book/en/v1/Git-Internals) chapter of
the Pro Git book.
As an example, if you wanted to commit a change to a file in your
diff --git a/content/v3/git/blobs.md b/content/v3/git/blobs.md
index 9bdd659a4c..df84b5c41f 100644
--- a/content/v3/git/blobs.md
+++ b/content/v3/git/blobs.md
@@ -1,20 +1,21 @@
---
-title: Git Blobs | GitHub API
+title: Git Blobs
---
-# Blobs API
+# Blobs
-Since blobs can be any arbitrary binary data, the input and responses
-for the blob API takes an encoding parameter that can be either `utf-8`
-or `base64`. If your data cannot be losslessly sent as a UTF-8 string,
-you can base64 encode it.
+{:toc}
-Blobs leverage [these](#custom-mime-types) custom mime types. You can
-read more about the use of mime types in the API [here](/v3/mime/).
+Blobs leverage [these custom media types](#custom-media-types). You can
+read more about the use of media types in the API [here](/v3/media/).
## Get a Blob
- GET /repos/:user/:repo/git/blobs/:sha
+ GET /repos/:owner/:repo/git/blobs/:sha
+
+The `content` in the response will always be Base64 encoded.
+
+*Note*: This API supports blobs up to 100 megabytes in size.
### Response
@@ -23,22 +24,28 @@ read more about the use of mime types in the API [here](/v3/mime/).
## Create a Blob
- POST /repos/:user/:repo/git/blobs
+ POST /repos/:owner/:repo/git/blobs
+
+### Parameters
+
+Name | Type | Description
+-----|------|-------------
+`content`|`string` | **Required**. The new blob's content.
+`encoding`|`string` | The encoding used for `content`. Currently, `"utf-8"` and `"base64"` are supported. Default: `"utf-8"`.
-### Input
+### Example Input
<%= json :content => "Content of the blob", :encoding => "utf-8" %>
### Response
-<%= headers 201,
- :Location => "https://api.github.com/git/:user/:repo/blob/:sha" %>
-<%= json :sha => "3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15" %>
+<%= headers 201, :Location => get_resource(:blob_after_create)['url'] %>
+<%= json :blob_after_create %>
-## Custom Mime Types
+## Custom media types
-These are the supported mime types for blobs. You can read more about the
-use of mime types in the API [here](/v3/mime/).
+These are the supported media types for blobs. You can read more about the
+use of media types in the API [here](/v3/media/).
application/json
application/vnd.github.VERSION.raw
diff --git a/content/v3/git/commits.md b/content/v3/git/commits.md
index dc812cf962..69a0da52fe 100644
--- a/content/v3/git/commits.md
+++ b/content/v3/git/commits.md
@@ -1,12 +1,14 @@
---
-title: Git Commits | GitHub API
+title: Git Commits
---
-# Commits API
+# Commits
+
+{:toc}
## Get a Commit
- GET /repos/:user/:repo/git/commits/:sha
+ GET /repos/:owner/:repo/git/commits/:sha
### Response
@@ -15,46 +17,34 @@ title: Git Commits | GitHub API
## Create a Commit
- POST /repos/:user/:repo/git/commits
+ POST /repos/:owner/:repo/git/commits
### Parameters
-message
-: _String_ of the commit message
-
-tree
-: _String_ of the SHA of the tree object this commit points to
+Name | Type | Description
+-----|------|--------------
+`message`|`string` | **Required**. The commit message
+`tree`|`string` | **Required**. The SHA of the tree object this commit points to
+`parents`|`array` of `string`s| **Required**. The SHAs of the commits that were the parents of this commit. If omitted or empty, the commit will be written as a root commit. For a single parent, an array of one SHA should be provided; for a merge commit, an array of more than one should be provided.
-parents
-: _Array_ of the SHAs of the commits that were the parents of this
-commit. If omitted or empty, the commit will be written as a root
-commit. For a single parent, an array of one SHA should be provided,
-for a merge commit, an array of more than one should be provided.
### Optional Parameters
+You can provide an additional `committer` parameter, which is an object containing
+information about the committer. Or, you can provide an `author` parameter, which
+is an object containing information about the author.
+
The `committer` section is optional and will be filled with the `author`
data if omitted. If the `author` section is omitted, it will be filled
-in with the authenticated users information and the current date.
-
-
-author.name
-: _String_ of the name of the author of the commit
+in with the authenticated user's information and the current date.
-author.email
-: _String_ of the email of the author of the commit
+Both the `author` and `committer` parameters have the same keys:
-author.date
-: _Timestamp_ of when this commit was authored
-
-committer.name
-: _String_ of the name of the committer of the commit
-
-committer.email
-: _String_ of the email of the committer of the commit
-
-committer.date
-: _Timestamp_ of when this commit was committed
+Name | Type | Description
+-----|------|-------------
+`name`|`string` | The name of the author (or committer) of the commit
+`email`|`string` | The email of the author (or committer) of the commit
+`date`|`string` | Indicates when this commit was authored (or committed). This is a timestamp in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.
### Example Input
@@ -67,7 +57,61 @@ committer.date
### Response
-<%= headers 201,
- :Location => "https://api.github.com/git/:user/:repo/commit/:sha" %>
+<%= headers 201, :Location => get_resource(:new_commit)['url'] %>
<%= json :new_commit %>
+{% if page.version == 'dotcom' %}
+
+## Commit signature verification
+
+{{#tip}}
+
+Commit response objects including signature verification data are currently available for developers to preview.
+During the preview period, the object formats may change without advance notice.
+Please see the [blog post](/changes/2016-04-04-git-signing-api-preview) for full details.
+
+To receive signature verification data in commit objects you must provide a custom [media type](/v3/media) in the `Accept` header:
+
+ application/vnd.github.cryptographer-preview
+
+{{/tip}}
+
+ GET /repos/:owner/:repo/git/commits/:sha
+
+### Response
+
+<%= headers 200 %>
+<%= json(:signed_git_commit) %>
+
+### The `verification` object
+
+The response will include a `verification` field whose value is an object describing the result of verifying the commit's signature. The following fields are included in the `verification` object:
+
+Name | Type | Description
+-----|------|--------------
+`verified`|`boolean` | Does GitHub consider the signature in this commit to be verified?
+`reason`|`string` | The reason for `verified` value. Possible values and their meanings are enumerated in the table below.
+`signature`|`string` | The signature that was extracted from the commit.
+`payload`|`string` | The value that was signed.
+
+#### The `reason` field
+
+The following are possible `reason`s that may be included in the `verification` object:
+
+Value | Description
+------|------------
+`expired_key` | The key that made the signature is expired.
+`not_signing_key` | The "signing" flag is not among the usage flags in the GPG key that made the signature.
+`gpgverify_error` | There was an error communicating with the signature-verification service.
+`gpgverify_unavailable` | The signature-verification service is currently unavailable.
+`unsigned` | The object does not include a signature.
+`unknown_signature_type` | A non-PGP signature was found in the commit.
+`no_user` | No user was associated with the `committer` email address in the commit.
+`unverified_email` | The `committer` email address in the commit was associated with a user, but the email address is not verified on her/his account.
+`bad_email` | The `committer` email address in the commit is not included in the identities of the PGP key that made the signature.
+`unknown_key` | The key that made the signature has not been registered with any user's account.
+`malformed_signature` | There was an error parsing the signature.
+`invalid` | The signature could not be cryptographically verified using the key whose key-id was found in the signature.
+`valid` | None of the above errors applied, so the signature is considered to be verified.
+
+{% endif %}
diff --git a/content/v3/git/import.md b/content/v3/git/import.md
deleted file mode 100644
index a96d53173c..0000000000
--- a/content/v3/git/import.md
+++ /dev/null
@@ -1,26 +0,0 @@
----
-title: Git Import | GitHub API
----
-
-# Import API
-
-`git fast-import` input parser
-
-Would this be cool?
-
-See the [Pro Git book](http://git-scm.com/book/ch8-2.html#a_custom_importer) or the
-[fast-import man page](http://www.kernel.org/pub/software/scm/git/docs/git-fast-import.html)
-for more information about the fast-import syntax.
-
-It would be awesome if there was some way to open up a streaming
-listener and just stream this data to it in order to:
-
-* import directly into github from the fast-export scripts that exist
- for multiple VCS systems
-
-* be able to easily import multiple objects - for instance a series of
- commits without having to make multiple git calls
-
-even without streaming capability, this might be pretty interesting
-functionality.
-
diff --git a/content/v3/git/refs.md b/content/v3/git/refs.md
index 5319af3829..ef4a444d92 100644
--- a/content/v3/git/refs.md
+++ b/content/v3/git/refs.md
@@ -1,25 +1,42 @@
---
-title: Git Refs | GitHub API
+title: Git Refs
---
-# References API
+# References
+
+{:toc}
## Get a Reference
- GET /repos/:user/:repo/git/refs/:ref
+ GET /repos/:owner/:repo/git/refs/:ref
The `ref` in the URL must be formatted as `heads/branch`, not just `branch`. For example, the call to get the data for a branch named `skunkworkz/featureA` would be:
- GET /repos/:user/:repo/git/refs/heads/skunkworkz/featureA
-
-### Response
+ GET /repos/:owner/:repo/git/refs/heads/skunkworkz/featureA
<%= headers 200 %>
<%= json :ref %>
+If the `ref` doesn't exist in the repository, but existing refs start with `ref`
+they will be returned as an array. For example, a call to get the data for a
+branch named `feature`, which doesn't exist, would return head refs
+including `featureA` and `featureB` which do.
+
+ GET /repos/:owner/:repo/git/refs/heads/feature
+
+<%= headers 200 %>
+<%= json :refs_matching %>
+
+If the `ref` doesn't match an existing ref or any prefixes a 404 will be returned.
+
+ GET /repos/:owner/:repo/git/refs/heads/feature-branch-that-no-longer-exists
+
+<%= headers 404 %>
+<%= json :refs_not_found %>
+
## Get all References
- GET /repos/:user/:repo/git/refs
+ GET /repos/:owner/:repo/git/refs
This will return an array of all the references on the system, including
things like notes and stashes if they exist on the server. Anything in
@@ -29,50 +46,47 @@ most common.
You can also request a sub-namespace. For example, to get all the tag
references, you can call:
- GET /repos/:user/:repo/git/refs/tags
+ GET /repos/:owner/:repo/git/refs/tags
For a full refs listing, you'll get something that looks like:
-<%= headers 200 %>
+<%= headers 200, :pagination => default_pagination_rels %>
<%= json :refs %>
## Create a Reference
- POST /repos/:user/:repo/git/refs
+ POST /repos/:owner/:repo/git/refs
### Parameters
-ref
-: _String_ of the name of the fully qualified reference (ie: `refs/heads/master`).
- If it doesn't start with 'refs' and have at least two slashes, it will be rejected.
+Name | Type | Description
+-----|------|--------------
+`ref`|`type`| **Required**. The name of the fully qualified reference (ie: `refs/heads/master`). If it doesn't start with 'refs' and have at least two slashes, it will be rejected.
+`sha`|`type`| **Required**. The SHA1 value to set this reference to
-sha
-: _String_ of the SHA1 value to set this reference to
### Input
-<%= json "ref"=>"refs/heads/master",\
- "sha"=>"827efc6d56897b048c772eb4087f854f46256132" %>
+<%= json "ref"=>"refs/heads/featureA",\
+ "sha"=>"aa218f56b14c9653891f9e74264a383fa43fefbd" %>
### Response
-<%= headers 201 %>
+<%= headers 201, :Location => get_resource(:ref)['url'] %>
<%= json :ref %>
## Update a Reference
- PATCH /repos/:user/:repo/git/refs/:ref
+ PATCH /repos/:owner/:repo/git/refs/:ref
### Parameters
-sha
-: _String_ of the SHA1 value to set this reference to
+Name | Type | Description
+-----|------|--------------
+`sha`|`type`| **Required**. The SHA1 value to set this reference to
+`force`|`boolean`| Indicates whether to force the update or to make sure the update is a fast-forward update. Leaving this out or setting it to `false` will make sure you're not overwriting work. Default: `false`
-force
-: _Boolean_ indicating whether to force the update or to make sure the
-update is a fast-forward update. The default is `false`, so leaving this
-out or setting it to `false` will make sure you're not overwriting work.
### Input
@@ -81,13 +95,12 @@ out or setting it to `false` will make sure you're not overwriting work.
### Response
-<%= headers 200, \
- :Location => "https://api.github.com/git/:user/:repo/commit/:sha" %>
+<%= headers 200 %>
<%= json :ref %>
## Delete a Reference
- DELETE /repos/:user/:repo/git/refs/:ref
+ DELETE /repos/:owner/:repo/git/refs/:ref
Example: Deleting a branch:
@@ -100,4 +113,3 @@ Example: Deleting a tag:
### Response
<%= headers 204 %>
-
diff --git a/content/v3/git/tags.md b/content/v3/git/tags.md
index 3906c4af94..b0605da270 100644
--- a/content/v3/git/tags.md
+++ b/content/v3/git/tags.md
@@ -1,15 +1,17 @@
---
-title: Git Tags | GitHub API
+title: Git Tags
---
-# Tags API
+# Tags
+
+{:toc}
This tags API only deals with tag objects - so only annotated tags, not
lightweight tags.
## Get a Tag
- GET /repos/:user/:repo/git/tags/:sha
+ GET /repos/:owner/:repo/git/tags/:sha
### Response
@@ -20,40 +22,100 @@ lightweight tags.
Note 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 create
-the `refs/tags/[tag]` reference. If you want to create a lightweight
-tag, you simply have to create the reference - this call would be
-unnecessary.
+you have to do this call to create the tag object, and then
+[create](/v3/git/refs/#create-a-reference) the `refs/tags/[tag]` reference.
+If you want to create a lightweight tag, you only have to
+[create](/v3/git/refs/#create-a-reference) the tag reference - this call
+would be unnecessary.
- POST /repos/:user/:repo/git/tags
+ POST /repos/:owner/:repo/git/tags
### Parameters
-tag
-: _String_ of the tag
-
-message
-: _String_ of the tag message
+Name | Type | Description
+-----|------|--------------
+`tag`|`string`| The tag
+`message`|`string`| The tag message
+`object`|`string`| The SHA of the git object this is tagging
+`type`|`string`| The type of the object we're tagging. Normally this is a `commit` but it can also be a `tree` or a `blob`.
+`tagger`|`object`| An object with information about the individual creating the tag.
-object
-: _String_ of the SHA of the git object this is tagging
+The `tagger` object contains the following keys:
-type
-: _String_ of the type of the object we're tagging. Normally this is a
-`commit` but it can also be a `tree` or a `blob`.
+Name | Type | Description
+-----|------|--------------
+`name`|`string`| The name of the author of the tag
+`email`|`string`| The email of the author of the tag
+`date`|`string`| When this object was tagged. This is a timestamp in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.
-tagger.name
-: _String_ of the name of the author of the tag
-tagger.email
-: _String_ of the email of the author of the tag
+### Example Input
-tagger.date
-: _Timestamp_ of when this object was tagged
+<%= json "tag"=> "v0.0.1", \
+ "message" => "initial version\n", \
+ "object" => "c3d0be41ecbe669545ee3e94d31ed9a4bc91ee3c", \
+ "type" => "commit", \
+ "tagger"=> \
+ {"name" => "Scott Chacon", "email" => "schacon@gmail.com", \
+ "date" => "2011-06-17T14:53:35-07:00"} %>
### Response
-<%= headers 201,
- :Location => "https://api.github.com/repos/:user/:repo/git/tags/:sha" %>
+<%= headers 201, :Location => get_resource(:gittag)['url'] %>
<%= json :gittag %>
+{% if page.version == 'dotcom' %}
+
+## Tag signature verification
+
+{{#tip}}
+
+Tag response objects including signature verification data are currently available for developers to preview.
+During the preview period, the object formats may change without advance notice.
+Please see the [blog post](/changes/2016-04-04-git-signing-api-preview) for full details.
+
+To receive signature verification data in tag objects you must provide a custom [media type](/v3/media) in the `Accept` header:
+
+ application/vnd.github.cryptographer-preview
+
+{{/tip}}
+
+ GET /repos/:owner/:repo/git/tags/:sha
+
+### Response
+
+<%= headers 200 %>
+<%= json(:signed_gittag) %>
+
+### The `verification` object
+
+The response will include a `verification` field whose value is an object describing the result of verifying the tag's signature. The following fields are included in the `verification` object:
+
+Name | Type | Description
+-----|------|--------------
+`verified`|`boolean` | Does GitHub consider the signature in this tag to be verified?
+`reason`|`string` | The reason for `verified` value. Possible values and their meanings are enumerated in the table below.
+`signature`|`string` | The signature that was extracted from the tag.
+`payload`|`string` | The value that was signed.
+
+#### The `reason` field
+
+The following are possible `reason`s that may be included in the `verification` object:
+
+Value | Description
+------|------------
+`expired_key` | The key that made the signature is expired.
+`not_signing_key` | The "signing" flag is not among the usage flags in the GPG key that made the signature.
+`gpgverify_error` | There was an error communicating with the signature-verification service.
+`gpgverify_unavailable` | The signature-verification service is currently unavailable.
+`unsigned` | The object does not include a signature.
+`unkown_signature_type` | A non-PGP signature was found in the tag.
+`no_user` | No user was associated with the `tagger` email address in the tag.
+`unverified_email` | The `tagger` email address in the tag was associated with a user, but the email address is not verified on her/his account.
+`bad_email` | The `tagger` email address in the tag is not included in the identities of the PGP key that made the signature.
+`unknown_key` | The key that made the signature has not been registered with any user's account.
+`malformed_signature` | There was an error parsing the signature.
+`invalid` | The signature could not be cryptographically verified using the key whose key-id was found in the signature.
+`valid` | None of the above errors applied, so the signature is considered to be verified.
+
+{% endif %}
diff --git a/content/v3/git/trees.md b/content/v3/git/trees.md
index 9941c76e69..485e622ada 100644
--- a/content/v3/git/trees.md
+++ b/content/v3/git/trees.md
@@ -1,24 +1,38 @@
---
-title: Git Trees | GitHub API
+title: Git Trees
---
-# Trees API
+# Trees
+
+{:toc}
## Get a Tree
- GET /repos/:user/:repo/git/trees/:sha
+ GET /repos/:owner/:repo/git/trees/:sha
### Response
+{{#tip}}
+
+If `truncated` is `true`, the number of items in the `tree` array exceeded our maximum limit. If you need to fetch more items, you can clone the repository and iterate over the Git data locally.
+
+{{/tip}}
+
<%= headers 200 %>
<%= json :tree %>
## Get a Tree Recursively
- GET /repos/:user/:repo/git/trees/:sha?recursive=1
+ GET /repos/:owner/:repo/git/trees/:sha?recursive=1
### Response
+{{#tip}}
+
+If `truncated` is `true`, the number of items in the `tree` array 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.
+
+{{/tip}}
+
<%= headers 200 %>
<%= json :tree_extra %>
@@ -29,42 +43,37 @@ tree and a nested path modifying that tree are specified, it will
overwrite the contents of that tree with the new path contents and write
a new tree out.
- POST /repos/:user/:repo/git/trees
+ POST /repos/:owner/:repo/git/trees
### Parameters
-base_tree
-: optional _String_ of the SHA1 of the tree you want to update with new data
-
-tree
-: _Array_ of _Hash_ objects (of `path`, `mode`, `type` and `sha`) specifying a tree structure
-
-tree.path
-: _String_ of the file referenced in the tree
+Name | Type | Description
+-----|------|--------------
+`tree`|`array` of `object`s | **Required**. Objects (of `path`, `mode`, `type`, and `sha`) specifying a tree structure
+`base_tree`| `string` | The SHA1 of the tree you want to update with new data. If you don't set this, the commit will be created on top of everything; however, it will only contain your change, the rest of your files will show up as deleted.
-tree.mode
-: _String_ of the file mode - one of `100644` for file (blob), `100755` for executable (blob), `040000` for subdirectory (tree), `160000` for submodule (commit) or `120000` for a blob that specifies the path of a symlink
+The `tree` parameter takes the following keys:
-tree.type
-: _String_ of `blob`, `tree`, `commit`
+Name | Type | Description
+-----|------|--------------
+`path`|`string`| The file referenced in the tree
+`mode`|`string`| The file mode; one of `100644` for file (blob), `100755` for executable (blob), `040000` for subdirectory (tree), `160000` for submodule (commit), or `120000` for a blob that specifies the path of a symlink
+`type`| `string`| Either `blob`, `tree`, or `commit`
+`sha`|`string`| The SHA1 checksum ID of the object in the tree
+`content`|`string` | The content you want this file to have. {{ site.data.variables.product.product_name }} will write this blob out and use that SHA for this entry. Use either this, or `tree.sha`.
-tree.sha
-: _String_ of SHA1 checksum ID of the object in the tree
-
-tree.content
-: _String_ of content you want this file to have - GitHub will write this blob out and use that SHA for this entry. Use either this or `tree.sha`
### Input
-<%= json "tree"=> \
- [{"path"=>"file.rb", \
- "mode"=>"100644", \
- "type"=>"blob", \
- "sha"=>"44b4fc6d56897b048c772eb4087f854f46256132"}] %>
+<%= json \
+ "base_tree" => "9fb037999f264ba9a7fc6274d15fa3ae2ab98312", \
+ "tree"=> \
+ [{"path"=>"file.rb", \
+ "mode"=>"100644", \
+ "type"=>"blob", \
+ "sha"=>"44b4fc6d56897b048c772eb4087f854f46256132"}] %>
### Response
-<%= headers 201,
- :Location => "https://api.github.com/repos/:user/:repo/git/trees/:sha" %>
+<%= headers 201, :Location => get_resource(:tree_new)['url'] %>
<%= json :tree_new %>
-
diff --git a/content/v3/gitignore.md b/content/v3/gitignore.md
new file mode 100644
index 0000000000..66fc12632d
--- /dev/null
+++ b/content/v3/gitignore.md
@@ -0,0 +1,61 @@
+---
+title: Gitignore
+---
+
+# Gitignore
+
+{:toc}
+
+When you create a new {{ site.data.variables.product.product_name }} repository via the API, you can specify a
+[.gitignore template][what-is] to apply to the repository upon creation. The
+.gitignore Templates API lists and fetches templates from the [{{ site.data.variables.product.product_name }} .gitignore repository][templates-repo].
+
+## Listing available templates
+
+List all templates available to pass as an option when [creating a repository][create-repo].
+
+ GET /gitignore/templates
+
+### Response
+
+<%= headers 200 %>
+<%= json(:templates) %>
+
+## Get a single template
+
+The API also allows fetching the source of a single template.
+
+ GET /gitignore/templates/C
+
+### Response
+
+<%= headers 200 %>
+<%= json(:template) %>
+
+Use the raw [media type][media-type] to get the raw contents.
+
+<%= headers 200 %>
+
+# Object files
+*.o
+
+# Libraries
+*.lib
+*.a
+
+# Shared objects (inc. Windows DLLs)
+*.dll
+*.so
+*.so.*
+*.dylib
+
+# Executables
+*.exe
+*.out
+*.app
+
+
+[what-is]: https://help.github.com/articles/ignoring-files
+[templates-repo]: https://github.com/github/gitignore
+[create-repo]: /v3/repos/#create
+[media-type]: /v3/media/
diff --git a/content/v3/issues.md b/content/v3/issues.md
index d91cc690c8..59e7f99a29 100644
--- a/content/v3/issues.md
+++ b/content/v3/issues.md
@@ -1,177 +1,281 @@
---
-title: Issues | GitHub API
+title: Issues
---
-# Issues API
+# Issues
-Issues leverage [these](#custom-mime-types) custom mime types. You can
-read more about the use of mime types in the API [here](/v3/mime/).
+{:toc}
-## List your issues
+Issues use [these custom media types](#custom-media-types). You can
+read more about the use of media types in the API [here](/v3/media/).
+
+## List issues
+
+<%= fetch_content(:prs_as_issues) %>
+
+List all issues **assigned** to the authenticated user across all visible repositories
+including owned repositories, member repositories, and organization
+repositories:
GET /issues
-### Parameters
+{{#tip}}
-filter
-: * `assigned`: Issues assigned to you (default)
- * `created`: Issues created by you
- * `mentioned`: Issues mentioning you
- * `subscribed`: Issues you're subscribed to updates for
+You can use the `filter` query parameter to fetch issues that are not necessarily assigned to you. See the table below for more information.
-state
-: `open`, `closed`, default: `open`
+{{/tip}}
-labels
-: _String_ list of comma separated Label names. Example:
-`bug,ui,@high`
+List all issues across owned and member repositories assigned to the authenticated user:
-sort
-: `created`, `updated`, `comments`, default: `created`.
+ GET /user/issues
-direction
-: `asc` or `desc`, default: `desc`.
+List all issues for a given organization assigned to the authenticated user:
-since
-: _Optional_ **string** of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ
+ GET /orgs/:org/issues
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`filter`|`string`| Indicates which sorts of issues to return. Can be one of:
* `assigned`: Issues assigned to you
* `created`: Issues created by you
* `mentioned`: Issues mentioning you
* `subscribed`: Issues you're subscribed to updates for
* `all`: All issues the authenticated user can see, regardless of participation or creation
Default: `assigned`
+`state`|`string`| Indicates the state of the issues to return. Can be either `open`, `closed`, or `all`. Default: `open`
+`labels`|`string`| A list of comma separated label names. Example: `bug,ui,@high`
+`sort`|`string`| What to sort results by. Can be either `created`, `updated`, `comments`. Default: `created`
+`direction`|`string`| The direction of the sort. Can be either `asc` or `desc`. Default: `desc`
+`since`|`string` | Only issues updated at or after this time are returned. This is a timestamp in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.
### Response
-<%= headers 200, :pagination => true %>
+<%= headers 200, :pagination => default_pagination_rels %>
<%= json(:issue) { |h| [h] } %>
-## List issues for a repository
+{% if page.version == 'dotcom' %}
+#### Reactions summary
- GET /repos/:user/:repo/issues
+{{#tip}}
-### Parameters
+
+
+ An additional `reactions` object in the issue payload is currently available for developers to preview. During the preview period, the APIs may change without advance notice.
+ Please see the [blog post](/changes/2016-05-12-reactions-api-preview) for full details.
-milestone
-: * _Integer_ Milestone number
- * `none` for Issues with no Milestone.
- * `*` for Issues with any Milestone.
+ To access the API you must provide a custom [media type](/v3/media) in the `Accept` header:
-state
-: `open`, `closed`, default: `open`
+ application/vnd.github.squirrel-girl-preview
-assignee
-: * _String_ User login
- * `none` for Issues with no assigned User.
- * `*` for Issues with any assigned User.
+ The `reactions` key will have the following payload where `url` can be used to construct the API location for [listing and creating](/v3/reactions) reactions.
-mentioned
-: _String_ User login.
+{{/tip}}
+<%= json :issue_reaction_summary %>
+{% endif %}
+
+## List issues for a repository
-labels
-: _String_ list of comma separated Label names. Example:
-`bug,ui,@high`
+<%= fetch_content(:prs_as_issues) %>
-sort
-: `created`, `updated`, `comments`, default: `created`
+ GET /repos/:owner/:repo/issues
-direction
-: `asc` or `desc`, default: `desc`.
+### Parameters
-since
-: _Optional_ **string** of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ
+Name | Type | Description
+-----|------|--------------
+`milestone`|`integer` or `string`| If an `integer` is passed, it should refer to a milestone by its `number` field. If the string `*` is passed, issues with any milestone are accepted. If the string `none` is passed, issues without milestones are returned.
+`state`|`string`| Indicates the state of the issues to return. Can be either `open`, `closed`, or `all`. Default: `open`
+`assignee`|`string`| Can be the name of a user. Pass in `none` for issues with no assigned user, and `*` for issues assigned to any user.
+`creator`|`string`| The user that created the issue.
+`mentioned`|`string`| A user that's mentioned in the issue.
+`labels`|`string`| A list of comma separated label names. Example: `bug,ui,@high`
+`sort`|`string`| What to sort results by. Can be either `created`, `updated`, `comments`. Default: `created`
+`direction`|`string`| The direction of the sort. Can be either `asc` or `desc`. Default: `desc`
+`since`|`string` |Only issues updated at or after this time are returned. This is a timestamp in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.
### Response
-<%= headers 200, :pagination => true %>
+<%= headers 200, :pagination => default_pagination_rels %>
<%= json(:issue) { |h| [h] } %>
+{% if page.version == 'dotcom' %}
+#### Reactions summary
+
+{{#tip}}
+
+
+
+ An additional `reactions` object in the issue payload is currently available for developers to preview.
+ During the preview period, the APIs may change without advance notice.
+ Please see the [blog post](/changes/2016-05-12-reactions-api-preview) for full details.
+
+ To access the API you must provide a custom [media type](/v3/media) in the `Accept` header:
+
+ application/vnd.github.squirrel-girl-preview
+
+ The `reactions` key will have the following payload where `url` can be used to construct the API location for [listing and creating](/v3/reactions) reactions.
+
+{{/tip}}
+<%= json :issue_reaction_summary %>
+{% endif %}
+
## Get a single issue
- GET /repos/:user/:repo/issues/:number
+<%= fetch_content(:prs_as_issues) %>
+
+ GET /repos/:owner/:repo/issues/:number
### Response
<%= headers 200 %>
-<%= json :issue %>
+<%= json :full_issue %>
-## Create an issue
+{% if page.version == 'dotcom' %}
+#### Reactions summary
+
+{{#tip}}
- POST /repos/:user/:repo/issues
+
-### Input
+ An additional `reactions` object in the issue payload is currently available for developers to preview.
+ During the preview period, the APIs may change without advance notice.
+ Please see the [blog post](/changes/2016-05-12-reactions-api-preview) for full details.
-title
-: _Required_ **string**
+ To access the API you must provide a custom [media type](/v3/media) in the `Accept` header:
-body
-: _Optional_ **string**
+ application/vnd.github.squirrel-girl-preview
-assignee
-: _Optional_ **string** - Login for the user that this issue should be
-assigned to.
+ The `reactions` key will have the following payload where `url` can be used to construct the API location for [listing and creating](/v3/reactions) reactions.
+
+{{/tip}}
+<%= json :issue_reaction_summary %>
+{% endif %}
+
+## Create an issue
+
+Any user with pull access to a repository can create an issue.
+
+ POST /repos/:owner/:repo/issues
+
+### Parameters
-milestone
-: _Optional_ **number** - Milestone to associate this issue with.
+Name | Type | Description
+-----|------|--------------
+`title`|`string` | **Required**. The title of the issue.
+`body`|`string` | The contents of the issue.
+`assignee`|`string` | Login for the user that this issue should be assigned to. _NOTE: Only users with push access can set the assignee for new issues. The assignee is silently dropped otherwise. **This field is [deprecated](https://developer.github.com/v3/versions/#v3-deprecations).**_
+`milestone`|`integer` | The `number` of the milestone to associate this issue with. _NOTE: Only users with push access can set the milestone for new issues. The milestone is silently dropped otherwise._
+`labels`|`array` of `strings` | Labels to associate with this issue. _NOTE: Only users with push access can set labels for new issues. Labels are silently dropped otherwise._
+`assignees`|`array` of `strings` | Logins for Users to assign to this issue. _NOTE: Only users with push access can set assignees for new issues. Assignees are silently dropped otherwise._
-labels
-: _Optional_ **array** of **strings** - Labels to associate with this
-issue.
+#### Example
<%= json \
:title => "Found a bug",
:body => "I'm having a problem with this.",
:assignee => "octocat",
+ :assignees => [get_resource(:user)],
:milestone => 1,
- :labels => %w(Label1 Label2)
+ :labels => %w(bug)
%>
### Response
-<%= headers 201,
- :Location =>
-'https://api.github.com/repos/user/repo/issues/1' %>
-<%= json :issue %>
+<%= headers 201, :Location => get_resource(:full_issue)['url'] %>
+<%= json :full_issue %>
## Edit an issue
- PATCH /repos/:user/:repo/issues/:number
+Issue owners and users with push access can edit an issue.
-### Input
+ PATCH /repos/:owner/:repo/issues/:number
-title
-: _Optional_ **string**
-
-body
-: _Optional_ **string**
-
-assignee
-: _Optional_ **string** - Login for the user that this issue should be
-assigned to.
-
-state
-: _Optional_ **string** - State of the issue: `open` or `closed`.
+### Parameters
-milestone
-: _Optional_ **number** - Milestone to associate this issue with.
+Name | Type | Description
+-----|------|--------------
+`title`|`string` | The title of the issue.
+`body`|`string` | The contents of the issue.
+`assignee`|`string` | Login for the user that this issue should be assigned to. **This field is [deprecated](https://developer.github.com/v3/versions/#v3-deprecations).**
+`state`|`string` | State of the issue. Either `open` or `closed`.
+`milestone`|`integer` | The `number` of the milestone to associate this issue with or `null` to remove current. _NOTE: Only users with push access can set the milestone for issues. The milestone is silently dropped otherwise._
+`labels`|`array` of `strings` | Labels to associate with this issue. Pass one or more Labels to _replace_ the set of Labels on this Issue. Send an empty array (`[]`) to clear all Labels from the Issue. _NOTE: Only users with push access can set labels for issues. Labels are silently dropped otherwise._
+`assignees`|`array` of `strings` | Logins for Users to assign to this issue. Pass one or more user logins to _replace_ the set of assignees on this Issue. .Send an empty array (`[]`) to clear all assignees from the Issue. _NOTE: Only users with push access can set assignees for new issues. Assignees are silently dropped otherwise._
-labels
-: _Optional_ **array** of **strings** - Labels to associate with this
-issue. Pass one or more Labels to _replace_ the set of Labels on this
-Issue. Send an empty array (`[]`) to clear all Labels from the Issue.
+#### Example
<%= json \
:title => "Found a bug",
:body => "I'm having a problem with this.",
:assignee => "octocat",
+ :assignees => [get_resource(:user)],
:milestone => 1,
:state => "open",
- :labels => %w(Label1 Label2)
+ :labels => %w(bug)
%>
### Response
<%= headers 200 %>
-<%= json :issue %>
+<%= json :full_issue %>
+
+{% if page.version == 'dotcom' or page.version >= 2.6 %}
+## Lock an issue
+
+{% if page.version == 2.6 %}
+{{#tip}}
+
+
+
+ The API to lock an issue is currently available for developers to preview.
+ During the preview period, the API may change without advance notice.
+ Please see the [blog post](/changes/2016-02-11-issue-locking-api) for full details.
+
+ To access the API during the preview period, you must provide a custom [media type](/v3/media) in the `Accept` header:
+
+ application/vnd.github.the-key-preview+json
+
+{{/tip}}
+{% endif %}
+
+Users with push access can lock an issue's conversation.
+
+ PUT /repos/:owner/:repo/issues/:number/lock
+
+<%= fetch_content(:put_content_length) %>
+
+### Response
+
+<%= headers 204 %>
+
+## Unlock an issue
+
+{% if page.version == 2.6 %}
+{{#tip}}
+
+
+
+ The API to unlock an issue is currently available for developers to preview.
+ During the preview period, the API may change without advance notice.
+ Please see the [blog post](/changes/2016-02-11-issue-locking-api) for full details.
+
+ To access the API during the preview period, you must provide a custom [media type](/v3/media) in the `Accept` header:
+
+ application/vnd.github.the-key-preview+json
+
+{{/tip}}
+{% endif %}
+
+Users with push access can unlock an issue's conversation.
+
+ DELETE /repos/:owner/:repo/issues/:number/lock
+
+### Response
+
+<%= headers 204 %>
+
+{% endif %}
-## Custom Mime Types
+## Custom media types
-These are the supported mime types for issues. You can read more about the
-use of mime types in the API [here](/v3/mime/).
+These are the supported media types for issues. You can read more about the
+use of media types in the API [here](/v3/media/).
application/vnd.github.VERSION.raw+json
application/vnd.github.VERSION.text+json
diff --git a/content/v3/issues/assignees.md b/content/v3/issues/assignees.md
index b5e55254b9..4d0c1a59a0 100644
--- a/content/v3/issues/assignees.md
+++ b/content/v3/issues/assignees.md
@@ -1,26 +1,27 @@
---
-title: Issue Assignees | GitHub API
+title: Issue Assignees
---
-# Assignees API
+# Assignees
+
+{:toc}
## List assignees
-This call lists all the available assignees (owner + collaborators) to which
-issues may be assigned.
+This call lists all the [available assignees][] to which issues may be assigned.
- GET /repos/:user/:repo/assignees
+ GET /repos/:owner/:repo/assignees
### Response
-<%= headers 200 %>
+<%= headers 200, :pagination => default_pagination_rels %>
<%= json(:user) { |h| [h] } %>
## Check assignee
You may also check to see if a particular user is an assignee for a repository.
- GET /repos/:user/:repo/assignees/:assignee
+ GET /repos/:owner/:repo/assignees/:assignee
### Response
@@ -32,3 +33,35 @@ If the given `assignee` login belongs to an assignee for the repository, a
Otherwise a `404` status code is returned.
<%= headers 404 %>
+
+[available assignees]: https://help.github.com/articles/assigning-issues-and-pull-requests-to-other-github-users/
+
+## Add assignees to an Issue
+
+This call adds the users passed in the `assignees` key (as their logins) to the issue.
+
+ POST /repos/:owner/:repo/issues/:number/assignees
+
+### Input
+
+<%= json({"assignees" => %w(hubot other_assignee)}) %>
+
+### Response
+
+<%= headers 201 %>
+<%= json :issue_with_assignees %>
+
+## Remove assignees from an Issue
+
+This call removes the users passed in the `assignees` key (as their logins) from the issue.
+
+ DELETE /repos/:owner/:repo/issues/:number/assignees
+
+### Input
+
+<%= json({"assignees" => %w(hubot other_assignee)}) %>
+
+### Response
+
+<%= headers 200 %>
+<%= json :issue_with_assignees %>
diff --git a/content/v3/issues/comments.md b/content/v3/issues/comments.md
index dfabba27ff..b9d077b4a0 100644
--- a/content/v3/issues/comments.md
+++ b/content/v3/issues/comments.md
@@ -1,62 +1,157 @@
---
-title: Issue Comments | GitHub API
+title: Issue Comments
---
-# Issue Comments API
+# Comments
+
+{:toc}
The Issue Comments API supports listing, viewing, editing, and creating
comments on issues and pull requests.
-Issue Comments leverage [these](#custom-mime-types) custom mime types.
-You can read more about the use of mime types in the API
-[here](/v3/mime/).
+Issue Comments use [these custom media types](#custom-media-types).
+You can read more about the use of media types in the API
+[here](/v3/media/).
## List comments on an issue
- GET /repos/:user/:repo/issues/:number/comments
+ GET /repos/:owner/:repo/issues/:number/comments
+
+Issue Comments are ordered by ascending ID.
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`since`|`string` | Only comments updated at or after this time are returned. This is a timestamp in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.
### Response
-<%= headers 200, :pagination => true %>
+<%= headers 200, :pagination => default_pagination_rels %>
<%= json(:issue_comment) { |h| [h] } %>
-## Get a single comment
+{% if page.version == 'dotcom' %}
+#### Reactions summary
+
+{{#tip}}
+
+
+
+ An additional `reactions` object in the issue comment payload is currently available for developers to preview.
+ During the preview period, the APIs may change without advance notice.
+ Please see the [blog post](/changes/2016-05-12-reactions-api-preview) for full details.
+
+ To access the API you must provide a custom [media type](/v3/media) in the `Accept` header:
+
+ application/vnd.github.squirrel-girl-preview
+
+ The `reactions` key will have the following payload where `url` can be used to construct the API location for [listing and creating](/v3/reactions) reactions.
+
+{{/tip}}
+<%= json :issue_comment_reaction_summary %>
+{% endif %}
+
+## List comments in a repository
+
+ GET /repos/:owner/:repo/issues/comments
+
+By default, Issue Comments are ordered by ascending ID.
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`sort`|`string` | Either `created` or `updated`. Default: `created`
+`direction`|`string` | Either `asc` or `desc`. Ignored without the `sort` parameter.
+`since`|`string` | Only comments updated at or after this time are returned. This is a timestamp in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.
- GET /repos/:user/:repo/issues/comments/:id
### Response
<%= headers 200 %>
+<%= json(:issue_comment) { |h| [h] } %>
+
+{% if page.version == 'dotcom' %}
+#### Reactions summary
+
+{{#tip}}
+
+
+
+ An additional `reactions` object in the issue comment payload is currently available for developers to preview.
+ During the preview period, the APIs may change without advance notice.
+ Please see the [blog post](/changes/2016-05-12-reactions-api-preview) for full details.
+
+ To access the API you must provide a custom [media type](/v3/media) in the `Accept` header:
+
+ application/vnd.github.squirrel-girl-preview
+
+ The `reactions` key will have the following payload where `url` can be used to construct the API location for [listing and creating](/v3/reactions) reactions.
+
+{{/tip}}
+<%= json :issue_comment_reaction_summary %>
+{% endif %}
+
+## Get a single comment
+
+ GET /repos/:owner/:repo/issues/comments/:id
+
+### Response
+
+<%= headers 200, :pagination => default_pagination_rels %>
<%= json :issue_comment %>
+{% if page.version == 'dotcom' %}
+#### Reactions summary
+
+{{#tip}}
+
+
+
+ An additional `reactions` object in the issue comment payload is currently available for developers to preview.
+ During the preview period, the APIs may change without advance notice.
+ Please see the [blog post](/changes/2016-05-12-reactions-api-preview) for full details.
+
+ To access the API you must provide a custom [media type](/v3/media) in the `Accept` header:
+
+ application/vnd.github.squirrel-girl-preview
+
+ The `reactions` key will have the following payload where `url` can be used to construct the API location for [listing and creating](/v3/reactions) reactions.
+
+{{/tip}}
+<%= json :issue_comment_reaction_summary %>
+{% endif %}
+
## Create a comment
- POST /repos/:user/:repo/issues/:number/comments
+ POST /repos/:owner/:repo/issues/:number/comments
### Input
-body
-: _Required_ **string**
+Name | Type | Description
+-----|------|--------------
+`body`|`string` | **Required**. The contents of the comment.
-<%= json :body => "a new comment" %>
+
+<%= json :body => "Me too" %>
### Response
-<%= headers 201,
- :Location =>
-"https://api.github.com/repos/user/repo/issues/comments/1" %>
+<%= headers 201, :Location => get_resource(:issue_comment)['url'] %>
<%= json :issue_comment %>
## Edit a comment
- PATCH /repos/:user/:repo/issues/comments/:id
+ PATCH /repos/:owner/:repo/issues/comments/:id
### Input
-body
-: _Required_ **string**
+Name | Type | Description
+-----|------|--------------
+`body`|`string` | **Required**. The contents of the comment.
+
-<%= json :body => "String" %>
+<%= json :body => "Me too" %>
### Response
@@ -65,16 +160,16 @@ body
## Delete a comment
- DELETE /repos/:user/:repo/issues/comments/:id
+ DELETE /repos/:owner/:repo/issues/comments/:id
### Response
<%= headers 204 %>
-## Custom Mime Types
+## Custom media types
-These are the supported mime types for issue comments. You can read more
-about the use of mime types in the API [here](/v3/mime/).
+These are the supported media types for issue comments. You can read more
+about the use of media types in the API [here](/v3/media/).
application/vnd.github.VERSION.raw+json
application/vnd.github.VERSION.text+json
diff --git a/content/v3/issues/events.md b/content/v3/issues/events.md
index a73cd12c55..2b40755155 100644
--- a/content/v3/issues/events.md
+++ b/content/v3/issues/events.md
@@ -1,75 +1,143 @@
---
-title: Issue Events | GitHub API
+title: Issue Events
---
-# Issue Events API
+# Events
-Records various events that occur around an Issue or Pull Request. This is
+{:toc}
+
+Records various events that occur around an issue or pull request. This is
useful both for display on issue/pull request information pages and also to
determine who should be notified of comments.
### Attributes
-actor
-: Always the User that generated the event.
+
+ - id
+ - The Integer ID of the event.
+
+ - url
+ - The API URL for fetching the event.
+
+ - actor
+ - The User object that generated the event.
+
+ - commit_id
+ - The String SHA of a commit that referenced this Issue
+
+ - commit_url
+ - The GitHub API link to a commit that referenced this Issue
+
+ - event
+ - Identifies the actual type of Event that occurred.
-commit_id
-: The String SHA of a commit that referenced this Issue
+ - created_at
+ - The timestamp indicating when the event occurred.
-event
-: Identifies the actual type of Event that occurred.
+ - label
+ - The Label object including `name` and `color` attributes. Only provided for `labeled`
+ and `unlabeled` events.
+
+ - assignee
+ - The User object which was assigned to (or unassigned from) this Issue. Only provided for 'assigned' and 'unassigned' events.
+
+ {% if page.version == 'dotcom' or page.version > 2.5 %}
+ - assigner
+ - The User object that performed the assignment (or unassignment) for this Issue. Only provided for 'assigned' and 'unassigned' events.
+ {% endif %}
+
+ - milestone
+ - The Milestone object including a `title` attribute. Only provided for `milestoned` and
+ `demilestoned` events.
+
+ - rename
+ - An object containing rename details including `from` and `to` attributes. Only
+ provided for `renamed` events.
+
### Events
-closed
-: The issue was closed by the actor. When the commit_id is present, it
+
+ - closed
+ - The issue was closed by the actor. When the commit_id is present, it
identifies the commit that closed the issue using "closes / fixes #NN"
- syntax.
+ syntax.
+
-reopened
-: The issue was reopened by the actor.
+ - reopened
+ - The issue was reopened by the actor.
-subscribed
-: The actor subscribed to receive notifications for an issue.
+ - subscribed
+ - The actor subscribed to receive notifications for an issue.
-merged
-: The issue was merged by the actor. The `commit_id` attribute is the SHA1 of
- the HEAD commit that was merged.
+ - merged
+ - The issue was merged by the actor. The `commit_id` attribute is the SHA1 of
+ the HEAD commit that was merged.
-referenced
-: The issue was referenced from a commit message. The `commit_id` attribute is
- the commit SHA1 of where that happened.
+ - referenced
+ - The issue was referenced from a commit message. The `commit_id` attribute is
+ the commit SHA1 of where that happened.
-mentioned
-: The actor was @mentioned in an issue body.
+ - mentioned
+ - The actor was @mentioned in an issue body.
-assigned
-: The issue was assigned to the actor.
+ - assigned
+ - The issue was assigned to the actor.
+
+ - unassigned
+ - The actor was unassigned from the issue.
+
+ - labeled
+ - A label was added to the issue.
+
+ - unlabeled
+ - A label was removed from the issue.
+
+ - milestoned
+ - The issue was added to a milestone.
+
+ - demilestoned
+ - The issue was removed from a milestone.
+
+ - renamed
+ - The issue title was changed.
+
+ - locked
+ - The issue was locked by the actor.
+
+ - unlocked
+ - The issue was unlocked by the actor.
+
+ - head_ref_deleted
+ - The pull request's branch was deleted.
+
+ - head_ref_restored
+ - The pull request's branch was restored.
+
## List events for an issue
- GET /repos/:user/:repo/issues/:issue_number/events
+ GET /repos/:owner/:repo/issues/:issue_number/events
### Response
-<%= headers 200, :pagination => true %>
+<%= headers 200, :pagination => default_pagination_rels %>
<%= json(:issue_event) { |h| [h] } %>
## List events for a repository
- GET /repos/:user/:repo/issues/events
+ GET /repos/:owner/:repo/issues/events
### Response
-<%= headers 200, :pagination => true %>
+<%= headers 200, :pagination => default_pagination_rels %>
<%= json(:full_issue_event) { |h| [h] } %>
## Get a single event
- GET /repos/:user/:repo/issues/events/:id
+ GET /repos/:owner/:repo/issues/events/:id
### Response
<%= headers 200 %>
<%= json :full_issue_event %>
-
diff --git a/content/v3/issues/labels.md b/content/v3/issues/labels.md
index b263584dd3..718a0c6339 100644
--- a/content/v3/issues/labels.md
+++ b/content/v3/issues/labels.md
@@ -1,21 +1,23 @@
---
-title: Issue Labels | GitHub API
+title: Issue Labels
---
-# Labels API
+# Labels
+
+{:toc}
## List all labels for this repository
- GET /repos/:user/:repo/labels
+ GET /repos/:owner/:repo/labels
### Response
-<%= headers 200 %>
+<%= headers 200, :pagination => default_pagination_rels %>
<%= json(:label) { |h| [h] } %>
## Get a single label
- GET /repos/:user/:repo/labels/:name
+ GET /repos/:owner/:repo/labels/:name
### Response
@@ -24,38 +26,36 @@ title: Issue Labels | GitHub API
## Create a label
- POST /repos/:user/:repo/labels
+ POST /repos/:owner/:repo/labels
-### Input
+### Parameters
-name
-: _Required_ **string**
+Name | Type | Description
+-----|------|--------------
+`name`|`string` | **Required**. The name of the label.
+`color`|`string` |**Required**. A 6 character hex code, without the leading `#`, identifying the color.
-color
-: _Required_ **string** - 6 character hex code, without a leading `#`.
-<%= json :name => "API", :color => "FFFFFF" %>
+<%= json :name => "bug", :color => "f29513" %>
### Response
-<%= headers 201,
- :Location =>
-"https://api.github.com/repos/user/repo/labels/foo" %>
+<%= headers 201, :Location => get_resource(:label)['url'] %>
<%= json :label %>
## Update a label
- PATCH /repos/:user/:repo/labels/:name
+ PATCH /repos/:owner/:repo/labels/:name
-### Input
+### Parameters
-name
-: _Required_ **string**
+Name | Type | Description
+-----|------|--------------
+`name`|`string` | The name of the label.
+`color`|`string` | A 6 character hex code, without the leading `#`, identifying the color.
-color
-: _Required_ **string** - 6 character hex code, without a leading `#`.
-<%= json :name => "API", :color => "FFFFFF" %>
+<%= json :name => "bug", :color => "f29513" %>
### Response
@@ -64,7 +64,7 @@ color
## Delete a label
- DELETE /repos/:user/:repo/labels/:name
+ DELETE /repos/:owner/:repo/labels/:name
### Response
@@ -72,16 +72,16 @@ color
## List labels on an issue
- GET /repos/:user/:repo/issues/:number/labels
+ GET /repos/:owner/:repo/issues/:number/labels
### Response
-<%= headers 200 %>
+<%= headers 200, :pagination => default_pagination_rels %>
<%= json(:label) { |h| [h] } %>
## Add labels to an issue
- POST /repos/:user/:repo/issues/:number/labels
+ POST /repos/:owner/:repo/issues/:number/labels
### Input
@@ -94,16 +94,15 @@ color
## Remove a label from an issue
- DELETE /repos/:user/:repo/issues/:number/labels/:name
+ DELETE /repos/:owner/:repo/issues/:number/labels/:name
### Response
-<%= headers 200 %>
-<%= json(:label) { |h| [h] } %>
+<%= headers 204 %>
## Replace all labels for an issue
- PUT /repos/:user/:repo/issues/:number/labels
+ PUT /repos/:owner/:repo/issues/:number/labels
### Input
@@ -118,7 +117,7 @@ Sending an empty array (`[]`) will remove all Labels from the Issue.
## Remove all labels from an issue
- DELETE /repos/:user/:repo/issues/:number/labels
+ DELETE /repos/:owner/:repo/issues/:number/labels
### Response
@@ -126,9 +125,9 @@ Sending an empty array (`[]`) will remove all Labels from the Issue.
## Get labels for every issue in a milestone
- GET /repos/:user/:repo/milestones/:number/labels
+ GET /repos/:owner/:repo/milestones/:number/labels
### Response
-<%= headers 200 %>
+<%= headers 200, :pagination => default_pagination_rels %>
<%= json(:label) { |h| [h] } %>
diff --git a/content/v3/issues/milestones.md b/content/v3/issues/milestones.md
index a36505b5c6..2438449bae 100644
--- a/content/v3/issues/milestones.md
+++ b/content/v3/issues/milestones.md
@@ -1,32 +1,32 @@
---
-title: Issue Milestones | GitHub API
+title: Issue Milestones
---
-# Milestones API
+# Milestones
+
+{:toc}
## List milestones for a repository
- GET /repos/:user/:repo/milestones
+ GET /repos/:owner/:repo/milestones
### Parameters
-state
-: `open`, `closed`, default: `open`
-
-sort
-: `due_date`, `completeness`, default: `due_date`
+Name | Type | Description
+-----|------|--------------
+`state`|`string` | The state of the milestone. Either `open`, `closed`, or `all`. Default: `open`
+`sort`|`string` | What to sort results by. Either `due_on` or `completeness`. Default: `due_on`
+`direction`|`string` | The direction of the sort. Either `asc` or `desc`. Default: `asc`
-direction
-: `asc` or `desc`, default: `desc`.
### Response
-<%= headers 200, :pagination => true %>
+<%= headers 200, :pagination => default_pagination_rels %>
<%= json(:milestone) { |h| [h] } %>
## Get a single milestone
- GET /repos/:user/:repo/milestones/:number
+ GET /repos/:owner/:repo/milestones/:number
### Response
@@ -35,62 +35,51 @@ direction
## Create a milestone
- POST /repos/:user/:repo/milestones
+ POST /repos/:owner/:repo/milestones
### Input
-title
-: _Required_ **string**
-
-state
-: _Optional_ **string** - `open` or `closed`. Default is `open`.
-
-description
-: _Optional_ **string**
+Name | Type | Description
+-----|------|---------------
+`title`|`string` | **Required**. The title of the milestone.
+`state`|`string` | The state of the milestone. Either `open` or `closed`. Default: `open`
+`description`|`string` | A description of the milestone.
+`due_on`|`string` | The milestone due date. This is a timestamp in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.
-due\_on
-: _Optional_ **string** - ISO 8601 time.
+#### Example
<%= json \
- :title => "String",
- :state => "open or closed",
- :description => "String",
- :due_on => "Time"
+ :title => "v1.0",
+ :state => "open",
+ :description => "Tracking milestone for version 1.0",
+ :due_on => "2012-10-09T23:39:01Z"
%>
### Response
-<%= headers 201,
- :Location =>
-"https://api.github.com/repos/user/repo/milestones/1" %>
+<%= headers 201, :Location => get_resource(:milestone)['url'] %>
<%= json :milestone %>
## Update a milestone
- PATCH /repos/:user/:repo/milestones/:number
+ PATCH /repos/:owner/:repo/milestones/:number
### Input
-number
-: _Required_ **integer**
+Name | Type | Description
+-----|------|---------------
+`title`|`string` | The title of the milestone.
+`state`|`string` | The state of the milestone. Either `open` or `closed`. Default: `open`
+`description`|`string` | A description of the milestone.
+`due_on`|`string` | The milestone due date. This is a timestamp in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.
-title
-: _Optional_ **string**
-
-state
-: _Optional_ **string** - `open` or `closed`. Default is `open`.
-
-description
-: _Optional_ **string**
-
-due\_on
-: _Optional_ **string** - ISO 8601 time.
+#### Example
<%= json \
- :title => "String",
- :state => "open or closed",
- :description => "String",
- :due_on => "Time"
+ :title => "v1.0",
+ :state => "open",
+ :description => "Tracking milestone for version 1.0",
+ :due_on => "2012-10-09T23:39:01Z"
%>
### Response
@@ -100,9 +89,8 @@ due\_on
## Delete a milestone
- DELETE /repos/:user/:repo/milestones/:number
+ DELETE /repos/:owner/:repo/milestones/:number
### Response
<%= headers 204 %>
-
diff --git a/content/v3/issues/timeline.md b/content/v3/issues/timeline.md
new file mode 100644
index 0000000000..c1ba039e0e
--- /dev/null
+++ b/content/v3/issues/timeline.md
@@ -0,0 +1,149 @@
+---
+title: Issue Timeline
+---
+
+{{#tip}}
+
+
+
+ The API to get issue timeline events is currently available for developers to preview.
+ During the preview period, the APIs may change without advance notice.
+ Please see the [blog post](/changes/2016-05-23-timeline-preview-api/) for full details.
+
+ To access the API you must provide a custom [media type](/v3/media) in the `Accept` header:
+
+ application/vnd.github.mockingbird-preview
+
+{{/tip}}
+
+# Timeline
+
+{:toc}
+
+Records various events that occur around an issue or pull request. This is
+useful both for display on issue and pull request information pages, as well as to
+determine who should be notified of comments.
+
+### Attributes
+
+
+ - id
+ - The Integer ID of the event.
+
+ - url
+ - The API URL for fetching the event.
+
+ - actor
+ - The User object that generated the event.
+
+ - commit_id
+ - The String SHA of a commit that referenced this Issue.
+
+ - event
+ - Identifies the actual type of Event that occurred.
+
+ - created_at
+ - The timestamp indicating when the event occurred.
+
+ - label
+ - The Label object including `name` and `color` attributes. Only provided for `labeled`
+ and `unlabeled` events.
+
+ - assignee
+ - The User object which was assigned to (or unassigned from) this Issue. Only provided for `assigned` and `unassigned` events.
+
+ - milestone
+ - The Milestone object including a `title` attribute. Only provided for `milestoned` and
+ `demilestoned` events.
+
+ - source
+ - The `id`, `actor`, and `url` for the source of a reference from
+another issue. Only provided for `cross-referenced` events.
+
+ - rename
+ - An object containing rename details including `from` and `to` attributes. Only
+ provided for `renamed` events.
+
+
+### Events
+
+
+ - assigned
+ - The issue was assigned to the assignee.
+
+ - closed
+ - The issue was closed by the actor. When the commit_id is present, it
+ identifies the commit that closed the issue using "closes / fixes #NN"
+ syntax.
+
+ - commented
+ - A comment was added to the issue.
+
+ - committed
+ - A commit was added to the pull request's `HEAD` branch. Only
+provided for pull requests.
+
+ - cross-referenced
+ - The issue was referenced from another issue. The `source`
+attribute contains the `id`, `actor`, and `url` of the reference's
+source.
+
+ - demilestoned
+ - The issue was removed from a milestone.
+
+ - head_ref_deleted
+ - The pull request's branch was deleted.
+
+ - head_ref_restored
+ - The pull request's branch was restored.
+
+ - labeled
+ - A label was added to the issue.
+
+ - locked
+ - The issue was locked by the actor.
+
+ - mentioned
+ - The actor was @mentioned in an issue body.
+
+ - merged
+ - The issue was merged by the actor. The `commit_id` attribute is the SHA1 of
+ the HEAD commit that was merged.
+
+ - milestoned
+ - The issue was added to a milestone.
+
+ - referenced
+ - The issue was referenced from a commit message. The `commit_id` attribute is
+ the commit SHA1 of where that happened.
+
+ - renamed
+ - The issue title was changed.
+
+ - reopened
+ - The issue was reopened by the actor.
+
+ - subscribed
+ - The actor subscribed to receive notifications for an issue.
+
+ - unassigned
+ - The assignee was unassigned from the issue.
+
+ - unlabeled
+ - A label was removed from the issue.
+
+ - unlocked
+ - The issue was unlocked by the actor.
+
+ - unsubscribed
+ - The actor unsubscribed to stop receiving notifications for an issue.
+
+
+## List events for an issue
+
+ GET /repos/:owner/:repo/issues/:issue_number/timeline
+
+### Response
+
+<%= headers 200, :pagination => default_pagination_rels %>
+<%= json(:issue_event) { |h| [h] } %>
diff --git a/content/v3/libraries.md b/content/v3/libraries.md
deleted file mode 100644
index 8c939b1f92..0000000000
--- a/content/v3/libraries.md
+++ /dev/null
@@ -1,118 +0,0 @@
----
-title: Libraries | GitHub API
----
-
-# Libraries
-
-Libraries for accessing the GitHub API from your favorite language.
-
-## ActionScript
-
-* [ActionScript GitHub API][as3]
-
-[as3]: https://github.com/cbrammer/api-github-as3
-
-## Clojure
-
-* [Tentacles][tentacles]
-
-[tentacles]: https://github.com/Raynes/tentacles
-
-## CSharp
-
-* [CSharp GitHub API][csharp]
-
-[csharp]: https://github.com/sgrassie/csharp-github-api
-
-## Erlang
-
-* [Erlang GitHub API][erlang]
-
-[erlang]: https://github.com/onlyshk/erlang-github-api
-
-## Haskell
-
-* [Haskell GitHub API][haskell]
-
-[haskell]: https://github.com/dmnpignaud/haskell-github-api
-
-## Java
-
-The [GitHub Java API](https://github.com/eclipse/egit-github/tree/master/org.eclipse.egit.github.core) library
-is part of the [GitHub Mylyn Connector](https://github.com/eclipse/egit-github) and aims to support the entire
-GitHub v3 API. Builds are available in [Maven Central](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22org.eclipse.egit.github.core%22).
-
-## Javascript
-
-* [Node-GitHub][ajaxorg-node-github]
-* [NodeJS GitHub library][octonode]
-* [gh3 client-side API v3 wrapper][gh3]
-
-[ajaxorg-node-github]: https://github.com/ajaxorg/node-github
-[octonode]: https://github.com/pksunkara/octonode
-[gh3]: https://github.com/k33g/gh3
-
-## Objective-C
-
-* [UAGithubEngine][uagithubengine]
-
-[uagithubengine]: http://github.com/owainhunt/uagithubengine
-
-## Perl
-
-* [Pithub][pithub-github] ([CPAN][pithub-cpan])
-* [Net::Github][net-github-github] ([CPAN][net-github-cpan])
-
-[net-github-github]: https://github.com/fayland/perl-net-github
-[net-github-cpan]: http://search.cpan.org/~fayland/Net-GitHub-0.30/lib/Net/GitHub.pm
-[pithub-github]: https://github.com/plu/Pithub
-[pithub-cpan]: http://metacpan.org/module/Pithub
-
-## PHP
-
-* [PHP GitHub API][php-github-api]
-* [GitHub API][github-api]
-* [GitHub Kohana Module][kohana]
-
-[php-github-api]: https://github.com/KnpLabs/php-github-api
-[github-api]: https://github.com/yiiext/github-api
-[kohana]: https://github.com/acoulton/github_v3_api
-
-## Python
-
-* [PyGithub][jacquev6_pygithub]
-* [Pygithub3][pygithub3-api]
-* [libsaas][libsaas]
-* [github3.py][github3py]
-* [sanction][sanction]
-* [agithub][agithub]
-
-[jacquev6_pygithub]: https://github.com/jacquev6/PyGithub
-[pygithub3-api]: https://github.com/copitux/python-github3
-[libsaas]: https://github.com/ducksboard/libsaas
-[github3py]: https://github.com/sigmavirus24/github3.py
-[sanction]: https://github.com/demianbrecht/sanction
-[agithub]: https://github.com/jpaugh64/agithub "Agnostic Github"
-
-## Ruby
-
-* [Octokit][octokit]
-* [GitHub API Gem][ghapi]
-* [Octocat Herder][herder]
-* [GitHub v3 API][ruby1]
-* [GitHub API Client][ruby2]
-* [Ghee][ghee]
-
-[octokit]: https://github.com/pengwynn/octokit
-[herder]: https://github.com/jhelwig/octocat_herder
-[ghapi]: https://github.com/peter-murach/github
-[ruby1]: https://github.com/jwilger/github-v3-api
-[ruby2]: https://github.com/okonski/github-api-client
-[ghee]: https://github.com/rauhryan/ghee
-
-## Scala
-
-* [Dispatch GitHub][scala]
-
-[scala]: https://github.com/andreazevedo/dispatch-github
-
diff --git a/content/v3/licenses.md b/content/v3/licenses.md
new file mode 100644
index 0000000000..8fd40230aa
--- /dev/null
+++ b/content/v3/licenses.md
@@ -0,0 +1,77 @@
+---
+title: Licenses
+---
+
+# Licenses
+
+{:toc}
+
+{{#tip}}
+
+
+
+ The Licenses API is currently available for developers to preview.
+ During the preview period, the API may change without advance notice.
+ Please see the [blog post](https://github.com/blog/1964-open-source-license-usage-on-github-com) for full details.
+
+ To access the API during the preview period, you must provide a custom [media type](/v3/media) in the `Accept` header:
+
+ application/vnd.github.drax-preview+json
+
+{{/tip}}
+
+The Licenses API returns metadata about popular open source licenses and information about a particular project's license file.
+
+The Licenses API uses [the open source Ruby Gem Licensee](https://github.com/benbalter/licensee) to attempt to identity the project's license. Licensee matches the contents of a project's `LICENSE` file (if it exists) against a short list of known licenses. As a result, the API does not take into account the licenses of project dependencies or other means of documenting a project's license such as references to the license name in the documentation.
+
+If a license is matched, the license key and name returned conforms to the [SPDX specification](https://spdx.org/).
+
+{{#warning}}
+
+GitHub is a lot of things, but it’s not a law firm. As such, GitHub does not provide legal advice. Using the Licenses API or sending us an email about it does not constitute legal advice nor does it create an attorney-client relationship. If you have any questions about what you can and can't do with a particular license, you should consult with your own legal counsel before moving forward. In fact, you should always consult with your own lawyer before making any decisions that might have legal ramifications or that may impact your legal rights.
+
+GitHub created the License API to help users get information about open source licenses and the projects that use them. We hope it helps, but please keep in mind that we’re not lawyers (at least not most of us aren't) and that we make mistakes like everyone else. For that reason, GitHub provides the API on an “as-is” basis and makes no warranties regarding any information or licenses provided on or through it, and disclaims liability for damages resulting from using the API.
+
+{{/warning}}
+
+## List all licenses
+
+ GET /licenses
+
+### Response
+
+<%= headers 200 %>
+<%= json(:licenses) %>
+
+## Get an individual license
+
+ GET /licenses/mit
+
+### Response
+
+<%= headers 200 %>
+<%= json(:mit) %>
+
+## Get a repository's license
+
+When passed the preview media type, requests to get a repository will also return the repository's license, if it can be detected from the repository's license file.
+
+ GET /repos/:owner/:repo
+
+### Response
+
+<%= headers 200 %>
+<%= json(:licensee) %>
+
+## Get the contents of a repository's license
+
+This method returns the contents of the repository's license file, if one is detected.
+
+ GET /repos/:owner/:repo/license
+
+Similar to [the repository contents API](/v3/repos/contents/#get-contents), this method also supports [custom media types](/v3/repos/contents/#custom-media-types) for retrieving the raw license content or rendered license HTML.
+
+### Response
+
+<%= headers 200 %>
+<%= json(:license_contents) %>
diff --git a/content/v3/markdown.md b/content/v3/markdown.md
index 3f984a0b40..6ae1867f01 100644
--- a/content/v3/markdown.md
+++ b/content/v3/markdown.md
@@ -1,26 +1,24 @@
---
-title: Markdown Rendering | GitHub API
+title: Markdown
---
-# Markdown Rendering API
+# Markdown
-## Render an arbritrary Markdown document
+{:toc}
- POST /markdown
-
-### Input
+## Render an arbitrary Markdown document
-text
-: _Required_ **string** - The Markdown text to render
+ POST /markdown
-mode
-: _Optional_ **string** - The rendering mode
+### Parameters
- - `markdown` to render a document as plain Markdown, just like README files are rendered.
- - `gfm` to render a document as user-content, e.g. like user comments or issues are rendered. In GFM mode, hard line breaks are always taken into account, and issue and user mentions are linked accordingly.
+Name | Type | Description
+-----|------|---------------
+`text`|`string` | **Required**.The Markdown text to render
+`mode`|`string` | The rendering mode. Can be either:
* `markdown` to render a document as plain Markdown, just like README files are rendered.
* `gfm` to render a document as user-content, _e.g._ like user comments or issues are rendered. In GFM mode, hard line breaks are always taken into account, and issue and user mentions are linked accordingly.
Default: `markdown`
+`context`|`string` | The repository context. Only taken into account when rendering as `gfm`
-context
-: _Optional_ **string** - The repository context, only taken into account when rendering as `gfm`
+#### Example
<%= json \
:text => "Hello world github/linguist#1 **cool**, and #1!",
@@ -34,11 +32,11 @@ context
%(Hello world github/linguist#1 cool, and #1!
), 200
%>
-# Render a Markdown document in raw mode
+## Render a Markdown document in raw mode
POST /markdown/raw
-### Input
+### Parameters
The raw API is not JSON-based. It takes a Markdown document as plaintext (`text/plain` or `text/x-markdown`) and renders it as plain Markdown without a repository context (just like a README.md file is rendered -- this is the simplest way to preview a readme online).
diff --git a/content/v3/media.md b/content/v3/media.md
new file mode 100644
index 0000000000..539acc407c
--- /dev/null
+++ b/content/v3/media.md
@@ -0,0 +1,164 @@
+---
+title: Media Types
+---
+# Media Types
+
+{:toc}
+
+Custom media types are used in the API to let consumers choose the format
+of the data they wish to receive. This is done by adding one or more of
+the following types to the `Accept` header when you make a request. Media types
+are specific to resources, allowing them to change independently and support
+formats that other resources don't.
+
+All {{ site.data.variables.product.product_name }} media types look like this:
+
+ application/vnd.github[.version].param[+json]
+
+The most basic media types the API supports are:
+
+ application/json
+ application/vnd.github+json
+
+Neither of these specify a [version][versions], so you will always get the
+current default JSON representation of resources.
+
+
+
+ Important: The default version of the API may change in the
+ future. If you're building an application and care about the stability of
+ the API, be sure to request a specific version in the Accept
+ header as shown in the examples below.
+
+
+
+You can specify a version like so:
+
+ application/vnd.github.v3+json
+
+If you're specifying a property (such as full/raw/etc defined below),
+put the version before the property:
+
+ application/vnd.github.v3.raw+json
+
+You can check the current version through every response's headers. Look
+for the `X-GitHub-Media-Type` header:
+
+``` command-line
+$ curl {{ site.data.variables.product.api_url_pre }}/users/technoweenie -I
+> HTTP/1.1 200 OK
+> X-GitHub-Media-Type: github.v3
+
+$ curl {{ site.data.variables.product.api_url_pre }}/users/technoweenie -I \
+$ -H "Accept: application/vnd.github.full+json"
+> HTTP/1.1 200 OK
+> X-GitHub-Media-Type: github.v3; param=full; format=json
+
+$ curl {{ site.data.variables.product.api_url_pre }}/users/technoweenie -I \
+$ -H "Accept: application/vnd.github.v3.full+json"
+> HTTP/1.1 200 OK
+> X-GitHub-Media-Type: github.v3; param=full; format=json
+```
+
+## Comment Body Properties
+
+The body of a comment can be written in [GitHub Flavored Markdown][gfm].
+Issues, Issue Comments, Pull Request Comments, and Gist Comments all
+accept these same media types:
+
+### Raw
+
+ application/vnd.github.VERSION.raw+json
+
+Return the raw markdown body. Response will include `body`. This is the
+default if you do not pass any specific media type.
+
+### Text
+
+ application/vnd.github.VERSION.text+json
+
+Return a text only representation of the markdown body. Response will
+include `body_text`.
+
+### HTML
+
+ application/vnd.github.VERSION.html+json
+
+Return HTML rendered from the body's markdown. Response will include
+`body_html`.
+
+### Full
+
+ application/vnd.github.VERSION.full+json
+
+Return raw, text and HTML representations. Response will include `body`,
+`body_text`, and `body_html`:
+
+## Git Blob Properties
+
+The following media types are allowed when getting a blob:
+
+### JSON
+
+ application/vnd.github.VERSION+json
+ application/json
+
+Return JSON representation of the blob with `content` as a base64
+encoded string. This is the default if nothing is passed.
+
+### Raw
+
+ application/vnd.github.VERSION.raw
+
+Return the raw blob data.
+
+## Commits, Commit comparison, and Pull Requests
+
+The Commit, Commit Comparison, and Pull Request resources support
+[diff][git-diff] and [patch][git-patch] formats:
+
+### diff
+
+ application/vnd.github.VERSION.diff
+
+### patch
+
+ application/vnd.github.VERSION.patch
+
+### sha
+
+ application/vnd.github.VERSION.sha
+
+## Repository contents
+
+### Raw
+
+ application/vnd.github.VERSION.raw
+
+Return the raw contents of a file. This is the default if you do not pass any specific media type.
+
+### HTML
+
+ application/vnd.github.VERSION.html
+
+For markup files such as Markdown or AsciiDoc, you can retrieve the rendered HTML using the `.html` media type. Markup languages are rendered to HTML using our open-source [Markup library](https://github.com/github/markup).
+
+## Gists
+
+### Raw
+
+ application/vnd.github.VERSION.raw
+
+Return the raw contents of a gist. This is the default if you do not pass any specific media type.
+
+### base64
+
+ application/vnd.github.VERSION.base64
+
+The gist contents are base64-encoded before being sent out. This can be useful if your gist contains any invalid UTF-8 sequences.
+
+[gfm]:http://github.github.com/github-flavored-markdown/
+[git-diff]: http://git-scm.com/docs/git-diff
+[git-patch]: http://git-scm.com/docs/git-format-patch
+[hypermedia]: /v3/#hypermedia
+[versions]: /v3/versions
diff --git a/content/v3/meta.md b/content/v3/meta.md
new file mode 100644
index 0000000000..6ba388351d
--- /dev/null
+++ b/content/v3/meta.md
@@ -0,0 +1,33 @@
+---
+title: Meta
+---
+
+# Meta
+
+{% if page.version == 'dotcom' %}
+
+This endpoint provides information about GitHub.com, the service.
+
+{% else %}
+
+If you access this endpoint on your organization's [GitHub Enterprise](https://enterprise.github.com/) installation, this endpoint provides information about that installation.
+
+{% endif %}
+
+ GET /meta
+
+### Response
+
+<%= headers 200 %>
+<%= json :meta %>
+
+### Body
+
+Name | Type | Description
+-----|------|--------------
+`verifiable_password_authentication`|`boolean` | Whether authentication with username and password is supported. {% if page.version != 'dotcom' %}GitHub Enterprise instances using CAS or OAuth for authentication will return `false`. Features like [Basic Authentication with a username and password](/v3/auth/#via-username-and-password), [sudo mode](https://help.github.com/articles/sudo-mode), and [two-factor authentication](https://help.github.com/articles/about-two-factor-authentication) are not supported on these servers.{% endif %}
+`github_services_sha` | `string` | The currently-deployed SHA of [`github-services`](https://github.com/github/github-services).
+`hooks`|`array` of `strings` | An Array of IP addresses in CIDR format specifying the addresses that incoming service hooks will originate from on GitHub.com. Subscribe to the [API Changes blog](https://developer.github.com/changes/) or follow [@GitHubAPI](https://twitter.com/GitHubAPI) on Twitter to get updated when this list changes.
+`git`|`array` of `strings` | An Array of IP addresses in CIDR format specifying the Git servers for GitHub.com.
+`pages`|`array` of `strings` | An Array of IP addresses in CIDR format specifying the A records for [GitHub Pages](https://pages.github.com/).
+`importer`|`array` of `strings` | An Array of IP addresses specifying the addresses that source imports will originate from on GitHub.com.
diff --git a/content/v3/migration.md b/content/v3/migration.md
new file mode 100644
index 0000000000..5291cd5928
--- /dev/null
+++ b/content/v3/migration.md
@@ -0,0 +1,29 @@
+---
+title: Migration
+---
+
+# Migration
+
+These APIs help you move projects to or from {{ site.data.variables.product.product_name }}.
+
+{% if page.version == 'dotcom' %}
+
+## [Enterprise Migrations][migrations]
+
+The [Enterprise Migrations API][migrations] lets you move a repository from GitHub to GitHub Enterprise.
+
+## [Source Imports][source_imports]
+
+The [Source Imports API][source_imports] lets you import a source repository to
+{{ site.data.variables.product.product_name }}.
+
+{% else %}
+
+The migration APIs are only available on github.com. To learn more about migration,
+read the [API documentation on github.com](https://developer.github.com/v3/migration/)
+or check out the [Enterprise Migration Guide](https://help.github.com/enterprise/admin/guides/migrations/).
+
+{% endif %}
+
+[migrations]: /v3/migration/migrations/
+[source_imports]: /v3/migration/source_imports/
diff --git a/content/v3/migration/migrations.md b/content/v3/migration/migrations.md
new file mode 100644
index 0000000000..be76e44e2e
--- /dev/null
+++ b/content/v3/migration/migrations.md
@@ -0,0 +1,115 @@
+---
+title: Migrations
+---
+
+# Migrations
+
+{:toc}
+
+The Migrations API *is only available to [authenticated](https://developer.github.com/v3/#authentication) organization [owners](https://help.github.com/articles/permission-levels-for-an-organization/)*.
+
+{% if page.version != 'dotcom' %}
+
+{{#warning}}
+
+This API is not currently available on GitHub Enterprise.
+
+{{/warning}}
+
+{% endif %}
+
+{{#tip}}
+
+ To access the Migrations API, you must provide a custom [media type](/v3/media) in the `Accept` header:
+
+ application/vnd.github.wyandotte-preview+json
+
+{{/tip}}
+
+## Start a migration
+
+Initiates the generation of a migration archive.
+
+ POST /orgs/:org/migrations
+
+### Parameters
+
+Name | Type | Description
+--------|---------|--------------
+`repositories` | `array` of `strings` | **Required**. A list of arrays indicating which repositories should be migrated.
+`lock_repositories`|`boolean` | Indicates whether repositories should be locked (to prevent manipulation) while migrating data. Default: `false`.
+`exclude_attachments`|`boolean` | Indicates whether attachments should be excluded from the migration (to reduce migration archive file size). Default: `false`.
+
+### Example
+
+<%= json \
+ :repositories => ["octocat/Hello-World"],
+ :lock_repositories => true
+%>
+
+### Response
+
+<%= headers 201 %>
+<%= json(:migrations) %>
+
+## Get a list of migrations
+
+Lists the most recent migrations.
+
+ GET /orgs/:org/migrations
+
+### Response
+
+<%= headers 200, :pagination => default_pagination_rels %>
+<%= json(:migrations) { |h| [h] } %>
+
+## Get the status of a migration
+
+Fetches the status of a migration.
+
+ GET /orgs/:org/migrations/:id
+
+### Response
+
+The `state` of a migration can be one of the following values:
+
+* `pending`, which means the migration hasn't started yet.
+* `exporting`, which means the migration is in progress.
+* `exported`, which means the migration finished successfully.
+* `failed`, which means the migration failed.
+
+<%= headers 200 %>
+<%= json(:migrations) { |h| h['state'] = 'exported'; h } %>
+
+## Download a migration archive
+
+Fetches the URL to a migration archive.
+
+ GET /orgs/:org/migrations/:id/archive
+
+### Response
+
+<%= headers 302 %>
+
+https://s3.amazonaws.com/github-cloud/migration/79/67?response-content-disposition=filename%3D0b989ba4-242f-11e5-81e1.tar.gz&response-content-type=application/x-gzip
+
+
+## Delete a migration archive
+
+Deletes a previous migration archive. Migration archives are automatically deleted after seven days.
+
+ DELETE /orgs/:org/migrations/:id/archive
+
+### Response
+
+<%= headers 204 %>
+
+## Unlock a repository
+
+Unlocks a repository that was locked for migration. You should unlock each migrated repository and [delete them](/v3/repos/#delete-a-repository) when the migration is complete and you no longer need the source data.
+
+ DELETE /orgs/:org/migrations/:id/repos/:repo_name/lock
+
+### Response
+
+<%= headers 204 %>
diff --git a/content/v3/migration/source_imports.md b/content/v3/migration/source_imports.md
new file mode 100644
index 0000000000..044cc0079e
--- /dev/null
+++ b/content/v3/migration/source_imports.md
@@ -0,0 +1,321 @@
+---
+title: Source Imports | GitHub API
+---
+
+# Source Imports
+
+{:toc}
+
+{% if page.version != 'dotcom' %}
+
+{{#warning}}
+
+This API is not currently available on GitHub Enterprise.
+
+{{/warning}}
+
+{% endif %}
+
+{{#tip}}
+
+ The source import APIs are currently in public preview. During this period, the APIs may change in a backwards-incompatible way. To access the API during the preview period, you must provide a custom [media type](/v3/media) in the `Accept` header:
+
+ application/vnd.github.barred-rock-preview
+
+{{/tip}}
+
+The Source Import API lets you start an import from a Git, Subversion, Mercurial, or Team Foundation Server source repository. This is the same functionality as [the GitHub Importer](https://help.github.com/articles/importing-from-other-version-control-systems-to-github/).
+
+A typical source import would [start the import](#start-an-import) and then (optionally) [update the authors](#map-a-commit-author) and/or [set the preference](#set-git-lfs-preference) for using Git LFS if large files exist in the import. A more detailed example can be seen in this diagram:
+
+```
++---------+ +--------+ +---------------------+
+| Tooling | | GitHub | | Original Repository |
++---------+ +--------+ +---------------------+
+ | | |
+ | Start import | |
+ |----------------------------->| |
+ | | |
+ | | Download source data |
+ | |--------------------------------------------->|
+ | | Begin streaming data |
+ | |<---------------------------------------------|
+ | | |
+ | Get import progress | |
+ |----------------------------->| |
+ | "status": "importing" | |
+ |<-----------------------------| |
+ | | |
+ | Get commit authors | |
+ |----------------------------->| |
+ | | |
+ | Map a commit author | |
+ |----------------------------->| |
+ | | |
+ | | |
+ | | Finish streaming data |
+ | |<---------------------------------------------|
+ | | |
+ | | Rewrite commits with mapped authors |
+ | |------+ |
+ | | | |
+ | |<-----+ |
+ | | |
+ | | Update repository on GitHub |
+ | |------+ |
+ | | | |
+ | |<-----+ |
+ | | |
+ | Map a commit author | |
+ |----------------------------->| |
+ | | Rewrite commits with mapped authors |
+ | |------+ |
+ | | | |
+ | |<-----+ |
+ | | |
+ | | Update repository on GitHub |
+ | |------+ |
+ | | | |
+ | |<-----+ |
+ | | |
+ | Get large files | |
+ |----------------------------->| |
+ | | |
+ | opt_in to Git LFS | |
+ |----------------------------->| |
+ | | Rewrite commits for large files |
+ | |------+ |
+ | | | |
+ | |<-----+ |
+ | | |
+ | | Update repository on GitHub |
+ | |------+ |
+ | | | |
+ | |<-----+ |
+ | | |
+ | Get import progress | |
+ |----------------------------->| |
+ | "status": "complete" | |
+ |<-----------------------------| |
+ | | |
+ | | |
+```
+
+## Start an import
+
+Start a source import to a GitHub repository using GitHub Importer.
+
+ PUT /repos/:owner/:repo/import
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`vcs_url`|`url`|**Required** The URL of the originating repository.
+`vcs`|`string`|The originating VCS type. Can be one of `subversion`, `git`, `mercurial`, or `tfvc`. Please be aware that without this parameter, the import job will take additional time to detect the VCS type before beginning the import. This detection step will be reflected in the response.
+`vcs_username`|`string`|If authentication is required, the username to provide to `vcs_url`.
+`vcs_password`|`string`|If authentication is required, the password to provide to `vcs_url`.
+`tfvc_project`|`string`|For a tfvc import, the name of the project that is being imported.
+
+#### Example
+
+<%= json \
+ :vcs => "subversion",
+ :vcs_url => "http://svn.mycompany.com/svn/myproject",
+ :vcs_username => "octocat",
+ :vcs_password => "secret"
+%>
+
+### Response
+
+<%= headers 201, :Location => "https://api.github.com/repos/spraints/socm/import" %>
+<%= json :source_import %>
+
+## Get import progress
+
+View the progress of an import.
+
+ GET /repos/:owner/:repo/import
+
+### Response
+
+<%= headers 200 %>
+<%= json :source_import_complete %>
+
+### Import `status`
+
+This section includes details about the possible values of the `status` field of the Import Progress response.
+
+An import that does not have errors will progress through these steps:
+
+* `detecting` - the "detection" step of the import is in progress because the request did not include a `vcs` parameter. The import is identifying the type of source control present at the URL.
+* `importing` - the "raw" step of the import is in progress. This is where commit data is fetched from the original repository. The import progress response will include `commit_count` (the total number of raw commits that will be imported) and `percent` (0 - 100, the current progress through the import).
+* `mapping` - the "rewrite" step of the import is in progress. This is where SVN branches are converted to Git branches, and where author updates are applied. The import progress response does not include progress information.
+* `pushing` - the "push" step of the import is in progress. This is where the importer updates the repository on GitHub. The import progress response will include `push_percent`, which is the percent value reported by `git push` when it is "Writing objects".
+* `complete` - the import is complete, and the repository is ready on GitHub.
+
+If there are problems, you will see one of these in the `status` field:
+
+* `auth_failed` - the import requires authentication in order to connect to the original repository. To update authentication for the import, please see the [Update Existing Import](#update-existing-import) section.
+* `error` - the import encountered an error. The import progress response will include the `failed_step` and an error message. [Contact support](https://github.com/contact?form%5Bsubject%5D=Source+Import+API+error) for more information.
+* `detection_needs_auth` - the importer requires authentication for the originating repository to continue detection. To update authentication for the import, please see the [Update Existing Import](#update-existing-import) section.
+* `detection_found_nothing` - the importer didn't recognize any source control at the URL. To resolve, [Cancel the import](#cancel-an-import) and [retry](#start-an-import) with the correct URL.
+* `detection_found_multiple` - the importer found several projects or repositories at the provided URL. When this is the case, the Import Progress response will also include a `project_choices` field with the possible project choices as values. To update project choice, please see the [Update Existing Import](#update-existing-import) section.
+
+### The `project_choices` field
+
+When multiple projects are found at the provided URL, the response hash will include a `project_choices` field, the value of which is an array of hashes each representing a project choice. The exact key/value pairs of the project hashes will differ depending on the version control type.
+
+<%= json :source_import_project_choices %>
+
+### Git LFS related fields
+
+This section includes details about Git LFS related fields that may be present in the Import Progress response.
+
+* `use_lfs` - describes whether the import has been opted in or out of using Git LFS. The value can be `opt_in`, `opt_out`, or `undecided` if no action has been taken.
+* `has_large_files` - the boolean value describing whether files larger than 100MB were found during the `importing` step.
+* `large_files_size` - the total size in gigabytes of files larger than 100MB found in the originating repository.
+* `large_files_count` - the total number of files larger than 100MB found in the originating repository. To see a list of these files, make a "Get Large Files" request.
+
+## Update existing import
+
+An import can be updated with credentials or a project choice by passing in the appropriate parameters in this API request. If no parameters are provided, the import will be restarted.
+
+ PATCH /repos/:owner/:repo/import
+
+### Parameters for updating authentication
+
+Name | Type | Description
+-----|------|--------------
+`vcs_username`|`string`|The username to provide to the originating repository.
+`vcs_password`|`string`|The password to provide to the originating repository.
+
+### Example
+
+<%= json \
+ :vcs_username => "octocat",
+ :vcs_password => "secret"
+%>
+
+### Response
+
+<%= headers 200 %>
+<%= json :source_import_update_auth %>
+
+### Parameters for updating project choice
+
+Some servers (e.g. TFS servers) can have several projects at a single URL. In those cases the import progress will have the status `detection_found_multiple` and the Import Progress response will include a `project_choices` array. You can select the project to import by providing one of the objects in the `project_choices` array in the update request.
+
+The following example demonstrates the workflow for updating an import with "project1" as the project choice. Given a `project_choices` array like such:
+
+<%= json :source_import_project_choices %>
+
+### Example
+
+<%= json\
+ "vcs": "tfvc",
+ "tfvc_project": "project1",
+ "human_name": "project1 (tfs)"
+%>
+
+### Response
+
+<%= headers 200 %>
+<%= json :source_import_update_project_choice %>
+
+### Parameters for restarting import
+
+To restart an import, no parameters are provided in the update request.
+
+### Response
+
+<%= headers 200, :Location => "https://api.github.com/repos/spraints/socm/import" %>
+<%= json :source_import %>
+
+## Get commit authors
+
+Each type of source control system represents authors in a different way. For example, a Git commit author has a display name and an email address, but a Subversion commit author just has a username. The GitHub Importer will make the author information valid, but the author might not be correct. For example, it will change the bare Subversion username `hubot` into something like `hubot `.
+
+This API method and the "Map a commit author" method allow you to provide correct Git author information.
+
+ GET /repos/:owner/:repo/import/authors
+
+### Parameters
+
+Name | Type | Description
+-----|------|------------
+`since`|`string`|Only authors found after this id are returned. Provide the highest author ID you've seen so far. New authors may be added to the list at any point while the importer is performing the `raw` step.
+
+### Response
+
+<%= headers 200 %>
+<%= json :source_import_authors %>
+
+## Map a commit author
+
+Update an author's identity for the import. Your application can continue updating authors any time before you push new commits to the repository.
+
+ PATCH /repos/:owner/:repo/import/authors/:author_id
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`email`|`string`|The new Git author email.
+`name`|`string`|The new Git author name.
+
+### Example
+
+<%= json \
+ :email => "hubot@github.com",
+ :name => "Hubot the Robot"
+%>
+
+### Response
+
+<%= headers 200 %>
+<%= json :source_import_author %>
+
+## Set Git LFS preference
+
+You can import repositories from Subversion, Mercurial, and TFS that include files larger than 100MB. This ability is powered by [Git LFS](https://git-lfs.github.com). You can learn more about our LFS feature and working with large files [on our help site](https://help.github.com/articles/versioning-large-files/).
+
+ PATCH /:owner/:name/import/lfs
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`use_lfs`|`string`|**Required** Can be one of `opt_in` (large files will be stored using Git LFS) or `opt_out` (large files will be removed during the import).
+
+### Example
+
+<%= json \
+ :use_lfs => "opt_in"
+%>
+
+### Response
+
+<%= headers 200 %>
+<%= json :source_import_complete %>
+
+## Get large files
+
+List files larger than 100MB found during the import
+
+ GET /:owner/:name/import/large_files
+
+### Response
+
+<%= headers 200 %>
+<%= json :source_import_large_files %>
+
+## Cancel an import
+
+Stop an import for a repository.
+
+ DELETE /repos/:owner/:repo/import
+
+### Response
+
+<%= headers 204 %>
diff --git a/content/v3/mime.md b/content/v3/mime.md
deleted file mode 100644
index f68f87c0a4..0000000000
--- a/content/v3/mime.md
+++ /dev/null
@@ -1,87 +0,0 @@
----
-title: Custom Mime Types | GitHub API
----
-
-# GitHub Mime Types
-
-Custom mime types are used in the API to let consumers choose the format
-of the data they wish to receive. This is done by adding one or more of
-the following types to the `Accept` header when you make a request. Mime
-types are specific to resources, allowing them to change independently
-and support formats that other resources don't.
-
-All GitHub mime types look like this:
-
- application/vnd.github[.version].param[+json]
-
-The most basic mime types the API supports are:
-
- application/json
- application/vnd.github+json
-
-Neither of these specify a version, so you will always get the latest
-JSON representation of resources. If you're building an application and
-care about the stability of the API, specify a version like so:
-
- application/vnd.github.beta+json
-
-If you're specifying a property (such as full/raw/etc defined below),
-put the version before the property:
-
- application/vnd.github.beta.raw+json
-
-For specifics on versions, check the [API changelog](/v3/changelog).
-
-## Comment Body Properties
-
-The body of a comment can be written in [GitHub Flavored Markdown][gfm].
-Issues, Issue Comments, Pull Request Comments, and Gist Comments all
-accept these same mime types:
-
-### Raw
-
- application/vnd.github.VERSION.raw+json
-
-Return the raw markdown body. Response will include `body`. This is the
-default if you do not pass any specific mime type.
-
-### Text
-
- application/vnd.github.VERSION.text+json
-
-Return a text only representation of the markdown body. Response will
-include `body_text`.
-
-### Html
-
- application/vnd.github.VERSION.html+json
-
-Return html rendered from the body's markdown. Response will include
-`body_html`.
-
-### Full
-
- application/vnd.github.VERSION.full+json
-
-Return raw, text and html representations. Response will include `body`,
-`body_text`, and `body_html`:
-
-## Git Blob Properties
-
-The following mime types are allowed when getting a blob:
-
-### JSON
-
- application/vnd.github.VERSION+json
- application/json
-
-Return JSON representation of the blob with `content` as a base64
-encoded string. This is the default if nothing is passed.
-
-### Raw
-
- application/vnd.github.VERSION.raw
-
-Return the raw blob data.
-
-[gfm]:http://github.github.com/github-flavored-markdown/
diff --git a/content/v3/misc.md b/content/v3/misc.md
new file mode 100644
index 0000000000..7fefcbb369
--- /dev/null
+++ b/content/v3/misc.md
@@ -0,0 +1,54 @@
+---
+title: Miscellaneous
+---
+
+# Miscellaneous
+
+This is a miscellaneous set of APIs which provide access to top level {{ site.data.variables.product.product_name }} resources and info.
+
+## [Emojis][]
+
+The [Emojis API][Emojis] lets you list all the emojis available to use on
+{{ site.data.variables.product.product_name }}.
+
+## [Gitignore][]
+
+The [Gitignore API][Gitignore] gives you access to the available gitignore
+templates.
+
+## [Markdown][]
+
+The [Markdown API][Markdown] lets you render Markdown documents.
+
+## [Meta][]
+
+{% if page.version == 'dotcom' %}
+
+The [Meta API][Meta] provides information about GitHub.com (the service).
+
+{% else %}
+
+The [Meta API][Meta] provides information about your
+organization's [GitHub Enterprise](https://enterprise.github.com/) installation.
+
+{% endif %}
+
+{% if page.version == 'dotcom' %}
+
+## [Rate Limit][]
+
+The [Rate Limit API][Rate Limit] lets you check your current rate limit
+status at any time.
+
+{% endif %}
+
+## [Licenses][]
+
+The [Licenses API][Licenses] returns information about open source licenses or under what license, if any a given project is distributed.
+
+[Emojis]: /v3/emojis
+[Gitignore]: /v3/gitignore
+[Markdown]: /v3/markdown
+[Meta]: /v3/meta
+[Rate Limit]: /v3/rate_limit
+[Licenses]: /v3/licenses
diff --git a/content/v3/oauth.md b/content/v3/oauth.md
index 8c61f4df2a..1555d954d7 100644
--- a/content/v3/oauth.md
+++ b/content/v3/oauth.md
@@ -1,12 +1,14 @@
---
-title: OAuth | GitHub API
+title: OAuth
---
# OAuth
-OAuth2 is a protocol that lets external apps request authorization to
-private details in a user's GitHub account without getting their
-password. This is preferred over Basic Authentication because tokens can
+{:toc}
+
+OAuth2 is a protocol that lets external applications request authorization to
+private details in a user's {{ site.data.variables.product.product_name }} account without getting their
+password. This is preferred over [Basic Authentication](/v3/auth#basic-authentication) because tokens can
be limited to specific types of data, and can be revoked by users at any
time.
@@ -14,10 +16,14 @@ All developers need to [register their
application](https://github.com/settings/applications/new) before getting
started. A registered OAuth application is assigned a unique Client ID
and Client Secret. The Client Secret should not be shared.
+**You may create a [personal access token](https://github.com/settings/tokens/new)
+for your own use or implement the web flow below to allow other users to authorize your application.**
+
+GitHub's OAuth implementation supports the standard [authorization code grant type](https://tools.ietf.org/html/rfc6749#section-4.1). Developers should implement the web application flow described below to obtain an authorization code and then exchange it for a token. (The [implicit grant type](https://tools.ietf.org/html/rfc6749#section-4.2) is not supported.)
## Web Application Flow
-This is a description of the OAuth flow from 3rd party web sites.
+This is a description of the OAuth2 flow from 3rd party web sites.
### 1. Redirect users to request GitHub access
@@ -25,27 +31,19 @@ This is a description of the OAuth flow from 3rd party web sites.
### Parameters
-client\_id
-: _Required_ **string** - The client ID you received from GitHub when
-you [registered](https://github.com/settings/applications/new).
-
-redirect\_uri
-: _Optional_ **string** - URL in your app where users will be sent
-after authorization. See details below about [redirect
-urls](#redirect-urls).
-
-scope
-: _Optional_ **string** - Comma separated list of [scopes](#scopes).
-
-state
-: _Optional_ **string** - An unguessable random string. It is used to protect
-against cross-site request forgery attacks.
+Name | Type | Description
+-----|------|--------------
+`client_id`|`string` | **Required**. The client ID you received from GitHub when you [registered](https://github.com/settings/applications/new).
+`redirect_uri`|`string` | The URL in your application where users will be sent after authorization. See details below about [redirect urls](#redirect-urls).
+`scope`|`string` | A space delimited list of [scopes](#scopes). If not provided, `scope` defaults to an empty list for users that have not authorized any scopes for the application. For users who have authorized scopes for the application, the user won't be shown the OAuth authorization page with the list of scopes. Instead, this step of the flow will automatically complete with the set of scopes the user has authorized for the application. For example, if a user has already performed the web flow twice and has authorized one token with `user` scope and another token with `repo` scope, a third web flow that does not provide a `scope` will receive a token with `user` and `repo` scope.
+`state`|`string` | An unguessable random string. It is used to protect against cross-site request forgery attacks.
+`allow_signup`|`boolean` | Whether or not unauthenticated users will be offered an option to sign up for GitHub during the OAuth flow. The default is `true`. Use `false` in the case that a policy prohibits signups.
### 2. GitHub redirects back to your site
If the user accepts your request, GitHub redirects back to your site
with a temporary code in a `code` parameter as well as the state you provided in
-the previous step in a state parameter. If the states don't match, the request
+the previous step in a `state` parameter. If the states don't match, the request
has been created by a third party and the process should be aborted.
Exchange this for an access token:
@@ -54,209 +52,302 @@ Exchange this for an access token:
### Parameters
-client\_id
-: _Required_ **string** - The client ID you received from GitHub when
-you [registered](https://github.com/settings/applications/new).
-
-redirect\_uri
-: _Optional_ **string**
-
-client\_secret
-: _Required_ **string** - The client secret you received from GitHub
-when you [registered](https://github.com/settings/applications/new).
-
-code
-: _Required_ **string** - The code you received as a response to [Step 1](#redirect-users-to-request-github-access).
-
-state
-: _Required_ **string** - The state value you provided in Step 1.
+Name | Type | Description
+-----|------|---------------
+`client_id`|`string` | **Required**. The client ID you received from GitHub when you [registered](https://github.com/settings/applications/new).
+`client_secret`|`string` | **Required**. The client secret you received from GitHub when you [registered](https://github.com/settings/applications/new).
+`code`|`string` | **Required**. The code you received as a response to [Step 1](#1-redirect-users-to-request-github-access).
+`redirect_uri`|`string` | The URL in your application where users will be sent after authorization. See details below about [redirect urls](#redirect-urls).
+`state`|`string` | The unguessable random string you optionally provided in [Step 1](#1-redirect-users-to-request-github-access).
### Response
By default, the response will take the following form:
- access_token=e72e16c7e42f292c6912e7710c838347ae178b4a&token_type=bearer
+ access_token=e72e16c7e42f292c6912e7710c838347ae178b4a&scope=user%2Cgist&token_type=bearer
You can also receive the content in different formats depending on the Accept
header:
Accept: application/json
- {"access_token":"e72e16c7e42f292c6912e7710c838347ae178b4a","token_type":"bearer"}
+ {"access_token":"e72e16c7e42f292c6912e7710c838347ae178b4a", "scope":"repo,gist", "token_type":"bearer"}
Accept: application/xml
bearer
+ repo,gist
e72e16c7e42f292c6912e7710c838347ae178b4a
+#### Multiple tokens
+
+GitHub allows multiple tokens to exist for a user/application/scope combination.
+This can be used to create tokens for specific use cases. For example, your
+application might support one workflow that uses GitHub for sign in, and only
+requires basic user information. And, your application might support a different
+workflow that requires access to a user's private repositories. Using multiple
+tokens, your application can perform the web flow for each use case, requesting
+only the scopes needed. If a user only uses your application to sign in, they
+are never required to grant your application access to their private
+repositories. Note, there is a limit to the number of tokens that are issued per
+user/application/scope combination. If your application requests enough tokens
+to go over one of the limits, older tokens will stop working.
+
+#### Requested scopes vs. granted scopes
+
+The `scope` attribute lists scopes attached to the token that were granted by
+the user. Normally, these scopes will be identical to what you requested.
+However, users [will soon be able to edit their scopes][oauth changes blog], effectively
+granting your application less access than you originally requested. Also, users
+will also be able to edit token scopes after the OAuth flow completed.
+You should be aware of this possibility and adjust your application's behavior
+accordingly.
+
+It is important to handle error cases where a user chooses to grant you
+less access than you originally requested. For example, applications can warn
+or otherwise communicate with their users that they will see reduced
+functionality or be unable to perform some actions.
+
+Also, applications can always send users back through the flow again to get
+additional permission, but don’t forget that users can always say no.
+
+Check out the [Basics of Authentication guide][basics auth guide] which
+provides tips on handling modifiable token scopes.
+
+#### Normalized scopes
+
+When requesting multiple scopes, the token will be saved with a normalized list
+of scopes, discarding those that are implicitly included by another requested
+scope. For example, requesting `user,gist,user:email` will result in a
+token with `user` and `gist` scopes only since the access granted with
+`user:email` scope [is included](#scopes) in the `user` scope.
+
### 3. Use the access token to access the API
The access token allows you to make requests to the API on a behalf of a user.
GET https://api.github.com/user?access_token=...
+You can pass the token in the query params like shown above, but a
+cleaner approach is to include it in the Authorization header
+
+ Authorization: token OAUTH-TOKEN
+
+For example, in curl you can set the Authorization header like this:
+
+``` command-line
+curl -H "Authorization: token OAUTH-TOKEN" https://api.github.com/user
+```
+
## Non-Web Application Flow
-Use basic authentication to create an OAuth2 token using the [interface
-below](/v3/oauth#create-a-new-authorization). With this technique, a username
-and password need not be stored permanently, and the user can revoke access at
-any time.
+Use [Basic Authentication](/v3/auth#basic-authentication) to create an OAuth2
+token using the [interface below](/v3/oauth_authorizations/#create-a-new-authorization). With
+this technique, a username and password need not be stored permanently, and the
+user can revoke access at any time. (Make sure to understand how to [work with
+two-factor authentication](/v3/auth/#working-with-two-factor-authentication) if
+you or your users have two-factor authentication enabled.)
## Redirect URLs
The `redirect_uri` parameter is optional. If left out, GitHub will
redirect users to the callback URL configured in the OAuth Application
-settings. If provided, the redirect URL must match the callback URL's
-host.
+settings. If provided, the redirect URL's host and port must exactly
+match the callback URL. The redirect URL's path must reference a
+subdirectory of the callback URL.
- CALLBACK: http://foo.com
+ CALLBACK: http://example.com/path
- GOOD: https://foo.com
- GOOD: http://foo.com/bar
- BAD: http://foo.com:8080
- BAD: http://oauth.foo.com:8080
- BAD: http://bar.com
+ GOOD: http://example.com/path
+ GOOD: http://example.com/path/subdir/other
+ BAD: http://example.com/bar
+ BAD: http://example.com/
+ BAD: http://example.com:8080/path
+ BAD: http://oauth.example.com:8080/path
+ BAD: http://example.org
## Scopes
-Scopes let you specify exactly what type of access you need. This will
-be displayed to the user on the authorize form.
+Scopes let you specify exactly what type of access you need. Scopes _limit_
+access for OAuth tokens. They do not grant any additional permission beyond
+that which the user already has.
+
+For the web flow, requested scopes will be displayed to the user on the
+authorize form.
Check headers to see what OAuth scopes you have, and what the API action
-accept.
+accepts.
- $ curl -H "Authorization: bearer TOKEN" https://api.github.com/users/technoweenie -I
- HTTP/1.1 200 OK
- X-OAuth-Scopes: repo, user
- X-Accepted-OAuth-Scopes: user
+``` command-line
+$ curl -H "Authorization: token OAUTH-TOKEN" https://api.github.com/users/technoweenie -I
+HTTP/1.1 200 OK
+X-OAuth-Scopes: repo, user
+X-Accepted-OAuth-Scopes: user
+```
`X-OAuth-Scopes` lists the scopes your token has authorized.
`X-Accepted-OAuth-Scopes` lists the scopes that the action checks for.
-(no scope)
-: public read-only access (includes public user profile info, public
-repo info, and gists).
-user
-: Read/write access to profile info only.
-
-public\_repo
-: Read/write access to public repos and organizations.
-
-repo
-: Read/write access to public and private repos and organizations.
-
-delete\_repo
-: Delete access to adminable repositories.
-
-gist
-: write access to gists.
+Name | Description
+-----|-----------|
+`(no scope)`| Grants read-only access to public information (includes public user profile info, public repository info, and gists)
+`user` | Grants read/write access to profile info only. Note that this scope includes `user:email` and `user:follow`.
+`user:email`| Grants read access to a user's email addresses.
+`user:follow`| Grants access to follow or unfollow other users.
+`public_repo`| Grants read/write access to code, commit statuses, collaborators, and deployment statuses for public repositories and organizations. Also required for starring public repositories.
+`repo`| Grants read/write access to code, commit statuses, repository invitations, collaborators, and deployment statuses for public and private repositories and organizations.
+`repo_deployment`| Grants access to [deployment statuses][deployments] for public and private repositories. This scope is only necessary to grant other users or services access to deployment statuses, *without* granting access to the code.
+`repo:status`| Grants read/write access to public and private repository commit statuses. This scope is only necessary to grant other users or services access to private repository commit statuses *without* granting access to the code.
+`delete_repo`| Grants access to delete adminable repositories.
+`notifications`| Grants read access to a user's notifications. `repo` also provides this access.
+`gist`| Grants write access to gists.
+`read:repo_hook`| Grants read and ping access to hooks in public or private repositories.
+`write:repo_hook`| Grants read, write, and ping access to hooks in public or private repositories.
+`admin:repo_hook`| Grants read, write, ping, and delete access to hooks in public or private repositories.
+`admin:org_hook`| Grants read, write, ping, and delete access to organization hooks. **Note:** OAuth tokens will only be able to perform these actions on organization hooks which were created by the OAuth application. Personal access tokens will only be able to perform these actions on organization hooks created by a user.
+`read:org`| Read-only access to organization, teams, and membership.
+`write:org`| Publicize and unpublicize organization membership.
+`admin:org`| Fully manage organization, teams, and memberships.
+`read:public_key`| List and view details for public keys.
+`write:public_key`| Create, list, and view details for public keys.
+`admin:public_key`| Fully manage public keys.
+{% if page.version == 'dotcom' %}`read:gpg_key`| List and view details for GPG keys.{% endif %}
+{% if page.version == 'dotcom' %}`write:gpg_key`| Create, list, and view details for GPG keys.{% endif %}
+{% if page.version == 'dotcom' %}`admin:gpg_key`| Fully manage GPG keys.{% endif %}
NOTE: Your application can request the scopes in the initial redirection. You
-can specify multiple scopes by separating them by a comma.
+can specify multiple scopes by separating them with a space:
https://github.com/login/oauth/authorize?
client_id=...&
- scope=user,public_repo
+ scope=user%20public_repo
-## OAuth Authorizations API
+## Common errors for the authorization request
-There is an API for users to manage their own tokens. You can only
-access your own tokens, and only through Basic Authentication.
+There are a few things that can go wrong in the process of obtaining an
+OAuth token for a user. In the initial authorization request phase,
+these are some errors you might see:
-## List your authorizations
+### Application Suspended
- GET /authorizations
+If the OAuth application you set up has been suspended (due to reported
+abuse, spam, or a mis-use of the API), GitHub will redirect to the
+registered callback URL with the following parameters summarizing the
+error:
-### Response
-
-<%= headers 200, :pagination => true %>
-<%= json(:oauth_access) { |h| [h] } %>
+ http://your-application.com/callback?error=application_suspended
+ &error_description=Your+application+has+been+suspended.+Contact+support@github.com.
+ &error_uri=https://developer.github.com/v3/oauth/%23application-suspended
+ &state=xyz
-## Get a single authorization
+Please contact [support](https://github.com/contact) to solve issues
+with suspended applications.
- GET /authorizations/:id
+### Redirect URI mismatch
-### Response
+If you provide a redirect_uri that doesn't match what you've registered
+with your application, GitHub will redirect to the registered callback
+URL with the following parameters summarizing the error:
-<%= headers 200 %>
-<%= json :oauth_access %>
+ http://your-application.com/callback?error=redirect_uri_mismatch
+ &error_description=The+redirect_uri+MUST+match+the+registered+callback+URL+for+this+application.
+ &error_uri=https://developer.github.com/v3/oauth/%23redirect-uri-mismatch
+ &state=xyz
-## Create a new authorization
+To correct this error, either provide a redirect_uri that matches what
+you registered or leave out this parameter to use the default one
+registered with your application.
-Note: Authorizations created from the API will show up in the GitHub API
-app.
+### Access denied
- POST /authorizations
+If the user rejects access to your application, GitHub will redirect to
+the registered callback URL with the following parameters summarizing
+the error:
-### Input
+ http://your-application.com/callback?error=access_denied
+ &error_description=The+user+has+denied+your+application+access.
+ &error_uri=https://developer.github.com/v3/oauth/%23access-denied
+ &state=xyz
-scopes
-: _Optional_ **array** - A list of scopes that this authorization is in.
+There's nothing you can do here as users are free to choose not to use
+your application. More often than not, users will just close the window
+or press back in their browser, so it is likely that you'll never see
+this error.
-note
-: _Optional_ **string** - A note to remind you what the OAuth token is for.
+## Common errors for the access token request
-note_url
-: _Optional_ **string** - A URL to remind you what app the OAuth token is for.
+In the second phase of exchanging a code for an access token, there are
+an additional set of errors that can occur. The format of these
+responses is determined by the accept header you pass. The following
+examples only show JSON responses.
-<%= json :scopes => ["public_repo"], :note => 'admin script' %>
+### Incorrect client credentials
-### Response
+If the client\_id and or client\_secret you pass are incorrect you will
+receive this error response.
-<%= headers 201, :Location => "https://api.github.com/authorizations/1"
+<%= json :error => :incorrect_client_credentials,
+ :error_description => "The client_id and/or client_secret passed are incorrect.",
+ :error_uri => "https://developer.github.com/v3/oauth/#incorrect-client-credentials"
%>
-<%= json :oauth_access %>
-## Update an existing authorization
+To solve this error, go back and make sure you have the correct
+credentials for your oauth application. Double check the `client_id` and
+`client_secret` to make sure they are correct and being passed correctly
+to GitHub.
- PATCH /authorizations/:id
+### Redirect URI mismatch(2)
-### Input
+If you provide a redirect_uri that doesn't match what you've registered
+with your application, you will receive this error message:
-scopes
-: _Optional_ **array** - Replaces the authorization scopes with these.
-
-add_scopes
-: _Optional_ **array** - A list of scopes to add to this authorization.
-
-remove_scopes
-: _Optional_ **array** - A list of scopes to remove from this
-authorization.
-
-note
-: _Optional_ **string** - A note to remind you what the OAuth token is for.
+<%= json :error => :redirect_uri_mismatch,
+ :error_description => "The redirect_uri MUST match the registered callback URL for this application.",
+ :error_uri => "https://developer.github.com/v3/oauth/#redirect-uri-mismatch(2)"
+%>
-note_url
-: _Optional_ **string** - A URL to remind you what app the OAuth token is for.
+To correct this error, either provide a redirect_uri that matches what
+you registered or leave out this parameter to use the default one
+registered with your application.
-You can only send one of these scope keys at a time.
+### Bad verification code
<%= json :add_scopes => ['repo'], :note => 'admin script' %>
-### Response
+If the verification code you pass is incorrect, expired, or doesn't
+match what you received in the first request for authorization you will
+receive this error.
-<%= headers 200 %>
-<%= json :oauth_access %>
+<%= json :error => :bad_verification_code,
+ :error_description => "The code passed is incorrect or expired.",
+ :error_uri => "https://developer.github.com/v3/oauth/#bad-verification-code"
+%>
-## Delete an authorization
+To solve this error, start the [OAuth process over from the beginning](#1-redirect-users-to-request-github-access)
+and get a new code.
- DELETE /authorizations/:id
+## Directing users to review their access for an application
-### Response
+Users can review and revoke their application authorizations from the [settings
+screen within GitHub][authorized-apps]. A user's organizations [control whether
+an application can access organization data][org-app-policies]. Integrators can
+deep link to the authorization information for their particular application to let their
+end users review these details.
-<%= headers 204 %>
+To build this link, you'll need your OAuth application's `client_id` you
+received from GitHub when you [registered the application][owned-apps].
-## More Information
+ https://github.com/settings/connections/applications/:client_id
-It can be a little tricky to get started with OAuth. Here are a few
-links that might be of help:
+For tips on discovering the resources that your application can access for a
+user, be sure to check out our [guide][resource-discovery-guide].
-* [OAuth 2 spec](http://tools.ietf.org/html/draft-ietf-oauth-v2-07)
-* [Facebook API](http://developers.facebook.com/docs/authentication/)
-* [Ruby OAuth2 lib](https://github.com/intridea/oauth2)
-* [simple ruby/sinatra example](https://gist.github.com/9fd1a6199da0465ec87c)
-* [simple python example](https://gist.github.com/e3fbd47fbb7ee3c626bb) using [python-oauth2](http://github.com/dgouldin/python-oauth2)
-* [Ruby OmniAuth example](http://github.com/intridea/omniauth)
-* [Ruby Sinatra extension](http://github.com/atmos/sinatra_auth_github)
-* [Ruby Warden strategy](http://github.com/atmos/warden-github)
+[oauth changes blog]: /changes/2013-10-04-oauth-changes-coming/
+[basics auth guide]: /guides/basics-of-authentication/
+[deployments]: /v3/repos/deployments
+[public keys]: /v3/users/keys/
+[authorized-apps]: https://github.com/settings/applications#authorized
+[owned-apps]: https://github.com/settings/developers
+[org-app-policies]: /changes/2015-01-19-an-integrators-guide-to-organization-application-policies/
+[resource-discovery-guide]: /guides/discovering-resources-for-a-user/
diff --git a/content/v3/oauth_authorizations.md b/content/v3/oauth_authorizations.md
new file mode 100644
index 0000000000..785a6f0e9a
--- /dev/null
+++ b/content/v3/oauth_authorizations.md
@@ -0,0 +1,324 @@
+---
+title: Authorizations
+---
+
+{% if page.version == 'dotcom' or page.version > 2.6 %}
+
+{{#tip}}
+
+
+
+ APIs for managing OAuth grants are currently available for developers to preview.
+ During the preview period, the APIs may change without advance notice.
+ Please see the [blog post](/changes/2016-04-21-oauth-authorizations-grants-api-preview) for full details.
+
+ To access the API you must provide a custom [media type](/v3/media) in the `Accept` header:
+
+ application/vnd.github.damage-preview
+
+{{/tip}}
+
+{% endif %}
+
+
+
+
Deprecation Notice
+
+
+ The token attribute is deprecated in all
+ of the following OAuth Authorizations API responses:
+
+
+
+
+ {% if page.version == 'dotcom' or page.version > 2.2 %}
+
+ To reduce the impact of removing the token value,
+ the OAuth Authorizations API now includes a new request attribute
+ (fingerprint), three new response attributes
+ (token_last_eight, hashed_token, and
+ fingerprint), and
+ one new endpoint.
+
+ {% else %}
+
+ To reduce the impact of removing the token value,
+ the OAuth Authorizations API now includes a new request attribute
+ (fingerprint) and three new response attributes
+ (token_last_eight, hashed_token, and
+ fingerprint).
+
+ {% endif %}
+
+ This functionality became the default for all requests on April 20, 2015. Please see the blog post for full details.
+
+
+
+# OAuth Authorizations API
+
+{:toc}
+
+You can use this API to manage the access OAuth applications have to your account. You can only access this API via [Basic Authentication](/v3/auth#basic-authentication) using your username and password, not tokens.
+
+Make sure you understand how to [work with two-factor authentication](/v3/auth/#working-with-two-factor-authentication) if you or your users have two-factor authentication enabled.
+
+{% if page.version == 'dotcom' or page.version > 2.6 %}
+
+## List your grants
+
+You can use this API to list the set of OAuth applications that have been granted access to your account. Unlike the [list your authorizations](/v3/oauth_authorizations/#list-your-authorizations) 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 application authorizations settings screen within GitHub][authorized-application-listing]. The `scopes` returned are the union of scopes authorized for the application. For example, if an application has one token with `repo` scope and another token with `user` scope, the grant will return `["repo", "user"]`.
+
+ GET /applications/grants
+
+### Response
+
+<%= headers 200, :pagination => default_pagination_rels %>
+<%= json(:oauth_authorization) { |h| [h] } %>
+
+## Get a single grant
+
+ GET /applications/grants/:id
+
+### Response
+
+<%= headers 200 %>
+<%= json(:oauth_authorization) %>
+
+## Delete a grant
+
+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 [the application authorizations settings screen within GitHub][authorized-application-listing].
+
+ DELETE /applications/grants/:id
+
+### Response
+
+<%= headers 204 %>
+
+{% endif %}
+
+## List your authorizations
+
+ GET /authorizations
+
+### Response
+
+<%= headers 200, :pagination => default_pagination_rels %>
+<%= json(:oauth_access) { |h| [h.merge("token" => "")] } %>
+
+## Get a single authorization
+
+ GET /authorizations/:id
+
+### Response
+
+<%= headers 200 %>
+<%= json(:oauth_access) { |h| h.merge("token" => "") } %>
+
+## Create a new authorization
+
+If you need a small number of tokens, implementing the [web flow](/v3/oauth/#web-application-flow)
+can be cumbersome. Instead, tokens can be created using the OAuth Authorizations API using
+[Basic Authentication](/v3/auth#basic-authentication). To create tokens for a particular OAuth application, you
+must provide its client ID and secret, found on the OAuth application settings
+page, linked from your [OAuth applications listing on GitHub][app-listing]. If your OAuth application intends to create multiple tokens for one user you should use `fingerprint` to differentiate between them. OAuth tokens
+can also be created through the web UI via the [Personal access tokens settings][tokens-listing].
+Read more about these tokens on the [GitHub Help page](https://help.github.com/articles/creating-an-access-token-for-command-line-use).
+
+ POST /authorizations
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`scopes`|`array` | A list of scopes that this authorization is in.
+`note`|`string` | **Required**. A note to remind you what the OAuth token is for. Tokens not associated with a specific OAuth application (i.e. personal access tokens) must have a unique note.
+`note_url`|`string` | A URL to remind you what app the OAuth token is for.
+`client_id`|`string` | The 20 character OAuth app client key for which to create the token.
+`client_secret`|`string` | The 40 character OAuth app client secret for which to create the token.
+`fingerprint`|`string` | A unique string to distinguish an authorization from others created for the same client ID and user.
+
+
+<%= json :scopes => ["public_repo"], :note => 'admin script' %>
+
+### Response
+
+<%= headers 201, :Location => get_resource(:oauth_access)['url'] %>
+<%= json(:oauth_access) { |h| h.merge("fingerprint" => "") } %>
+
+## Get-or-create an authorization for a specific app
+
+This method will create 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.
+
+ PUT /authorizations/clients/:client_id
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`client_secret`|`string`| **Required**. The 40 character OAuth app client secret associated with the client ID specified in the URL.
+`scopes`|`array` | A list of scopes that this authorization is in.
+`note`|`string` | A note to remind you what the OAuth token is for.
+`note_url`|`string` | A URL to remind you what app the OAuth token is for.
+{% if page.version == 'dotcom' or page.version > 2.2 %}`fingerprint`|`string` | A unique string to distinguish an authorization from others created for the same client and user. If provided, this API is functionally equivalent to [Get-or-create an authorization for a specific app and fingerprint](/v3/oauth_authorizations/#get-or-create-an-authorization-for-a-specific-app-and-fingerprint).{% endif %}
+
+
+<%= json :client_secret => "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcd", :scopes => ["public_repo"], :note => 'admin script' %>
+
+### Response if returning a new token
+
+<%= headers 201, :Location => get_resource(:oauth_access)['url'] %>
+<%= json(:oauth_access) { |h| h.merge("fingerprint" => "") } %>
+
+### Response if returning an existing token
+
+<%= headers 200, :Location => get_resource(:oauth_access)['url'] %>
+<%= json(:oauth_access) { |h| h.merge("token" => "", "fingerprint" => "") } %>
+
+{% if page.version == 'dotcom' or page.version > 2.2 %}
+
+## Get-or-create an authorization for a specific app and fingerprint
+
+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. `fingerprint` is 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.
+
+ PUT /authorizations/clients/:client_id/:fingerprint
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`client_secret`|`string`| **Required**. The 40 character OAuth app client secret associated with the client ID specified in the URL.
+`scopes`|`array` | A list of scopes that this authorization is in.
+`note`|`string` | A note to remind you what the OAuth token is for.
+`note_url`|`string` | A URL to remind you what app the OAuth token is for.
+
+
+<%= json :client_secret => "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcd", :scopes => ["public_repo"], :note => 'admin script' %>
+
+### Response if returning a new token
+
+<%= headers 201, :Location => get_resource(:oauth_access)['url'] %>
+<%= json :oauth_access %>
+
+### Response if returning an existing token
+
+<%= headers 200, :Location => get_resource(:oauth_access)['url'] %>
+<%= json(:oauth_access) { |h| h.merge("token" => "") } %>
+
+{% endif %}
+
+## Update an existing authorization
+
+ PATCH /authorizations/:id
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`scopes`|`array` | Replaces the authorization scopes with these.
+`add_scopes`|`array` | A list of scopes to add to this authorization.
+`remove_scopes`|`array` | A list of scopes to remove from this authorization.
+`note`|`string` | A note to remind you what the OAuth token is for. Tokens not associated with a specific OAuth application (i.e. personal access tokens) must have a unique note.
+`note_url`|`string` | A URL to remind you what app the OAuth token is for.
+`fingerprint`|`string` | A unique string to distinguish an authorization from others created for the same client ID and user.
+
+
+You can only send one of these scope keys at a time.
+
+<%= json :add_scopes => ['repo'], :note => 'admin script' %>
+
+### Response
+
+<%= headers 200 %>
+<%= json(:oauth_access) { |h| h.merge("token" => "") } %>
+
+## Delete an authorization
+
+ DELETE /authorizations/:id
+
+### Response
+
+<%= headers 204 %>
+
+## Check an authorization
+
+OAuth 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
+[Basic Authentication](/v3/auth#basic-authentication) when accessing it, where the username is the OAuth
+application `client_id` and the password is its `client_secret`. Invalid tokens
+will return `404 NOT FOUND`.
+
+ GET /applications/:client_id/tokens/:access_token
+
+### Response
+
+<%= headers 200 %>
+<%= json(:oauth_access_with_user) %>
+
+## Reset an authorization
+
+OAuth 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
+[Basic Authentication](/v3/auth#basic-authentication) when accessing it, where
+the username is the OAuth application `client_id` and the password is its
+`client_secret`. Invalid tokens will return `404 NOT FOUND`.
+
+ POST /applications/:client_id/tokens/:access_token
+
+### Response
+
+<%= headers 200 %>
+<%= json(:oauth_access_with_user) %>
+
+## Revoke an authorization for an application
+
+OAuth application owners can also revoke a single token for an OAuth
+application. You must use [Basic Authentication](/v3/auth#basic-authentication)
+for this method, where the username is the OAuth application `client_id` and
+ the password is its `client_secret`.
+
+ DELETE /applications/:client_id/tokens/:access_token
+
+### Response
+
+<%= headers 204 %>
+
+## More Information
+
+
+It can be a little tricky to get started with OAuth. Here are a few
+links that might be of help:
+
+* [OAuth 2 spec](http://tools.ietf.org/html/rfc6749)
+* [Facebook Login API](http://developers.facebook.com/docs/technical-guides/login/)
+* [Ruby OAuth2 lib](https://github.com/intridea/oauth2)
+* [Simple Ruby/Sinatra example](https://gist.github.com/9fd1a6199da0465ec87c)
+* [Python Flask example](https://gist.github.com/ib-lundgren/6507798) using [requests-oauthlib](https://github.com/requests/requests-oauthlib)
+* [Simple Python example](https://gist.github.com/e3fbd47fbb7ee3c626bb) using [python-oauth2](https://github.com/dgouldin/python-oauth2)
+* [Ruby OmniAuth example](https://github.com/intridea/omniauth)
+* [Ruby Sinatra extension](https://github.com/atmos/sinatra_auth_github)
+* [Ruby Warden strategy](https://github.com/atmos/warden-github)
+
+[app-listing]: https://github.com/settings/developers
+[tokens-listing]: https://github.com/settings/tokens
+[authorized-application-listing]: https://github.com/settings/applications#authorized
+[basics auth guide]: /guides/basics-of-authentication/
diff --git a/content/v3/orgs.md b/content/v3/orgs.md
index 5dcd67ff85..aa7419a031 100644
--- a/content/v3/orgs.md
+++ b/content/v3/orgs.md
@@ -1,25 +1,71 @@
---
-title: Organizations | GitHub API
+title: Organizations
---
-# Orgs API
+# Organizations
-## List
+{:toc}
-List all public organizations for a user.
+## List your organizations
- GET /users/:user/orgs
+List organizations for the authenticated user.
-List public and private 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:org` scope, you can publicize your organization membership with `user` scope, etc.). Therefore, this API requires at least `user` or `read:org` scope. OAuth requests with insufficient scope receive a `403 Forbidden` response.
GET /user/orgs
### Response
-<%= headers 200, :pagination => true %>
+<%= headers 200, :pagination => default_pagination_rels %>
+<%= json(:org) { |h| [h] } %>
+
+{% if page.version == 'dotcom' or page.version >= 2.3 %}
+
+## List all organizations
+
+Lists all organizations, in the order that they were created on {{ site.data.variables.product.product_name }}.
+
+Note: Pagination is powered exclusively by the `since` parameter.
+Use the [Link header](/v3/#link-header) to get the URL for the next page of
+organizations.
+
+ GET /organizations
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`since`|`string`| The integer ID of the last Organization that you've seen.
+
+### Response
+
+<%= headers 200, :pagination => { :next => 'https://api.github.com/organizations?since=135' } %>
+<%= json(:org) {|h| [h] } %>
+
+{% endif %}
+
+## List user organizations
+
+List [public organization memberships](https://help.github.com/articles/publicizing-or-concealing-organization-membership) 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 [List your organizations](#list-your-organizations) API instead.
+
+ GET /users/:username/orgs
+
+### Response
+
+<%= headers 200, :pagination => default_pagination_rels %>
<%= json(:org) { |h| [h] } %>
-## Get
+## Get an organization
+
+{% if page.version == 'dotcom' or page.version >= 2.8 %}
+Note: To receive values for `private_gists`, `disk_usage`, `collaborators`, and
+`billing_email` in the Organization response, the authenticated user must be an
+organization owner and have authorized the `admin:org` scope.
+{% endif %}
GET /orgs/:org
@@ -28,27 +74,22 @@ List public and private organizations for the authenticated user.
<%= headers 200 %>
<%= json(:full_org) %>
-## Edit
+## Edit an organization
PATCH /orgs/:org
### Input
-billing_email
-: _Optional_ **string** - Billing email address. This address is not
-publicized.
-
-company
-: _Optional_ **string**
-
-email
-: _Optional_ **string** - Publicly visible email address.
-
-location
-: _Optional_ **string**
+Name | Type | Description
+-----|------|--------------
+`billing_email`|`string` | Billing email address. This address is not publicized.
+`company`|`string` | The company name.
+`email`|`string` | The publicly visible email address.
+`location`|`string` | The location.
+`name`|`string` | The shorthand name of the company.
+`description`|`string` | The description of the company.
-name
-: _Optional_ **string**
+### Example
<%= json \
:billing_email => "support@github.com",
@@ -56,7 +97,8 @@ name
:company => "GitHub",
:email => "support@github.com",
:location => "San Francisco",
- :name => "github"
+ :name => "github",
+ :description => "GitHub, the company."
%>
### Response
diff --git a/content/v3/orgs/hooks.md b/content/v3/orgs/hooks.md
new file mode 100644
index 0000000000..a00c5c4836
--- /dev/null
+++ b/content/v3/orgs/hooks.md
@@ -0,0 +1,169 @@
+---
+title: Organization Webhooks
+---
+
+# Webhooks
+
+{:toc}
+
+{% if page.version != 'dotcom' and page.version <= 2.2 %}
+
+{{#tip}}
+
+The Organization Webhooks API is currently available for developers to preview.
+During the preview period, the API may change without advance notice.
+Please see the [blog post](/changes/2014-12-03-preview-the-new-organization-webhooks-api/) for full details.
+
+To access the API during the preview period, you must provide a custom [media type](/enterprise/{{ page.version }}/v3/media) in the `Accept` header:
+
+```
+application/vnd.github.sersi-preview+json
+```
+
+{{/tip}}
+
+{% endif %}
+
+Organization webhooks allow you to receive HTTP `POST` payloads whenever certain events happen within the organization. Subscribing to these events makes it possible to build integrations that react to actions on GitHub.com. For more information on actions you can subscribe to, check out our [Events documentation][webhook-events].
+
+## Scopes & Restrictions
+
+All actions against organization webhooks require the authenticated user to be an admin of the organization being managed. Additionally, OAuth tokens require [the `admin:org_hook` scope](/v3/oauth/#scopes).
+
+In order to protect sensitive data which may be present in webhook configurations, we also enforce the following access control rules:
+
+- OAuth applications cannot list, view, or edit webhooks which they did not create.
+- Users cannot list, view, or edit webhooks which were created by OAuth applications.
+
+## List hooks
+
+ GET /orgs/:org/hooks
+
+### Response
+
+<%= headers 200, :pagination => default_pagination_rels %>
+<%= json(:org_hook) { |h| [h] } %>
+
+
+## Get single hook
+
+ GET /orgs/:org/hooks/:id
+
+### Response
+
+<%= headers 200 %>
+<%= json :org_hook %>
+
+
+## Create a hook
+
+ POST /orgs/:org/hooks
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`name`|`string` | **Required**. Must be passed as "web".
+`config`|`object` | **Required**. Key/value pairs to provide settings for this webhook. [These are defined below](#create-hook-config-params).
+`events`|`array` | Determines what [events][event-types] the hook is triggered for. Default: `["push"]`.
+`active`|`boolean` | Determines whether the hook is actually triggered on pushes.
+
+
+The `config` object can accept the following keys:
+
+<%= fetch_content(:org_hook_config_hash) %>
+
+#### Example
+
+Here's how you can create a hook that posts payloads in JSON format:
+
+<%= json \
+ :name => "web",
+ :active => true,
+ :events => ['push', 'pull_request'],
+ :config => {
+ :url => 'http://example.com/webhook',
+ :content_type => 'json'}
+%>
+
+### Response
+
+<%= headers 201, :Location => get_resource(:org_hook)['url'] %>
+<%= json :org_hook %>
+
+
+## Edit a hook
+
+ PATCH /orgs/:org/hooks/:id
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`config`|`object` | **Required**. Key/value pairs to provide settings for this webhook. [These are defined below](#update-hook-config-params).
+`events`|`array` | Determines what [events][event-types] the hook is triggered for. Default: `["push"]`.
+`active`|`boolean` | Determines whether the hook is actually triggered on pushes.
+
+
+The `config` object can accept the following keys:
+
+<%= fetch_content(:org_hook_config_hash) %>
+
+
+#### Example
+
+<%= json \
+ :active => true,
+ :events => ['pull_request']
+%>
+
+### Response
+
+<%= headers 200 %>
+<%= json(:org_hook) { |h| h.merge "events" => %w(pull_request) } %>
+
+
+## Ping a hook
+
+This will trigger a [ping event][ping-event-url] to be sent to the hook.
+
+ POST /orgs/:org/hooks/:id/pings
+
+### Response
+
+<%= headers 204 %>
+
+
+## Delete a hook
+
+ DELETE /orgs/:org/hooks/:id
+
+### Response
+
+<%= headers 204 %>
+
+
+## Receiving Webhooks
+
+In order for {{ site.data.variables.product.product_name }} to send webhook payloads, your server needs to be accessible from the Internet. We also highly suggest using SSL so that we can send encrypted payloads over HTTPS.
+
+For more best practices, [see our guide][best-integration-practices].
+
+### Webhook Headers
+
+{{ site.data.variables.product.product_name }} will send along several HTTP headers to differentiate between event types and payload identifiers.
+
+Name | Description
+-----|-----------|
+`X-GitHub-Event` | The [event type](/v3/activity/events/types/) that was triggered.
+`X-GitHub-Delivery` | A [guid][guid] to identify the payload and event being sent.
+`X-Hub-Signature` | The value of this header is computed as the HMAC hex digest of the body, using the `secret` config option as the key.
+
+
+[guid]: http://en.wikipedia.org/wiki/Globally_unique_identifier
+[ping-event-url]: /webhooks/#ping-event
+[webhook-events]: /webhooks/#events
+[event-types]: /v3/activity/events/types/
+[media-type]: /v3/media
+[best-integration-practices]: /guides/best-practices-for-integrators/
+[developer-blog-post]: /changes/2014-12-03-preview-the-new-organization-webhooks-api/
diff --git a/content/v3/orgs/members.md b/content/v3/orgs/members.md
index 38e2e9881d..6f1b79abe4 100644
--- a/content/v3/orgs/members.md
+++ b/content/v3/orgs/members.md
@@ -1,52 +1,103 @@
---
-title: Organization Members | GitHub API
+title: Organization Members
---
-# Org Members API
+# Members
-## List members
+{:toc}
-List all users who are members of an organization. A member is a user
-that belongs to at least 1 team in the organization. If the authenticated user is
-also a member of this organization then both concealed and public
-members will be returned. Otherwise only public members are returned.
+## Members list
+
+List 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.
GET /orgs/:org/members
+
+
+### Parameters
+
+Name | Type | Description
+--------|---------|--------------
+`filter`|`string` | Filter members returned in the list. Can be one of:
* `2fa_disabled`: Members without [two-factor authentication][2fa-blog] enabled. Available for organization owners.
* `all`: All members the authenticated user can see.
Default: `all`
+`role` |`string` | Filter members returned by their role. Can be one of:
* `all`: All members of the organization, regardless of role.
* `admin`: Organization owners.
* `member`: Non-owner organization members. {% if page.version != 'dotcom' and page.version == 2.4 %}This option requires a custom media type to be specified. Please see more in the alert below.**{% endif %}
Default: `all`
+
+[2fa-blog]: https://github.com/blog/1614-two-factor-authentication
+
+{% if page.version != 'dotcom' and page.version > 2.3 and page.version < 2.6 %}
+
+{{#tip}}
+
+We're currently offering a preview period allowing applications to opt in to the Organization Permissions API. Please see [the blog post](/changes/2015-06-24-api-enhancements-for-working-with-organization-permissions/) for full details.
+
+To access the API during the preview period, you must provide a custom [media type](/v3/media) in the `Accept` header:
+
+```
+application/vnd.github.ironman-preview+json
+```
+
+{{/tip}}
+
+{% endif %}
+
### Response
-<%= headers 200 %>
+<%= headers 200, :pagination => default_pagination_rels %>
<%= json(:user) { |h| [h] } %>
-## Get member
+### Response if requester is not an organization member
- GET /orgs/:org/members/:user
+<%= headers 302, "Location" => "https://api.github.com/orgs/github/public_members" %>
-### Response if user is a member
+## Check membership
+
+Check if a user is, publicly or privately, a member of the organization.
+
+ GET /orgs/:org/members/:username
+
+### Response if requester is an organization member and user is a member
<%= headers 204 %>
-### Response if user is not a member
+### Response if requester is an organization member and user is not a member
<%= headers 404 %>
+### Response if requester is not an organization member and is inquiring about themselves
+
+<%= headers 404 %>
+
+### Response if requester is not an organization member
+
+<%= headers 302, :Location => "https://api.github.com/orgs/github/public_members/pezra" %>
+
## Add a member
-To add someone as a member to an org, you must add them to a
-[team](/v3/orgs/teams/#add-team-member).
+{% if page.version == 'dotcom' or page.version >= 2.4 %}
+
+To add someone as a member to an organization, you must
+[invite them to the organization](/v3/orgs/members/#add-or-update-organization-membership)
+or [invite them to a team](/v3/orgs/teams/#add-team-membership).
+
+{% else %}
+
+To add someone as a member to an organization, you must add them to a [team](/v3/orgs/teams/#add-team-member).
+
+{% endif %}
## Remove a member
Removing a user from this list will remove them from all teams and
they will no longer have any access to the organization's repositories.
- DELETE /orgs/:org/members/:user
+ DELETE /orgs/:org/members/:username
### Response
<%= headers 204 %>
-## List public members
+## Public members list
Members of an organization can choose to have their membership
publicized or not.
@@ -55,12 +106,12 @@ publicized or not.
### Response
-<%= headers 200 %>
+<%= headers 200, :pagination => default_pagination_rels %>
<%= json(:user) { |h| [h] } %>
-## Get if a user is a public member
+## Check public membership
- GET /orgs/:org/public_members/:user
+ GET /orgs/:org/public_members/:username
### Response if user is a public member
@@ -72,7 +123,12 @@ publicized or not.
## Publicize a user's membership
- PUT /orgs/:org/public_members/:user
+The user can publicize their own membership.
+(A user cannot publicize the membership for another user.)
+
+ PUT /orgs/:org/public_members/:username
+
+<%= fetch_content(:put_content_length) %>
### Response
@@ -80,8 +136,146 @@ publicized or not.
## Conceal a user's membership
- DELETE /orgs/:org/public_members/:user
+ DELETE /orgs/:org/public_members/:username
-## Response
+### Response
<%= headers 204 %>
+
+## Get organization membership
+
+{% if page.version == 'dotcom' or page.version >= 2.6 %}
+
+In order to get a user's membership with an organization, the authenticated user must be an organization member.
+
+{% elsif page.version >= 2.4 %}
+
+In order to get a user's membership with an organization, the authenticated user must be an organization owner.
+
+{% else %}
+
+In order to get a user's membership with an organization, the authenticated user must be an organization admin.
+
+{% endif %}
+
+ GET /orgs/:org/memberships/:username
+
+### Response if user has an active admin membership with organization
+
+<%= headers 200 %>
+<%= json(:active_admin_org_membership) %>
+
+### Response if user has an active membership with organization
+
+<%= headers 200 %>
+<%= json(:active_limited_org_membership) %>
+
+### Response if user has a pending membership with organization
+
+<%= headers 200 %>
+<%= json(:pending_limited_org_membership) %>
+
+## Add or update organization membership
+
+{% if page.version == 'dotcom' or page.version >= 2.4 %}
+
+In order to create or update a user's membership with an organization, the authenticated user must be an organization owner.
+
+{% else %}
+
+In order to create or update a user's membership with an organization, the authenticated user must be an organization admin.
+
+{% endif %}
+
+ PUT /orgs/:org/memberships/:username
+
+### Parameters
+
+{% if page.version == 'dotcom' or page.version >= 2.4 %}
+
+Name | Type | Description
+------|--------|--------------
+`role`|`string`| **Required**. The role to give the user in the organization. Can be one of:
* `admin` - The user will become an owner of the organization.
* `member` - The user will become a non-owner member of the organization.
+
+{% else %}
+
+Name | Type | Description
+------|--------|--------------
+`role`|`string`| **Required**. The role to give the user in the organization. Can be one of:
* `admin` - The user will become an administrator of the organization.
* `member` - The user will become a non-admin member of the organization. Use this only to demote an existing admin to a non-admin.
+
+{% endif %}
+
+### Response if user was previously unaffiliated with organization
+
+<%= headers 200 %>
+<%= json(:pending_admin_org_membership) %>
+
+### Response if user already had membership with organization
+
+<%= headers 200 %>
+<%= json(:active_admin_org_membership) %>
+
+## Remove organization membership
+
+{% if page.version == 'dotcom' or page.version >= 2.4 %}
+
+In order to remove a user's membership with an organization, the authenticated user must be an organization owner.
+
+{% else %}
+
+In order to remove a user's membership with an organization, the authenticated user must be an organization admin.
+
+{% endif %}
+
+ DELETE /orgs/:org/memberships/:username
+
+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.
+
+### Response
+
+<%= headers 204 %>
+
+## List your organization memberships
+
+ GET /user/memberships/orgs
+
+### Input
+
+Name | Type | Description
+-----|------|--------------
+`state`|`string`| Indicates the state of the memberships to return. Can be either `active` or `pending`. If not specified, both active and pending memberships are returned.
+
+### Response
+
+<%= headers 200, :pagination => default_pagination_rels %>
+<%= json(:org_memberships) %>
+
+## Get your organization membership
+
+ GET /user/memberships/orgs/:org
+
+### Response
+
+<%= headers 200 %>
+<%= json(:pending_admin_org_membership) %>
+
+## Edit your organization membership
+
+ PATCH /user/memberships/orgs/:org
+
+### Input
+
+Name | Type | Description
+-----|------|--------------
+`state`|`string`| **Required**. The state that the membership should be in. Only `"active"` will be accepted.
+
+### Example
+
+<%= json \
+ :state => "active"
+ %>
+
+### Response
+
+<%= headers 200 %>
+<%= json(:active_admin_org_membership) %>
diff --git a/content/v3/orgs/pre_receive_hooks.md b/content/v3/orgs/pre_receive_hooks.md
new file mode 100644
index 0000000000..7d3afc0bd4
--- /dev/null
+++ b/content/v3/orgs/pre_receive_hooks.md
@@ -0,0 +1,83 @@
+---
+title: Organization Pre-receive Hooks
+---
+
+# Organization Pre-receive Hooks (Enterprise)
+
+{{#tip}}
+
+
+
+ APIs for managing pre-receive hooks are currently available for developers to preview.
+ During the preview period, the APIs may change without advance notice.
+
+ To access the API you must provide a custom [media type](/v3/media) in the `Accept` header:
+
+ application/vnd.github.eye-scream-preview
+
+{{/tip}}
+
+{:toc}
+
+The Organization Pre-receive Hooks API allows you to view and modify
+enforcement of the pre-receive hooks that are available to an organization.
+
+Prefix all the endpoints for this API with the following URL:
+
+``` command-line
+http(s)://hostname/api/v3
+```
+
+## Object attributes
+
+| Name | Type | Description |
+|----------------------------------|-----------|-----------------------------------------------------------|
+| `name` | `string` | The name of the hook. |
+| `enforcement` | `string` | The state of enforcement for the hook on this repository. |
+| `allow_downstream_configuration` | `boolean` | Whether repositories can override enforcement. |
+| `configuration_url` | `string` | URL for the endpoint where enforcement is set. |
+
+Possible values for *enforcement* are `enabled`, `disabled` and`testing`. `disabled` indicates the pre-receive hook will not run. `enabled` indicates it will run and reject
+any pushes that result in a non-zero status. `testing` means the script will run but will not cause any pushes to be rejected.
+
+`configuration_url` may be a link to this endpoint or this hook's global
+configuration. Only site admins are able to access the global configuration.
+
+## List pre-receive hooks
+
+List 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.
+
+ GET /orgs/:org/pre-receive-hooks
+
+<%= headers 200, :pagination => default_pagination_rels %>
+<%= json :pre_receive_hooks_org %>
+
+## Get a single pre-receive hook
+
+ GET /orgs/:org:pre-receive-hooks/:id
+
+<%= headers 200 %> <%= json :pre_receive_hook_org %>
+
+## Update pre-receive hook enforcement
+
+For pre-receive hooks which are allowed to be configured at the org level, you can set
+`enforcement` and `allow_downstream_configuration`
+
+ PATCH /orgs/:org/pre-receive-hooks/:id
+
+<%= json :enforcement => "enabled", :allow_downstream_configuration => false %>
+
+### Response
+
+<%= headers 200 %><%= json :pre_receive_hook_org_update %>
+
+## Remove enforcment overrides for a pre-receive hook
+
+Removes any overrides for this hook at the org level for this org.
+
+ DELETE /orgs/:org/pre-receive-hooks/:id
+
+<%= headers 200 %> <%= json :pre_receive_hook_org %>
diff --git a/content/v3/orgs/teams.md b/content/v3/orgs/teams.md
index f48e7cff1f..07a233bea9 100644
--- a/content/v3/orgs/teams.md
+++ b/content/v3/orgs/teams.md
@@ -1,12 +1,14 @@
---
-title: Organization Teams | GitHub API
+title: Organization Teams
---
-# Org Teams API
+# Teams
+
+{:toc}
All actions against teams require at a minimum an authenticated user who
-is a member of the owner's team in the `:org` being managed. Additionally,
-OAuth users require "user" [scope](/v3/oauth/#scopes).
+is a member of the Owners team in the `:org` being managed. Additionally,
+OAuth users require the "read:org" [scope](/v3/oauth/#scopes).
## List teams
@@ -14,7 +16,7 @@ OAuth users require "user" [scope](/v3/oauth/#scopes).
### Response
-<%= headers 200 %>
+<%= headers 200, :pagination => default_pagination_rels %>
<%= json(:team) { |h| [h] } %>
## Get team
@@ -28,36 +30,74 @@ OAuth users require "user" [scope](/v3/oauth/#scopes).
## Create team
-In order to create a team, the authenticated user must be an owner of
-`:org`.
+{% if page.version == 'dotcom' or page.version >= 2.4 %}
+
+In order to create a team, the authenticated user must be a member of `:org`.
+
+{% else %}
+
+In order to create a team, the authenticated user must be an owner of `:org`.
+
+{% endif %}
POST /orgs/:org/teams
-### Input
+### Parameters
+
+{% if page.version == 'dotcom' or page.version >= 2.4 %}
+
+Name | Type | Description
+-----|------|--------------
+`name`|`string` | **Required**. The name of the team.
+`description`|`string` | The description of the team.
+`repo_names`|`array` of `strings` | The full name (e.g., "organization-name/repository-name") of repositories to add the team to.
+`privacy`|`string`| The level of privacy this team should have. Can be one of:
* `secret` - only visible to organization owners and members of this team.
* `closed` - visible to all members of this organization.
Default: `secret`
{% if page.version != 'dotcom' and page.version == 2.4 %}**This parameter requires a custom media type to be specified. Please see more in the alert below.**{% endif %}
+`permission`|`string` | **Deprecated**. The permission that new repositories will be added to the team with when none is specified. Can be one of:
* `pull` - team members can pull, but not push to or administer newly-added repositories.
* `push` - team members can pull and push, but not administer newly-added repositories.
* `admin` - team members can pull, push and administer newly-added repositories.
Default: `pull`
+
+{% if page.version != 'dotcom' and page.version > 2.3 and page.version < 2.6 %}
+
+{{#tip}}
+
+We're currently offering a preview period allowing applications to opt in to the Organization Permissions API. Please see the [blog post](/changes/2015-06-24-api-enhancements-for-working-with-organization-permissions/) for full details.
-name
-: _Required_ **string**
+To access the API during the preview period, you must provide a custom [media type](/v3/media) in the `Accept` header:
-repo\_names
-: _Optional_ **array** of **strings**
+```
+application/vnd.github.ironman-preview+json
+```
-permission
-: _Optional_ **string**
+**Warning:** If you specify the `privacy` attribute on an organization that hasn't had [improved organization permissions](https://github.com/blog/2020-improved-organization-permissions) enabled yet, you will get a `422` error response.
- `pull` - team members can pull, but not push to or administer these
- repositories. **Default**
+{{/tip}}
- `push` - team members can pull and push, but not administer these
- repositories.
+{% endif %}
- `admin` - team members can pull, push and administer these
- repositories.
+#### Example
<%= json \
:name => 'new team',
+ :description => 'team description',
+ :privacy => 'closed' %>
+
+{% else %}
+
+Name | Type | Description
+-----|------|--------------
+`name`|`string` | **Required**. The name of the team.
+`description`|`string` | The description of the team.
+`repo_names`|`array` of `strings` | The full name (e.g., "organization-name/repository-name") of repositories to add the team to.
+`permission`|`string` | The permission to grant the team. Can be one of:
* `pull` - team members can pull, but not push to or administer these repositories.
* `push` - team members can pull and push, but not administer these repositories.
* `admin` - team members can pull, push and administer these repositories.
Default: `pull`
+
+#### Example
+
+<%= json \
+ :name => 'new team',
+ :description => 'team description',
:permission => 'push',
:repo_names => ['github/dotfiles'] %>
+{% endif %}
+
### Response
<%= headers 201 %>
@@ -65,23 +105,74 @@ permission
## Edit team
-In order to edit a team, the authenticated user must be an owner of
-the org that the team is associated with.
+{% if page.version == 'dotcom' or page.version >= 2.4 %}
+
+In order to edit a team, the authenticated user must either be an owner of
+the org that the team is associated with, or a maintainer of the team.
+
+{% else %}
+
+In order to edit a team, the authenticated user must be an owner of the org that the team is associated with.
+
+{% endif %}
PATCH /teams/:id
-### Input
+{% if page.version == 'dotcom' or page.version >= 2.4 %}
-name
-: _Required_ **string**
+### Parameters
-permission
-: _Optional_ **string**
+Name | Type | Description
+-----|------|--------------
+`name`|`string` | **Required**. The name of the team.
+`description`|`string` | The description of the team.
+`privacy`|`string`| The level of privacy this team should have. Can be one of:
* `secret` - only visible to organization owners and members of this team.
* `closed` - visible to all members of this organization.
Default: `secret`
{% if page.version != 'dotcom' and page.version == 2.4 %}**This parameter requires a custom media type to be specified. Please see more in the alert below.**{% endif %}
+`permission`|`string` | **Deprecated**. The permission that new repositories will be added to the team with when none is specified. Can be one of:
* `pull` - team members can pull, but not push to or administer newly-added repositories.
* `push` - team members can pull and push, but not administer newly-added repositories.
* `admin` - team members can pull, push and administer newly-added repositories.
Default: `pull`
+
+{% if page.version != 'dotcom' and page.version > 2.3 and page.version < 2.6 %}
+
+{{#tip}}
+
+We're currently offering a preview period allowing applications to opt in to the Organization Permissions API. Please see the [blog post](/changes/2015-06-24-api-enhancements-for-working-with-organization-permissions/) for full details.
+
+To access the API during the preview period, you must provide a custom [media type](/v3/media) in the `Accept` header:
+
+```
+application/vnd.github.ironman-preview+json
+```
+
+**Warning:** If you specify the `privacy` attribute on an organization that hasn't had [improved organization permissions](https://github.com/blog/2020-improved-organization-permissions) enabled yet, you will get a `422` error response.
+
+{{/tip}}
+
+{% endif %}
+
+#### Example
+
+<%= json \
+ :name => 'new team name',
+ :description => 'new team description',
+ :privacy => 'closed' %>
+
+{% else %}
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`name`|`string` | **Required**. The name of the team.
+`description`|`string` | The description of the team.
+`permission`|`string` | The permission to grant the team. Can be one of:
* `pull` - team members can pull, but not push to or administer these repositories.
* `push` - team members can pull and push, but not administer these repositories.
* `admin` - team members can pull, push and administer these repositories. Default: `pull`
+
+#### Example
<%= json \
:name => 'new team name',
+ :description => 'new team description',
:permission => 'push' %>
+{% endif %}
+
### Response
<%= headers 200 %>
@@ -90,7 +181,7 @@ permission
## Delete team
In order to delete a team, the authenticated user must be an owner of
-the org that the team is associated with.
+the org that the team is associated with{% if page.version == 'dotcom' or page.version >= 2.4 %}, or a maintainer of the team{% endif %}.
DELETE /teams/:id
@@ -100,22 +191,66 @@ the org that the team is associated with.
## List team members
-In order to list members in a team, the authenticated user must be a
-member of the team.
+{% if page.version == 'dotcom' or page.version >= 2.4 %}
+
+In order to list members in a team, the team must be visible to the
+authenticated user.
+
+{% else %}
+
+In order to list members in a team, the authenticated user must be a member of the team.
+
+{% endif %}
+
+{% if page.version != 'dotcom' and page.version >= 2.3 %}
+
+<%= fetch_content(:if_site_admin) %>
+you will be able to list all members for the team.
+
+{% endif %}
GET /teams/:id/members
+{% if page.version == 'dotcom' or page.version >= 2.4 %}
+
+Name | Type | Description
+-----|------|--------------
+`role`|`string`| Filters members returned by their role in the team. Can be one of:
* `member` - normal members of the team.
* `maintainer` - team maintainers.
* `all` - all members of the team.
Default: `all`
+
+{% endif %}
+
### Response
-<%= headers 200 %>
+<%= headers 200, :pagination => default_pagination_rels %>
<%= json(:user) { |h| [h] } %>
## Get team member
-In order to get if a user is a member of a team, the authenticated user
-must be a member of the team.
+### Deprecation notice
+
+{{#tip}}
+
+The "Get team member" API (described below) is
+[deprecated](/v3/versions/#v3-deprecations) and is scheduled for
+removal in the next major version of the API.
+
+We recommend using the
+[Get team membership API](/v3/orgs/teams/#get-team-membership)
+instead. It allows you to get both active and pending memberships.
+
+{{/tip}}
- GET /teams/:id/members/:user
+{% if page.version == 'dotcom' or page.version >= 2.4 %}
+
+In order to list members in a team, the team must be visible to the authenticated user.
+
+{% else %}
+
+In order to get if a user is a member of a team, the authenticated user must be a member of the team.
+
+{% endif %}
+
+ GET /teams/:id/members/:username
### Response if user is a member
@@ -127,11 +262,28 @@ must be a member of the team.
## Add team member
+### Deprecation notice
+
+{{#tip}}
+
+The "Add team member" API (described below) is
+[deprecated](/v3/versions/#v3-deprecations) and is scheduled for
+removal in the next major version of the API.
+
+We recommend using the
+[Add team membership API](/v3/orgs/teams/#add-team-membership)
+instead. It allows you to invite new organization members to your teams.
+
+{{/tip}}
+
In order to add a user to a team, the authenticated user must have
-'admin' permissions to the team or be an owner of the org that the team
-is associated with.
+'admin' permissions to the team or be an owner of the organization that the team
+is associated with, and the user being added must already be a member of at
+least one other team on the same organization.
+
+ PUT /teams/:id/members/:username
- PUT /teams/:id/members/:user
+<%= fetch_content(:put_content_length) %>
### Response
@@ -141,7 +293,7 @@ If you attempt to add an organization to a team, you will get this:
<%= headers 422 %>
<%=
- json :message => "Validation Failed",
+ json :message => "Cannot add an organization as a member.",
:errors => [{
:code => "org",
:field => :user,
@@ -149,14 +301,149 @@ If you attempt to add an organization to a team, you will get this:
}]
%>
+If you attempt to add a user to a team and that user is not a member of at least
+one other team on the same organization, you will get this:
+
+<%= headers 422 %>
+<%=
+ json :message => "User isn't a member of this organization. Please invite them first.",
+ :errors => [{
+ :code => "unaffiliated",
+ :field => :user,
+ :resource => :TeamMember
+ }]
+%>
+
## Remove team member
+### Deprecation notice
+
+{{#tip}}
+
+The "Remove team member" API (described below) is
+[deprecated](/v3/versions/#v3-deprecations) and is scheduled for
+removal in the next major version of the API.
+
+We recommend using the
+[Remove team membership API](/v3/orgs/teams/#remove-team-membership)
+instead. It allows you to remove both active and pending memberships.
+
+{{/tip}}
+
In order to remove a user from a team, the authenticated user must have
'admin' permissions to the team or be an owner of the org that the team
is associated with.
-NOTE: This does not delete the user, it just remove them from the team.
+NOTE: This does not delete the user, it just removes them from the team.
+
+ DELETE /teams/:id/members/:username
+
+### Response
+
+<%= headers 204 %>
- DELETE /teams/:id/members/:user
+## Get team membership
+
+{% if page.version == 'dotcom' or page.version >= 2.4 %}
+
+In order to get a user's membership with a team, the team must be visible to the
+authenticated user.
+
+{% else %}
+
+In order to get a user's membership with a team, the authenticated user must be a member of the team or an owner of the team's organization.
+
+{% endif %}
+
+ GET /teams/:id/memberships/:username
+
+### Response if user has an active membership with team
+
+<%= headers 200 %>
+<%= json(:active_team_membership) %>
+
+### Response if user has a pending membership with team
+
+<%= headers 200 %>
+<%= json(:pending_team_membership) %>
+
+### Response if user has no membership with team
+
+<%= headers 404 %>
+
+## Add team membership
+
+{% if page.version == 'dotcom' or page.version >= 2.4 %}
+
+If the user is already a member of the team's organization, this endpoint will
+add the user to the team. In order to add a membership between an organization
+member and a team, the authenticated user must be an organization owner or a
+maintainer of the team.
+
+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. In order to add a membership between an unaffiliated user
+and a team, the authenticated user must be an organization owner.
+
+{% else %}
+
+In order to add 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.
+
+If the user is already a part of the team's organization (meaning they're on at
+least one other team in the organization), this endpoint will add the user to
+the team.
+
+If the user is completely unaffiliated with the team's organization (meaning
+they're on none of the organization's teams), 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.
+
+{% endif %}
+
+ PUT /teams/:id/memberships/:username
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`role`|`string`| The role that this user should have in the team. Can be one of:
* `member` - a normal member of the team.
* `maintainer` - a team maintainer. Able to add/remove other team members, promote other team members to team maintainer, and edit the team's name and description.
Default: `member`
+
+### Response if user's membership with team is now active
+
+<%= headers 200 %>
+<%= json(:active_team_membership) %>
+
+### Response if user's membership with team is now pending
+
+<%= headers 200 %>
+<%= json(:pending_team_membership) %>
+
+If you attempt to add an organization to a team, you will get this:
+
+<%= headers 422 %>
+<%=
+ json :message => "Cannot add an organization as a member.",
+ :errors => [{
+ :code => "org",
+ :field => :user,
+ :resource => :TeamMember
+ }]
+%>
+
+## Remove team membership
+
+In order to 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.
+NOTE: This does not delete the user, it just removes their membership from the
+team.
+
+ DELETE /teams/:id/memberships/:username
### Response
@@ -166,37 +453,98 @@ NOTE: This does not delete the user, it just remove them from the team.
GET /teams/:id/repos
+{% if page.version != 'dotcom' and page.version >= 2.3 %}
+
+<%= fetch_content(:if_site_admin) %>
+you will be able to list all repositories for the team.
+
+{% endif %}
+
### Response
-<%= headers 200 %>
+<%= headers 200, :pagination => default_pagination_rels %>
<%= json(:repo) { |h| [h] } %>
-## Get team repo
+## Check if a team manages a repository
- GET /teams/:id/repos/:user/:repo
+ GET /teams/:id/repos/:owner/:repo
-### Response if repo is managed by this team
+### Response if repository is managed by this team
<%= headers 204 %>
-### Response if repo is not managed by this team
+### Response if repository is not managed by this team
<%= headers 404 %>
-## Add team repo
+{% if page.version == 'dotcom' or page.version >= 2.4 %}
+
+### Alternative response with extra repository information
+
+You can also get information about the specified repository, including what
+permissions the team grants on it, by passing the following custom
+[media type](/v3/media/) via the `Accept` header:
+
+ Accept: application/vnd.github.v3.repository+json
-In order to add a repo to a team, the authenticated user must be an
-owner of the org that the team is associated with. Also, the repo must
-be owned by the organization, or a direct for of a repo owned by the
+{% endif %}
+
+<%= headers 200 %>
+<%= json :repo %>
+
+## Add or update team repository
+
+{% if page.version == 'dotcom' or page.version >= 2.4 %}
+
+In order to 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. Also, the repository must be owned by the organization, or a direct fork of a repository owned by the organization.
+
+{% else %}
+
+In order to add a repository to a team, the authenticated user must have admin
+access to the repository, and must be able to see the team. Also, the repository
+must be owned by the organization, or a direct fork of a repository owned by the
organization.
- PUT /teams/:id/repos/:user/:repo
+{% endif %}
+
+ PUT /teams/:id/repos/:org/:repo
+
+{% if page.version == 'dotcom' or page.version >= 2.4 %}
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`permission`|`string` | The permission to grant the team on this repository. Can be one of:
* `pull` - team members can pull, but not push to or administer this repository.
* `push` - team members can pull and push, but not administer this repository.
* `admin` - team members can pull, push and administer this repository.
If no permission is specified, the team's `permission` attribute will be used to determine what permission to grant the team on this repository.
+
+<%= fetch_content(:optional_put_content_length) %>
+
+{% endif %}
+
+
+{% if page.version != 'dotcom' and page.version > 2.3 and page.version < 2.6 %}
+
+{{#tip}}
+
+We're currently offering a preview period allowing applications to opt in to the Organization Permissions API. Please see the [blog post](/changes/2015-06-24-api-enhancements-for-working-with-organization-permissions/) for full details.
+
+To access the API during the preview period, you must provide a custom [media type](/v3/media) in the `Accept` header:
+
+```
+application/vnd.github.ironman-preview+json
+```
+
+**Warning:** If you specify the `permission` attribute on an organization that hasn't had [improved organization permissions](https://github.com/blog/2020-improved-organization-permissions) enabled yet, you will get a `422` error response.
+
+{{/tip}}
+
+{% endif %}
### Response
<%= headers 204 %>
-If you attempt to add a repo to a team that is not owned by the
+If you attempt to add a repository to a team that is not owned by the
organization, you get:
<%= headers 422 %>
@@ -208,15 +556,40 @@ organization, you get:
:resource => :TeamMember}]
%>
-## Remove team repo
+
-In order to remove a repo from a team, the authenticated user must be an
-owner of the org that the team is associated with.
-NOTE: This does not delete the repo, it just removes it from the team.
+## Remove team repository
- DELETE /teams/:id/repos/:user/:repo
+{% if page.version == 'dotcom' or page.version >= 2.4 %}
+
+In order to remove a repository from a team, the authenticated user must have
+admin access to the repository or be a maintainer of the team.
+NOTE: This does not delete the repository, it just removes it from the team.
+
+{% else %}
+
+In order to remove a repository from a team, the authenticated user must be an owner of the org that the team is associated with. Also, since the Owners team always has access to all repositories in the organization, repositories cannot be removed from the Owners team.
+
+{% endif %}
+
+ DELETE /teams/:id/repos/:owner/:repo
### Response
<%= headers 204 %>
+## List user teams
+
+List all of the teams across all of the organizations to which the
+authenticated user belongs. This method requires `user`, `repo`, or
+`read:org` [scope][] when authenticating via [OAuth][].
+
+ GET /user/teams
+
+### Response
+
+<%= headers 200, :pagination => default_pagination_rels %>
+<%= json(:full_team) { |h| [h] } %>
+
+[OAuth]: /v3/oauth/
+[scope]: /v3/oauth/#scopes
diff --git a/content/v3/pulls.md b/content/v3/pulls.md
index 6faf4e7cb2..332c98ff3d 100644
--- a/content/v3/pulls.md
+++ b/content/v3/pulls.md
@@ -1,80 +1,97 @@
---
-title: Pull Requests | GitHub API
+title: Pull Requests
---
-# Pull Request API
+# Pull Requests
+
+{:toc}
The Pull Request API allows you to list, view, edit, create, and even merge
pull requests. Comments on pull requests can be managed via the [Issue
Comments API](/v3/issues/comments/).
-Pull Requests leverage [these](#custom-mime-types) custom mime types. You
-can read more about the use of mime types in the API
-[here](/v3/mime/).
+Pull Requests use [these custom media types](#custom-media-types). You
+can read more about the use of media types in the API
+[here](/v3/media/).
## Link Relations
Pull Requests have these possible link relations:
-`self`
-: The API location of this Pull Request.
-
-`html`
-: The HTML location of this Pull Request.
-
-`comments`
-: The API location of this Pull Request's Issue comments.
-
-`review_comments`
-: The API location of this Pull Request's Review comments.
+Name | Description
+-----|-----------|
+`self`| The API location of this Pull Request.
+`html`| The HTML location of this Pull Request.
+`issue`| The API location of this Pull Request's [Issue](/v3/issues/).
+`comments`| The API location of this Pull Request's [Issue comments](/v3/issues/comments/).
+`review_comments`| The API location of this Pull Request's [Review comments](/v3/pulls/comments/).
+`review_comment`| The [URL template](/v3/#hypermedia) to construct the API location for a [Review comment](/v3/pulls/comments/) in this Pull Request's repository.
+`commits`|The API location of this Pull Request's [commits](#list-commits-on-a-pull-request).
+`statuses`| The API location of this Pull Request's [commit statuses](/v3/repos/statuses/), which are the statuses of its `head` branch.
## List pull requests
- GET /repos/:user/:repo/pulls
+ GET /repos/:owner/:repo/pulls
### Parameters
-state
-: _Optional_ **string** - `open` or `closed` to filter by state. Default
-is `open`.
+Name | Type | Description
+-----|------|--------------
+`state`|`string` | Either `open`, `closed`, or `all` to filter by state. Default: `open`
+`head`|`string` | Filter pulls by head user and branch name in the format of `user:ref-name`. Example: `github:new-script-format`.
+`base`|`string` | Filter pulls by base branch name. Example: `gh-pages`.
+`sort`|`string`| What to sort results by. Can be either `created`, `updated`, `popularity` (comment count) or `long-running` (age, filtering by pulls updated in the last month). Default: `created`
+`direction`|`string`| The direction of the sort. Can be either `asc` or `desc`. Default: `desc` when sort is `created` or sort is not specified, otherwise `asc`.
### Response
-<%= headers 200 %>
+<%= headers 200, :pagination => default_pagination_rels %>
<%= json(:pull) { |h| [h] } %>
## Get a single pull request
- GET /repos/:user/:repo/pulls/:number
+ GET /repos/:owner/:repo/pulls/:number
### Response
+{{#tip}}
+
+Each time the pull request receives new commits, {{ site.data.variables.product.product_name }} creates a merge commit
+to _test_ whether the pull request can be automatically merged into the base
+branch. (This _test_ commit is not added to the base branch or the head branch.)
+The `merge_commit_sha` attribute holds the SHA of the _test_ merge commit;
+however, this attribute is [deprecated](/v3/versions/#v3-deprecations) and is scheduled for
+removal in the next version of the API. The Boolean `mergeable` attribute will
+remain to indicate whether the pull request can be automatically merged.
+
+The value of the `mergeable` attribute can be `true`, `false`, or `null`. If
+the value is `null`, this means that the mergeability hasn't been computed yet,
+and a background job was started to compute it. Give the job a few moments to
+complete, and then submit the request again. When the job is complete, the
+response will include a non-`null` value for the `mergeable` attribute.
+
+{{/tip}}
+
+Pass the appropriate [media type](/v3/media/#commits-commit-comparison-and-pull-requests) to fetch diff and patch formats.
+
<%= headers 200 %>
<%= json :full_pull %>
## Create a pull request
- POST /repos/:user/:repo/pulls
+ POST /repos/:owner/:repo/pulls
### Input
-title
-: _Required_ **string**
-
-body
-: _Optional_ **string**
-
-base
-: _Required_ **string** - The branch (or git ref) you want your changes pulled into.
-This should be an existing branch on the current repository. You cannot
-submit a pull request to one repo that requests a merge to a base of
-another repo.
+Name | Type | Description
+-----|------|-------------
+`title`|`string` | **Required**. The title of the pull request.
+`head`|`string` | **Required**. The name of the branch where your changes are implemented. For cross-repository pull requests in the same network, namespace `head` with a user like this: `username:branch`.
+`base`|`string` | **Required**. The name of the branch you want the changes pulled into. This should be an existing branch on the current repository. You cannot submit a pull request to one repository that requests a merge to a base of another repository.
+`body`|`string` | The contents of the pull request.
-head
-: _Required_ **string** - The branch (or git ref) where your changes are implemented.
-NOTE: `head` and `base` can be either a sha or a branch name. Typically you
-would namespace `head` with a user like this: `username:branch`.
+#### Example
<%= json \
:title => "Amazing new feature",
@@ -88,41 +105,45 @@ would namespace `head` with a user like this: `username:branch`.
You can also create a Pull Request from an existing Issue by passing an
Issue number instead of `title` and `body`.
-issue
-: _Required_ **number** - Issue number in this repository to turn into a
-Pull Request.
+Name | Type | Description
+-----|------|--------------
+`issue`|`integer` | **Required**. The issue number in this repository to turn into a Pull Request.
+
+#### Example
<%= json \
- :issue => "5",
- :head => "ocotocat:new-feature",
+ :issue => 5,
+ :head => "octocat:new-feature",
:base => "master"
%>
### Response
-<%= headers 201, :Location => "https://api.github.com/user/repo/pulls/1" %>
+<%= headers 201, :Location => get_resource(:pull)['url'] %>
<%= json :pull %>
## Update a pull request
- PATCH /repos/:user/:repo/pulls/:number
+ PATCH /repos/:owner/:repo/pulls/:number
### Input
-title
-: _Optional_ **string**
-
-body
-: _Optional_ **string**
+Name | Type | Description
+-----|------|--------------
+`title`|`string` | The title of the pull request.
+`body`|`string` | The contents of the pull request.
+`state`|`string` | State of this Pull Request. Either `open` or `closed`.{% if page.version == 'dotcom' or page.version >= 2.8 %}
+`base`|`string` | The name of the branch you want your changes pulled into. This should be an existing branch on the current repository. You cannot update the base branch on a pull request to point to another repository.
+{% endif %}
-state
-: _Optional_ **string** - State of this Pull Request. Valid values are
-`open` and `closed`.
+#### Example
<%= json \
:title => "new title",
:body => "updated body",
- :state => "open"
+ :state => "open"{% if page.version == 'dotcom' or page.version >= 2.8 %},
+ :base => "master"
+{% endif %}
%>
### Response
@@ -132,25 +153,27 @@ state
## List commits on a pull request
- GET /repos/:user/:repo/pulls/:number/commits
+ GET /repos/:owner/:repo/pulls/:number/commits
### Response
-<%= headers 200 %>
+<%= headers 200, :pagination => default_pagination_rels %>
<%= json(:commit) { |h| [h] } %>
+Note: The response includes a maximum of 250 commits. If you are working with a pull request larger than that, you can use the [Commit List API](/v3/repos/commits/#list-commits-on-a-repository) to enumerate all commits in the pull request.
+
## List pull requests files
- GET /repos/:user/:repo/pulls/:number/files
+ GET /repos/:owner/:repo/pulls/:number/files
### Response
-<%= headers 200 %>
+<%= headers 200, :pagination => default_pagination_rels %>
<%= json(:file) { |h| [h] } %>
## Get if a pull request has been merged
- GET /repos/:user/:repo/pulls/:number/merge
+ GET /repos/:owner/:repo/pulls/:number/merge
### Response if pull request has been merged
@@ -160,14 +183,34 @@ state
<%= headers 404 %>
-## Merge a pull request (Merge Button™)
+## Merge a pull request (Merge Button)
- PUT /repos/:user/:repo/pulls/:number/merge
+ PUT /repos/:owner/:repo/pulls/:number/merge
### Input
-commit\_message
-: _Optional_ **string** - The message that will be used for the merge commit
+Name | Type | Description
+-----|------|-------------
+{% if page.version == 'dotcom' or page.version >= 2.6 %}`commit_title`|`string`| Title for the automatic commit message.{% endif %}
+`commit_message`|`string`| Extra detail to append to automatic commit message.
+`sha`|`string`| SHA that pull request head must match to allow merge
+{% if page.version == 'dotcom' or page.version >= 2.6 %}`squash`|`boolean`| Commit a single commit to the head branch.{% endif %}
+
+{% if page.version == 'dotcom' or page.version >= 2.6 %}
+
+{{#tip}}
+
+The `commit_title` and `squash` parameters are currently available for developers to preview. During the preview period, the API may change without advance notice. Please see the [blog post](/changes/2016-04-01-squash-api-preview) for full details.
+
+To access the API during the preview period, you must provide a custom [media type](/v3/media) in the `Accept` header:
+
+```
+application/vnd.github.polaris-preview+json
+```
+
+{{/tip}}
+
+{% endif %}
### Response if merge was successful
@@ -182,17 +225,34 @@ commit\_message
<%= headers 405 %>
<%= json \
- :sha => nil,
- :merged => false,
- :message => 'Failure reason'
+ :message => "Pull Request is not mergeable",
+ :documentation_url => "https://developer.github.com/v3/pulls/#merge-a-pull-request-merge-button"
%>
-## Custom Mime Types
+### Response if sha was provided and pull request head did not match
-These are the supported mime types for pull requests. You can read more about the
-use of mime types in the API [here](/v3/mime/).
+<%= headers 409 %>
+<%= json \
+ :message => "Head branch was modified. Review and try the merge again.",
+ :documentation_url => "https://developer.github.com/v3/pulls/#merge-a-pull-request-merge-button"
+%>
+
+## Labels, assignees, and milestones
+
+Every pull request is an issue, but not every issue is a pull request. For this reason, "shared" actions for both features, like manipulating assignees, labels and milestones, are provided within [the Issues API](/v3/issues).
+
+## Custom media types
+
+These are the supported media types for pull requests. You can read more about the
+use of media types in the API [here](/v3/media/).
application/vnd.github.VERSION.raw+json
application/vnd.github.VERSION.text+json
application/vnd.github.VERSION.html+json
application/vnd.github.VERSION.full+json
+ application/vnd.github.VERSION.diff
+ application/vnd.github.VERSION.patch
+
+
+
+If a diff is corrupt, contact {{ site.data.variables.contact.contact_support }} to receive help. Be sure to include the repository name and pull request ID.
diff --git a/content/v3/pulls/comments.md b/content/v3/pulls/comments.md
index ce0b4634fd..fa543427ab 100644
--- a/content/v3/pulls/comments.md
+++ b/content/v3/pulls/comments.md
@@ -1,53 +1,141 @@
---
-title: Pull Request Comments | GitHub API
+title: Review Comments
---
-# Pull Request Review Comments API
+# Review Comments
+
+{:toc}
Pull Request Review Comments are comments on a portion of the unified
diff. These are separate from Commit Comments (which are applied
directly to a commit, outside of the Pull Request view), and Issue
Comments (which do not reference a portion of the unified diff).
-Pull Request Review Comments leverage [these](#custom-mime-types) custom mime
-types. You can read more about the use of mime types in the API
-[here](/v3/mime/).
+Pull Request Review Comments use [these custom media
+types](#custom-media-types). You can read more about the use of media types in the API
+[here](/v3/media/).
## List comments on a pull request
- GET /repos/:user/:repo/pulls/:number/comments
+ GET /repos/:owner/:repo/pulls/:number/comments
### Response
-<%= headers 200 %>
+<%= headers 200, :pagination => default_pagination_rels %>
+<%= json(:pull_comment) { |h| [h] } %>
+
+{% if page.version == 'dotcom' %}
+#### Reactions summary
+
+{{#tip}}
+
+
+
+ An additional `reactions` object in the review comment payload is currently available for developers to preview.
+ During the preview period, the APIs may change without advance notice.
+ Please see the [blog post](/changes/2016-05-12-reactions-api-preview) for full details.
+
+ To access the API you must provide a custom [media type](/v3/media) in the `Accept` header:
+
+ application/vnd.github.squirrel-girl-preview
+
+ The `reactions` key will have the following payload where `url` can be used to construct the API location for [listing and creating](/v3/reactions) reactions.
+
+{{/tip}}
+<%= json :pull_comment_reaction_summary %>
+{% endif %}
+
+## List comments in a repository
+
+ GET /repos/:owner/:repo/pulls/comments
+
+By default, Review Comments are ordered by ascending ID.
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`sort`|`string` | Can be either `created` or `updated`. Default: `created`
+`direction`|`string` | Can be either `asc` or `desc`. Ignored without `sort` parameter.
+`since`|`string` | Only comments updated at or after this time are returned. This is a timestamp in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.
+
+
+### Response
+
+<%= headers 200, :pagination => default_pagination_rels %>
<%= json(:pull_comment) { |h| [h] } %>
+{% if page.version == 'dotcom' %}
+#### Reactions summary
+
+{{#tip}}
+
+
+
+ An additional `reactions` object in the review comment payload is currently available for developers to preview.
+ During the preview period, the APIs may change without advance notice.
+ Please see the [blog post](/changes/2016-05-12-reactions-api-preview) for full details.
+
+ To access the API you must provide a custom [media type](/v3/media) in the `Accept` header:
+
+ application/vnd.github.squirrel-girl-preview
+
+ The `reactions` key will have the following payload where `url` can be used to construct the API location for [listing and creating](/v3/reactions) reactions.
+
+{{/tip}}
+<%= json :pull_comment_reaction_summary %>
+{% endif %}
+
## Get a single comment
- GET /repos/:user/:repo/pulls/comments/:number
+ GET /repos/:owner/:repo/pulls/comments/:id
### Response
<%= headers 200 %>
<%= json :pull_comment %>
+{% if page.version == 'dotcom' %}
+#### Reactions summary
+
+{{#tip}}
+
+
+
+ An additional `reactions` object in the review comment payload is currently available for developers to preview.
+ During the preview period, the APIs may change without advance notice.
+ Please see the [blog post](/changes/2016-05-12-reactions-api-preview) for full details.
+
+ To access the API you must provide a custom [media type](/v3/media) in the `Accept` header:
+
+ application/vnd.github.squirrel-girl-preview
+
+ The `reactions` key will have the following payload where `url` can be used to construct the API location for [listing and creating](/v3/reactions) reactions.
+
+{{/tip}}
+<%= json :pull_comment_reaction_summary %>
+{% endif %}
+
## Create a comment
- POST /repos/:user/:repo/pulls/:number/comments
+ POST /repos/:owner/:repo/pulls/:number/comments
### Input
-body
-: _Required_ **string**
+Name | Type | Description
+-----|------|--------------
+`body`|`string` | **Required**. The text of the comment
+`commit_id`|`string` | **Required**. The SHA of the commit to comment on.
+`path`|`string` | **Required**. The relative path of the file to comment on.
+`position`|`integer` | **Required**. The line index in the diff to comment on.
-commit_id
-: _Required_ **string** - Sha of the commit to comment on.
+{{#tip}}
-path
-: _Required_ **string** - Relative path of the file to comment on.
+When passing the `commit_id`, use the SHA of the latest commit in the pull request or your comment may appear as "outdated" if the specified `position` has been modified in a subsequent commit.
-position
-: _Required_ **number** - Line index in the diff to comment on.
+To comment on a specific line in a file, you will need to first determine the position in the diff. GitHub offers a `application/vnd.github.v3.diff` media type which you can use in a preceding request to view the pull request's diff. The diff needs to be [interpreted](https://en.wikipedia.org/wiki/Diff_utility#Unified_format) to translate from the *line in the file* to a *position in the diff*. The `position` value is the number of lines down from the first "@@" hunk header in the file you would like to comment on. The line just below the "@@" line is position 1, the next line is position 2, and so on. The position in the file's diff continues to increase through lines of whitespace and additional hunks until a new file is reached.
+
+{{/tip}}
#### Example
@@ -63,11 +151,11 @@ position
Instead of passing `commit_id`, `path`, and `position` you can reply to
an existing Pull Request Comment like this:
-body
-: _Required_ **string**
+Name | Type | Description
+-----|------|--------------
+`body`|`string` | **Required**. The text of the comment
+`in_reply_to`|`integer` | **Required**. The comment id to reply to.
-in_reply_to
-: _Required_ **number** - Comment id to reply to.
#### Example
@@ -78,19 +166,19 @@ in_reply_to
### Response
-<%= headers 201,
- :Location =>
-"https://api.github.com/repos/:user/:repo/pulls/comments/1" %>
+<%= headers 201, :Location => get_resource(:pull_comment)['url'] %>
<%= json :pull_comment %>
## Edit a comment
- PATCH /repos/:user/:repo/pulls/comments/:number
+ PATCH /repos/:owner/:repo/pulls/comments/:id
### Input
-body
-: _Required_ **string**
+Name | Type | Description
+-----|------|--------------
+`body`|`string` | **Required**. The text of the comment
+
#### Example
@@ -105,16 +193,16 @@ body
## Delete a comment
- DELETE /repos/:user/:repo/pulls/comments/:number
+ DELETE /repos/:owner/:repo/pulls/comments/:id
### Response
<%= headers 204 %>
-## Custom Mime Types
+## Custom media types
-These are the supported mime types for pull request comments. You can read
-more about the use of mime types in the API [here](/v3/mime/).
+These are the supported media types for pull request review comments. You can
+read more about the use of media types in the API [here](/v3/media/).
application/vnd.github.VERSION.raw+json
application/vnd.github.VERSION.text+json
diff --git a/content/v3/rate_limit.md b/content/v3/rate_limit.md
new file mode 100644
index 0000000000..cb27f21b3b
--- /dev/null
+++ b/content/v3/rate_limit.md
@@ -0,0 +1,55 @@
+---
+title: Rate Limit
+---
+
+{% if page.version == 'dotcom' %}
+
+# Rate Limit
+
+The overview documentation describes the [rate limit rules](/v3/#rate-limiting).
+You can check your current rate limit status at any time using the Rate Limit
+API described below.
+
+## Get your current rate limit status
+
+Note: Accessing this endpoint does not count against your rate limit.
+
+ GET /rate_limit
+
+### Response
+
+<%=
+ headers 200,
+ 'X-RateLimit-Limit' => 5000,
+ 'X-RateLimit-Remaining' => 4999,
+ 'X-RateLimit-Reset' => 1372700873
+%>
+<%=
+ json :resources => {
+ :core => {:limit => 5000, :remaining => 4999, :reset => 1372700873},
+ :search => {:limit => 30, :remaining => 18, :reset => 1372697452},
+ },
+ :rate => {:limit => 5000, :remaining => 4999, :reset => 1372700873}
+%>
+
+
+#### Understanding Your Rate Limit Status
+
+The Search API has a [custom rate limit](/v3/search/#rate-limit), separate from
+the rate limit governing the rest of the API. For that reason, the response
+(shown above) categorizes your rate limit by resource. Within the `"resources"`
+object, the `"search"` object provides your rate limit status for the
+[Search API](/v3/search). The `"core"` object provides your rate limit status for
+all the _rest_ of the API.
+
+#### Deprecation Notice
+
+The `"rate"` object (shown at the bottom of the response above) is
+[deprecated](/v3/versions/#v3-deprecations) and is scheduled for removal in the next
+version of the API.
+
+If you're writing new API client code (or updating your existing code), you
+should use the `"core"` object instead of the `"rate"` object. The `"core"` object
+contains the same information that is present in the `"rate"` object.
+
+{% endif %}
diff --git a/content/v3/reactions.md b/content/v3/reactions.md
new file mode 100644
index 0000000000..d8effc8a38
--- /dev/null
+++ b/content/v3/reactions.md
@@ -0,0 +1,208 @@
+---
+title: Reactions
+---
+
+{% if page.version == 'dotcom' or page.version >= 2.7 %}
+
+# Reactions
+
+{{#tip}}
+
+
+
+ APIs for managing reactions are currently available for developers to preview.
+ During the preview period, the APIs may change without advance notice.
+ Please see the [blog post](/changes/2016-05-12-reactions-api-preview) for full details.
+
+ To access the API you must provide a custom [media type](/v3/media) in the `Accept` header:
+
+ application/vnd.github.squirrel-girl-preview
+
+{{/tip}}
+
+{:toc}
+
+
+## Reaction types
+
+ When creating a reaction, the allowed values for the `content` parameter are as follows (with the corresponding emoji for reference):
+
+content | emoji
+-----|------
+`+1` | :+1:
+`-1` | :-1:
+`laugh` | :smile:
+`confused` | :confused:
+`heart` | :heart:
+`hooray` | :tada:
+
+
+## List reactions for a commit comment
+
+ GET /repos/:owner/:repo/comments/:id/reactions
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`content`|`string` | Indicates which type of reaction to return.
+
+### Response
+
+<%= headers 200, :pagination => default_pagination_rels %>
+<%= json(:reaction) { |h| [h] } %>
+
+
+## Create reaction for a commit comment
+
+ POST /repos/:owner/:repo/comments/:id/reactions
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`content`|`string` | **Required**. The reaction type
+
+<%= json :content => 'heart' %>
+
+### Response
+
+{{#tip}}
+
+ If you have already created a reaction of type `content`, the previously created reaction will be returned with `Status: 200 OK`.
+
+{{/tip}}
+
+<%= headers 201 %>
+<%= json :reaction %>
+
+
+## List reactions for an issue
+
+ GET /repos/:owner/:repo/issues/:number/reactions
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`content`|`string` | Indicates which type of reaction to return.
+
+### Response
+
+<%= headers 200, :pagination => default_pagination_rels %>
+<%= json(:reaction) { |h| [h] } %>
+
+
+## Create reaction for an issue
+
+ POST /repos/:owner/:repo/issues/:number/reactions
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`content`|`string` | **Required**. The reaction type
+
+<%= json :content => 'heart' %>
+
+### Response
+
+{{#tip}}
+
+ If you have already created a reaction of type `content`, the previously created reaction will be returned with `Status: 200 OK`.
+
+{{/tip}}
+
+<%= headers 201 %>
+<%= json :reaction %>
+
+
+## List reactions for an issue comment
+
+ GET /repos/:owner/:repo/issues/comments/:id/reactions
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`content`|`string` | Indicates which type of reaction to return.
+
+### Response
+
+<%= headers 200, :pagination => default_pagination_rels %>
+<%= json(:reaction) { |h| [h] } %>
+
+
+## Create reaction for an issue comment
+
+ POST /repos/:owner/:repo/issues/comments/:id/reactions
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`content`|`string` | **Required**. The reaction type
+
+<%= json :content => 'heart' %>
+
+### Response
+
+{{#tip}}
+
+ If you have already created a reaction of type `content`, the previously created reaction will be returned with `Status: 200 OK`.
+
+{{/tip}}
+
+<%= headers 201 %>
+<%= json :reaction %>
+
+
+## List reactions for a pull request review comment
+
+ GET /repos/:owner/:repo/pulls/comments/:id/reactions
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`content`|`string` | Indicates which type of reaction to return.
+
+### Response
+
+<%= headers 200, :pagination => default_pagination_rels %>
+<%= json(:reaction) { |h| [h] } %>
+
+
+## Create reaction for a pull request review comment
+
+ POST /repos/:owner/:repo/pulls/comments/:id/reactions
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`content`|`string` | **Required**. The reaction type
+
+<%= json :content => 'heart' %>
+
+### Response
+
+{{#tip}}
+
+ If you have already created a reaction of type `content`, the previously created reaction will be returned with `Status: 200 OK`.
+
+{{/tip}}
+
+<%= headers 201 %>
+<%= json :reaction %>
+
+
+## Delete a reaction
+
+ DELETE /reactions/:id
+
+### Response
+
+<%= headers 204 %>
+
+{% endif %}
diff --git a/content/v3/repos.md b/content/v3/repos.md
index e379f0f0c7..2e8b726228 100644
--- a/content/v3/repos.md
+++ b/content/v3/repos.md
@@ -1,44 +1,47 @@
---
-title: Repos | GitHub API
+title: Repositories
---
-# Repos API
+# Repositories
+
+{:toc}
## List your repositories
-List repositories for the authenticated user.
+List repositories that are accessible to the authenticated user.
+
+This includes repositories owned by the authenticated user, repositories where
+the authenticated user is a collaborator, and repositories that the
+authenticated user has access to through an organization membership.
GET /user/repos
### Parameters
-type
-: `all`, `owner`, `public`, `private`, `member`. Default: `all`.
-
-sort
-: `created`, `updated`, `pushed`, `full_name`, default: `full_name`.
-
-direction
-: `asc` or `desc`, default: when using `full_name`: `asc`, otherwise `desc`.
+Name | Type | Description
+-----|------|--------------
+`visibility` | `string` | Can be one of `all`, `public`, or `private`. Default: `all`
+`affiliation` | `string` | Comma-separated list of values. Can include:
* `owner`: Repositories that are owned by the authenticated user.
* `collaborator`: Repositories that the user has been added to as a collaborator.
* `organization_member`: Repositories that the user has access to through being a member of an organization. This includes every repository on every team that the user is on.
Default: `owner,collaborator,organization_member`
+`type`|`string` | Can be one of `all`, `owner`, `public`, `private`, `member`. Default: `all`
Will cause a `422` error if used in the same request as **visibility** or **affiliation**.
+`sort`|`string` | Can be one of `created`, `updated`, `pushed`, `full_name`. Default: `full_name`
+`direction`|`string` | Can be one of `asc` or `desc`. Default: when using `full_name`: `asc`; otherwise `desc`
## List user repositories
List public repositories for the specified user.
- GET /users/:user/repos
+ GET /users/:username/repos
### Parameters
-type
-: `all`, `owner`, `member`. Default: `all`.
+Name | Type | Description
+-----|------|-------------
+`type`|`string` | Can be one of `all`, `owner`, `member`. Default: `owner`
+`sort`|`string` | Can be one of `created`, `updated`, `pushed`, `full_name`. Default: `full_name`
+`direction`|`string` | Can be one of `asc` or `desc`. Default: when using `full_name`: `asc`, otherwise `desc`
-sort
-: `created`, `updated`, `pushed`, `full_name`, default: `full_name`.
-direction
-: `asc` or `desc`, default: when using `full_name`: `asc`, otherwise `desc`.
-
-## List organization repositories.
+## List organization repositories
List repositories for the specified org.
@@ -46,17 +49,54 @@ List repositories for the specified org.
### Parameters
-type
-: `all`, `public`, `member`, `private`. Default: `all`.
+Name | Type | Description
+-----|------|--------------
+`type`|`string` | Can be one of `all`, `public`, `private`, `forks`, `sources`, `member`. Default: `all`
+
### Response
-<%= headers 200, :pagination => true %>
+<%= headers 200, :pagination => default_pagination_rels %>
<%= json(:repo) { |h| [h] } %>
+## List all public repositories
+
+This provides a dump of every public repository, in the order that they were created.
+
+Note: Pagination is powered exclusively by the `since` parameter.
+Use the [Link header](/v3/#link-header) to get the URL for the next page of
+repositories.
+
+{% if page.version != 'dotcom' and page.version >= 2.3 %}
+
+If you are an [authenticated](/v3/#authentication) site administrator for your Enterprise instance,
+you will be able to list all repositories including private repositories.
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`visibility`|`string`| To include private repositories as well set to `all`. Default: `public`
+
+{% endif %}
+
+ GET /repositories
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`since`|`string`| The integer ID of the last Repository that you've seen.
+
+
+### Response
+
+<%= headers 200, :pagination => { :next => 'https://api.github.com/repositories?since=364' } %>
+<%= json(:simple_repo) { |h| [h] } %>
+
## Create
-Create a new repository for the authenticated user. OAuth users must supply `repo` scope.
+Create a new repository for the authenticated user.
POST /user/repos
@@ -65,42 +105,34 @@ be a member of the specified organization.
POST /orgs/:org/repos
-### Input
-
-name
-: _Required_ **string**
-
-description
-: _Optional_ **string**
+### OAuth scope requirements
-homepage
-: _Optional_ **string**
+When using [OAuth](/v3/oauth/#scopes), authorizations must include:
-private
-: _Optional_ **boolean** - `true` to create a private repository, `false`
-to create a public one. Creating private repositories requires a paid
-GitHub account. Default is `false`.
+- `public_repo` scope or `repo` scope to create a public repository
+- `repo` scope to create a private repository
-has\_issues
-: _Optional_ **boolean** - `true` to enable issues for this repository,
-`false` to disable them. Default is `true`.
-
-has\_wiki
-: _Optional_ **boolean** - `true` to enable the wiki for this
-repository, `false` to disable it. Default is `true`.
-
-has\_downloads
-: _Optional_ **boolean** - `true` to enable downloads for this
-repository, `false` to disable them. Default is `true`.
+### Input
-team\_id
-: _Optional_ **number** - The id of the team that will be granted access
-to this repository. This is only valid when creating a repo in an
-organization.
+Name | Type | Description
+-----|------|--------------
+`name`|`string` | **Required**. The name of the repository
+`description`|`string` | A short description of the repository
+`homepage`|`string` | A URL with more information about the repository
+`private`|`boolean` | Either `true` to create a private repository, or `false` to create a public one. Creating private repositories requires a paid GitHub account. Default: `false`
+`has_issues`|`boolean` | Either `true` to enable issues for this repository, `false` to disable them. Default: `true`
+`has_wiki`|`boolean` | Either `true` to enable the wiki for this repository, `false` to disable it. Default: `true`
+`has_downloads`|`boolean` | Either `true` to enable downloads for this repository, `false` to disable them. Default: `true`
+`team_id`|`integer` | The id of the team that will be granted access to this repository. This is only valid when creating a repository in an organization.
+`auto_init`|`boolean` | Pass `true` to create an initial commit with empty README. Default: `false`
+`gitignore_template`|`string` | Desired language or platform [.gitignore template](https://github.com/github/gitignore) to apply. Use the name of the template without the extension. For example, "Haskell".
+`license_template`|`string` | Desired [LICENSE template](https://github.com/github/choosealicense.com) to apply. Use the [name of the template](https://github.com/github/choosealicense.com/tree/gh-pages/_licenses) without the extension. For example, "mit" or "mozilla".
+
+#### Example
<%= json \
:name => "Hello-World",
- :description => "This is your first repo",
+ :description => "This is your first repository",
:homepage => "https://github.com",
:private => false,
:has_issues => true,
@@ -110,56 +142,46 @@ organization.
### Response
-<%= headers 201,
- :Location =>
-'https://api.github.com/repos/octocat/Hello-World' %>
+<%= headers 201, :Location => get_resource(:repo)['url'] %>
<%= json :repo %>
## Get
- GET /repos/:user/:repo
+ GET /repos/:owner/:repo
### Response
+The `parent` and `source` objects are present when the repository is a fork.
+`parent` is the repository this repository was forked from,
+`source` is the ultimate source for the network.
+
<%= headers 200 %>
<%= json :full_repo %>
## Edit
- PATCH /repos/:user/:repo
+ PATCH /repos/:owner/:repo
### Input
-name
-: _Required_ **string**
-
-description
-: _Optional_ **string**
-
-homepage
-: _Optional_ **string**
-
-private
-: _Optional_ **boolean** - `true` makes the repository private, and
-`false` makes it public.
+Name | Type | Description
+-----|------|--------------
+`name`|`string` | **Required**. The name of the repository
+`description`|`string` | A short description of the repository
+`homepage`|`string` | A URL with more information about the repository
+`private`|`boolean` | Either `true` to make the repository private, or `false` to make it public. Creating private repositories requires a paid GitHub account. Default: `false`
+`has_issues`|`boolean` | Either `true` to enable issues for this repository, `false` to disable them. Default: `true`
+`has_wiki`|`boolean` | Either `true` to enable the wiki for this repository, `false` to disable it. Default: `true`
+`has_downloads`|`boolean` | Either `true` to enable downloads for this repository, `false` to disable them. Default: `true`
+`default_branch`|`String` | Updates the default branch for this repository.
-has\_issues
-: _Optional_ **boolean** - `true` to enable issues for this repository,
-`false` to disable them. Default is `true`.
-
-has\_wiki
-: _Optional_ **boolean** - `true` to enable the wiki for this
-repository, `false` to disable it. Default is `true`.
-
-has\_downloads
-: _Optional_ **boolean** - `true` to enable downloads for this
-repository, `false` to disable them. Default is `true`.
+#### Example
<%= json \
:name => "Hello-World",
- :description => "This is your first repo",
+ :description => "This is your first repository",
:homepage => "https://github.com",
- :public => true,
+ :private => true,
:has_issues => true,
:has_wiki => true,
:has_downloads => true
@@ -172,24 +194,35 @@ repository, `false` to disable them. Default is `true`.
## List contributors
- GET /repos/:user/:repo/contributors
+List contributors to the specified repository, sorted by the number of commits per contributor in descending order.
+
+{{#tip}}
+
+Contributors data is cached for performance reasons. This endpoint may return information that is a few hours old.
+
+Git contributors are identified by author email address. This API attempts to group contribution counts by GitHub user, across all of their associated email addresses. For performance reasons, only the first 500 author email addresses in the repository will be linked to GitHub users. The rest will appear as anonymous contributors without associated GitHub user information.
+
+{{/tip}}
+
+ GET /repos/:owner/:repo/contributors
### Parameters
-anon
-: Optional flag. Set to `1` or `true` to include anonymous contributors
-in results.
+Name | Type | Description
+-----|------|-------------
+`anon`|`string` | Set to `1` or `true` to include anonymous contributors in results.
+
### Response
-<%= headers 200 %>
+<%= headers 200, :pagination => default_pagination_rels %>
<%= json(:contributor) { |h| [h] } %>
## List languages
List languages for the specified repository. The value on the right of a language is the number of bytes of code written in that language.
- GET /repos/:user/:repo/languages
+ GET /repos/:owner/:repo/languages
### Response
@@ -201,48 +234,29 @@ List languages for the specified repository. The value on the right of a languag
## List Teams
- GET /repos/:user/:repo/teams
+ GET /repos/:owner/:repo/teams
### Response
-<%= headers 200 %>
+<%= headers 200, :pagination => default_pagination_rels %>
<%= json(:team) { |h| [h] } %>
## List Tags
- GET /repos/:user/:repo/tags
+ GET /repos/:owner/:repo/tags
### Response
-<%= headers 200 %>
+<%= headers 200, :pagination => default_pagination_rels %>
<%= json(:tag) { |h| [h] } %>
-## List Branches
-
- GET /repos/:user/:repo/branches
-
-### Response
-
-<%= headers 200 %>
-<%= json(:branches) %>
-
-## Get Branch
-
- GET /repos/:user/:repo/branches/:branch
-
-### Response
-
-<%= headers 200 %>
-<%= json(:branch) %>
-
## Delete a Repository
Deleting a repository requires admin access. If OAuth is used, the
`delete_repo` scope is required.
- DELETE /repos/:user/:repo
+ DELETE /repos/:owner/:repo
### Response
<%= headers 204 %>
-
diff --git a/content/v3/repos/branches.md b/content/v3/repos/branches.md
new file mode 100644
index 0000000000..e620efd95c
--- /dev/null
+++ b/content/v3/repos/branches.md
@@ -0,0 +1,522 @@
+---
+title: Branches
+---
+
+# Branches
+
+{:toc}
+
+{% if page.version != 'dotcom' and page.version >= 2.5 and page.version < 2.7 %}
+
+## List Branches
+
+ GET /repos/:owner/:repo/branches
+
+### Parameters
+
+Name | Type | Description
+-----|------|-------------
+`protected`| `boolean` | Set to `true` to only return protected branches
+
+{{#tip}}
+
+
+
+ The Protected Branch API is currently available for developers to preview.
+ During the preview period, the API may change without advance notice.
+ Please see the [blog post](/changes/2015-11-11-protected-branches-api) for full details.
+
+ To access the API during the preview period, you must provide a custom [media type](/v3/media) in the `Accept` header:
+
+ application/vnd.github.loki-preview+json
+
+ The `protection` key will only be present in branch payloads if this header is passed.
+
+{{/tip}}
+
+### Response
+
+<%= headers 200, :pagination => default_pagination_rels %>
+<%= json(:branches) { |a| a.each { |b| b.merge!("protection" => {
+ "enabled" => false,
+ "required_status_checks" => {
+ "enforcement_level" => "off",
+ "contexts" => []
+ }
+}) } } %>
+
+## Get Branch
+
+ GET /repos/:owner/:repo/branches/:branch
+
+### Response
+
+{{#tip}}
+
+
+
+ The Protected Branch API is currently available for developers to preview.
+ During the preview period, the API may change without advance notice.
+ Please see the [blog post](/changes/2015-11-11-protected-branches-api) for full details.
+
+ To access the API during the preview period, you must provide a custom [media type](/v3/media) in the `Accept` header:
+
+ application/vnd.github.loki-preview+json
+
+ The `protection` key will only be present in branch payloads if this header is passed.
+
+{{/tip}}
+
+<%= headers 200 %>
+<%= json(:branch) { |h| h.merge!("protection" => {
+ "enabled" => false,
+ "required_status_checks" => {
+ "enforcement_level" => "off",
+ "contexts" => []
+ }
+}) } %>
+
+## Enabling and disabling branch protection
+
+{{#tip}}
+
+
+
+ The Protected Branch API is currently available for developers to preview.
+ During the preview period, the API may change without advance notice.
+ Please see the [blog post](/changes/2015-11-11-protected-branches-api) for full details.
+
+ To access the API during the preview period, you must provide a custom [media type](/v3/media) in the `Accept` header:
+
+ application/vnd.github.loki-preview+json
+
+{{/tip}}
+
+Protecting a branch requires admin access.
+
+ PATCH /repos/:owner/:repo/branches/:branch
+
+### Parameters
+
+You need to pass a `protection` object.
+
+Name | Type | Description
+-----|------|-------------
+`enabled`|`boolean` | **Required**. Should this branch be protected or not
+`required_status_checks`|`object`| Configure required status checks here
+
+The `required_status_checks` object must have the following keys:
+
+Name | Type | Description
+-----|------|-------------
+`enforcement_level`|`string` | **Required**. Who required status checks apply to. Options are `off`, `non_admins` or `everyone`.
+`contexts`|`array` | **Required**. The list of status checks to require in order to merge into this branch
+
+The `enforcement_level` key can have the following values:
+
+Name | Description
+------|------------
+`off` | Turn off required status checks for this branch.
+`non_admins` | Required status checks will be enforced for non-admins.
+`everyone` | Required status checks will be enforced for everyone (including admins).
+
+#### Example
+
+<%= json \
+ "protection" => {
+ "enabled" => true,
+ "required_status_checks" => {
+ "enforcement_level" => "everyone",
+ "contexts" => ["continuous-integration/travis-ci"]
+ }
+ }
+%>
+
+{% endif %}
+
+{% if page.version == 'dotcom' or page.version >= 2.7 %}
+
+{{#tip}}
+
+
+
+ The Protected Branch API is currently available for developers to preview.
+ During the preview period, the API may change without advance notice.
+ Please see the [blog post](/changes/2016-06-27-protected-branches-api-update) for full details.
+
+ To access the API during the preview period, you must provide a custom [media type](/v3/media) in the `Accept` header:
+
+ application/vnd.github.loki-preview+json
+
+{{/tip}}
+
+## List Branches
+
+ GET /repos/:owner/:repo/branches
+
+### Parameters
+
+Name | Type | Description
+-----|------|-------------
+`protected` | `boolean` | Set to `true` to only return protected branches
+
+{{#tip}}
+
+
+
+ The Protected Branch API is currently available for developers to preview.
+ During the preview period, the API may change without advance notice.
+ Please see the [blog post](/changes/2016-06-27-protected-branches-api-update) for full details.
+
+ To access the API during the preview period, you must provide a custom [media type](/v3/media) in the `Accept` header:
+
+ application/vnd.github.loki-preview+json
+
+ The `protected` key will only be present in branch payloads if this header is passed.
+
+{{/tip}}
+
+### Response
+
+<%= headers 200, :pagination => default_pagination_rels %>
+<%= json(:branches) { |a| a.each { |b| b.merge!(
+ "protected": true,
+ "protection_url": "https://api.github.com/repos/octocat/Hello-World/branches/#{b["name"]}/protection",
+) } } %>
+
+## Get Branch
+
+ GET /repos/:owner/:repo/branches/:branch
+
+### Response
+
+{{#tip}}
+
+
+
+ The Protected Branch API is currently available for developers to preview.
+ During the preview period, the API may change without advance notice.
+ Please see the [blog post](/changes/2016-06-27-protected-branches-api-update) for full details.
+
+ To access the API during the preview period, you must provide a custom [media type](/v3/media) in the `Accept` header:
+
+ application/vnd.github.loki-preview+json
+
+ The `protected` key will only be present in branch payloads if this header is passed.
+
+{{/tip}}
+
+<%= headers 200 %>
+<%= json(:branch) { |h| h.merge!(
+ "protected": true,
+ "protection_url": "https://api.github.com/repos/octocat/Hello-World/branches/#{h["name"]}/protection",
+) } %>
+
+
+## Get branch protection
+
+ GET /repos/:owner/:repo/branches/:branch/protection
+
+<%= headers 200 %>
+<%= json(:repo_branch_protection) %>
+
+## Update branch protection
+
+Protecting a branch requires admin access.
+
+ PUT /repos/:owner/:repo/branches/:branch/protection
+
+### Parameters
+
+You must pass two objects: `required_status_checks` and `restrictions`. Both can have the value `null` for disabled.
+
+The `required_status_checks` object must have the following keys:
+
+Name | Type | Description
+-----|------|-------------
+`include_admins` | `boolean` | **Required**. Enforce required status checks for repository administrators.
+`strict` | `boolean` | **Required**. Require branches to be up to date before merging.
+`contexts` | `array` | **Required**. The list of status checks to require in order to merge into this branch
+
+The `restrictions` object must have the following keys:
+
+Name | Type | Description
+-----|------|-------------
+`users` | `array` | The list of user `login`s with push access
+`teams` | `array` | The list of team `slug`s with push access
+
+{{#tip}}
+
+* Teams and users `restrictions` are only available for organization-owned repositories.
+* The list of users and teams in total is limited to 100 items.
+
+{{/tip}}
+
+### Example
+
+<%= json \
+ "required_status_checks" => {
+ "include_admins" => true,
+ "strict" => true,
+ "contexts" => ["continuous-integration/travis-ci"]
+ },
+ "restrictions" => {
+ "users" => ["octocat"],
+ "teams" => ["justice-league"]
+ }
+%>
+
+### Response
+
+<%= headers 200 %>
+<%= json(:repo_branch_protection) %>
+
+## Remove branch protection
+
+ DELETE /repos/:owner/:repo/branches/:branch/protection
+
+<%= headers 204 %>
+
+## Get required status checks of protected branch
+
+ GET /repos/:owner/:repo/branches/:branch/protection/required_status_checks
+
+<%= headers 200 %>
+<%= json(:repo_branch_protection_required_status_checks) %>
+
+## Update required status checks of protected branch
+
+Updating required status checks requires admin access and branch protection to be enabled.
+
+ PATCH /repos/:owner/:repo/branches/:branch/protection/required_status_checks
+
+### Parameters
+
+The object passed can have the following keys:
+
+Name | Type | Description
+-----|------|-------------
+`include_admins`|`boolean` | Enforce required status checks for repository administrators.
+`strict`|`boolean` | Require branches to be up to date before merging.
+`contexts`|`array` | The list of status checks to require in order to merge into this branch
+
+### Example
+
+<%= json \
+ "include_admins" => true,
+ "strict" => true,
+ "contexts" => ["continuous-integration/travis-ci"]
+%>
+
+### Response
+
+<%= headers 200 %>
+<%= json(:repo_branch_protection_required_status_checks) %>
+
+## Remove required status checks of protected branch
+
+ DELETE /repos/:owner/:repo/branches/:branch/protection/required_status_checks
+
+<%= headers 204 %>
+
+## List required status checks contexts of protected branch
+
+ GET /repos/:owner/:repo/branches/:branch/protection/required_status_checks/contexts
+
+<%= headers 200 %>
+<%= json ["continuous-integration/travis-ci"] %>
+
+## Replace required status checks contexts of protected branch
+
+ PUT /repos/:owner/:repo/branches/:branch/protection/required_status_checks/contexts
+
+### Example
+
+<%= json ["continuous-integration/travis-ci"] %>
+
+### Response
+
+<%= headers 200 %>
+<%= json ["continuous-integration/travis-ci"] %>
+
+## Add required status checks contexts of protected branch
+
+ POST /repos/:owner/:repo/branches/:branch/protection/required_status_checks/contexts
+
+### Example
+
+<%= json ["continuous-integration/jenkins"] %>
+
+### Response
+
+<%= headers 200 %>
+<%= json ["continuous-integration/travis-ci", "continuous-integration/jenkins"] %>
+
+## Remove required status checks contexts of protected branch
+
+ DELETE /repos/:owner/:repo/branches/:branch/protection/required_status_checks/contexts
+
+### Example
+
+<%= json ["continuous-integration/jenkins"] %>
+
+### Response
+
+<%= headers 200 %>
+<%= json ["continuous-integration/travis-ci"] %>
+
+
+## Get restrictions of protected branch
+
+{{#tip}}
+
+Teams and users `restrictions` are only available for organization-owned repositories.
+
+{{/tip}}
+
+ GET /repos/:owner/:repo/branches/:branch/protection/restrictions
+
+<%= headers 200 %>
+<%= json(:repo_branch_protection_restrictions) %>
+
+## Remove restrictions of protected branch
+
+ DELETE /repos/:owner/:repo/branches/:branch/protection/restrictions
+
+<%= headers 204 %>
+
+## List team restrictions of protected branch
+
+ GET /repos/:owner/:repo/branches/:branch/protection/restrictions/teams
+
+<%= headers 200 %>
+<%= json(:team) { |h| [h] } %>
+
+## Replace team restrictions of protected branch
+
+ PUT /repos/:owner/:repo/branches/:branch/protection/restrictions/teams
+
+### Body parameters
+
+Pass the list of team `slug`s with push access.
+
+{{#tip}}
+
+ The list of users and teams in total is limited to 100 items.
+
+{{/tip}}
+
+### Example
+
+<%= json ["justice-league"] %>
+
+### Response
+
+<%= headers 200 %>
+<%= json(:team) { |h| [h] } %>
+
+## Add team restrictions of protected branch
+
+ POST /repos/:owner/:repo/branches/:branch/protection/restrictions/teams
+
+### Body parameters
+
+Pass the list of team `slug`s with push access.
+
+{{#tip}}
+
+The list of users and teams in total is limited to 100 items.
+
+{{/tip}}
+
+### Example
+
+<%= json ["justice-league"] %>
+
+### Response
+
+<%= headers 200 %>
+<%= json(:team) { |h| [h] } %>
+
+## Remove team restrictions of protected branch
+
+ DELETE /repos/:owner/:repo/branches/:branch/protection/restrictions/teams
+
+### Example
+
+<%= json ["octocats"] %>
+
+### Response
+
+<%= headers 200 %>
+<%= json(:team) { |h| [h] } %>
+
+
+## List user restrictions of protected branch
+
+ GET /repos/:owner/:repo/branches/:branch/protection/restrictions/users
+
+<%= headers 200 %>
+<%= json(:user) { |h| [h] } %>
+
+## Replace user restrictions of protected branch
+
+ PUT /repos/:owner/:repo/branches/:branch/protection/restrictions/users
+
+### Body parameters
+
+Pass the list of user `login`s with push access.
+
+{{#tip}}
+
+The list of users and teams in total is limited to 100 items.
+
+{{/tip}}
+
+### Example
+
+<%= json ["octocat"] %>
+
+### Response
+
+<%= headers 200 %>
+<%= json(:user) { |h| [h] } %>
+
+## Add user restrictions of protected branch
+
+ POST /repos/:owner/:repo/branches/:branch/protection/restrictions/users
+
+### Body parameters
+
+Pass the list of user `login`s with push access.
+
+{{#tip}}
+
+The list of users and teams in total is limited to 100 items.
+
+{{/tip}}
+
+### Example
+
+<%= json ["octocat"] %>
+
+### Response
+
+<%= headers 200 %>
+<%= json(:user) { |h| [h] } %>
+
+## Remove user restrictions of protected branch
+
+ DELETE /repos/:owner/:repo/branches/:branch/protection/restrictions/users
+
+### Example
+
+<%= json ["defunkt"] %>
+
+### Response
+
+<%= headers 200 %>
+<%= json(:user) { |h| [h] } %>
+
+
+{% endif %}
diff --git a/content/v3/repos/collaborators.md b/content/v3/repos/collaborators.md
index 1bfe5b6436..5e22e210d7 100644
--- a/content/v3/repos/collaborators.md
+++ b/content/v3/repos/collaborators.md
@@ -1,21 +1,51 @@
---
-title: Repo Collaborators | GitHub API
+title: Collaborators
---
-# Repo Collaborators API
+# Collaborators
-## List
+{:toc}
- GET /repos/:user/:repo/collaborators
+
+
+## List collaborators
+
+ GET /repos/:owner/:repo/collaborators
+
+When authenticating as an organization owner of an organization-owned
+repository, all organization owners are included in the list of collaborators.
+Otherwise, only users with access to the repository are returned in the
+collaborators list.
### Response
-<%= headers 200 %>
+{% if page.version != 'dotcom' and page.version > 2.3 and page.version < 2.6 %}
+
+<%= headers 200, :pagination => default_pagination_rels %>
<%= json(:user) { |h| [h] } %>
-## Get
+### Alternative response with extra repository information
+
+{{#tip}}
+
+We're currently offering a preview period allowing applications to opt in to the Organization Permissions API. Please see the [blog post](/changes/2015-06-24-api-enhancements-for-working-with-organization-permissions/) for full details.
+
+To access the API during the preview period, you must provide a custom [media type](/v3/media) in the `Accept` header:
+
+```
+application/vnd.github.ironman-preview+json
+```
+
+{{/tip}}
- GET /repos/:user/:repo/collaborators/:user
+{% endif %}
+
+<%= headers 200, :pagination => default_pagination_rels %>
+<%= json(:collaborator) { |h| [h] } %>
+
+## Check if a user is a collaborator
+
+ GET /repos/:owner/:repo/collaborators/:username
### Response if user is a collaborator
@@ -25,17 +55,68 @@ title: Repo Collaborators | GitHub API
<%= headers 404 %>
-## Add collaborator
+## Add user as a collaborator
+
+ PUT /repos/:owner/:repo/collaborators/:username
+
+### Parameters
+
+{% if page.version == 'dotcom' or page.version >= 2.4 %}
+
+Name | Type | Description
+-----|------|--------------
+`permission`|`string` | The permission to grant the collaborator. **Only valid on organization-owned repositories.** Can be one of:
* `pull` - can pull, but not push to or administer this repository.
* `push` - can pull and push, but not administer this repository.
* `admin` - can pull, push and administer this repository.
Default: `push`
+
+<%= fetch_content(:optional_put_content_length) %>
- PUT /repos/:user/:repo/collaborators/:user
+{{#tip}}
+
+We're currently offering a preview period allowing applications to opt in to the Repository Invitations API.
+
+To send an invitation to a collaborator rather than directly adding them, you must provide a custom [media type](/v3/media) in the `Accept` header:
+
+```
+application/vnd.github.swamp-thing-preview+json
+```
+
+{{/tip}}
+
+{% if page.version != 'dotcom' and page.version > 2.3 and page.version < 2.6 %}
+
+{{#tip}}
+
+We're currently offering a preview period allowing applications to opt in to the Organization Permissions API. Please see the [blog post](/changes/2015-06-24-api-enhancements-for-working-with-organization-permissions/) for full details.
+
+To access the API during the preview period, you must provide a custom [media type](/v3/media) in the `Accept` header:
+
+```
+application/vnd.github.ironman-preview+json
+```
+
+**Warning:** If you use this API to add a collaborator to a repository that's owned by an organization that hasn't had [improved organization permissions](https://github.com/blog/2020-improved-organization-permissions) enabled yet, you will get a `422` error response.
+
+{{/tip}}
+
+{% endif %}
+
+{% else %}
+
+<%= fetch_content(:put_content_length) %>
+
+{% endif %}
### Response
<%= headers 204 %>
-## Remove collaborator
+### Response with preview media type
+
+<%= headers 201 %>
+<%= json(:repository_invitation) %>
+
+## Remove user as a collaborator
- DELETE /repos/:user/:repo/collaborators/:user
+ DELETE /repos/:owner/:repo/collaborators/:username
### Response
diff --git a/content/v3/repos/comments.md b/content/v3/repos/comments.md
index 5b7e7b1cba..e6f9bb5050 100644
--- a/content/v3/repos/comments.md
+++ b/content/v3/repos/comments.md
@@ -1,83 +1,144 @@
---
-title: Repo Comments | GitHub API
+title: Comments
---
-# Repo Comments API
+# Comments
+
+{:toc}
## List commit comments for a repository
-Commit Comments leverage [these](#custom-mime-types) custom mime types. You can
-read more about the use of mime types in the API [here](/v3/mime/).
+Commit Comments use [these custom media types](#custom-media-types). You can
+read more about the use of media types in the API [here](/v3/media/).
Comments are ordered by ascending ID.
- GET /repos/:user/:repo/comments
+ GET /repos/:owner/:repo/comments
### Response
-<%= headers 200 %>
+<%= headers 200, :pagination => default_pagination_rels %>
<%= json(:commit_comment) { |h| [h] } %>
+{% if page.version == 'dotcom' %}
+#### Reactions summary
+
+{{#tip}}
+
+
+
+ An additional `reactions` object in the commit comment payload is currently available for developers to preview.
+ During the preview period, the APIs may change without advance notice.
+ Please see the [blog post](/changes/2016-05-12-reactions-api-preview) for full details.
+
+ To access the API you must provide a custom [media type](/v3/media) in the `Accept` header:
+
+ application/vnd.github.squirrel-girl-preview
+
+ The `reactions` key will have the following payload where `url` can be used to construct the API location for [listing and creating](/v3/reactions) reactions.
+
+{{/tip}}
+<%= json :commit_comment_reaction_summary %>
+{% endif %}
+
## List comments for a single commit
- GET /repos/:user/:repo/commits/:sha/comments
+ GET /repos/:owner/:repo/commits/:ref/comments
### Response
-<%= headers 200 %>
+<%= headers 200, :pagination => default_pagination_rels %>
<%= json(:commit_comment) { |h| [h] } %>
-## Create a commit comment
+{% if page.version == 'dotcom' %}
+#### Reactions summary
- POST /repos/:user/:repo/commits/:sha/comments
+{{#tip}}
-### Input
+
+
+ An additional `reactions` object in the commit comment payload is currently available for developers to preview.
+ During the preview period, the APIs may change without advance notice.
+ Please see the [blog post](/changes/2016-05-12-reactions-api-preview) for full details.
+
+ To access the API you must provide a custom [media type](/v3/media) in the `Accept` header:
-body
-: _Required_ **string**
+ application/vnd.github.squirrel-girl-preview
-path
-: _Required_ **string** - Relative path of the file to comment on.
+ The `reactions` key will have the following payload where `url` can be used to construct the API location for [listing and creating](/v3/reactions) reactions.
-position
-: _Required_ **number** - Line index in the diff to comment on.
+{{/tip}}
+<%= json :commit_comment_reaction_summary %>
+{% endif %}
-line
-: _Optional_ **number** - Line number in the file to comment on. Defaults to 1.
+## Create a commit comment
+
+ POST /repos/:owner/:repo/commits/:sha/comments
+
+### Input
+
+Name | Type | Description
+-----|------|--------------
+`body`|`string` | **Required**. The contents of the comment.
+`path`|`string` | Relative path of the file to comment on.
+`position`|`integer` | Line index in the diff to comment on.
+`line`|`integer` | **Deprecated**. Use **position** parameter instead. Line number in the file to comment on.
#### Example
<%= json \
- :body => 'Nice change',
- :commit_id => '6dcb09b5b57875f334f61aebed695e2e4193db5e',
- :line => 1,
+ :body => 'Great stuff',
:path => 'file1.txt',
- :position => 4
+ :position => 4,
+ :line => nil
%>
### Response
-<%= headers 201, :Location => "https://api.github.com/user/repo/comments/1" %>
+<%= headers 201, :Location => get_resource(:commit_comment)['url'] %>
<%= json :commit_comment %>
## Get a single commit comment
- GET /repos/:user/:repo/comments/:id
+ GET /repos/:owner/:repo/comments/:id
### Response
<%= headers 200 %>
<%= json :commit_comment %>
+{% if page.version == 'dotcom' %}
+#### Reactions summary
+
+{{#tip}}
+
+
+
+ An additional `reactions` object in the commit comment payload is currently available for developers to preview.
+ During the preview period, the APIs may change without advance notice.
+ Please see the [blog post](/changes/2016-05-12-reactions-api-preview) for full details.
+
+ To access the API you must provide a custom [media type](/v3/media) in the `Accept` header:
+
+ application/vnd.github.squirrel-girl-preview
+
+ The `reactions` key will have the following payload where `url` can be used to construct the API location for [listing and creating](/v3/reactions) reactions.
+
+{{/tip}}
+<%= json :commit_comment_reaction_summary %>
+{% endif %}
+
## Update a commit comment
- PATCH /repos/:user/:repo/comments/:id
+ PATCH /repos/:owner/:repo/comments/:id
### Input
-body
-: _Required_ **string**
+Name | Type | Description
+-----|------|--------------
+`body`|`string` | **Required**. The contents of the comment
+
#### Example
@@ -88,20 +149,20 @@ body
### Response
<%= headers 200 %>
-<%= json :commit_comment %>
+<%= json(:commit_comment) { |h| h.merge('body' => 'Nice change') } %>
## Delete a commit comment
- DELETE /repos/:user/:repo/comments/:id
+ DELETE /repos/:owner/:repo/comments/:id
### Response
<%= headers 204 %>
-## Custom Mime Types
+## Custom media types
-These are the supported mime types for commit comments. You can read more
-about the use of mime types in the API [here](/v3/mime/).
+These are the supported media types for commit comments. You can read more
+about the use of media types in the API [here](/v3/media/).
application/vnd.github-commitcomment.raw+json
application/vnd.github-commitcomment.text+json
diff --git a/content/v3/repos/commits.md b/content/v3/repos/commits.md
index ab940d93fa..20c2ee69c3 100644
--- a/content/v3/repos/commits.md
+++ b/content/v3/repos/commits.md
@@ -1,49 +1,141 @@
---
-title: Repo Commits | GitHub API
+title: Commits
---
-# Repo Commits API
+# Commits
+
+{:toc}
The Repo Commits API supports listing, viewing, and comparing commits in a repository.
## List commits on a repository
- GET /repos/:user/:repo/commits
-
-_A special note on pagination:_ Due to the way Git works, commits are paginated
-based on SHA instead of page number. Please follow the link headers as outlined
-in the [pagination overview](http://developer.github.com/v3/#pagination)
-instead of constructing page links yourself.
+ GET /repos/:owner/:repo/commits
### Parameters
-sha
-: _Optional_ **string** - Sha or branch to start listing commits from.
+Name | Type | Description
+-----|------|--------------
+`sha`|`string` | SHA or branch to start listing commits from. Default: the repository’s default branch (usually `master`).
+`path`|`string` | Only commits containing this file path will be returned.
+`author`|`string` | GitHub login or email address by which to filter by commit author.
+`since`|`string` | Only commits after this date will be returned. This is a timestamp in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.
+`until`|`string` | Only commits before this date will be returned. This is a timestamp in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.
-path
-: _Optional_ **string** - Only commits containing this file path
-will be returned.
### Response
-<%= headers 200 %>
+<%= headers 200, :pagination => default_pagination_rels %>
<%= json(:commit) { |h| [h] } %>
## Get a single commit
- GET /repos/:user/:repo/commits/:sha
+ GET /repos/:owner/:repo/commits/:sha
### Response
+Diffs with binary data will have no 'patch' property. Pass the
+appropriate [media type](/v3/media/#commits-commit-comparison-and-pull-requests) to fetch diff and
+patch formats.
+
<%= headers 200 %>
<%= json(:full_commit) %>
-Note: Diffs with binary data will have no 'patch' property.
+## Get the SHA-1 of a commit reference
+
+Users with read access can get the SHA-1 of a commit reference:
+
+ GET /repos/:owner/:repo/commits/:ref
+
+To access the API you must provide a custom [media type](/v3/media) in the `Accept` header:
+
+ application/vnd.github.VERSION.sha
+
+To check if a remote reference's SHA-1 is the same as your local reference's SHA-1, make a `GET` request and provide the current SHA-1 for the local reference as the ETag.
+
+### Response
+
+The SHA-1 of the commit reference.
+
+<%= headers 200 %>
+
+814412cfbd631109df337e16c807207e78c0d24e
+
## Compare two commits
- GET /repos/:user/:repo/compare/:base...:head
+ GET /repos/:owner/:repo/compare/:base...:head
+
+Both `:base` and `:head` must be branch names in `:repo`. To compare branches across other repositories in the same network as `:repo`, use the format `:branch`. For example:
+
+ GET /repos/:owner/:repo/compare/hubot:branchname...octocat:branchname
### Response
+The response from the API is equivalent to running the `git log base..head` command; however, commits are returned in reverse chronological order.
+
+Pass the appropriate [media type](/v3/media/#commits-commit-comparison-and-pull-requests) to fetch diff and patch formats.
+
<%= json :commit_comparison %>
+
+### 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 [Commit List API](/v3/repos/commits/#list-commits-on-a-repository) 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.
+
+{% if page.version == 'dotcom' %}
+
+## Commit signature verification
+
+{{#tip}}
+
+Commit response objects including signature verification data are currently available for developers to preview.
+During the preview period, the object formats may change without advance notice.
+Please see the [blog post](/changes/2016-04-04-git-signing-api-preview) for full details.
+
+To receive signature verification data in commit objects you must provide a custom [media type](/v3/media) in the `Accept` header:
+
+ application/vnd.github.cryptographer-preview
+
+{{/tip}}
+
+ GET /repos/:owner/:repo/commits/:sha
+
+### Response
+
+<%= headers 200 %>
+<%= json(:signed_commit) %>
+
+### The `verification` object
+
+The response will include a `verification` field whose value is an object describing the result of verifying the commit's signature. The following fields are included in the `verification` object:
+
+Name | Type | Description
+-----|------|--------------
+`verified`|`boolean` | Does GitHub consider the signature in this commit to be verified?
+`reason`|`string` | The reason for `verified` value. Possible values and their meanings are enumerated in the table below.
+`signature`|`string` | The signature that was extracted from the commit.
+`payload`|`string` | The value that was signed.
+
+#### The `reason` field
+
+The following are possible `reason`s that may be included in the `verification` object:
+
+Value | Description
+------|------------
+`expired_key` | The key that made the signature is expired.
+`not_signing_key` | The "signing" flag is not among the usage flags in the GPG key that made the signature.
+`gpgverify_error` | There was an error communicating with the signature-verification service.
+`gpgverify_unavailable` | The signature-verification service is currently unavailable.
+`unsigned` | The object does not include a signature.
+`unkown_signature_type` | A non-PGP signature was found in the commit.
+`no_user` | No user was associated with the `committer` email address in the commit.
+`unverified_email` | The `committer` email address in the commit was associated with a user, but the email address is not verified on her/his account.
+`bad_email` | The `committer` email address in the commit is not included in the identities of the PGP key that made the signature.
+`unknown_key` | The key that made the signature has not been registered with any user's account.
+`malformed_signature` | There was an error parsing the signature.
+`invalid` | The signature could not be cryptographically verified using the key whose key-id was found in the signature.
+`valid` | None of the above errors applied, so the signature is considered to be verified.
+
+{% endif %}
diff --git a/content/v3/repos/contents.md b/content/v3/repos/contents.md
index 47d0377f54..d1d352e335 100644
--- a/content/v3/repos/contents.md
+++ b/content/v3/repos/contents.md
@@ -1,22 +1,27 @@
---
-title: Repo Contents | GitHub API
+title: Contents
---
-# Repo Contents API
+# Contents
+
+{:toc}
These API methods let you retrieve the contents of files within a repository as
-Base64 encoded content. See [Mime types](/v3/mime) for requesting raw or other formats.
+Base64 encoded content. See [media types](#custom-media-types) for requesting the raw format or rendered HTML (when supported).
## Get the README
This method returns the preferred README for a repository.
- GET /repos/:user/:repo/readme
+ GET /repos/:owner/:repo/readme
+
+READMEs support [custom media types](#custom-media-types) for retrieving the raw content or rendered HTML.
### Parameters
-ref
-: _Optional_ **string** - The String name of the Commit/Branch/Tag. Defaults to `master`.
+Name | Type | Description
+-----|------|--------------
+`ref`|`string` | The name of the commit/branch/tag. Default: the repository’s default branch (usually `master`)
### Response
@@ -25,22 +30,214 @@ ref
## Get contents
-This method returns the contents of any file or directory in a repository.
+This method returns the contents of a file or directory in a repository.
+
+ GET /repos/:owner/:repo/contents/:path
+
+Files and symlinks support [a custom media type](#custom-media-types) for retrieving the raw content or rendered HTML (when supported).
+All content types support [a custom media type](#custom-media-types) to ensure the content is returned in a consistent object format.
+
+{{#tip}}
+
+**Note**:
- GET /repos/:user/:repo/contents/:path
+- To get a repository's contents recursively, you can [recursively get the tree](/v3/git/trees/).
+- This API has an upper limit of 1,000 files for a directory. If you need to retrieve more files, use the [Git Trees API](/v3/git/trees/#get-a-tree).
+- This API supports files up to 1 megabyte in size.
+
+{{/tip}}
### Parameters
-path
-: _Optional_ **string** - The content path.
+Name | Type | Description
+-----|------|--------------
+`path`|`string` | The content path.
+`ref`|`string` | The name of the commit/branch/tag. Default: the repository’s default branch (usually `master`)
+
+### Response if content is a file
+
+<%= headers 200 %>
+<%= json :readme_content %>
+
+### Response if 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 [for backwards compatibility purposes](https://github.com/github/developer.github.com/commit/1b329b04cece9f3087faa7b1e0382317a9b93490).
+In the next major version of the API, the type will be returned as "submodule".
+
+<%= headers 200 %>
+<%= json :directory_content %>
+
+### Response if content is a symlink
+
+If the requested `:path` points 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 above](#response-if-content-is-a-file)).
+
+Otherwise, the API responds with an object describing the symlink itself:
+
+<%= headers 200 %>
+<%= json :symlink_content %>
+
+### Response if content is a submodule
-ref
-: _Optional_ **string** - The String name of the Commit/Branch/Tag. Defaults to `master`.
+The `submodule_git_url` identifies the location of the submodule repository, and the `sha` identifies 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_url` and `_links["git"]`) and the github.com URLs (`html_url` and `_links["html"]`) will have null values.
+
+<%= headers 200 %>
+<%= json :submodule_content %>
+
+## Create a file
+
+This method creates a new file in a repository
+
+ PUT /repos/:owner/:repo/contents/:path
+
+### Parameters
+
+Name | Type | Description
+-----|------|-------------
+`path`|`string` | **Required**. The content path.
+`message`|`string` | **Required**. The commit message.
+`content`|`string` | **Required**. The new file content, Base64 encoded.
+`branch` | `string` | The branch name. Default: the repository’s default branch (usually `master`)
+
+### Optional Parameters
+
+You can provide an additional `committer` parameter, which is an object containing
+information about the committer. Or, you can provide an `author` parameter, which
+is an object containing information about the author.
+
+The `author` section is optional and is filled in with the `committer`
+information if omitted. If the `committer` information is omitted, the authenticated
+user's information is used.
+
+You must provide values for both `name` and `email`, whether you choose to use
+`author` or `committer`. Otherwise, you'll receive a `422` status code.
+
+Both the `author` and `committer` parameters have the same keys:
+
+Name | Type | Description
+-----|------|--------------
+`name`|`string` | The name of the author (or committer) of the commit
+`email`|`string` | The email of the author (or committer) of the commit
+
+### Example Input
+
+<%= json "message" => "my commit message", \
+ "committer" => \
+ {"name" => "Scott Chacon", "email" => "schacon@gmail.com" }, \
+ "content" => "bXkgbmV3IGZpbGUgY29udGVudHM=" %>
+
+### Response
+
+<%= headers 201 %>
+<%= json :content_crud %>
+
+## Update a file
+
+This method updates a file in a repository
+
+ PUT /repos/:owner/:repo/contents/:path
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`path`|`string` | **Required**. The content path.
+`message`|`string` | **Required**. The commit message.
+`content`|`string` | **Required**. The updated file content, Base64 encoded.
+`sha` | `string` | **Required**. The blob SHA of the file being replaced.
+`branch` | `string` | The branch name. Default: the repository’s default branch (usually `master`)
+
+### Optional Parameters
+
+You can provide an additional `committer` parameter, which is an object containing
+information about the committer. Or, you can provide an `author` parameter, which
+is an object containing information about the author.
+
+The `author` section is optional and is filled in with the `committer`
+information if omitted. If the `committer` information is omitted, the authenticated
+user's information is used.
+
+You must provide values for both `name` and `email`, whether you choose to use
+`author` or `committer`. Otherwise, you'll receive a `422` status code.
+
+Both the `author` and `committer` parameters have the same keys:
+
+Name | Type | Description
+-----|------|--------------
+`name`|`string` | The name of the author (or committer) of the commit
+`email`|`string` | The email of the author (or committer) of the commit
+
+### Example Input
+
+<%= json "message" => "my commit message", \
+ "committer" => \
+ {"name" => "Scott Chacon", "email" => "schacon@gmail.com" }, \
+ "content" => "bXkgdXBkYXRlZCBmaWxlIGNvbnRlbnRz", \
+ "sha" => "329688480d39049927147c162b9d2deaf885005f" %>
### Response
<%= headers 200 %>
-<%= json :readme_content %>
+<%= json :content_crud %>
+
+## Delete a file
+
+This method deletes a file in a repository
+
+ DELETE /repos/:owner/:repo/contents/:path
+
+### Parameters
+
+
+Name | Type | Description
+-----|------|--------------
+`path`|`string` | **Required**. The content path.
+`message`|`string` | **Required**. The commit message.
+`sha` | `string` | **Required**. The blob SHA of the file being replaced.
+`branch` | `string` | The branch name. Default: the repository’s default branch (usually `master`)
+
+### Optional Parameters
+
+You can provide an additional `committer` parameter, which is an object containing
+information about the committer. Or, you can provide an `author` parameter, which
+is an object containing information about the author.
+
+The `author` section is optional and is filled in with the `committer`
+information if omitted. If the `committer` information is omitted, the authenticated
+user's information is used.
+
+You must provide values for both `name` and `email`, whether you choose to use
+`author` or `committer`. Otherwise, you'll receive a `422` status code.
+
+Both the `author` and `committer` parameters have the same keys:
+
+Name | Type | Description
+-----|------|--------------
+`name`|`string` | The name of the author (or committer) of the commit
+`email`|`string` | The email of the author (or committer) of the commit
+
+### Example Input
+
+<%= json "message" => "my commit message", \
+ "committer" => \
+ {"name" => "Scott Chacon", "email" => "schacon@gmail.com" }, \
+ "sha" => "329688480d39049927147c162b9d2deaf885005f" %>
+
+### Response
+
+<%= headers 200 %>
+<%=
+ json :content_crud do |response|
+ response['content'] = nil
+ response
+ end
+%>
## Get archive link
@@ -51,26 +248,46 @@ to make a second `GET` request.
*Note*: For private repositories, these links are temporary and expire quickly.
- GET /repos/:user/:repo/:archive_format/:ref
+ GET /repos/:owner/:repo/:archive_format/:ref
### Parameters
-archive_format
-: Either `tarball` or `zipball`
+Name | Type | Description
+-----|------|--------------
+`archive_format`|`string` | Can be either `tarball` or `zipball`. Default: `tarball`
+`ref`| `string` | A valid Git reference. Default: the repository’s default branch (usually `master`)
-ref
-: _Optional_ **string** - valid Git reference, defaults to `master`
### Response
-<%= headers 302, :Location => 'http://github.com/me/myprivate/tarball/master?SSO=thistokenexpires' %>
+<%= headers 302, :Location => 'https://codeload.github.com/me/myprivate/legacy.zip/master?login=me&token=thistokenexpires' %>
To follow redirects with curl, use the `-L` switch:
-
-curl -L https://api.github.com/repos/pengwynn/octokit/tarball > octokit.tar.gz
+``` command-line
+$curl -L https://api.github.com/repos/octokit/octokit.rb/tarball > octokit.tar.gz
+
+> % Total % Received % Xferd Average Speed Time Time Time Current
+> Dload Upload Total Spent Left Speed
+> 100 206k 100 206k 0 0 146k 0 0:00:01 0:00:01 --:--:-- 790k
+```
+
+## Custom media types
+
+[READMEs](#get-the-readme), [files](#get-contents), and [symlinks](#get-contents) support the following custom media types:
+
+ application/vnd.github.VERSION.raw
+ application/vnd.github.VERSION.html
+
+Use the `.raw` media type to retrieve the contents of the file.
+
+For markup files such as Markdown or AsciiDoc, you can retrieve the rendered HTML using the `.html` media type. Markup languages are rendered to HTML using our open-source [Markup library](https://github.com/github/markup).
+
+[All objects](#get-contents) support the following custom media type:
+
+ application/vnd.github.VERSION.object
+
+Use the `object` media type parameter to retrieve the contents in a consistent object format regardless of the content type. For example, instead of an array of objects
+for a directory, the response will be an object with an `entries` attribute containing the array of objects.
- % Total % Received % Xferd Average Speed Time Time Time Current
- Dload Upload Total Spent Left Speed
-100 206k 100 206k 0 0 146k 0 0:00:01 0:00:01 --:--:-- 790k
-
+You can read more about the use of media types in the API [here](/v3/media/).
diff --git a/content/v3/repos/deployments.md b/content/v3/repos/deployments.md
new file mode 100644
index 0000000000..34e2574621
--- /dev/null
+++ b/content/v3/repos/deployments.md
@@ -0,0 +1,277 @@
+---
+title: Deployments
+---
+
+# Deployments
+
+{:toc}
+
+Deployments are a request for a specific ref (branch, SHA, tag) to be deployed.
+GitHub then dispatches deployment events that external services can listen for
+and act on. This enables developers and organizations to build loosely-coupled
+tooling around deployments, without having to worry about implementation
+details of delivering different types of applications (e.g., web, native).
+
+Deployment Statuses allow external services to mark deployments with a
+'success', 'failure', 'error', or 'pending' state, which can then be consumed
+by any system listening for `deployment_status` events.
+
+Deployment Statuses can also include an optional `description` and `target_url`, and
+we highly recommend providing them as they make deployment statuses much more
+useful. The `target_url` would be the full URL to the deployment output, and
+the `description` would be the high level summary of what happened with the
+deployment.
+
+Deployments and Deployment Statuses both have associated
+[repository events](/v3/activity/events/types/#deploymentevent) when
+they're created. This allows webhooks and 3rd party integrations to respond to
+deployment requests as well as update the status of a deployment as progress is
+made.
+
+Below is a simple sequence diagram for how these interactions would work.
+
+```
++---------+ +--------+ +-----------+ +-------------+
+| Tooling | | GitHub | | 3rd Party | | Your Server |
++---------+ +--------+ +-----------+ +-------------+
+ | | | |
+ | Create Deployment | | |
+ |--------------------->| | |
+ | | | |
+ | Deployment Created | | |
+ |<---------------------| | |
+ | | | |
+ | | Deployment Event | |
+ | |---------------------->| |
+ | | | SSH+Deploys |
+ | | |-------------------->|
+ | | | |
+ | | Deployment Status | |
+ | |<----------------------| |
+ | | | |
+ | | | Deploy Completed |
+ | | |<--------------------|
+ | | | |
+ | | Deployment Status | |
+ | |<----------------------| |
+ | | | |
+```
+
+Keep in mind that GitHub is never actually accessing your servers. It's up to
+your 3rd party integration to interact with deployment events. This allows for
+[GitHub integrations](https://github.com/integrations) as
+well as running your own systems depending on your use case. Multiple systems
+can listen for deployment events, and it's up to each of those systems to
+decide whether or not they're responsible for pushing the code out to your
+servers, building native code, etc.
+
+Note that the `repo_deployment` [OAuth scope](/v3/oauth/#scopes) grants
+targeted access to Deployments and Deployment Statuses **without**
+granting access to repository code, while the `repo` scope grants permission to code
+as well.
+
+## List Deployments
+
+Simple filtering of deployments is available via query parameters:
+
+ GET /repos/:owner/:repo/deployments
+
+Name | Type | Description
+-----|------|--------------
+`sha`|`string` | The SHA that was recorded at creation time. Default: `none`
+`ref`|`string` | The name of the ref. This can be a branch, tag, or SHA. Default: `none`
+`task`|`string` | The name of the task for the deployment. e.g. `deploy` or `deploy:migrations`. Default: `none`
+`environment`|`string` | The name of the environment that was deployed to. e.g. `staging` or `production`. Default: `none`
+
+### Response
+
+<%= headers 200, :pagination => default_pagination_rels %>
+<%= json(:deployment) { |h| [h] } %>
+
+## Create a Deployment
+
+Deployments offer a few configurable parameters with sane defaults.
+
+The `ref` parameter can be any named branch, tag, or SHA. At GitHub we often
+deploy branches and verify them before we merge a pull request.
+
+The `environment` parameter allows deployments to be issued to different
+runtime environments. Teams often have multiple environments for verifying
+their applications, like 'production', 'staging', and 'qa'. This allows for
+easy tracking of which environments had deployments requested. The default
+environment is 'production'.
+
+The `auto_merge` parameter 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, [commit statuses](/v3/repos/statuses) for every submitted context
+must be in a 'success' state. The `required_contexts` parameter allows you to
+specify a subset of contexts that must be "success", 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 `payload` parameter 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 `task` parameter is used by the deployment system to allow different
+execution paths. In the web world this might be 'deploy:migrations' to run
+schema changes on the system. In the compiled world this could be a flag to
+compile an application with debugging enabled.
+
+Users with `repo` or `repo_deployment` scopes can create a deployment for a given ref:
+
+ POST /repos/:owner/:repo/deployments
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`ref`|`string`| **Required**. The ref to deploy. This can be a branch, tag, or SHA.
+`task`|`string`| Optional parameter to specify a task to execute, e.g. `deploy` or `deploy:migrations`. Default: `deploy`
+`auto_merge`|`boolean`| Optional parameter to merge the default branch into the requested ref if it is behind the default branch. Default: `true`
+`required_contexts`|`Array`| Optional array of status contexts verified against commit status checks. If this parameter is omitted from the parameters then all unique contexts will be verified before a deployment is created. To bypass checking entirely pass an empty array. Defaults to all unique contexts.
+`payload`|`string` | Optional JSON payload with extra information about the deployment. Default: `""`
+`environment`|`string` | Optional name for the target deployment environment (e.g., production, staging, qa). Default: `"production"`
+`description`|`string` | Optional short description. Default: `""`
+{% if page.version == 'dotcom' || page.version > 2.6 %} `transient_environment` | `boolean` | Optionally specifies if the given environment is specific to the deployment and will no longer exist at some point in the future. Default: `false` **This parameter requires a custom media type to be specified. Please see more in the alert below.**{% endif %}
+{% if page.version == 'dotcom' || page.version > 2.6 %} `production_environment` | `boolean` | Optionally specifies if the given environment is one that end-users directly interact with. Default: `true` when `environment` is `"production"` and `false` otherwise. **This parameter requires a custom media type to be specified. Please see more in the alert below.**{% endif %}
+
+{% if page.version == 'dotcom' || page.version > 2.6 %}
+{{#tip}}
+
+The new `transient_environment` and `production_environment` parameters are currently available for developers to preview. During the preview period, the API may change without advance notice. Please see the [blog post][blog-post] for full details.
+
+To access the API during the preview period, you must provide a custom [media type](/v3/media) in the `Accept` header:
+
+```
+application/vnd.github.ant-man-preview+json
+```
+
+{{/tip}}
+
+{% endif %}
+
+#### Simple Example
+
+A simple example putting the user and room into the payload to notify back to
+chat networks.
+
+<%= json \
+ :ref => "topic-branch",
+ :payload => "{\"user\":\"atmos\",\"room_id\":123456}",
+ :description => "Deploying my sweet branch"
+%>
+
+### Successful response
+
+<%= headers 201, :Location => get_resource(:deployment)['url'] %>
+<%= json :deployment %>
+
+#### Advanced Example
+
+A more advanced example specifying required commit statuses and bypassing auto-merging.
+
+<%= json \
+ :ref => "topic-branch",
+ :auto_merge => false,
+ :payload => "{\"user\":\"atmos\",\"room_id\":123456}",
+ :description => "Deploying my sweet branch",
+ :required_contexts => ["ci/janky", "security/brakeman"]
+%>
+
+### Successful response
+
+<%= headers 201, :Location => get_resource(:deployment)['url'] %>
+<%= json :deployment %>
+
+### Merge conflict response
+
+This error happens when the `auto_merge` option is enabled and when the default branch (in this case `master`), can't be merged into the branch that's being deployed (in this case `topic-branch`), due to merge conflicts.
+
+<%= headers 409 %>
+<%= json({ :message => "Conflict merging master into topic-branch" }) %>
+
+### Failed commit status checks
+
+This error happens when the `required_contexts` parameter indicates that one or more contexts need to have a `success` status for the commit to be deployed, but one or more of the required contexts do not have a state of `success`.
+
+<%= headers 409 %>
+<%= json({ :message => "Conflict: Commit status checks failed for topic-branch." }) %>
+
+## Update a Deployment
+
+Once a deployment is created, it cannot be updated. Information relating to the
+success or failure of a deployment is handled through Deployment Statuses.
+
+# Deployment Statuses
+
+## List Deployment Statuses
+
+Users with pull access can view deployment statuses for a deployment:
+
+ GET /repos/:owner/:repo/deployments/:id/statuses
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`id` |`integer`| **Required**. The Deployment ID to list the statuses from.
+
+
+### Response
+
+<%= headers 200, :pagination => default_pagination_rels %>
+<%= json(:deployment_status) { |h| h.delete("deployment"); [h] } %>
+
+## Create a Deployment Status
+
+Users with push access can create deployment statuses for a given deployment:
+
+ POST /repos/:owner/:repo/deployments/:id/statuses
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`state`|`string` | **Required**. The state of the status. Can be one of `pending`, `success`, `error`, {% if page.version == 'dotcom' || page.version > 2.6 %} `inactive`, {% endif %}or `failure` **The `inactive` state requires a custom media type to be specified. Please see more in the alert below.**.
+`target_url`|`string` | The target URL to associate with this status. This URL should contain output to keep the user updated while the task is running or serve as historical information for what happened in the deployment. Default: `""`
+{% if page.version == 'dotcom' || page.version > 2.6 %}`log_url`|`string` | This is functionally equivalent to `target_url`. We will continue accept `target_url` to support legacy uses, but we recommend modifying this to the new name to avoid confusion. Default: `""` **This parameter requires a custom media type to be specified. Please see more in the alert below.**{% endif %}
+`description`|`string` | A short description of the status. Maximum length of 140 characters. Default: `""`
+{% if page.version == 'dotcom' || page.version > 2.6 %}`environment_url`|`string`| Optionally set the URL for accessing your environment. Default: `""` **This parameter requires a custom media type to be specified. Please see more in the alert below.**{% endif %}
+{% if page.version == 'dotcom' || page.version > 2.6 %}`auto_inactive`|`boolean`| Optional parameter to add a new `inactive` status to all non-transient, non-production environment deployments with the same repository and environment name as the created status's deployment. Default: `true` **This parameter requires a custom media type to be specified. Please see more in the alert below.**{% endif %}
+
+{% if page.version == 'dotcom' || page.version > 2.6 %}
+
+{{#tip}}
+
+The new `inactive` state, rename of the `target_url` parameter to `log_url` and new `environment_url` and `auto_inactive` parameters are currently available for developers to preview. During the preview period, the API may change without advance notice. Please see the [blog post][blog-post] for full details.
+
+To access the API during the preview period, you must provide a custom [media type](/v3/media) in the `Accept` header:
+
+```
+application/vnd.github.ant-man-preview+json
+```
+
+{{/tip}}
+
+{% endif %}
+
+#### Example
+
+<%= json \
+ :state => "success",
+ :target_url => "https://example.com/deployment/42/output",
+ :description => "Deployment finished successfully."
+%>
+
+### Response
+
+<%= headers 201, :Location => get_resource(:deployment_status)['url'] %>
+<%= json :deployment_status %>
+
+[blog-post]: /changes/2016-04-06-deployment-and-deployment-status-enhancements
diff --git a/content/v3/repos/downloads.md b/content/v3/repos/downloads.md
index a49fee2614..c5f027a106 100644
--- a/content/v3/repos/downloads.md
+++ b/content/v3/repos/downloads.md
@@ -1,124 +1,46 @@
---
-title: Repo Downloads | GitHub API
+title: Downloads
---
-# Repo Downloads API
+# Downloads
+
+{:toc}
+
+### Downloads API is Deprecated
+
+{{#warning}}
+
+The Downloads API (described below) was deprecated on December 11, 2012. It will be removed at a future date.
+
+We recommend using Releases instead.
+
+{{/warning}}
The downloads API is for package downloads only. If you want to get
-source tarballs you should use [this](/repos/contents/#get-archive-link)
+source tarballs you should use [this](/v3/repos/contents/#get-archive-link)
instead.
## List downloads for a repository
- GET /repos/:user/:repo/downloads
+ GET /repos/:owner/:repo/downloads
### Response
-<%= headers 200 %>
+<%= headers 200, :pagination => default_pagination_rels %>
<%= json(:download) { |h| [h] } %>
## Get a single download
- GET /repos/:user/:repo/downloads/:id
+ GET /repos/:owner/:repo/downloads/:id
### Response
<%= headers 200 %>
<%= json :download %>
-## Create a new download (Part 1: Create the resource)
-
-Creating a new download is a two step process. You must first create a
-new download resource.
-
- POST /repos/:user/:repo/downloads
-
-### Input
-
-name
-: _Required_ **string**
-
-size
-: _Required_ **number** - Size of file in bytes.
-
-description
-: _Optional_ **string**
-
-content\_type
-: _Optional_ **string**
-
-<%= json \
- :name => "new_file.jpg",
- :size => 114034,
- :description => "Latest release",
- :content_type => "text/plain"
-%>
-
-### Response
-
-<%= headers 201, :Location => "https://api.github.com/user/repo/downloads/1" %>
-<%= json :create_download %>
-
-## Create a new download (Part 2: Upload file to s3)
-
-Now that you have created the download resource, you can use the
-information in the response to upload your file to s3. This can be done
-with a `POST` to the `s3_url` you got in the create response. Here is a
-brief example using curl:
-
- curl \
- -F "key=downloads/octocat/Hello-World/new_file.jpg" \
- -F "acl=public-read" \
- -F "success_action_status=201" \
- -F "Filename=new_file.jpg" \
- -F "AWSAccessKeyId=1ABCDEF..." \
- -F "Policy=ewogIC..." \
- -F "Signature=mwnF..." \
- -F "Content-Type=image/jpeg" \
- -F "file=@new_file.jpg" \
- https://github.s3.amazonaws.com/
-
-NOTES
-
-The order in which you pass these fields matters! Follow the order shown
-above exactly. All parameters shown are required and if you excluded or
-modify them your upload will fail because the values are hashed and signed
-by the policy.
-
-key
-: Value of `path` field in the response.
-
-acl
-: Value of `acl` field in the response.
-
-success_action_status
-: 201, or whatever you want to get back.
-
-Filename
-: Value of `name` field in the response.
-
-AWSAccessKeyId
-: Value of `accesskeyid` field in the response.
-
-Policy
-: Value of `policy` field in the response.
-
-Signature
-: Value of `signature` field in the response.
-
-Content-Type
-: Value of `mime_type` field in the response.
-
-file
-: Local file. Example assumes the file existing in the directory where
-you are running the curl command. Yes, the `@` matters.
-
-More information about using the REST API to interact with s3 can
-be found [here](http://docs.amazonwebservices.com/AmazonS3/latest/API/).
-
## Delete a download
- DELETE /repos/:user/:repo/downloads/:id
+ DELETE /repos/:owner/:repo/downloads/:id
### Response
diff --git a/content/v3/repos/forks.md b/content/v3/repos/forks.md
index 5e5ab1bc9c..27c1c98f89 100644
--- a/content/v3/repos/forks.md
+++ b/content/v3/repos/forks.md
@@ -1,40 +1,45 @@
---
-title: Repo Forks | GitHub API
+title: Forks
---
-# Repo Forks API
+# Forks
+
+{:toc}
## List forks
- GET /repos/:user/:repo/forks
+ GET /repos/:owner/:repo/forks
### Parameters
-sort
-: `newest`, `oldest`, `watchers`, default: `newest`.
+Name | Type | Description
+-----|------|-------------
+`sort`|`string` | The sort order. Can be either `newest`, `oldest`, or `stargazers`. Default: `newest`
+
### Response
-<%= headers 200 %>
-<%= json(:repo) { |h| [h] } %>
+<%= headers 200, :pagination => default_pagination_rels %>
+<%= json(:repo) { |h| h['fork'] = true; [h] } %>
## Create a fork
Create a fork for the authenticated user.
- POST /repos/:user/:repo/forks
+ POST /repos/:owner/:repo/forks
### Parameters
-org
-: _Optional_ **String** - Organization login. The repository will be
-forked into this organization.
+Name | Type | Description
+-----|------|-------------
+`organization`|`string` | Optional parameter to specify the organization name if forking into an organization.
+
### Response
Forking a Repository happens asynchronously. Therefore, you may have to wait
a short period before accessing the git objects. If this takes longer than
-5 minutes, be sure to [contact Support](https://github.com/contact).
+5 minutes, be sure to [contact Support](https://github.com/contact?form[subject]=APIv3).
<%= headers 202 %>
-<%= json :repo %>
+<%= json(:repo) { |h| h['fork'] = true; h } %>
diff --git a/content/v3/repos/hooks.md b/content/v3/repos/hooks.md
index c5acc6cc07..2208924598 100644
--- a/content/v3/repos/hooks.md
+++ b/content/v3/repos/hooks.md
@@ -1,53 +1,29 @@
---
-title: Repo Hooks | GitHub API
+title: Repository Webhooks
---
-# Repo Hooks API
+# Webhooks
-The Repository Hooks API manages the post-receive web and service hooks
-for a repository. There are two main APIs to manage these hooks: a JSON
-HTTP API, and [PubSubHubbub](#pubsubhubbub).
+{:toc}
-Active hooks can be configured to trigger for one or more events.
-The default event is `push`. The available events are:
+The Repository Webhooks API allows repository admins to manage the post-receive
+hooks for a repository. Webhooks can be managed using the JSON HTTP API,
+or the [PubSubHubbub API](#pubsubhubbub).
-* `push` - Any git push to a Repository.
-* `issues` - Any time an Issue is opened or closed.
-* `issue_comment` - Any time an Issue is commented on.
-* `commit_comment` - Any time a Commit is commented on.
-* `pull_request` - Any time a Pull Request is opened, closed, or
- synchronized (updated due to a new push in the branch that the pull
-request is tracking).
-* `gollum` - Any time a Wiki page is updated.
-* `watch` - Any time a User watches the Repository.
-* `download` - Any time a Download is added to the Repository.
-* `fork` - Any time a Repository is forked.
-* `fork_apply` - Any time a patch is applied to the Repository from the
- Fork Queue.
-* `member` - Any time a User is added as a collaborator to a
- non-Organization Repository.
-* `public` - Any time a Repository changes from private to public.
+If you would like to set up a single webhook to receive events from all of your organization's repositories, check out our [API documentation for Organization Webhooks][org-hooks].
-The payloads for all of the hooks mirror [the payloads for the Event
-types](/v3/events/types/), with the exception of [the original `push`
-event](http://help.github.com/post-receive-hooks/).
+## List hooks
-For a Hook to go through, the Hook needs to be configured to trigger for
-an event, and the Service has to listen to it. The Services are all
-part of the open source [github-services](https://github.com/github/github-services) project. Most of the Services only listen for `push` events. However, the generic [Web Service](https://github.com/github/github-services/blob/master/services/web.rb) listens for all events. Other services like the [IRC Service](https://github.com/github/github-services/blob/master/services/irc.rb) may only listen for `push`, `issues`, and `pull_request` events.
-
-## List
-
- GET /repos/:user/:repo/hooks
+ GET /repos/:owner/:repo/hooks
### Response
-<%= headers 200, :pagination => true %>
+<%= headers 200, :pagination => default_pagination_rels %>
<%= json(:hook) { |h| [h] } %>
## Get single hook
- GET /repos/:user/:repo/hooks/:id
+ GET /repos/:owner/:repo/hooks/:id
### Response
@@ -56,86 +32,66 @@ part of the open source [github-services](https://github.com/github/github-servi
## Create a hook
- POST /repos/:user/:repo/hooks
+ POST /repos/:owner/:repo/hooks
+
+**Note**: Repository service hooks (like email or Campfire) can have at most one configured at a time. Creating hooks for a service that already has one configured will [update the existing hook](#edit-a-hook).
+
+Repositories can have multiple webhooks installed. Each webhook should have a unique `config`. Multiple webhooks can share the same `config` as long as those webhooks do not have any `events` that overlap.
-### Input
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`name`|`string` | **Required**. Use `web` for a webhook or use the name of a valid service. (See /hooks for the list of valid service names.)
+`config`|`object` | **Required**. Key/value pairs to provide settings for this hook. These settings vary between hooks and some are defined in the [github-services](https://github.com/github/github-services) repository. Booleans are stored internally as "1" for true, and "0" for false. Any JSON `true`/`false` values will be converted automatically.
+`events`|`array` | Determines what events the hook is triggered for. Default: `["push"]`
+`active`|`boolean` | Determines whether the hook is actually triggered on pushes.
-`name`
-: _Required_ **string** - The name of the service that is being called.
-See [/hooks](https://api.github.com/hooks) for the possible names.
+#### Example
-`config`
-: _Required_ **hash** - A Hash containing key/value pairs to provide
-settings for this hook. These settings vary between the services and
-are defined in the
-[github-services](https://github.com/github/github-services) repo.
-Booleans are stored internally as "1" for true, and "0" for false. Any
-JSON true/false values will be converted automatically.
+To create [a webhook](/webhooks), the following fields are required by the `config`:
-`events`
-: _Optional_ **array** - Determines what events the hook is triggered
-for. Default: `["push"]`.
+* `url`: A required string defining the URL to which the payloads will be delivered.
+* `content_type`: An optional string defining the media type used to serialize the payloads. Supported values include `json` and `form`. The default is `form`.
+* `secret`: An optional string that's passed with the HTTP requests as an `X-Hub-Signature` header. The value of this header is computed as the HMAC hex digest of the body, using the `secret` as the key.
+* `insecure_ssl`: An optional string that determines whether the SSL certificate of the host for `url` will be verified when delivering payloads. Supported values include `"0"` (verification is performed) and `"1"` (verification is not performed). The default is `"0"`.
-`active`
-: _Optional_ **boolean** - Determines whether the hook is actually
-triggered on pushes.
+Here's how you can create a hook that posts payloads in JSON format:
<%= json \
:name => "web",
:active => true,
+ :events => ['push', 'pull_request'],
:config => {
- :url => 'http://something.com/webhook'}
+ :url => 'http://example.com/webhook',
+ :content_type => 'json'}
%>
### Response
-<%= headers 201,
- :Location => 'https://api.github.com/repos/user/repo/hooks/1' %>
+<%= headers 201, :Location => get_resource(:hook)['url'] %>
<%= json :hook %>
-### Edit a hook
-
- PATCH /repos/:user/:repo/hooks/:id
-
-### Input
+## Edit a hook
-`name`
-: _Required_ **string** - The name of the service that is being called.
-See [/hooks](https://api.github.com/hooks) for the possible names.
+ PATCH /repos/:owner/:repo/hooks/:id
-`config`
-: _Required_ **hash** - A Hash containing key/value pairs to provide
-settings for this hook. Modifying this will replace the entire config
-object. These settings vary between the services and
-are defined in the
-[github-services](https://github.com/github/github-services) repo.
-Booleans are stored internally as "1" for true, and "0" for false. Any
-JSON true/false values will be converted automatically.
-
-
-`events`
-: _Optional_ **array** - Determines what events the hook is triggered
-for. This replaces the entire array of events. Default: `["push"]`.
+### Parameters
-`add_events`
-: _Optional_ **array** - Determines a list of events to be added to the
-list of events that the Hook triggers for.
+Name | Type | Description
+-----|------|--------------
+`config`|`object` | Key/value pairs to provide settings for this hook. Modifying this will replace the entire config object. These settings vary between hooks and some are defined in the [github-services](https://github.com/github/github-services) repository. Booleans are stored internally as "1" for true, and "0" for false. Any JSON `true`/`false` values will be converted automatically.
+`events`|`array` | Determines what events the hook is triggered for. This replaces the entire array of events. Default: `["push"]`
+`add_events`|`array` | Determines a list of events to be added to the list of events that the Hook triggers for.
+`remove_events`|`array` | Determines a list of events to be removed from the list of events that the Hook triggers for.
+`active`|`boolean` | Determines whether the hook is actually triggered on pushes.
-`remove_events`
-: _Optional_ **array** - Determines a list of events to be removed from the
-list of events that the Hook triggers for.
-`active`
-: _Optional_ **boolean** - Determines whether the hook is actually
-triggered on pushes.
+#### Example
<%= json \
- :name => "campfire",
:active => true,
- :config => {
- :subdomain => 'github',
- :room => 'Commits',
- :token => 'abc123'}
+ :add_events => ['pull_request']
%>
### Response
@@ -143,12 +99,26 @@ triggered on pushes.
<%= headers 200 %>
<%= json :hook %>
-## Test a hook
+## Test a `push` hook
This will trigger the hook with the latest push to the current
-repository.
+repository if the hook is subscribed to `push` events. If the
+hook is not subscribed to `push` events, the server will respond
+with 204 but no test POST will be generated.
+
+ POST /repos/:owner/:repo/hooks/:id/tests
+
+**Note**: Previously `/repos/:owner/:repo/hooks/:id/test`
+
+### Response
- POST /repos/:user/:repo/hooks/:id/test
+<%= headers 204 %>
+
+## Ping a hook
+
+This will trigger a [ping event][ping-event-url] to be sent to the hook.
+
+ POST /repos/:owner/:repo/hooks/:id/pings
### Response
@@ -156,28 +126,50 @@ repository.
## Delete a hook
- DELETE /repos/:user/:repo/hooks/:id
+ DELETE /repos/:owner/:repo/hooks/:id
### Response
<%= headers 204 %>
+## Receiving Webhooks
+
+In order for {{ site.data.variables.product.product_name }} to send webhook payloads, your server needs to be accessible from the Internet. We also highly suggest using SSL so that we can send encrypted payloads over HTTPS.
+
+### Webhook Headers
+
+GitHub will send along several HTTP headers to differentiate between event types and payload identifiers.
+
+Name | Description
+-----|-----------|
+`X-GitHub-Event` | The [event type](/v3/activity/events/types/) that was triggered.
+`X-GitHub-Delivery` | A [guid][guid] to identify the payload and event being sent.
+`X-Hub-Signature` | The value of this header is computed as the HMAC hex digest of the body, using the `secret` config option as the key.
+
## PubSubHubbub
-GitHub can also serve as a [PubSubHubbub][pubsub] hub for all repositories. PSHB is a simple publish/subscribe protocol that lets servers register to receive updates when a topic is updated. The updates are sent with an HTTP POST request to a callback URL. Topic URLs for a GitHub repository's pushes are in this format:
+GitHub can also serve as a [PubSubHubbub][pubsub] hub for all repositories.
+PSHB is a simple publish/subscribe protocol
+that lets servers register to receive updates when a topic is updated.
+The updates are sent with an HTTP POST request to a callback URL.
+Topic URLs for a GitHub repository's pushes are in this format:
- https://github.com/:user/:repo/events/:event
+ https://github.com/:owner/:repo/events/:event
-The event can be any Event string that is listed at the top of this
+The event can be any [event][events-url] string that is listed at the top of this
document.
+### Response format
+
The default format is what [existing post-receive hooks should
expect][post-receive]: A JSON body sent as the `payload` parameter in a
POST. You can also specify to receive the raw JSON body with either an
`Accept` header, or a `.json` extension.
Accept: application/json
- https://github.com/:user/:repo/events/push.json
+ https://github.com/:owner/:repo/events/push.json
+
+### Callback URLs
Callback URLs can use either the `http://` protocol, or `github://`.
`github://` callbacks specify a GitHub service.
@@ -188,38 +180,38 @@ Callback URLs can use either the `http://` protocol, or `github://`.
# Send updates to Campfire
github://campfire?subdomain=github&room=Commits&token=abc123
-The GitHub PubSubHubbub endpoint is: https://api.github.com/hub.
-(GitHub Enterprise users should use http://yourhost/api/v3/hub as the
+### Subscribing
+
+The GitHub PubSubHubbub endpoint is: `https://api.github.com/hub`.
+(GitHub Enterprise users should use `http://yourhost/api/v3/hub` as the
PubSubHubbub endpoint, but not change the `hub.topic` URI format.) A
successful request with curl looks like:
- curl -u "user" -i \
- https://api.github.com/hub \
- -F "hub.mode=subscribe" \
- -F "hub.topic=https://github.com/:user/:repo/events/push" \
- -F "hub.callback=http://postbin.org/123"
+``` command-line
+curl -u "user" -i \
+ https://api.github.com/hub \
+ -F "hub.mode=subscribe" \
+ -F "hub.topic=https://github.com/:owner/:repo/events/push" \
+ -F "hub.callback=http://postbin.org/123"
+```
PubSubHubbub requests can be sent multiple times. If the hook already
exists, it will be modified according to the request.
-### Parameters
-
-`hub.mode`
-: _Required_ **string** - Either `subscribe` or `unsubscribe`.
+#### Parameters
-`hub.topic`
-: _Required_ **string** - The URI of the GitHub repository to subscribe
-to. The path must be in the format of `/:user/:repo/events/:event`.
+Name | Type | Description
+-----|------|--------------
+``hub.mode``|`string` | **Required**. Either `subscribe` or `unsubscribe`.
+``hub.topic``|`string` |**Required**. The URI of the GitHub repository to subscribe to. The path must be in the format of `/:owner/:repo/events/:event`.
+``hub.callback``|`string` | The URI to receive the updates to the topic.
+``hub.secret``|`string` | A shared secret key that generates a SHA1 HMAC of the outgoing body content. You can verify a push came from GitHub by comparing the raw request body with the contents of the `X-Hub-Signature` header. You can see [the PubSubHubbub documentation][pshb-secret] for more details.
-`hub.callback`
-: _Required_ **string** - The URI to receive the updates to the topic.
-`hub.secret`
-: _Optional_ **string** - A shared secret key that generates a SHA1 HMAC
-of the payload content. You can verify a push came from GitHub by
-comparing the received body with the contents of the `X-Hub-Signature`
-header.
-
-[pubsub]: http://code.google.com/p/pubsubhubbub/
+[guid]: http://en.wikipedia.org/wiki/Globally_unique_identifier
+[pubsub]: https://github.com/pubsubhubbub/PubSubHubbub
[post-receive]: http://help.github.com/post-receive-hooks/
-
+[pshb-secret]: https://pubsubhubbub.github.io/PubSubHubbub/pubsubhubbub-core-0.4.html#authednotify
+[events-url]: /webhooks/#events
+[ping-event-url]: /webhooks/#ping-event
+[org-hooks]: /v3/orgs/hooks/
diff --git a/content/v3/repos/invitations.md b/content/v3/repos/invitations.md
new file mode 100644
index 0000000000..50469923aa
--- /dev/null
+++ b/content/v3/repos/invitations.md
@@ -0,0 +1,98 @@
+---
+title: Repository Invitations
+---
+
+# Repository Invitations
+
+{{#tip}}
+
+We're currently offering a preview of the Repository Invitations API.
+
+To access the API during the preview period, you must provide a custom [media type](/v3/media) in the `Accept` header:
+
+```
+application/vnd.github.swamp-thing-preview+json
+```
+
+{{/tip}}
+
+{:toc}
+
+
+
+## Invite a user to a repository
+
+Use the API endpoint for adding a collaborator [here](/v3/repos/collaborators).
+
+
+
+## List invitations for a repository
+
+ GET /repositories/:repo_id/invitations
+
+When authenticating as a user with admin rights to a repository, this endpoint will list all currently open repository invitations.
+
+### Response
+
+<%= headers 200, :pagination => default_pagination_rels %>
+<%= json(:repository_invitation) { |h| [h] } %>
+
+
+
+## Delete a repository invitation
+
+ DELETE /repositories/:repo_id/invitations/:invitation_id
+
+### Response
+
+<%= headers 204 %>
+
+
+
+## Update a repository invitation
+
+ PATCH /repositories/:repo_id/invitations/:invitation_id
+
+### Input
+
+Name | Type | Description
+-----|------|--------------
+`permissions`|`string` | The permissions that the associated user will have on the repository. Valid values are `read`, `write`, and `admin`.
+
+### Response
+
+<%= headers 200 %>
+<%= json(:repository_invitation) %>
+
+
+
+## List a user's repository invitations
+
+ GET /user/repository_invitations
+
+When authenticating as a user, this endpoint will list all currently open repository invitations for that user.
+
+### Response
+
+<%= headers 200 %>
+<%= json(:repository_invitation) { |h| [h] } %>
+
+
+
+## Accept a repository invitation
+
+ PATCH /user/repository_invitations/:invitation_id
+
+### Response
+
+<%= headers 204 %>
+
+
+
+## Decline a repository invitation
+
+ DELETE /user/repository_invitations/:invitation_id
+
+### Response
+
+<%= headers 204 %>
diff --git a/content/v3/repos/keys.md b/content/v3/repos/keys.md
index 429dea72fa..db2fdcc7cc 100644
--- a/content/v3/repos/keys.md
+++ b/content/v3/repos/keys.md
@@ -1,56 +1,70 @@
---
-title: Repo Deploy Keys | GitHub API
+title: Deploy Keys
---
-# Repo Deploy Keys API
+# Deploy Keys
-## List
+{:toc}
- GET /repos/:user/:repo/keys
+
+
+## List deploy keys
+
+ GET /repos/:owner/:repo/keys
### Response
-<%= headers 200 %>
-<%= json(:public_key) { |h| [h] } %>
+<%= headers 200, :pagination => default_pagination_rels %>
+<%= json(:deploy_key) { |h| [h] } %>
-## Get
+
- GET /repos/:user/:repo/keys/:id
+## Get a deploy key
+
+ GET /repos/:owner/:repo/keys/:id
### Response
<%= headers 200 %>
-<%= json :public_key %>
+<%= json :deploy_key %>
-## Create
+
- POST /repos/:user/:repo/keys
+## Add a new deploy key
-### Input
+ POST /repos/:owner/:repo/keys
-<%= json :title => "octocat@octomac", :key => "ssh-rsa AAA..." %>
+### Parameters
-### Response
+Name | Type | Description
+-----|------|-------------
+`title`|`string`|A name for the key.
+`key`|`string`|The contents of the key.
+`read_only`|`boolean`|If `true`, the key will only be able to read repository contents. Otherwise, the key will be able to read and write.
-<%= headers 201, :Location => "https://api.github.com/user/repo/keys/1" %>
-<%= json :public_key %>
+#### Example
-## Edit
+Here's how you can create a read-only deploy key:
- PATCH /repos/:user/:repo/keys/:id
+<%= json :title => "octocat@octomac", :key => "ssh-rsa AAA...", :read_only => true %>
-### Input
+### Response
-<%= json :title => "octocat@octomac", :key => "ssh-rsa AAA..." %>
+<%= headers 201, :Location => get_resource(:deploy_key)['url'] %>
+<%= json :deploy_key %>
-### Response
+
-<%= headers 200 %>
-<%= json :public_key %>
+## Edit a deploy key
+
+Deploy keys are immutable. If you need to update a key, [remove the
+key](#remove-a-deploy-key) and [create a new one](#add-a-new-deploy-key) instead.
+
+
-## Delete
+## Remove a deploy key
- DELETE /repos/:user/:repo/keys/:id
+ DELETE /repos/:owner/:repo/keys/:id
### Response
diff --git a/content/v3/repos/merging.md b/content/v3/repos/merging.md
index 16ace4a025..ed5285c212 100644
--- a/content/v3/repos/merging.md
+++ b/content/v3/repos/merging.md
@@ -1,12 +1,14 @@
---
-title: Repo Merging | GitHub API
+title: Merging
---
-# Repo Merging API
+# Merging
+
+{:toc}
The Repo Merging API supports merging branches in a repository. This accomplishes
essentially the same thing as merging one branch into another in a local repository
-and then pushing to GitHub. The benefit is that the merge is done on the server side
+and then pushing to {{ site.data.variables.product.product_name }}. The benefit is that the merge is done on the server side
and a local repository is not needed. This makes it more appropriate for automation
and other tools where maintaining local repositories would be cumbersome and inefficient.
@@ -14,19 +16,16 @@ The authenticated user will be the author of any merges done through this endpoi
## Perform a merge
- POST /repos/:user/:repo/merges
+ POST /repos/:owner/:repo/merges
### Input
-base
-: _Required_ **string** - The name of the base branch that the head will be merged into.
-
-head
-: _Required_ **string** - The head to merge. This can be a branch name or a commit SHA1.
+Name | Type | Description
+-----|------|--------------
+`base`|`string` | **Required**. The name of the base branch that the head will be merged into.
+`head`|`string` | **Required**. The head to merge. This can be a branch name or a commit SHA1.
+`commit_message`|`string` | Commit message to use for the merge commit. If omitted, a default message will be used.
-commit_message
-: _Optional_ **string** - Commit message to use for the merge commit.
-If omitted, a default message will be used.
<%= json \
:base => "master",
@@ -48,8 +47,12 @@ If omitted, a default message will be used.
<%= headers 409 %>
<%= json({ :message => "Merge Conflict" }) %>
-### Missing base or head response
+### Missing base response
<%= headers 404 %>
<%= json(:message => "Base does not exist") %>
+
+### Missing head response
+
+<%= headers 404 %>
<%= json(:message => "Head does not exist") %>
diff --git a/content/v3/repos/pages.md b/content/v3/repos/pages.md
new file mode 100644
index 0000000000..78f8c5ba94
--- /dev/null
+++ b/content/v3/repos/pages.md
@@ -0,0 +1,91 @@
+---
+title: Pages
+---
+
+# Pages
+
+{:toc}
+
+The GitHub Pages API retrieves information about your GitHub Pages configuration, and
+the statuses of your builds. Information about the site and the builds can only be
+accessed by authenticated owners, even though the websites are public.
+
+In JSON responses, `status` can be one of:
+
+* `null`, which means the site has yet to be built
+* `queued`, which means the build has been requested but not yet begun
+* `building`, which means the build is in progress
+* `built`, which means the site has been built
+* `errored`, which indicates an error occurred during the build
+
+## Get information about a Pages site
+
+ GET /repos/:owner/:repo/pages
+
+{% if page.version == 'dotcom' or page.version > 2.7 %}
+
+{{#tip}}
+
+
+
+ Additional functionality of the GitHub Pages API is currently available for developers to preview.
+ During the preview period, the API may change without advance notice.
+
+ To access the additional functionality during the preview period, you must provide a custom [media type](/v3/media) in the `Accept` header:
+
+ application/vnd.github.mister-fantastic-preview+json
+
+ When the [preview flag](#preview-period) is passed, the response will contain an additional field, `html_url`, which will contain the absolute URL (with scheme) to the rendered site (e.g., `https://username.github.io`, or `http://example.com`).
+
+{{/tip}}
+
+{% endif %}
+
+### Response
+
+<%= headers 200 %>
+<%= json(:pages) %>
+
+{% if page.version == 'dotcom' or page.version > 2.7 %}
+
+## Request a page build
+
+ POST /repos/:owner/:repo/pages/builds
+
+{{#tip}}
+
+
+
+ This endpoint is currently available for developers to preview.
+ During the preview period, the API may change without advance notice.
+
+ To access this endpoint during the preview period, you must provide a custom [media type](/v3/media) in the `Accept` header:
+
+ application/vnd.github.mister-fantastic-preview+json
+
+{{/tip}}
+
+You 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.
+
+### Response
+
+<%= headers 200 %>
+<%= json(:pages_request_build) %>
+
+{% endif %}
+
+## List Pages builds
+
+ GET /repos/:owner/:repo/pages/builds
+
+<%= headers 200, :pagination => default_pagination_rels %>
+<%= json(:pages_build) { |h| [h] } %>
+
+## List latest Pages build
+
+ GET /repos/:owner/:repo/pages/builds/latest
+
+<%= headers 200 %>
+<%= json(:pages_build) %>
diff --git a/content/v3/repos/pre_receive_hooks.md b/content/v3/repos/pre_receive_hooks.md
new file mode 100644
index 0000000000..2eef1d9459
--- /dev/null
+++ b/content/v3/repos/pre_receive_hooks.md
@@ -0,0 +1,88 @@
+---
+title: Repository Pre-receive Hooks
+---
+
+# Repository Pre-receive Hooks (Enterprise)
+
+{{#tip}}
+
+
+
+ APIs for managing pre-receive hooks are currently available for developers to preview.
+ During the preview period, the APIs may change without advance notice.
+
+ To access the API you must provide a custom [media type](/v3/media) in the `Accept` header:
+
+ application/vnd.github.eye-scream-preview
+
+{{/tip}}
+
+
+{:toc}
+
+The Repository Pre-receive Hooks API allows you to view and modify
+enforcement of the pre-receive hooks that are available to a repository.
+
+Prefix all the endpoints for this API with the following URL:
+
+``` command-line
+http(s)://hostname/api/v3
+```
+
+## Object attributes
+
+| Name | Type | Description |
+|---------------------|----------|-----------------------------------------------------------|
+| `name` | `string` | The name of the hook. |
+| `enforcement` | `string` | The state of enforcement for the hook on this repository. |
+| `configuration_url` | `string` | URL for the endpoint where enforcement is set. |
+
+Possible values for *enforcement* are `enabled`, `disabled` and`testing`. `disabled` indicates the pre-receive hook will not run. `enabled` indicates it will run and reject
+any pushes that result in a non-zero status. `testing` means the script will run but will not cause any pushes to be rejected.
+
+`configuration_url` may be a link to this repository, it's organization
+owner or global configuration. Authorization to access the endpoint at
+`configuration_url` is determined at the owner or site admin level.
+
+## List pre-receive hooks
+
+List 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.
+
+ GET /repos/:owner/:repo/pre-receive-hooks
+
+<%= headers 200, :pagination => default_pagination_rels %>
+<%= json :pre_receive_hooks_repo %>
+
+## Get a single pre-receive hook
+
+ GET /repos/:owner/:repo/pre-receive-hooks/:id
+
+<%= headers 200 %> <%= json :pre_receive_hook_repo %>
+
+## Update pre-receive hook enforcement
+
+For pre-receive hooks which are allowed to be configured at the repo level, you can set `enforcement`
+
+ PATCH /repos/:owner/:repo/pre-receive-hooks/:id
+
+<%= json :enforcement => "enabled" %>
+
+### Response
+
+<%= headers 200 %><%= json :pre_receive_hook_repo_update %>
+
+## Remove enforcement overrides for a pre-receive hook
+
+Deletes any overridden enforcement on this repository for the specified
+hook.
+
+ DELETE /repos/:owner/:repo/pre-receive-hooks/:id
+
+### Response
+
+Responds with effective values inherited from owner and/or global level.
+
+<%= headers 200 %> <%= json :pre_receive_hook_repo %>
diff --git a/content/v3/repos/releases.md b/content/v3/repos/releases.md
new file mode 100644
index 0000000000..73a2e10891
--- /dev/null
+++ b/content/v3/repos/releases.md
@@ -0,0 +1,242 @@
+---
+title: Releases
+---
+
+# Releases
+
+{:toc}
+
+## List releases for a repository
+
+{{#tip}}
+
+This 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 [Repository Tags API][repo tags api].
+
+{{/tip}}
+
+Information about published releases are available to everyone.
+Only users with push access will receive listings for draft releases.
+
+ GET /repos/:owner/:repo/releases
+
+### Response
+
+<%= headers 200, :pagination => default_pagination_rels %>
+<%= json(:release) { |h| [h] } %>
+
+## Get a single release
+
+ GET /repos/:owner/:repo/releases/:id
+
+### Response
+
+{{#tip}}
+
+
+
+**Note:** This returns an `upload_url` key corresponding to the endpoint for uploading release assets. This key is a [hypermedia resource](https://developer.github.com/v3/#hypermedia).
+
+{{/tip}}
+
+<%= headers 200 %>
+<%= json :release %>
+
+## Get the latest release
+
+View the latest published full release for the repository. Draft releases and prereleases are not returned by this endpoint.
+
+ GET /repos/:owner/:repo/releases/latest
+
+### Response
+
+<%= headers 200 %>
+<%= json :release %>
+
+## Get a release by tag name
+
+Get a published release with the specified tag.
+
+ GET /repos/:owner/:repo/releases/tags/:tag
+
+### Response
+
+<%= headers 200 %>
+<%= json :release %>
+
+
+## Create a release
+
+Users with push access to the repository can create a release.
+
+ POST /repos/:owner/:repo/releases
+
+### Input
+
+Name | Type | Description
+-----|------|--------------
+`tag_name`|`string` | **Required**. The name of the tag.
+`target_commitish`|`string` | Specifies the commitish value that determines where the Git tag is created from. Can be any branch or commit SHA. Unused if the Git tag already exists. Default: the repository's default branch (usually `master`).
+`name`|`string` | The name of the release.
+`body`|`string` | Text describing the contents of the tag.
+`draft`|`boolean` | `true` to create a draft (unpublished) release, `false` to create a published one. Default: `false`
+`prerelease`|`boolean` | `true` to identify the release as a prerelease. `false` to identify the release as a full release. Default: `false`
+
+#### Example
+
+<%= json \
+ :tag_name => "v1.0.0",
+ :target_commitish => "master",
+ :name => "v1.0.0",
+ :body => "Description of the release",
+ :draft => false,
+ :prerelease => false
+%>
+
+### Response
+
+<%= headers 201, :Location => get_resource(:created_release)['url'] %>
+<%= json(:created_release) %>
+
+## Edit a release
+
+Users with push access to the repository can edit a release.
+
+ PATCH /repos/:owner/:repo/releases/:id
+
+### Input
+
+Name | Type | Description
+-----|------|--------------
+`tag_name`|`string` | The name of the tag.
+`target_commitish`|`string` | Specifies the commitish value that determines where the Git tag is created from. Can be any branch or commit SHA. Unused if the Git tag already exists. Default: the repository's default branch (usually `master`).
+`name`|`string` | The name of the release.
+`body`|`string` | Text describing the contents of the tag.
+`draft`|`boolean` | `true` makes the release a draft, and `false` publishes the release.
+`prerelease`|`boolean` | `true` to identify the release as a prerelease, `false` to identify the release as a full release.
+
+#### Example
+
+<%= json \
+ :tag_name => "v1.0.0",
+ :target_commitish => "master",
+ :name => "v1.0.0",
+ :body => "Description of the release",
+ :draft => false,
+ :prerelease => false
+%>
+
+### Response
+
+<%= headers 200 %>
+<%= json :release %>
+
+## Delete a release
+
+Users with push access to the repository can delete a release.
+
+ DELETE /repos/:owner/:repo/releases/:id
+
+### Response
+
+<%= headers 204 %>
+
+## List assets for a release
+
+ GET /repos/:owner/:repo/releases/:id/assets
+
+### Response
+
+<%= headers 200, :pagination => default_pagination_rels %>
+<%= json(:release_asset) { |h| [h] } %>
+
+## Upload a release asset
+
+This endpoint makes use of [a Hypermedia relation](/v3/#hypermedia) to determine which URL to access.
+This endpoint is provided by a URI template in [the release's API response](#get-a-single-release).
+{% if page.version == 'dotcom' %}You need to use an HTTP client which supports
+SNI to make calls to this endpoint.{% endif %}
+
+The asset data is expected in its raw binary form, rather than JSON.
+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.
+
+ POST https:///repos/:owner/:repo/releases/:id/assets?name=foo.zip
+
+
+### Input
+
+The raw file is uploaded to {{ site.data.variables.product.product_name }}. Set the content type appropriately, and the
+asset's name and label in URI query parameters.
+
+Name | Type | Description
+-----|------|--------------
+`Content-Type`|`string` | **Required**. The content type of the asset. This should be set in the Header. Example: `"application/zip"`. For a list of acceptable types, refer this list of [media types][media type list].
+`name`|`string` | **Required**. The file name of the asset. This should be set in a URI query parameter.
+`label`|`string` | An alternate short description of the asset. Used in place of the filename. This should be set in a URI query parameter.
+
+Send the raw binary content of the asset as the request body.
+
+### Response for successful upload
+
+<%= headers 201 %>
+<%= json :release_asset %>
+
+### Response for upstream failure
+
+This may leave an empty asset with a state of `"new"`. It can be safely deleted.
+
+<%= headers 502 %>
+
+## Get a single release asset
+
+ GET /repos/:owner/:repo/releases/assets/:id
+
+### Response
+
+{{#tip}}
+
+To download the asset's binary content, set the `Accept` header of the request to [`application/octet-stream`](https://developer.github.com/v3/media/#media-types).
+The API will either redirect the client to the location, or stream it directly if possible.
+API clients should handle both a `200` or `302` response.
+
+{{/tip}}
+
+<%= headers 200 %>
+<%= json :release_asset %>
+
+## Edit a release asset
+
+Users with push access to the repository can edit a release asset.
+
+ PATCH /repos/:owner/:repo/releases/assets/:id
+
+### Input
+
+Name | Type | Description
+-----|------|--------------
+`name`|`string` | **Required**. The file name of the asset.
+`label`|`string` | An alternate short description of the asset. Used in place of the filename.
+
+#### Example
+
+<%= json \
+ :name => "foo-1.0.0-osx.zip",
+ :label => "Mac binary"
+%>
+
+### Response
+
+<%= headers 200 %>
+<%= json :release_asset %>
+
+## Delete a release asset
+
+ DELETE /repos/:owner/:repo/releases/assets/:id
+
+### Response
+
+<%= headers 204 %>
+
+[media type list]: https://www.iana.org/assignments/media-types/media-types.xhtml
+[repo tags api]: /v3/repos/#list-tags
diff --git a/content/v3/repos/statistics.md b/content/v3/repos/statistics.md
new file mode 100644
index 0000000000..5b829f33d8
--- /dev/null
+++ b/content/v3/repos/statistics.md
@@ -0,0 +1,106 @@
+---
+title: Statistics
+---
+
+# Statistics
+
+{:toc}
+
+The Repository Statistics API allows you to fetch the data that {{ site.data.variables.product.product_name }} uses for visualizing different
+types of repository activity.
+
+### A word about caching
+
+Computing repository statistics is an expensive operation, so we try to return cached
+data whenever possible. If the data hasn't been cached when you query a repository's
+statistics, you'll receive a `202` response; a background job is also fired to
+start compiling these statistics. Give the job a few moments to complete, and
+then submit the request again. If the job has completed, that request will receive a
+`200` response with the statistics in the response body.
+
+Repository statistics are cached by the SHA of the repository's default branch,
+which is usually master; pushing to the default branch resets the statistics cache.
+
+
+## Get contributors list with additions, deletions, and commit counts
+
+ GET /repos/:owner/:repo/stats/contributors
+
+### Response
+
+* `total` - The Total number of commits authored by the contributor.
+
+Weekly Hash (`weeks` array):
+
+* `w` - Start of the week, given as a [Unix timestamp](http://en.wikipedia.org/wiki/Unix_time).
+* `a` - Number of additions
+* `d` - Number of deletions
+* `c` - Number of commits
+
+<%= headers 200 %>
+<%= json(:repo_stats_contributors) %>
+
+
+
+## Get the last year of commit activity data
+
+Returns the last year of commit activity grouped by week. The `days` array
+is a group of commits per day, starting on `Sunday`.
+
+ GET /repos/:owner/:repo/stats/commit_activity
+
+### Response
+
+<%= headers 200 %>
+<%= json(:repo_stats_commit_activity) %>
+
+
+
+## Get the number of additions and deletions per week
+
+ GET /repos/:owner/:repo/stats/code_frequency
+
+### Response
+
+Returns a weekly aggregate of the number of additions and deletions pushed
+to a repository.
+
+<%= headers 200 %>
+<%= json(:repo_stats_code_frequency) %>
+
+
+
+## Get the weekly commit count for the repository owner and everyone else
+
+ GET /repos/:owner/:repo/stats/participation
+
+### Response
+
+Returns the total commit counts for the `owner` and total commit counts in `all`.
+`all` is everyone combined, including the `owner` in the last 52 weeks. If you'd like to get the commit
+counts for non-owners, you can subtract `owner` from `all`.
+
+The array order is oldest week (index 0) to most recent week.
+
+<%= headers 200 %>
+<%= json(:repo_stats_participation) %>
+
+
+
+## Get the number of commits per hour in each day
+
+ GET /repos/:owner/:repo/stats/punch_card
+
+### Response
+
+Each array contains the day number, hour number, and number of commits:
+
+* `0-6`: Sunday - Saturday
+* `0-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.
+
+<%= headers 200 %>
+<%= json(:repo_stats_punch_card) %>
diff --git a/content/v3/repos/statuses.md b/content/v3/repos/statuses.md
new file mode 100644
index 0000000000..0ab8ce9701
--- /dev/null
+++ b/content/v3/repos/statuses.md
@@ -0,0 +1,116 @@
+---
+title: Statuses
+---
+
+# Statuses
+
+{:toc}
+
+The Status API allows external services to mark commits with a success,
+failure, error, or pending `state`, which is then reflected in pull requests
+involving those commits.
+
+Statuses can also include an optional `description` and `target_url`, and
+we highly recommend providing them as they make statuses much more
+useful in the GitHub UI.
+
+As an example, one common use is for continuous integration
+services to mark commits as passing or failing builds using Status. The
+`target_url` would be the full URL to the build output, and the
+`description` would be the high level summary of what happened with the
+build.
+
+Statuses can include a `context` to indicate what service is providing that status.
+For example, you may have your continuous integration service push statuses with a context of `ci`,
+and a security audit tool push statuses with a context of `security`. You can
+then use the [combined status endpoint](https://developer.github.com/v3/repos/statuses/#get-the-combined-status-for-a-specific-ref)
+to retrieve the whole status for a commit.
+
+Note that the `repo:status` [OAuth scope](/v3/oauth/#scopes) grants targeted
+access to Statuses **without** also granting access to repository code, while the
+`repo` scope grants permission to code as well as statuses.
+
+## Create a Status
+
+Users with push access can create commit statuses for a given ref:
+
+ POST /repos/:owner/:repo/statuses/:sha
+
+Note: there is a limit of 1000 statuses per `sha` and `context` within a Repository.
+Attempts to create more than 1000 statuses will result in a validation error.
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`state`|`string` | **Required**. The state of the status. Can be one of `pending`, `success`, `error`, or `failure`.
+`target_url`|`string` | The target URL to associate with this status. This URL will be linked from the {{ site.data.variables.product.product_name }} UI to allow users to easily see the 'source' of the Status.
For example, if your Continuous Integration system is posting build status, you would want to provide the deep link for the build output for this specific SHA:
`http://ci.example.com/user/repo/build/sha`.
+`description`|`string` | A short description of the status.
+`context`|`string` | A string label to differentiate this status from the status of other systems. Default: `"default"`
+
+#### Example
+
+<%= json \
+ :state => "success",
+ :target_url => "https://example.com/build/status",
+ :description => "The build succeeded!",
+ :context => "continuous-integration/jenkins"
+%>
+
+### Response
+
+<%= headers 201, :Location => get_resource(:status)['url'] %>
+<%= json :status %>
+
+## List Statuses for a specific Ref
+
+Users with pull access can view commit statuses for a given ref:
+
+ GET /repos/:owner/:repo/commits/:ref/statuses
+
+{{#tip}}
+
+This resource is also available via a legacy route:
+`GET /repos/:owner/:repo/statuses/:ref`.
+
+{{/tip}}
+
+Statuses are returned in reverse chronological order. The first status in the
+list will be the latest one.
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`ref`|`string` | **Required**. Ref to list the statuses from. It can be a SHA, a branch name, or a tag name.
+
+
+### Response
+
+<%= headers 200, :pagination => default_pagination_rels %>
+<%= json(:status) { |h| [h] } %>
+
+## Get the combined Status for a specific Ref
+
+Users with pull access can access a combined view of commit statuses for a given ref.
+
+ GET /repos/:owner/:repo/commits/:ref/status
+
+The most recent status for each context is returned, up to 100. This field
+[paginates](/v3/#pagination) if there are over 100 contexts.
+
+Additionally, a combined `state` is returned. The `state` is one of:
+
+ * **failure** if any of the contexts report as error or failure
+ * **pending** if there are no statuses or a context is pending
+ * **success** if the latest status for all contexts is success
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`ref`|`string` | **Required**. Ref to fetch the status for. It can be a SHA, a branch name, or a tag name.
+
+### Response
+<%= headers 200 %>
+<%= json(:combined_status) %>
diff --git a/content/v3/repos/traffic.md b/content/v3/repos/traffic.md
new file mode 100644
index 0000000000..483197db77
--- /dev/null
+++ b/content/v3/repos/traffic.md
@@ -0,0 +1,79 @@
+---
+title: Traffic
+---
+
+# Traffic
+{{#tip}}
+
+
+
+ APIs for repository traffic are currently available for developers to preview.
+ During the preview period, the APIs may change without advance notice.
+ Please see the [blog post](/changes/2016-08-15-traffic-api-preview) for full details.
+
+ To access the API you must provide a custom [media type](/v3/media) in the `Accept` header:
+
+ application/vnd.github.spiderman-preview
+
+{{/tip}}
+
+{:toc}
+
+For repositories that you have push access to, the traffic API provides access
+to the information provided in the [graphs section](https://help.github.com/articles/about-repository-graphs/#traffic).
+
+
+
+## List referrers
+
+Get the top 10 referrers over the last 14 days.
+
+ GET /repos/:owner/:repo/traffic/popular/referrers
+
+### Response
+
+<%= headers 200 %>
+<%= json(:traffic_referrers) %>
+
+## List paths
+
+Get the top 10 popular contents over the last 14 days.
+
+ GET /repos/:owner/:repo/traffic/popular/paths
+
+### Response
+
+<%= headers 200%>
+<%= json(:traffic_contents) %>
+
+## Views
+
+Get the total number of views and breakdown per day or week for the last 14 days.
+
+ GET /repos/:owner/:repo/traffic/views
+
+### Parameters
+Name | Type | Description
+-----|------|--------------
+`per`|string|Must be one of: `day`, `week`. Default: `day`
+
+
+### Response
+<%= headers 200 %>
+<%= json(:traffic_views) %>
+
+## Clones
+
+Get the total number of clones and breakdown per day or week for the last 14 days.
+
+ GET /repos/:owner/:repo/traffic/clones
+
+### Parameters
+Name | Type | Description
+-----|------|--------------
+`per`|string|Must be one of: `day`, `week`. Default: `day`
+
+### Response
+
+<%= headers 200 %>
+<%= json(:traffic_clones) %>
diff --git a/content/v3/repos/watching.md b/content/v3/repos/watching.md
deleted file mode 100644
index f2826b7970..0000000000
--- a/content/v3/repos/watching.md
+++ /dev/null
@@ -1,70 +0,0 @@
----
-title: Repo Watching | GitHub API
----
-
-# Repo Watching API
-
-We recently [changed the way watching
-works](https://github.com/blog/1204-notifications-stars) on GitHub. We hope to
-roll out many of these features in the API soon. Until then, the [Watchers
-method](#list-watchers) below will return "stargazers", and the [Watched
-methods](#list-repos-being-watched) return repositories that have been
-"starred."
-
-## List watchers
-
- GET /repos/:user/:repo/watchers
-
-### Response
-
-<%= headers 200, :pagination => true %>
-<%= json(:user) { |h| [h] } %>
-
-## List repos being watched
-
-List repos being watched by a user
-
- GET /users/:user/watched
-
-List repos being watched by the authenticated user
-
- GET /user/watched
-
-### Response
-
-<%= headers 200, :pagination => true %>
-<%= json(:repo) { |h| [h] } %>
-
-## Check if you are watching a repo
-
-Requires for the user to be authenticated
-
- GET /user/watched/:user/:repo
-
-### Response if this repo is watched by you
-
-<%= headers 204 %>
-
-### Response if this repo is not watched by you
-
-<%= headers 404 %>
-
-## Watch a repo
-
-Requires for the user to be authenticated
-
- PUT /user/watched/:user/:repo
-
-### Response
-
-<%= headers 204 %>
-
-## Stop watching a repo
-
-Requires for the user to be authenticated
-
- DELETE /user/watched/:user/:repo
-
-### Response
-
-<%= headers 204 %>
diff --git a/content/v3/search.md b/content/v3/search.md
index 9cfd8f1bba..bfdefdd175 100644
--- a/content/v3/search.md
+++ b/content/v3/search.md
@@ -1,76 +1,442 @@
---
-title: Search | GitHub API
+title: Search
---
# Search
-This is a listing of the Search API features from API v2 that have been ported to API
-v3. There should be no changes, other than the new URL and JSON output format.
+{:toc}
-## Search issues
+### About the Search API
-Find issues by state and keyword.
+The Search API is optimized to help you find the specific item you're looking
+for (e.g., a specific user, a specific file in a repository, etc.). Think of it
+the way you think of performing a search on Google. It's designed to help you
+find the one result you're looking for (or maybe the few results you're looking
+for). Just like searching on Google, you sometimes want to see a few pages of
+search results so that you can find the item that best meets your needs. To
+satisfy that need, the {{ site.data.variables.product.product_name }} Search API provides **up to 1,000 results for each
+search**.
- GET /legacy/issues/search/:owner/:repository/:state/:keyword
+### Ranking search results
-### Parameters
+Unless another sort option is provided as a query parameter, results are sorted
+by best match, as indicated by the `score` field for each item returned. This
+is a computed value representing the relevance of an item relative to the other
+items in the result set. Multiple factors are combined to boost the most
+relevant item to the top of the result list.
+
+{% if page.version == 'dotcom' %}
+
+### Rate limit
+
+The Search API has a custom rate limit. For requests using [Basic
+Authentication](/v3/#authentication), [OAuth](/v3/#authentication), or [client
+ID and secret](/v3/#increasing-the-unauthenticated-rate-limit-for-oauth-applications), you can make up to
+30 requests per minute. For unauthenticated requests, the rate limit allows you
+to make up to 10 requests per minute.
+
+See the [rate limit documentation](/v3/#rate-limiting) for details on
+determining your current rate limit status.
-state
-: `open` or `closed`
+{% endif %}
-keyword
-: Search term
+### Timeouts and incomplete results
-<%= headers 200 %>
-<%= json(:issue_search_results) %>
+To keep the Search API fast for everyone, we limit how long any individual query
+can run. For queries that [exceed the time limit](/changes/2014-04-07-understanding-search-results-and-potential-timeouts/),
+the API returns the matches that were already found prior to the timeout, and
+the response has the `incomplete_results` property set to `true`.
+
+Reaching a timeout does not necessarily mean that search results are incomplete.
+More results might have been found, but also might not.
## Search repositories
-Find repositories by keyword. Note, this legacy method does not follow the
-v3 pagination pattern. This method returns up to 100 results per page and
-pages can be fetched using the `start_page` parameter.
+Find repositories via various criteria. This method returns up to 100 results [per page](/v3/#pagination).
- GET /legacy/repos/search/:keyword
+ GET /search/repositories
### Parameters
-keyword
-: Search term
+Name | Type | Description
+-----|------|--------------
+`q`|`string`| The search keywords, as well as any qualifiers.
+`sort`|`string`| The sort field. One of `stars`, `forks`, or `updated`. Default: results are sorted by best match.
+`order`|`string`| The sort order if `sort` parameter is provided. One of `asc` or `desc`. Default: `desc`
-language
-: _Optional_ Filter results by [language](https://github.com/languages)
+The `q` search term can also contain any combination of the supported repository search qualifiers as described by the in-browser [repository search documentation](https://help.github.com/articles/searching-repositories/) and [search syntax documentation](https://help.github.com/articles/search-syntax/):
-start_page
-: _Optional_ Page number to fetch
+* [`in`](https://help.github.com/articles/searching-repositories#scope-the-search-fields)
+ Qualifies which fields are searched. With this qualifier you can restrict the
+ search to just the repository name, description, readme, or
+ any combination of these.
+* [`size`](https://help.github.com/articles/searching-repositories#search-based-on-the-size-of-a-repository)
+ Finds repositories that match a certain size (in kilobytes).
+* [`forks`](https://help.github.com/articles/searching-repositories#search-based-on-the-number-of-forks-the-parent-repository-has)
+ Filters repositories based on the number of forks.
+* [`fork`](https://help.github.com/articles/searching-repositories#search-based-on-the-number-of-forks-the-parent-repository-has) Filters whether forked repositories should be included (`true`) or only forked repositories should be returned (`only`).
+* [`created` or `pushed`](https://help.github.com/articles/searching-repositories#search-based-on-when-a-repository-was-created-or-last-updated)
+ Filters repositories based on date of creation, or when they were last updated.
+* [`user` or `repo`](https://help.github.com/articles/searching-repositories#search-within-a-users-or-organizations-repositories)
+ Limits searches to a specific user or repository.
+* [`language`](https://help.github.com/articles/searching-repositories#search-based-on-the-main-language-of-a-repository)
+ Searches repositories based on the language they're written in.
+* [`stars`](https://help.github.com/articles/searching-repositories#search-based-on-the-number-of-stars-a-repository-has)
+ Searches repositories based on the number of stars.
-<%= headers 200 %>
-<%= json(:repo_search_results) %>
+Example
-## Search users
+Suppose you want to search for popular Tetris repositories written in Assembly.
+Your query might look like this.
+
+ https://api.github.com/search/repositories?q=tetris+language:assembly&sort=stars&order=desc
+
+In this request, we're searching for repositories with the word `tetris` in the
+name, the description, or the README. We're limiting the results to only find
+repositories where the primary language is Assembly. We're sorting by stars in
+descending order, so that the most popular repositories appear first in the
+search results.
+
+<%= headers 200, {:pagination => default_pagination_rels{% if page.version == 'dotcom' %}, 'X-RateLimit-Limit' => 20, 'X-RateLimit-Remaining' => 19{% endif %}} %>
+<%= json(:repo_search_v3_results) %>
+
+### Highlighting Repository Search Results
+
+Some API consumers will want to highlight the matching search terms when
+displaying search results. The API offers additional metadata to support this
+use case. To get this metadata in your search results, specify the `text-match`
+media type in your Accept header. For example, via curl, the above query would
+look like this:
+
+``` command-line
+curl -H 'Accept: application/vnd.github.v3.text-match+json' \
+ 'https://api.github.com/search/repositories?q=tetris+language:assembly&sort=stars&order=desc'
+```
+
+This produces the same JSON payload as above, with an extra key called
+`text_matches`, an array of objects. These objects provide information such as
+the position of your search terms within the text, as well as the property that
+included the search term.
+
+When searching for repositories, you can get text match metadata for the
+**name** and **description** fields. (See the section on [text match metadata
+](#text-match-metadata) for full details.)
+
+Here's an example response:
+
+<%= json(:repo_search_v3_results_highlighting) %>
+
+## Search code
+
+Find file contents via various criteria. (This method returns up to 100 results [per page](/v3/#pagination).)
+
+ GET /search/code
+
+### Considerations for code search
-Find users by keyword.
+Due to the complexity of searching code, there are a few restrictions on how searches are performed:
- GET /legacy/user/search/:keyword
+
+- Only the default branch is considered. In most cases, this will be the
master branch.
+- Only files smaller than {% if page.version != 'dotcom' and page.version >= 2.2 %} 10 MB {% else %} 384 KB {% endif %} are searchable.
+{% if page.version == 'dotcom' %}
+- You must always include at least one search term when searching source code. For example, searching for
language:go is not valid, while amazing language:go is.
+{% endif %}
+
### Parameters
-keyword
-: Keyword search parameters
+Name | Type | Description
+-----|------|--------------
+`q`|`string`| The search terms.
+`sort`|`string`| The sort field. Can only be `indexed`, which indicates how recently a file has been indexed by the {{ site.data.variables.product.product_name }} search infrastructure. Default: results are sorted by best match.
+`order`|`string`| The sort order if `sort` parameter is provided. One of `asc` or `desc`. Default: `desc`
-<%= headers 200 %>
-<%= json(:user_search_results) %>
+The `q` search term can also contain any combination of the supported code search qualifiers as described by the in-browser [code search documentation](https://help.github.com/articles/searching-code/) and [search syntax documentation](https://help.github.com/articles/search-syntax/):
-## Email search
+* [`in`](https://help.github.com/articles/searching-code#scope-the-search-fields)
+ Qualifies which fields are searched. With this qualifier you can restrict the
+ search to the file contents (`file`), the file path (`path`), or both.
+* [`language`](https://help.github.com/articles/searching-code#search-by-language)
+ Searches code based on the language it's written in.
+* [`fork`](https://help.github.com/articles/searching-code#search-by-the-number-of-forks-the-parent-repository-has)
+ Specifies that code from forked repositories should be searched (`true`). Repository
+ forks will not be searchable unless the fork has more stars than the parent
+ repository.
+* [`size`](https://help.github.com/articles/searching-code#search-by-the-size-of-the-parent-repository)
+ Finds files that match a certain size (in bytes).
+* [`path`](https://help.github.com/articles/searching-code#search-by-the-location-of-a-file-within-the-repository)
+ Specifies the path prefix that the resulting file must be under.
+* [`filename`](https://help.github.com/articles/searching-code#search-by-filename)
+ Matches files by a substring of the filename.
+* [`extension`](https://help.github.com/articles/searching-code#search-by-the-file-extension)
+ Matches files with a certain extension after a dot.
+* [`user` or `repo`](https://help.github.com/articles/searching-code#search-within-a-users-or-organizations-repositories)
+ Limits searches to a specific user or repository.
-This API call is added for compatibility reasons only. There's no guarantee
-that full email searches will always be available.
+Example
- GET /legacy/user/email/:email
+Suppose you want to find the definition of the `addClass` function inside
+[jQuery](https://github.com/jquery/jquery). Your query would look something like
+this:
+
+ https://api.github.com/search/code?q=addClass+in:file+language:js+repo:jquery/jquery
+
+Here, we're searching for the keyword `addClass` within a file's contents. We're
+making sure that we're only looking in files where the language is JavaScript.
+And we're scoping the search to the `repo:jquery/jquery` repository.
+
+<%= headers 200, {:pagination => default_pagination_rels,{% if page.version == 'dotcom' %} 'X-RateLimit-Limit' => 20, 'X-RateLimit-Remaining' => 19{% endif %}} %>
+<%= json(:code_search_v3_results) %>
+
+### Highlighting Code Search Results
+
+Some API consumers will want to highlight the matching search terms when
+displaying search results. The API offers additional metadata to support this
+use case. To get this metadata in your search results, specify the `text-match`
+media type in your Accept header. For example, via curl, the above query would
+look like this:
+
+``` command-line
+curl -H 'Accept: application/vnd.github.v3.text-match+json' \
+ https://api.github.com/search/code?q=addClass+in:file+language:js+repo:jquery/jquery
+```
+
+This produces the same JSON payload as above, with an extra key called
+`text_matches`, an array of objects. These objects provide information such as
+the position of your search terms within the text, as well as the property that
+included the search term.
+
+When searching for code, you can get text match metadata for the file
+**content** and file **path** fields. (See the section on
+[text match metadata](#text-match-metadata) for full details.)
+
+Here's an example response:
+
+<%= json(:code_search_v3_results_highlighting) %>
+
+## Search issues
+
+Find issues by state and keyword. (This method returns up to 100 results [per page](/v3/#pagination).)
+
+ GET /search/issues
### Parameters
-email
-: Email address
+Name | Type | Description
+-----|------|--------------
+`q`|`string`| The search terms.
+`sort`|`string`| The sort field. Can be `comments`, `created`, or `updated`. Default: results are sorted by best match.
+`order`|`string`| The sort order if `sort` parameter is provided. One of `asc` or `desc`. Default: `desc`
+
+The `q` search term can also contain any combination of the supported issue search qualifiers as described by the in-browser [issue search documentation](https://help.github.com/articles/searching-issues/) and [search syntax documentation](https://help.github.com/articles/search-syntax/):
+
+ * [`type`](https://help.github.com/articles/searching-issues#search-issues-or-pull-requests)
+ With this qualifier you can restrict the search to issues (`issue`) or pull request (`pr`) only.
+ * [`in`](https://help.github.com/articles/searching-issues#scope-the-search-fields)
+ Qualifies which fields are searched. With this qualifier you can restrict the
+ search to just the title (`title`), body (`body`), comments (`comments`), or any combination of these.
+ * [`author`](https://help.github.com/articles/searching-issues#search-by-the-author-of-an-issue-or-pull-request)
+ Finds issues or pull requests created by a certain user.
+ * [`assignee`](https://help.github.com/articles/searching-issues#search-by-the-assignee-of-an-issue-or-pull-request)
+ Finds issues or pull requests that are assigned to a certain user.
+ * [`mentions`](https://help.github.com/articles/searching-issues#search-by-a-mentioned-user-within-an-issue-or-pull-request)
+ Finds issues or pull requests that mention a certain user.
+ * [`commenter`](https://help.github.com/articles/searching-issues#search-by-a-commenter-within-an-issue-or-pull-request)
+ Finds issues or pull requests that a certain user commented on.
+ * [`involves`](https://help.github.com/articles/searching-issues#search-by-a-user-thats-involved-within-an-issue-or-pull-request)
+ Finds issues or pull requests that were either created by a certain user, assigned to that
+ user, mention that user, or were commented on by that user.
+ * [`team`](https://help.github.com/articles/searching-issues/#search-by-a-team-thats-mentioned-within-an-issue-or-pull-request)
+ For organizations you're a member of, finds issues or pull requests that @mention a team within the organization.
+ * [`state`](https://help.github.com/articles/searching-issues#search-based-on-whether-an-issue-or-pull-request-is-open)
+ Filter issues or pull requests based on whether they're open or closed.
+ * [`labels`](https://help.github.com/articles/searching-issues#search-by-the-labels-on-an-issue)
+ Filters issues or pull requests based on their labels.
+ * [`no`](https://help.github.com/articles/searching-issues#search-by-missing-metadata-on-an-issue-or-pull-request)
+ Filters items missing certain metadata, such as `label`, `milestone`, or `assignee`
+ * [`language`](https://help.github.com/articles/searching-issues#search-by-the-main-language-of-a-repository)
+ Searches for issues or pull requests within repositories that match a certain language.
+ * [`is`](https://help.github.com/articles/searching-issues#search-based-on-the-state-of-an-issue-or-pull-request)
+ Searches for items within repositories that match a certain state, such as `open`, `closed`, or `merged`
+ * [`created` or `updated`](https://help.github.com/articles/searching-issues#search-based-on-when-an-issue-or-pull-request-was-created-or-last-updated)
+ Filters issues or pull requests based on date of creation, or when they were last updated.
+ * [`merged`](https://help.github.com/articles/searching-issues#search-based-on-when-a-pull-request-was-merged)
+ Filters pull requests based on the date when they were merged.
+ * [`status`](https://help.github.com/articles/searching-issues#search-based-on-commit-status)
+ Filters pull requests based on the commit status.
+ * [`head` or `base`](https://help.github.com/articles/searching-issues#search-based-on-branch-names)
+ Filters pull requests based on the branch that they came from or that they are modifying.
+ * [`closed`](https://help.github.com/articles/searching-issues#search-based-on-when-an-issue-or-pull-request-was-closed)
+ Filters issues or pull requests based on the date when they were closed.
+ * [`comments`](https://help.github.com/articles/searching-issues#search-by-the-number-of-comments-an-issue-or-pull-request-has)
+ Filters issues or pull requests based on the quantity of comments.
+ * [`user` or `repo`](https://help.github.com/articles/searching-issues#search-within-a-users-or-organizations-repositories)
+ Limits searches to a specific user or repository.
+
+
+If you know the specific SHA hash of a commit, you can use also [use it to search for pull requests](https://help.github.com/articles/searching-issues#search-by-the-commit-shas-within-a-pull-request) that contain that SHA. Note that the SHA syntax must be at least seven characters.
+
+Example
+
+Let's say you want to find the oldest unresolved Python bugs on Windows. Your
+query might look something like this.
+
+ https://api.github.com/search/issues?q=windows+label:bug+language:python+state:open&sort=created&order=asc
+
+In this query, we're searching for the keyword `windows`, within any open issue
+that's labeled as `bug`. The search runs across repositories whose primary
+language is Python. We’re sorting by creation date in ascending order, so that
+the oldest issues appear first in the search results.
+
+<%= headers 200, {:pagination => default_pagination_rels,{% if page.version == 'dotcom' %} 'X-RateLimit-Limit' => 20, 'X-RateLimit-Remaining' => 19{% endif %}} %>
+<%= json(:issue_search_v3_results) %>
+
+### Highlighting Issue Search Results
+
+Some API consumers will want to highlight the matching search terms when
+displaying search results. The API offers additional metadata to support this
+use case. To get this metadata in your search results, specify the `text-match`
+media type in your Accept header. For example, via curl, the above query would
+look like this:
+
+``` command-line
+curl -H 'Accept: application/vnd.github.v3.text-match+json' \
+ 'https://api.github.com/search/issues?q=windows+label:bug+language:python+state:open&sort=created&order=asc'
+```
+
+This produces the same JSON payload as above, with an extra key called
+`text_matches`, an array of objects. These objects provide information such as
+the position of your search terms within the text, as well as the property that
+included the search term.
+
+When searching for issues, you can get text match metadata for the issue
+**title**, issue **body**, and issue **comment body** fields. (See the section
+on [text match metadata ](#text-match-metadata) for full details.)
+
+Here's an example response:
+
+<%= json(:issue_search_v3_results_highlighting) %>
+
+## Search users
+
+Find users via various criteria. (This method returns up to 100 results [per page](/v3/#pagination).)
+
+ GET /search/users
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`q`|`string`| The search terms.
+`sort`|`string`| The sort field. Can be `followers`, `repositories`, or `joined`. Default: results are sorted by best match.
+`order`|`string`| The sort order if `sort` parameter is provided. One of `asc` or `desc`. Default: `desc`
+
+The `q` search term can also contain any combination of the supported user search qualifiers as described by the in-browser [user search documentation](https://help.github.com/articles/searching-users/) and [search syntax documentation](https://help.github.com/articles/search-syntax/):
+
+ * [`type`](https://help.github.com/articles/searching-users#search-for-users-or-organizations)
+ With this qualifier you can restrict the search to just personal accounts (`user`) or
+ just organization accounts (`org`).
+ * [`in`](https://help.github.com/articles/searching-users#scope-the-search-fields)
+ Qualifies which fields are searched. With this qualifier you can restrict
+ the search to just the username (`login`), public email (`email`), full name (`fullname`), or any
+ combination of these.
+ * [`repos`](https://help.github.com/articles/searching-users#search-based-on-the-number-of-repositories-a-user-has)
+ Filters users based on the number of repositories they have.
+ * [`location`](https://help.github.com/articles/searching-users#search-based-on-the-location-where-a-user-resides)
+ Filter users by the location indicated in their profile.
+ * [`language`](https://help.github.com/articles/searching-users#search-based-on-the-languages-of-a-users-repositories)
+ Search for users that have repositories that match a certain language.
+ * [`created`](https://help.github.com/articles/searching-users#search-based-on-when-a-user-joined-github)
+ Filter users based on when they joined.
+ * [`followers`](https://help.github.com/articles/searching-users#search-based-on-the-number-of-followers-a-user-has)
+ Filter users based on the number of followers they have.
+
+Example
+
+Imagine you're looking for a list of popular users. You might try out this query:
+
+ https://api.github.com/search/users?q=tom+repos:%3E42+followers:%3E1000
+
+Here, we're looking at users with the name Tom. We're only interested in those
+with more than 42 repositories, and only if they have over 1,000 followers.
+
+<%= headers 200, {:pagination => default_pagination_rels,{% if page.version == 'dotcom' %} 'X-RateLimit-Limit' => 20, 'X-RateLimit-Remaining' => 19{% endif %}} %>
+<%= json(:user_search_v3_results) %>
+
+### Highlighting User Search Results
+
+Some API consumers will want to highlight the matching search terms when
+displaying search results. The API offers additional metadata to support this
+use case. To get this metadata in your search results, specify the `text-match`
+media type in your Accept header. For example, via curl, the above query would
+look like this:
+
+``` command-line
+curl -H 'Accept: application/vnd.github.v3.text-match+json' \
+ https://api.github.com/search/users?q=tom+repos:%3E42+followers:%3E1000
+```
+
+This produces the same JSON payload as above, with an extra key called
+`text_matches`, an array of objects. These objects provide information such as
+the position of your search terms within the text, as well as the property that
+included the search term.
+
+When searching for users, you can get text match metadata for the issue
+**login**, **email**, and **name** fields. (See the section on [text match
+metadata](#text-match-metadata) for full details.)
+
+<%= json(:user_search_v3_results_highlighting) %>
+
+## Text match metadata
+
+On github.com, we enjoy the context provided by code snippets and highlights in
+search results.
+
+[](https://f.cloud.github.com/assets/865/819651/959a4826-efb5-11e2-8af8-46c4a3857cdf.png)
+
+API consumers have access to that information as well. Requests can opt to
+receive those text fragments in the response, and every fragment is accompanied
+by numeric offsets identifying the exact location of each matching search term.
+
+To get this metadata in your search results, specify the `text-match` media type
+in your Accept header.
+
+ application/vnd.github.v3.text-match+json
+
+The results will provide the same JSON payloads as shown above, with an extra
+key called `text_matches`. Inside the `text_matches` array, each object includes
+the following attributes:
+
+
+Name | Description
+-----|-----------|
+`object_url` | The URL for the resource that contains a string property matching one of the search terms.
+`object_type` | The name for the type of resource that exists at the given `object_url`.
+`property` | The name of a property of the resource that exists at `object_url`. That property is a string that matches one of the search terms. (In the JSON returned from `object_url`, the full content for the `fragment` will be found in the property with this name.)
+`fragment` | A subset of the value of `property`. This is the text fragment that matches one or more of the search terms.
+`matches` | An array of one or more search terms that are present in `fragment`. The indices (i.e., "offsets") are relative to the fragment. (They are not relative to the _full_ content of `property`.)
+
+### Example
+
+Using curl, and the [example issue search](#issue-search-example) above, our API
+request would look like this:
+
+``` command-line
+curl -H 'Accept: application/vnd.github.v3.text-match+json' \
+ 'https://api.github.com/search/issues?q=windows+label:bug+language:python+state:open&sort=created&order=asc'
+```
+
+The response will include a `text_matches` array for each search result. In the
+JSON below, we have two objects in the `text_matches` array.
+
+The first text match occurred in the `body` property of the issue. We see a
+fragment of text from the issue body. The search term (`windows`) appears twice
+within that fragment, and we have the indices for each occurrence.
+
+The second text match occurred in the `body` property of one of the issue's
+comments. We have the URL for the issue comment. And of course, we see a
+fragment of text from the comment body. The search term (`windows`) appears once
+within that fragment.
-<%= headers 200 %>
-<%= json(:email_search_results) %>
+<%= json(:issue_search_v3_results_highlighting) %>
diff --git a/content/v3/search/legacy.md b/content/v3/search/legacy.md
new file mode 100644
index 0000000000..bcae61c3ff
--- /dev/null
+++ b/content/v3/search/legacy.md
@@ -0,0 +1,97 @@
+---
+title: Legacy Search
+---
+
+# Legacy Search
+
+{:toc}
+
+This is a listing of the Legacy Search API features from API v2 that have been ported to API
+v3. There should be no changes, other than the new URL and JSON output format.
+
+### Legacy Search API is Deprecated
+
+{{#warning}}
+
+The Legacy Search API (described below) is deprecated and is scheduled for removal in the next major version of the API.
+
+We recommend using the v3 Search API instead. It contains new endpoints and much more functionality.
+
+{{/warning}}
+
+## Search issues
+
+Find issues by state and keyword.
+
+ GET /legacy/issues/search/:owner/:repository/:state/:keyword
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`state`|`string` | Indicates the state of the issues to return. Can be either `open` or `closed`.
+`keyword`|`string`| The search term.
+
+
+<%= headers 200 %>
+<%= json(:issue_search_results) %>
+
+## Search repositories
+
+Find repositories by keyword. Note, this legacy method does not follow the
+v3 pagination pattern. This method returns up to 100 results per page and
+pages can be fetched using the `start_page` parameter.
+
+ GET /legacy/repos/search/:keyword
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`keyword`|`string`| The search term|
+`language`|`string` | Filter results by language
+`start_page`|`string` | The page number to fetch
+`sort`|`string` | The sort field. One of `stars`, `forks`, or `updated`. Default: results are sorted by best match.
+`order`|`string` | The sort field. if `sort` param is provided. Can be either `asc` or `desc`.
+
+
+<%= headers 200 %>
+<%= json(:repo_search_results) %>
+
+## Search users
+
+Find users by keyword.
+
+ GET /legacy/user/search/:keyword
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`keyword`|`string`| The search term
+`start_page`|`string` | The page number to fetch
+`sort`|`string`| The sort field. One of `stars`, `forks`, or `updated`. Default: results are sorted by best match.
+`order`|`string`| The sort field. if `sort` param is provided. Can be either `asc` or `desc`.
+
+
+<%= headers 200 %>
+<%= json(:user_search_results) %>
+
+## Email search
+
+This API call is added for compatibility reasons only. There's no guarantee
+that full email searches will always be available. The `@` character in the
+address must be left unencoded. Searches only against public email addresses
+(as configured on the user's {{ site.data.variables.product.product_name }} profile).
+
+ GET /legacy/user/email/:email
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`email`|`string`| The email address
+
+
+<%= headers 200 %>
+<%= json(:email_search_results) %>
diff --git a/content/v3/troubleshooting.md b/content/v3/troubleshooting.md
new file mode 100644
index 0000000000..09a0d04864
--- /dev/null
+++ b/content/v3/troubleshooting.md
@@ -0,0 +1,48 @@
+---
+title: Troubleshooting
+---
+
+# Troubleshooting
+
+{:toc}
+
+If you're encountering some oddities in the API, here's a list of resolutions to
+some of the problems you may be experiencing.
+
+## Why am I getting a `404` error on a repository that exists?
+
+Typically, we send a `404` error when your client isn't properly authenticated.
+You might expect to see a `403 Forbidden` in these cases. However, since we don't
+want to provide _any_ information about private repositories, the API returns a
+`404` error instead.
+
+To troubleshoot, ensure [you're authenticating correctly](/guides/getting-started/), [your OAuth access token has the required scopes](/v3/oauth/#scopes), and [third-party application restrictions][oap-guide] are not blocking access.
+
+## Why am I not seeing all my results?
+
+Most API calls accessing a list of resources (_e.g._, users, issues, _etc._) support
+pagination. If you're making requests and receiving an incomplete set of results, you're
+probably only seeing the first page. You'll need to request the remaining pages
+in order to get more results.
+
+It's important to *not* try and guess the format of the pagination URL. Not every
+API call uses the same structure. Instead, extract the pagination information from
+[the Link Header](/v3/#pagination), which is sent with every request.
+
+{% if page.version == 'dotcom' %}
+
+## Can I get my rate limits bumped?
+
+The {{ site.data.variables.product.product_name }} API has a pretty lenient quota for rate limits, for your enjoyment and
+our safety. You can read more about it [here](/v3/#rate-limiting).
+
+If you're using OAuth or Basic Authentication and are hitting your rate limits,
+you might be able to fix the issue by either caching our results, or [using conditional requests](/v3/#conditional-requests).
+
+In certain exceptional cases, we may temporarily bump your rate limit higher. You
+should be prepared to answer technical questions about your goal and your planned usage of the API. We may still choose not to bump your limit if we feel that you can achieve your wildest
+dreams with the current rate limit (but don't worry, we'll help you out).
+
+{% endif %}
+
+[oap-guide]: /changes/2015-01-19-an-integrators-guide-to-organization-application-policies/
diff --git a/content/v3/users.md b/content/v3/users.md
index b111d651af..11e5479a4c 100644
--- a/content/v3/users.md
+++ b/content/v3/users.md
@@ -1,21 +1,26 @@
---
-title: Users | GitHub API
+title: Users
---
-# Users API
+# Users
+
+{:toc}
Many of the resources on the users API provide a shortcut for getting
information about the currently authenticated user. If a request URL
-does not include a `:user` parameter then the response will be for the
+does not include a `:username` parameter then the response will be for the
logged in user (and you must pass [authentication
information](/v3/#authentication) with your request).
## Get a single user
- GET /users/:user
+ GET /users/:username
### Response
+Note: The returned email is the user's publicly visible email address
+(or `null` if the user has not [specified a public email address in their profile](https://github.com/settings/profile)).
+
<%= headers 200 %>
<%= json :full_user %>
@@ -32,28 +37,19 @@ information](/v3/#authentication) with your request).
PATCH /user
-### Input
-
-name
-: _Optional_ **string**
-
-email
-: _Optional_ **string** - Publicly visible email address.
+### Parameters
-blog
-: _Optional_ **string**
+Name | Type | Description
+-----|------|--------------
+`name`|`string` | The new name of the user
+`email`|`string` | Publicly visible email address.
+`blog`|`string` | The new blog URL of the user.
+`company`|`string` | The new company of the user.
+`location`|`string` | The new location of the user.
+`hireable`|`boolean` | The new hiring availability of the user.
+`bio`|`string` | The new short biography of the user.
-company
-: _Optional_ **string**
-
-location
-: _Optional_ **string**
-
-hireable
-: _Optional_ **boolean**
-
-bio
-: _Optional_ **string**
+#### Example
<%= json \
:name => "monalisa octocat",
@@ -70,3 +66,24 @@ bio
<%= headers 200 %>
<%= json :private_user %>
+## Get all users
+
+Lists all users, in the order that they signed up on {{ site.data.variables.product.product_name }}. This list includes personal user accounts and organization accounts.
+
+Note: Pagination is powered exclusively by the `since` parameter.
+Use the [Link header](/v3/#link-header) to get the URL for the next page of
+users.
+
+ GET /users
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`since`|`string`| The integer ID of the last User that you've seen.
+
+
+### Response
+
+<%= headers 200, :pagination => { :next => 'https://api.github.com/users?since=135' } %>
+<%= json(:user) { |h| [h] } %>
diff --git a/content/v3/users/administration.md b/content/v3/users/administration.md
new file mode 100644
index 0000000000..f918e2f38c
--- /dev/null
+++ b/content/v3/users/administration.md
@@ -0,0 +1,199 @@
+---
+title: User Administration
+---
+
+# Administration (Enterprise)
+
+{:toc}
+
+The User Administration API allows you to promote, demote, suspend, and unsuspend users on a GitHub Enterprise appliance. *It is only available to [authenticated](/v3/#authentication) site administrators.* Normal users will receive a `403` response if they try to access it.
+
+Prefix all the endpoints for this API with the following URL:
+
+``` command-line
+http(s)://hostname/api/v3
+```
+
+{% if page.version != 'dotcom' and page.version >= 2.3 %}
+
+## Create a new user
+
+{{#warning}}
+
+If 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
+[update the LDAP mapping](/v3/enterprise/ldap/#update-ldap-mapping-for-a-user)
+for the user.
+
+{{/warning}}
+
+ POST /admin/users
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`login`|`string` | **Required.** The user's username.
+`email`|`string` | **Required.** The user's email address.
+
+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 `422` response.
+
+#### Example
+
+<%= json \
+ :login => "monalisa",
+ :email => "octocat@github.com"
+%>
+
+### Response
+
+<%= headers 201 %>
+<%= json :user %>
+
+## Rename an existing user
+
+ PATCH /admin/users/:username
+
+### Parameters
+
+Name | Type | Description
+-----|------|--------------
+`login`|`string` | **Required.** The user's new username.
+
+#### Example
+
+<%= json \
+ :login => "thenewmonalisa"
+%>
+
+### Response
+
+<%= headers 202 %>
+<%= json \
+ :message => "Job queued to rename user. It may take a few minutes to complete.",
+ :url => "https://api.github.com/user/1"
+%>
+
+## Create an impersonation OAuth token
+
+ POST /admin/users/:username/authorizations
+
+### Parameters
+
+Name | Type | Description
+---- | ---- | -------------
+`scopes`|`array` | A list of [scopes](/v3/oauth/#scopes).
+
+### Response
+
+<%= headers 201 %>
+<%= json(:oauth_access) %>
+
+## Delete an impersonation OAuth token
+
+ DELETE /admin/users/:username/authorizations
+
+### Response
+
+<%= headers 204 %>
+
+{% endif %}
+
+## Promote an ordinary user to a site administrator
+
+ PUT /users/:username/site_admin
+
+<%= fetch_content(:put_content_length) %>
+
+### Response
+
+<%= headers 204 %>
+
+## Demote a site administrator to an ordinary user
+
+ DELETE /users/:username/site_admin
+
+You can demote any user account except your own.
+
+### Response
+
+<%= headers 204 %>
+
+## Suspend a user
+
+{{#warning}}
+
+If your GitHub Enterprise appliance has [LDAP Sync with Active Directory LDAP servers](https://help.github.com/enterprise/admin/guides/user-management/using-ldap), this API is disabled and will return a `403` response. Users managed by an external account cannot be suspended via the API.
+
+{{/warning}}
+
+ PUT /users/:username/suspended
+
+You can suspend any user account except your own.
+
+<%= fetch_content(:put_content_length) %>
+
+### Response
+
+<%= headers 204 %>
+
+## Unsuspend a user
+
+{{#warning}}
+
+If your GitHub Enterprise appliance has [LDAP Sync with Active Directory LDAP servers](https://help.github.com/enterprise/admin/guides/user-management/using-ldap), this API is disabled and will return a `403` response. Users managed by an external account cannot be unsuspended via the API.
+
+{{/warning}}
+
+ DELETE /users/:username/suspended
+
+### Response
+
+<%= headers 204 %>
+
+{% if page.version != 'dotcom' and page.version >= 2.3 %}
+
+## List all public keys
+
+ GET /admin/keys
+
+### Response
+
+<%= headers 200, :pagination => default_pagination_rels %>
+<%= json(:all_keys) { |public_key, deploy_key| \
+ [public_key, deploy_key.merge("id" => "2", "url" => "https://api.github.com/repos/octocat/Hello-World/keys/2")] \
+} %>
+
+{% if page.version != 'dotcom' and page.version >= 2.4 %}
+
+## Delete a user
+
+{{#warning}}
+
+Deleting a user will delete all their repositories, gists, applications, and personal settings. [Suspending a user](/v3/users/administration/#suspend-a-user) is often a better option.
+
+{{/warning}}
+
+ DELETE /admin/users/:username
+
+You can delete any user account except your own.
+
+### Response
+
+<%= headers 204 %>
+
+{% endif %}
+
+## Delete a public key
+
+ DELETE /admin/keys/1
+
+### Response
+
+<%= headers 204 %>
+
+{% endif %}
diff --git a/content/v3/users/emails.md b/content/v3/users/emails.md
index 7015dc1ea1..0de8cb90b6 100644
--- a/content/v3/users/emails.md
+++ b/content/v3/users/emails.md
@@ -1,23 +1,37 @@
---
-title: User Emails | GitHub API
+title: User Emails
---
-# User Emails API
+# Emails
+
+{:toc}
Management of email addresses via the API requires that you are
-authenticated.
+authenticated through basic auth or OAuth with the user scope.
## List email addresses for a user
GET /user/emails
+This endpoint is accessible with the user:email scope.
+
### Response
-<%= headers 200 %>
-<%= json ["octocat@github.com", "support@github.com"] %>
+<%= headers 200, :pagination => default_pagination_rels %>
+<%= json(:user_email) {|e| [e]} %>
## Add email address(es)
+{% if page.version != 'dotcom' && page.version >= 2.1 %}
+
+{{#warning}}
+
+If your GitHub Enterprise appliance has [LDAP Sync enabled](https://help.github.com/enterprise/admin/guides/user-management/using-ldap) and the option to synchronize emails enabled, this API is disabled and will return a `403` response. Users managed in LDAP won't be able to add an email address via the API with these options enabled.
+
+{{/warning}}
+
+{% endif %}
+
POST /user/emails
### Input
@@ -29,10 +43,31 @@ You can post a single email address or an array of addresses:
### Response
<%= headers 201 %>
-<%= json ["octocat@github.com", "support@github.com"] %>
+<%= json [
+ {
+ "email" => "octocat@github.com",
+ "primary" => false,
+ "verified" => false
+ },
+ {
+ "email" => "support@github.com",
+ "primary" => false,
+ "verified" => false
+ },
+] %>
## Delete email address(es)
+{% if page.version != 'dotcom' && page.version >= 2.1 %}
+
+{{#warning}}
+
+If your GitHub Enterprise appliance has [LDAP Sync enabled](https://help.github.com/enterprise/admin/guides/user-management/using-ldap) and the option to synchronize emails enabled, this API is disabled and will return a `403` response. Users managed in LDAP won't be able to remove an email address via the API with these options enabled.
+
+{{/warning}}
+
+{% endif %}
+
DELETE /user/emails
### Input
@@ -45,3 +80,5 @@ You can include a single email address or an array of addresses:
<%= headers 204 %>
+
+[media-types]: /v3/media
diff --git a/content/v3/users/followers.md b/content/v3/users/followers.md
index eb32126e10..258d8d5e31 100644
--- a/content/v3/users/followers.md
+++ b/content/v3/users/followers.md
@@ -1,14 +1,16 @@
---
-title: User Followers | GitHub API
+title: User Followers
---
-# User Followers API
+# Followers
+
+{:toc}
## List followers of a user
List a user's followers:
- GET /users/:user/followers
+ GET /users/:username/followers
List the authenticated user's followers:
@@ -16,14 +18,14 @@ List the authenticated user's followers:
### Response
-<%= headers 200, :pagination => true %>
+<%= headers 200, :pagination => default_pagination_rels %>
<%= json(:user) { |h| [h] } %>
-## List users following another user
+## List users followed by another user
List who a user is following:
- GET /users/:user/following
+ GET /users/:username/following
List who the authenticated user is following:
@@ -31,12 +33,12 @@ List who the authenticated user is following:
### Response
-<%= headers 200, :pagination => true %>
+<%= headers 200, :pagination => default_pagination_rels %>
<%= json(:user) { |h| [h] } %>
## Check if you are following a user
- GET /user/following/:user
+ GET /user/following/:username
### Response if you are following this user
@@ -46,9 +48,26 @@ List who the authenticated user is following:
<%= headers 404 %>
+## Check if one user follows another
+
+ GET /users/:username/following/:target_user
+
+### Response if user follows target user
+
+<%= headers 204 %>
+
+### Response if user does not follow target user
+
+<%= headers 404 %>
+
## Follow a user
- PUT /user/following/:user
+ PUT /user/following/:username
+
+<%= fetch_content(:put_content_length) %>
+
+Following a user requires the user to be logged in and authenticated with basic
+auth or OAuth with the `user:follow` scope.
### Response
@@ -56,7 +75,10 @@ List who the authenticated user is following:
## Unfollow a user
- DELETE /user/following/:user
+ DELETE /user/following/:username
+
+Unfollowing a user requires the user to be logged in and authenticated with basic
+auth or OAuth with the `user:follow` scope.
### Response
diff --git a/content/v3/users/gpg_keys.md b/content/v3/users/gpg_keys.md
new file mode 100644
index 0000000000..448737dc56
--- /dev/null
+++ b/content/v3/users/gpg_keys.md
@@ -0,0 +1,78 @@
+---
+title: User GPG Keys
+---
+
+{% if page.version == 'dotcom' %}
+
+# GPG Keys
+
+{{#tip}}
+
+
+
+ APIs for managing user GPG keys are currently available for developers to preview.
+ During the preview period, the APIs may change without advance notice.
+ Please see the [blog post](/changes/2016-04-04-git-signing-api-preview) for full details.
+
+ To access the API you must provide a custom [media type](/v3/media) in the `Accept` header:
+
+ application/vnd.github.cryptographer-preview
+
+{{/tip}}
+
+{:toc}
+
+## List your GPG keys
+
+ GET /user/gpg_keys
+
+Lists the current user's GPG keys. Requires that you are authenticated via
+Basic Auth or via OAuth with at least `read:gpg_key`
+[scope](/v3/oauth/#scopes).
+
+### Response
+
+<%= headers 200, :pagination => default_pagination_rels %>
+<%= json(:gpg_key) { |h| [h] } %>
+
+## Get a single GPG key
+
+View extended details for a single GPG key. Requires that you are
+authenticated via Basic Auth or via OAuth with at least `read:gpg_key`
+[scope](/v3/oauth/#scopes).
+
+ GET /user/gpg_keys/:id
+
+### Response
+
+<%= headers 200 %>
+<%= json :gpg_key %>
+
+## Create a GPG key
+
+Creates a GPG key. Requires that you are authenticated via Basic Auth,
+or OAuth with at least `write:gpg_key` [scope](/v3/oauth/#scopes).
+
+ POST /user/gpg_keys
+
+### Input
+
+<%= json :armored_public_key => "-----BEGIN PGP PUBLIC KEY BLOCK-----\n...\n-----END PGP PUBLIC KEY BLOCK-----" %>
+
+### Response
+
+<%= headers 201, :Location => get_resource(:gpg_key)['url'] %>
+<%= json :gpg_key %>
+
+## Delete a GPG key
+
+Removes a GPG key. Requires that you are authenticated via Basic Auth
+or via OAuth with at least `admin:gpg_key` [scope](/v3/oauth/#scopes).
+
+ DELETE /user/gpg_keys/:id
+
+### Response
+
+<%= headers 204 %>
+
+{% endif %}
diff --git a/content/v3/users/keys.md b/content/v3/users/keys.md
index 646a8840d7..25378d75f4 100644
--- a/content/v3/users/keys.md
+++ b/content/v3/users/keys.md
@@ -1,23 +1,42 @@
---
-title: User Public Keys | GitHub API
+title: User Public Keys
---
-# User Public Keys API
+# Public Keys
-Management of public keys via the API requires that you are
-authenticated.
+{:toc}
## List public keys for a user
+ GET /users/:username/keys
+
+Lists the _verified_ public keys for a user. This is accessible by anyone.
+
+### Response
+
+<%= headers 200, :pagination => default_pagination_rels %>
+<%= json(:simple_public_key) { |h| [h] } %>
+
+
+## List your public keys
+
GET /user/keys
+Lists the current user's keys. Requires that you are authenticated via
+Basic Auth or via OAuth with at least `read:public_key`
+[scope](/v3/oauth/#scopes).
+
### Response
-<%= headers 200 %>
+<%= headers 200, :pagination => default_pagination_rels %>
<%= json(:public_key) { |h| [h] } %>
## Get a single public key
+View extended details for a single public key. Requires that you are
+authenticated via Basic Auth or via OAuth with at least `read:public_key`
+[scope](/v3/oauth/#scopes).
+
GET /user/keys/:id
### Response
@@ -27,6 +46,19 @@ authenticated.
## Create a public key
+Creates a public key. Requires that you are authenticated via Basic Auth,
+or OAuth with at least `write:public_key` [scope](/v3/oauth/#scopes).
+
+{% if page.version != 'dotcom' && page.version >= 2.1 %}
+
+{{#warning}}
+
+If your GitHub Enterprise appliance has [LDAP Sync enabled](https://help.github.com/enterprise/admin/guides/user-management/using-ldap) and the option to synchronize SSH keys enabled, this API is disabled and will return a `403` response. Users managed in LDAP won't be able to add an SSH key address via the API with these options enabled.
+
+{{/warning}}
+
+{% endif %}
+
POST /user/keys
### Input
@@ -35,23 +67,29 @@ authenticated.
### Response
-<%= headers 201, :Location => "https://api.github.com/user/keys/1" %>
+<%= headers 201, :Location => get_resource(:public_key)['url'] %>
<%= json :public_key %>
## Update a public key
- PATCH /user/keys/:id
+Public keys are immutable. If you need to update a public key, [remove the
+key](#delete-a-public-key) and [create a new one](#create-a-public-key)
+instead.
-### Input
+## Delete a public key
-<%= json :title => "octocat@octomac", :key => "ssh-rsa AAA..." %>
+Removes a public key. Requires that you are authenticated via Basic Auth
+or via OAuth with at least `admin:public_key` [scope](/v3/oauth/#scopes).
-### Response
+{% if page.version != 'dotcom' && page.version >= 2.1 %}
-<%= headers 200 %>
-<%= json :public_key %>
+{{#warning}}
-## Delete a public key
+If your GitHub Enterprise appliance has [LDAP Sync enabled](https://help.github.com/enterprise/admin/guides/user-management/using-ldap) and the option to synchronize SSH keys enabled, this API is disabled and will return a `403` response. Users managed in LDAP won't be able to remove an SSH key address via the API with these options enabled.
+
+{{/warning}}
+
+{% endif %}
DELETE /user/keys/:id
diff --git a/content/v3/versions.md b/content/v3/versions.md
new file mode 100644
index 0000000000..53c7cf6f33
--- /dev/null
+++ b/content/v3/versions.md
@@ -0,0 +1,198 @@
+---
+title: Versions
+---
+# Versions
+
+There are two stable versions of the GitHub API: the [v3](#v3) version and the deprecated [beta](#beta) version. There are just a few [differences between these two versions](#differences-from-beta-version).
+
+By default, all requests receive the v3 version. We encourage you to [request a specific version via the `Accept` header](/v3/media/#request-specific-version).
+
+# v3
+
+The [v3 API](/v3) is stable, and we strive to ensure that all [changes](/changes) are backwards compatible. Please [file a support issue][support] if you have problems.
+
+Some v3 functionality is [deprecated](#v3-deprecations) 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](/v3/gists/#get-a-single-gist), the v3 media type renames the `user` attribute to `owner`.
+
+### Issue JSON
+
+When an [issue](/v3/issues/#get-a-single-issue) is not a pull request, the v3 media type omits the `pull_request` attribute.
+
+### Repository JSON
+
+For [Repositories](/v3/repos/#get), 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](/v3/users/emails/#list-email-addresses-for-a-user), 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.
+
+1. Method: /gists/:id/fork
+
+ Recommendation: Use **/gists/:id/forks** (plural) instead.
+
+1. Method: /legacy/issues/search/:owner/:repository/:state/:keyword
+
+ Recommendation: Use [v3 Issue Search API](/v3/search/#search-issues) instead.
+
+1. Method: /legacy/repos/search/:keyword
+
+ Recommendation: Use [v3 Repository Search API](/v3/search/#search-repositories) instead.
+
+1. Method: /legacy/user/search/:keyword
+
+ Recommendation: Use [v3 User Search API](/v3/search/#search-users) instead.
+
+1. Method: /legacy/user/email/:email
+
+ Recommendation: Use [v3 User Search API](/v3/search/#search-users) instead.
+
+1. Method: /repos/:owner/:repo/hooks/:id/test
+
+ Recommendation: Use **/repos/:owner/:repo/hooks/:id/tests** (plural) instead.
+
+1. Method: /teams/:id/members/:username
+
+ Recommendation: Use [Get Team Membership](/v3/orgs/teams/#get-team-membership), [Add Team Membership](/v3/orgs/teams/#add-team-membership), and [Remove Team Membership](/v3/orgs/teams/#remove-team-membership) instead.
+
+1. Query parameters when POSTing to /repos/:owner/:repo/forks
+
+ Recommendation: Use JSON to POST to this method instead.
+
+1. 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.
+
+1. Pull Request attribute: merge_commit_sha
+
+ Recommendation: [Do not use this attribute](/changes/2013-04-25-deprecating-merge-commit-sha/).
+
+1. Rate Limit attribute: rate
+
+ Recommendation: Use **resources["core"]** instead.
+
+1. Repository attribute: forks
+
+ Recommendation: Use **forks_count** instead.
+
+1. Repository attribute: master_branch
+
+ Recommendation: Use **default_branch** instead.
+
+1. Repository attribute: open_issues
+
+ Recommendation: Use **open_issues_count** instead.
+
+1. Repository attribute: public
+
+ Recommendation: When [creating a repository](/v3/repos/#create), use the
+ **private** attribute to indicate whether the repository should be public or
+ private. Do not use the **public** attribute.
+
+1. Repository attribute: watchers
+
+ Recommendation: Use **watchers_count** instead.
+
+1. User attribute: bio
+
+ Recommendation: Do not use this attribute. It is obsolete.
+
+1. User attribute: plan["collaborators"]
+
+ Recommendation: Do not use this attribute. It is obsolete.
+
+1. User attribute: gravatar_id
+
+ Recommendation: Use **avatar_url** instead.
+
+1. Feed attribute: current_user_organization_url
+
+ Recommendation: Use **current_user_organization_urls** instead.
+
+1. Feed attribute: current_user_organization
+
+ Recommendation: Use **current_user_organizations** instead.
+
+1. Pagination parameters `top` and `sha` for method: /repos/:owner/:repo/commits
+
+ Recommendation: When fetching [the list of commits for a repository](/v3/repos/commits/#list-commits-on-a-repository)
+ use the [standard `per_page` and `page` parameters](/v3/#pagination) for pagination, instead of `per_page`,
+ `top`, and `sha`.
+
+1. 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](/changes/2015-04-20-authorizations-api-response-changes-are-now-in-effect/)
+ and the [Authorizations API deprecation notice](/v3/oauth_authorizations/#deprecation-notice)
+ for full details.
+
+1. Team attribute: permission
+
+ Recommendation: This attribute no longer dictates the permission a team has on its repositories; it only dictates the default permission that the [Add or update team repository](/v3/orgs/teams/#add-or-update-team-repository) API will use for requests where no `permission` attribute is specified. To change the permission level for every repository on a team, use the [List team repositories](/v3/orgs/teams/#list-team-repos) API to list all of the team's repositories, and then use the [Add or update team repository](/v3/orgs/teams/#add-or-update-team-repository) with a `permission` attribute to update each repository's permission separately.
+
+1. Issue attribute: assignee
+
+ Recommendation: Use the [`assignees`](https://developer.github.com/v3/issues/#create-an-issue) key instead, since issues can have more than one assignee. Alternatively, you can use the
+ [assignees](https://developer.github.com/v3/issues/assignees/) endpoints.
+
+
+
+# beta (Deprecated)
+
+The [beta API](/v3) is deprecated. Its current functionality is stable, and we strive to ensure that any [changes](/changes) are backwards compatible. Please [file a support issue][support] if you have problems.
+
+{{#tip}}
+
+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.
+
+{{/tip}}
+
+## Breaking beta changes
+
+### June 15th, 2011:
+
+* `gravatar_url` is being deprecated in favor of `avatar_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.
+
+[support]: https://github.com/contact?form[subject]=APIv3
diff --git a/content/webhooks/configuring.md b/content/webhooks/configuring.md
new file mode 100644
index 0000000000..c48be12ffb
--- /dev/null
+++ b/content/webhooks/configuring.md
@@ -0,0 +1,86 @@
+---
+title: Configuring your server
+layout: webhooks
+---
+
+# Configuring Your Server
+
+{:toc}
+
+Now that our webhook is ready to deliver messages, we'll set up a basic Sinatra server
+to handle incoming payloads.
+
+Recall that we specifically set our webhook URL to `http://localhost:4567/payload`.
+Since we're developing locally, we'll need to expose our local development environment
+to the Internet, so that GitHub can send out messages, and our local server can
+process them.
+
+Note: you can download the complete source code for this project
+[from the platform-samples repo][platform samples].
+
+## Using ngrok
+
+First, we'll install a program to expose our local host to the Internet. We'll use
+ngrok to do this. [ngrok is a free download](https://ngrok.com/download) available
+for all major operating systems.
+
+When you're done with that, you can expose your localhost by running `./ngrok http 4567`
+on the command line. You should see a line that looks something like this:
+
+``` command-line
+$ Forwarding http://7e9ea9dc.ngrok.io -> 127.0.0.1:4567
+```
+
+Copy that funky `*.ngrok.io` URL! We're now going to go *back* to the Payload
+URL and pasting this server into that field. It should look something like `http://7e9ea9dc.ngrok.io/payload`.
+
+By doing this, we've set ourselves up to expose our localhost at path `/payload`
+to the Internet.
+
+## Writing the server
+
+Now comes the fun part! We want our server to listen to `POST` requests, at `/payload`,
+because that's where we told GitHub our webhook URL was. Since ngrok is exposing
+our local environment, we don't need to set up a real server somewhere online, and
+can happily test out our code locally.
+
+Let's set up a little Sinatra app to do something with the information. Our initial
+setup might look something like this:
+
+``` ruby
+require 'sinatra'
+require 'json'
+
+post '/payload' do
+ push = JSON.parse(request.body.read)
+ puts "I got some JSON: #{push.inspect}"
+end
+```
+
+(If you're unfamiliar with how Sinatra works, we recommend [reading the Sinatra guide][Sinatra].)
+
+Start this server up.
+
+Since we set up our webhook to listen to events dealing with `Issues`, go ahead
+and create a new Issue on the repository you're testing with. Once you create
+it, switch back to your terminal. You should see something like this in your output:
+
+``` command-line
+$ ~/Developer/platform-samples/hooks/ruby/configuring-your-server $ ruby server.rb
+> == Sinatra/1.4.4 has taken the stage on 4567 for development with backup from Thin
+> >> Thin web server (v1.5.1 codename Straight Razor)
+> >> Maximum connections set to 1024
+> >> Listening on localhost:4567, CTRL+C to stop
+> I got some JSON: {"action"=>"opened", "issue"=>{"url"=>"...
+```
+
+Success! You've successfully configured your server to listen to webhooks. Your
+server can now process this information any way you see fit. For example, if you
+were setting up a "real" web application, you might want to log some of the JSON
+output to a database.
+
+For additional information on working with webhooks for fun and profit, head on
+over to the [Testing Webhooks](/webhooks/testing) guide.
+
+[platform samples]: https://github.com/github/platform-samples/tree/master/hooks/ruby/configuring-your-server
+[Sinatra]: http://www.sinatrarb.com/
diff --git a/content/webhooks/creating.md b/content/webhooks/creating.md
new file mode 100644
index 0000000000..06170155d1
--- /dev/null
+++ b/content/webhooks/creating.md
@@ -0,0 +1,65 @@
+---
+title: Creating webhooks
+layout: webhooks
+---
+
+# Creating Webhooks
+
+{:toc}
+
+Now that we understand [the basics of webhooks][webhooks-overview], let's go
+through the process of building out our own webhook powered integration. In
+this tutorial, we'll create a repository webhook that will be responsible for
+listing out how popular our repository is, based on the number of Issues it
+receives per day.
+
+Creating a webhook is a two-step process. You'll first need to set up how you want
+your webhook to behave through {{ site.data.variables.product.product_name }}--what events should it listen to. After that,
+you'll set up your server to receive and manage the payload.
+
+## Setting up a Webhook
+
+To set up a repository webhook on {{ site.data.variables.product.product_name }}, head over to the **Settings** page of
+your repository, and click on **Webhooks & services**. After that, click on
+**Add webhook**.
+
+Alternatively, you can choose to build and manage a webhook [through the Webhooks API][webhook-api].
+
+Webhooks require a few configuration options before you can make use of them.
+We'll go through each of these settings below.
+
+## Payload URL
+
+This is the server endpoint that will receive the webhook payload.
+
+Since we're developing locally for our tutorial, let's set it to `http://localhost:4567/payload`.
+We'll explain why in the [Configuring Your Server](/webhooks/configuring/) docs.
+
+## Content Type
+
+Webhooks can be delivered using different content types:
+
+- The `application/json` content type will deliver the JSON payload directly as the body of the POST.
+- The `application/x-www-form-urlencoded` content type will send the JSON payload as a form parameter
+ called "payload".
+
+Choose the one that best fits your needs. For this tutorial, the default content type of
+`application/json` is fine.
+
+## Events
+
+Events are at the core of webhooks. These webhooks fire whenever a certain action is
+taken on the repository, which your server's payload URL intercepts and acts upon.
+
+A full list of webhook events, and when they execute, can be found in [the webhooks API][hooks-api] reference.
+
+Since our webhook is dealing with Issues in a repository, we'll click on **Issues**,
+and toggle the options there.
+
+When you're finished, click on **Add webhook**. Phew! Now that the webhook is created,
+it's time to set up our local server to test the webhook. Head on over to
+[Configuring Your Server](/webhooks/configuring/) to learn how to do that.
+
+[webhooks-overview]: /webhooks/
+[webhook-api]: /v3/repos/hooks/
+[hooks-api]: /webhooks/#events
diff --git a/content/webhooks/index.md b/content/webhooks/index.md
new file mode 100644
index 0000000000..03fc42d1ca
--- /dev/null
+++ b/content/webhooks/index.md
@@ -0,0 +1,188 @@
+---
+title: Webhooks
+layout: webhooks
+---
+
+# Webhooks
+
+{:toc}
+
+
+Webhooks allow you to build or set up integrations which subscribe to certain
+events on GitHub.com. When one of those events is triggered, we'll send a HTTP
+POST payload to the webhook's configured URL. Webhooks can be used to update
+an external issue tracker, trigger CI builds, update a backup mirror, or even
+deploy to your production server. You're only limited by your imagination.
+
+Each webhook can be installed [on an organization][org-hooks] or [a specific
+repository][repo-hooks]. Once installed, they will be triggered each time one
+or more subscribed events occurs on that organization or repository.
+
+You can create up to 20 webhooks for each event on each installation target
+(specific organization or specific repository).
+
+## Events
+
+When configuring a webhook, you can choose which events you would like to
+receive payloads for. You can [even opt-in to all current and future
+events][wildcard-section]. Only subscribing to the specific events you plan on
+handling is useful for limiting the number of HTTP requests to your server. You
+can change the list of subscribed events through the API or UI anytime. By
+default, webhooks are only subscribed to the `push` event.
+
+Each event corresponds to a certain set of actions that can happen to your
+organization and/or repository. For example, if you subscribe to the `issues`
+event you'll receive [detailed payloads][payloads-section] every time an issue
+is opened, closed, labeled, etc.
+
+
+The available events are:
+
+Name | Description
+-----|-----------|
+`*` | Any time any event is triggered ([Wildcard Event][wildcard-section]).
+[`commit_comment`][event-types-commit_comment] | Any time a Commit is commented on.
+[`create`][event-types-create] | Any time a Branch or Tag is created.
+[`delete`][event-types-delete] | Any time a Branch or Tag is deleted.
+[`deployment`][event-types-deployment] | Any time a Repository has a new deployment created from the API.
+[`deployment_status`][event-types-deployment_status] | Any time a deployment for a Repository has a status update from the API.
+[`fork`][event-types-fork] | Any time a Repository is forked.
+[`gollum`][event-types-gollum] | Any time a Wiki page is updated.
+[`issue_comment`][event-types-issue_comment] | {% if page.version == 'dotcom' or page.version > 2.6 %}Any time a [comment on an issue](/v3/issues/comments/) is created, edited, or deleted.{% else %}Any time an [issue is commented on](/v3/issues/comments).{% endif %}
+[`issues`][event-types-issues] | Any time an Issue is assigned, unassigned, labeled, unlabeled, opened, {% if page.version == 'dotcom' or page.version > 2.6 %}edited, {% endif %}closed, or reopened.
+[`member`][event-types-member] | Any time a User is added as a collaborator to a Repository.
+[`membership`][event-types-membership] | Any time a User is added or removed from a team. **Organization hooks only**.
+[`page_build`][event-types-page_build] | Any time a Pages site is built or results in a failed build.
+[`public`][event-types-public] | Any time a Repository changes from private to public.
+[`pull_request_review_comment`][event-types-pull_request_review_comment] | {% if page.version == 'dotcom' or page.version > 2.6 %}Any time a [comment on a Pull Request's unified diff](/v3/pulls/comments) is created, edited, or deleted{% else %}Any time a [Pull Request's unified diff is commented on](/v3/pulls/comments){% endif %} (in the Files Changed tab).
+[`pull_request`][event-types-pull_request] | Any time a Pull Request is assigned, unassigned, labeled, unlabeled, opened, {% if page.version == 'dotcom' or page.version > 2.6 %}edited, {% endif %}closed, reopened, or synchronized (updated due to a new push in the branch that the pull request is tracking).
+[`push`][event-types-push] | Any Git push to a Repository, including editing tags or branches. Commits via API actions that update references are also counted. **This is the default event.**
+[`repository`][event-types-repository] | Any time a Repository is created{% if page.version == 'dotcom' or page.version > 2.6 %}, deleted, made public, or made private{% else %}. **Organization hooks only**{% endif %}.
+[`release`][event-types-release] | Any time a Release is published in a Repository.
+[`status`][event-types-status] | Any time a Repository has a status update from the API
+[`team_add`][event-types-team_add] | Any time a team is added or modified on a Repository.
+[`watch`][event-types-watch] | Any time a User stars a Repository.
+
+### Wildcard Event
+
+We also support a wildcard (`*`) that will match all supported events. When you
+add the wildcard event, we'll replace any existing events you have configured
+with the wildcard event and send you payloads for all supported events. You'll
+also automatically get any new events we might add in the future.
+
+
+## Payloads
+
+Each event type has a specific payload format with the relevant event
+information. All event payloads mirror [the payloads for the Event
+types][event-types], with the exception of [the original `push`
+event][event-types-push], which has a more detailed webhook payload.
+
+In addition to the fields [documented for each event][event-types], webhook
+payloads include the user who performed the event (`sender`) as well as the
+organization (`organization`) and/or repository (`repository`) which the event
+occurred on.
+
+{{#tip}}
+
+**Note:** Payloads are capped at 5 MB. If your event generates a larger payload, a webhook will not be fired. This may happen, for example, on a `create` event if many branches or tags are pushed at once. We suggest monitoring your payload size to ensure delivery.
+
+{{/tip}}
+
+### Delivery headers
+
+HTTP requests made to your webhook's configured URL endpoint will contain
+several special headers:
+
+Header | Description
+-------|-------------|
+`X-GitHub-Event`| Name of the [event][events-section] that triggered this delivery.
+`X-Hub-Signature`| HMAC hex digest of the payload, using [the hook's `secret`][repo-hooks-create] as the key (if configured).
+`X-GitHub-Delivery`| Unique ID for this delivery.
+
+Also, the `User-Agent` for the requests will have the prefix `GitHub-Hookshot/`.
+
+### Example delivery
+
+``` command-line
+> POST /payload HTTP/1.1
+
+> Host: localhost:4567
+> X-Github-Delivery: 72d3162e-cc78-11e3-81ab-4c9367dc0958
+> User-Agent: GitHub-Hookshot/044aadd
+> Content-Type: application/json
+> Content-Length: 6615
+> X-GitHub-Event: issues
+
+> {
+> "action": "opened",
+> "issue": {
+> "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347",
+> "number": 1347,
+> ...
+> },
+> "repository" : {
+> "id": 1296269,
+> "full_name": "octocat/Hello-World",
+> "owner": {
+> "login": "octocat",
+> "id": 1,
+> ...
+> },
+> ...
+> },
+> "sender": {
+> "login": "octocat",
+> "id": 1,
+> ...
+> }
+> }
+```
+
+## Ping Event
+
+When you create a new webhook, we'll send you a simple `ping` event to let you
+know you've set up the webhook correctly. This event isn't stored so it isn't
+retrievable via the [Events API][events-api]. You can trigger a `ping` again by
+calling the [ping endpoint][repo-hooks-ping].
+
+### Ping Event Payload
+
+Key | Value |
+----| ----- |
+zen | Random string of GitHub zen |
+hook_id | The ID of the webhook that triggered the ping |
+hook | The [webhook configuration][repo-hooks-show] |
+
+[service-hooks-section]: #service-hooks
+[events-section]: #events
+[wildcard-section]: #wildcard-event
+[payloads-section]: #payloads
+[org-hooks]: /v3/orgs/hooks/
+[repo-hooks]: /v3/repos/hooks/
+[repo-hooks-show]: /v3/repos/hooks/#get-single-hook
+[repo-hooks-create]: /v3/repos/hooks/#create-a-hook
+[repo-hooks-ping]: /v3/repos/hooks/#ping-a-hook
+[events-api]: /v3/activity/events/
+[event-types]: /v3/activity/events/types/
+[event-types-commit_comment]: /v3/activity/events/types/#commitcommentevent
+[event-types-create]: /v3/activity/events/types/#createevent
+[event-types-delete]: /v3/activity/events/types/#deleteevent
+[event-types-deployment]: /v3/activity/events/types/#deploymentevent
+[event-types-deployment_status]: /v3/activity/events/types/#deploymentstatusevent
+[event-types-fork]: /v3/activity/events/types/#forkevent
+[event-types-gollum]: /v3/activity/events/types/#gollumevent
+[event-types-issue_comment]: /v3/activity/events/types/#issuecommentevent
+[event-types-issues]: /v3/activity/events/types/#issuesevent
+[event-types-member]: /v3/activity/events/types/#memberevent
+[event-types-membership]: /v3/activity/events/types/#membershipevent
+[event-types-page_build]: /v3/activity/events/types/#pagebuildevent
+[event-types-public]: /v3/activity/events/types/#publicevent
+[event-types-pull_request]: /v3/activity/events/types/#pullrequestevent
+[event-types-pull_request_review_comment]: /v3/activity/events/types/#pullrequestreviewcommentevent
+[event-types-push]: /v3/activity/events/types/#pushevent
+[event-types-release]: /v3/activity/events/types/#releaseevent
+[event-types-repository]: /v3/activity/events/types/#repositoryevent
+[event-types-status]: /v3/activity/events/types/#statusevent
+[event-types-team_add]: /v3/activity/events/types/#teamaddevent
+[event-types-watch]: /v3/activity/events/types/#watchevent
diff --git a/content/webhooks/securing.md b/content/webhooks/securing.md
new file mode 100644
index 0000000000..407ea1f26b
--- /dev/null
+++ b/content/webhooks/securing.md
@@ -0,0 +1,71 @@
+---
+title: Securing your webhooks
+layout: webhooks
+---
+
+# Securing your webhooks
+
+{:toc}
+
+Once your server is configured to receive payloads, it'll listen for any payload sent to the endpoint you configured. For security reasons, you probably want to limit requests to those coming from GitHub. There are a few ways to go about this--for example, you could opt to whitelist requests from GitHub's IP address--but a far easier method is to set up a secret token and validate the information.
+
+
+## Setting your secret token
+
+You'll need to set up your secret token in two places: GitHub and your server.
+
+To set your token on GitHub:
+
+1. Navigate to the repository where you're setting up your webhook.
+2. Fill out the Secret textbox. Use a random string with high entropy (e.g., by taking the output of `ruby -rsecurerandom -e 'puts SecureRandom.hex(20)'` at the terminal).
+
+3. Click **Update Webhook**.
+
+Next, set up an environment variable on your server that stores this token. Typically, this is as simple as running:
+
+``` command-line
+$ export SECRET_TOKEN=your_token
+```
+
+**Never** hardcode the token into your app!
+
+## Validating payloads from GitHub
+
+When your secret token is set, GitHub uses it to create a hash signature with each payload.
+
+This hash signature is passed along with each request in the headers as `X-Hub-Signature`. Suppose you have a basic server listening to webhooks that looks like this:
+
+``` ruby
+require 'sinatra'
+require 'json'
+
+post '/payload' do
+ push = JSON.parse(params[:payload])
+ puts "I got some JSON: #{push.inspect}"
+end
+```
+
+The goal is to compute a hash using your `SECRET_TOKEN`, and ensure that the hash from GitHub matches. GitHub uses an HMAC hexdigest to compute the hash, so you could change your server to look a little like this:
+
+``` ruby
+post '/payload' do
+ request.body.rewind
+ payload_body = request.body.read
+ verify_signature(payload_body)
+ push = JSON.parse(params[:payload])
+ puts "I got some JSON: #{push.inspect}"
+end
+
+def verify_signature(payload_body)
+ signature = 'sha1=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), ENV['SECRET_TOKEN'], payload_body)
+ return halt 500, "Signatures didn't match!" unless Rack::Utils.secure_compare(signature, request.env['HTTP_X_HUB_SIGNATURE'])
+end
+```
+
+Obviously, your language and server implementations may differ than this code. There's a couple of very important thing to point out, however:
+
+* No matter which implementation you use, the hash signature starts with `sha1=`, using the key of your secret token and your payload body.
+
+* Using a plain `==` operator is **not advised**. A method like [`secure_compare`][secure_compare] performs a "constant time" string comparison, which renders it safe from certain timing attacks against regular equality operators.
+
+[secure_compare]: http://rubydoc.info/github/rack/rack/master/Rack/Utils.secure_compare
diff --git a/content/webhooks/testing.md b/content/webhooks/testing.md
new file mode 100644
index 0000000000..c57a2ba788
--- /dev/null
+++ b/content/webhooks/testing.md
@@ -0,0 +1,43 @@
+---
+title: Testing webhooks
+layout: webhooks
+---
+
+# Testing Webhooks
+
+{:toc}
+
+Now that you've [configured your local server](/webhooks/configuring/), you might
+be interested in pushing your code to the limits. To that end, GitHub's webhooks
+view provides some tooling for testing your deployed payloads.
+
+
+## Listing recent deliveries
+
+Every webhook has its own "Recent Deliveries" section, which lists, at a glance
+whether a deployment was successful (green check) or failed (red x).
+
+
+
+You can also identify when each delivery was attempted.
+
+## Digging into results
+
+By expanding an individual delivery, you'll be able to witness *precisely*
+what information GitHub is attempting to send to your server. This includes
+both the HTTP Request and Response.
+
+### Request
+
+The webhook delivery view provides information on which Headers were sent by GitHub.
+It also includes details about the JSON payload.
+
+
+
+### Response
+
+The response tab lists how your server replied once it received the payload from
+GitHub. This includes the status code, the headers, and any additional data
+within the response body.
+
+
diff --git a/data/variables/contact.yml b/data/variables/contact.yml
new file mode 100644
index 0000000000..6728eb4501
--- /dev/null
+++ b/data/variables/contact.yml
@@ -0,0 +1,6 @@
+contact_support:
+ {% if page.version == 'dotcom' %}
+ '[GitHub support](https://github.com/contact)'
+ {% else %}
+ 'your GitHub Enterprise site administrator'
+ {% endif %}
diff --git a/data/variables/product.yml b/data/variables/product.yml
new file mode 100644
index 0000000000..221100b3ca
--- /dev/null
+++ b/data/variables/product.yml
@@ -0,0 +1,20 @@
+api_url_pre:
+ {% if page.version == 'dotcom' %}
+ 'https://api.github.com'
+ {% else %}
+ 'http(s)://[hostname]/api/v3'
+ {% endif %}
+
+api_url_code:
+ {% if page.version == 'dotcom' %}
+ 'https://api.github.com'
+ {% else %}
+ 'http(s)://[hostname]/api/v3'
+ {% endif %}
+
+product_name:
+ {% if page.version == 'dotcom' %}
+ 'GitHub'
+ {% else %}
+ 'GitHub Enterprise'
+ {% endif %}
diff --git a/gulpfile.js b/gulpfile.js
new file mode 100644
index 0000000000..8b858f499b
--- /dev/null
+++ b/gulpfile.js
@@ -0,0 +1,107 @@
+var gulp = require("gulp"),
+ gulpif = require("gulp-if"),
+ sass = require("gulp-sass"),
+ minifyCss = require("gulp-minify-css"),
+ replace = require("gulp-replace"),
+ coffee = require("gulp-coffee"),
+ concat = require("gulp-concat"),
+ uglify = require("gulp-uglify"),
+ yaml = require("js-yaml"),
+
+ exec = require('child_process').exec,
+
+ fs = require('fs'),
+ path = require("path");
+
+CONFIG = yaml.safeLoad(fs.readFileSync("nanoc.yaml", "utf8"));
+IS_PRODUCTION = process.env.NODE_ENV == "production";
+
+var transformCS = function (file) {
+ return path.extname(file.path) == ".coffee";
+};
+
+gulp.task("css", function() {
+ return gulp.src([
+ "assets/stylesheets/reset.css",
+ "assets/stylesheets/documentation.css",
+ "assets/stylesheets/pagination.css",
+ "assets/stylesheets/pygments.css",
+ "assets/vendor/octicons/octicons/octicons.css"
+ ])
+ .pipe(concat("application.css"))
+ .pipe(gulpif(IS_PRODUCTION, minifyCss()))
+ .pipe(gulp.dest("output/assets/stylesheets/"));
+});
+
+gulp.task("javascript", function () {
+ gulp.src("assets/javascripts/dev_mode.js")
+ .pipe(gulp.dest("output/assets/javascripts/"));
+ return gulp.src([
+ "assets/javascripts/initial.js",
+ "assets/javascripts/documentation.js",
+ "assets/javascripts/search.js",
+ "assets/javascripts/images.js",
+ "assets/vendor/retinajs/src/retinajs"
+ ])
+ .pipe(gulpif(transformCS, coffee()))
+ .pipe(concat("application.js"))
+ .pipe(replace(/\{\{ site\.version \}\}/g, CONFIG.latest_enterprise_version))
+ .pipe(gulpif(IS_PRODUCTION, uglify()))
+ .pipe(gulp.dest("output/assets/javascripts"));
+});
+
+gulp.task("javascript_workers", function () {
+ return gulp.src([
+ "assets/javascripts/search_worker.js",
+ "assets/vendor/lunr.js/lunr.min.js"
+ ])
+ .pipe(gulp.dest("output/assets/javascripts"));
+});
+
+gulp.task("octicons", function() {
+ return gulp.src("assets/vendor/octicons/octicons/**/*")
+ .pipe(gulp.dest("output/assets/stylesheets"));
+});
+
+gulp.task("images", function() {
+ return gulp.src("assets/images/**/*")
+ .pipe(gulp.dest("output/assets/images"));
+});
+
+gulp.task("nanoc:compile", function (cb) {
+ exec("bundle exec nanoc compile", {maxBuffer: 1024 * 1000}, function (err, stdout, stderr) {
+ console.log(stdout);
+ console.log(stderr);
+ cb(err);
+ });
+});
+
+gulp.task("server", function() {
+ connect = require("gulp-connect");
+ connect.server({
+ port: 4000,
+ root: ["output"],
+ fallback: "output/404.html"
+ });
+});
+
+gulp.task("watch:nanoc", function() {
+ gulp.watch([
+ "nanoc.yaml",
+ "Rules",
+ "content/**/*",
+ "layouts/**/*",
+ "lib/**/*"
+ ], ["nanoc:compile"]);
+});
+
+gulp.task("watch:assets", function() {
+ gulp.watch([
+ "assets/**/*"
+ ], ["assets"]);
+});
+
+gulp.task("serve", [ "server", "watch:nanoc", "watch:assets" ]);
+gulp.task("assets", [ "css", "javascript", "javascript_workers", "octicons", "images" ]);
+gulp.task("build", [ "nanoc:compile", "assets" ]);
+gulp.task("default", [ "build", "serve" ]);
diff --git a/layouts/_changes.html b/layouts/_changes.html
new file mode 100644
index 0000000000..35b25d854e
--- /dev/null
+++ b/layouts/_changes.html
@@ -0,0 +1,6 @@
+<% @changes.each do |article| %>
+
+ <%= renderp '/_meta.*', :item => article %>
+ <%= article.compiled_content %>
+
+<% end %>
diff --git a/layouts/_meta.html b/layouts/_meta.html
new file mode 100644
index 0000000000..1e00f62367
--- /dev/null
+++ b/layouts/_meta.html
@@ -0,0 +1,19 @@
+
+
+
diff --git a/layouts/api.html b/layouts/api.html
new file mode 100644
index 0000000000..3158b7c83e
--- /dev/null
+++ b/layouts/api.html
@@ -0,0 +1,27 @@
+<%= renderp '/head.*' %>
+
+
+ <%= renderp '/header.*' %>
+
+
+
+
+
+ <%= yield %>
+
+
+ <%= renderp '/sidebar.*' %>
+
+
+ <%= renderp '/footer.*' %>
+
+
diff --git a/layouts/blog.html b/layouts/blog.html
new file mode 100644
index 0000000000..6e8e32a891
--- /dev/null
+++ b/layouts/blog.html
@@ -0,0 +1,20 @@
+<%= renderp '/head.*' %>
+
+
+ <%= renderp '/header.*' %>
+
+
+
+ <%= renderp '/footer.*' %>
+
+