octokit/rest.js
Usage
Import the Octokit constructor.
For direct usage in browsers, download octokit-rest.min.js from the latest release and import it using a <script src="octokit-rest.min.js"></script> tag.
const { Octokit } = require("@octokit/rest");Now instantiate your octokit API. All options are optional, but authentication is strongly encouraged.
const octokit = Octokit({You can set auth to a personal access token string.
Learn more about authentication.
auth: "secret123",Setting a user agent is required. It defaults to octokit/rest.js v1.2.3 where v1.2.3 is the current version of @octokit/rest, but you should set it to something that identifies your app or script.
userAgent: 'myApp v1.2.3',API Previews can be enabled globally by setting the previews option. They can be set per-request as well.
Learn more about API Previews.
previews: ['jean-grey', 'symmetra'],A default time zone can be enabled by setting the timeZone option.
timeZone: 'Europe/Amsterdam',Learn more about using time zones with the GitHub API.
In order to use Octokit with GitHub Enterprise, set the baseUrl option.
baseUrl: 'https://api.github.com',For custom logging, pass an object with debug, info, warn and error methods as the log option.
Learn more about logging and debugging.
log: {
debug: () => {},
info: () => {},
warn: console.warn,
error: console.error
},Custom request options can be passed as request.* options. See @octokit/request options. The same options can be passed to each endpoint request method.
request: {
agent: undefined,
fetch: undefined,
timeout: 0
}
})Most of GitHub’s REST API endpoints have matching methods. All endpoint methods are asynchronous, in order to use await in the code examples, we wrap them into an anonymous async function.
(async () => {For example to retrieve a pull request, use octokit.pulls.get(). We recommend to use the search above to find the endpoint method you are looking for
const { data: pullRequest } = await octokit.pulls.get({
owner: "octokit",
repo: "rest.js",
pull_number: 123
});Some API endpoints support alternative response formats, see Media types. For example, to request the above pull request in a diff format, pass the mediaType.format option.
Learn more about request formats
const { data: diff } = await octokit.pulls.get({
owner: "octokit",
repo: "rest.js",
pull_number: 123,
mediaType: {
format: "diff"
}
});For the API endpoints that do not have a matching method, such as the root endpoint or legacy endpoints, you can send custom requests.
Learn more about custom requests.
const { data: root } = await octokit.request("GET /");You can also register custom endpoint methods, which is particularly useful if you participate in a private beta.
Learn more about custom endpoint methods.
await octokit.registerEndpoints({
misc: {
getRoot: {
method: "GET",
url: "/"
}
}
});Some endpoints return a list which has to be paginated in order to retrieve the complete data set.
Learn more about pagination.
const options = octokit.issues.listForRepo.endpoint.merge({
owner: 'octokit',
repo: 'rest.js'
})
octokit.paginate(options)
.then(issues => {
// issues is an array of all issue objects
})
})You can add more functionality with plugins. We recommend the retry and throttling plugins.
Learn more about throttling, automatic retries and building your own Plugins.
import plugin as retry from '@octokit/plugin-retry'
import plugin as throttling from '@octokit/plugin-throttling'
const MyOctokit = Octokit.plugin([
retry,
throttling
])Octokit.plugin() returns a new constructor. The same options can be passed to the constructor. The options are passed on to all plugin functions as the 2nd argument
const myOctokit = new MyOctokit({
auth: "secret123",
throttle: {
onRateLimit: (retryAfter, options) => {
myOctokit.log.warn(
`Request quota exhausted for request ${options.method} ${options.url}`
);
if (options.request.retryCount === 0) {
// only retries once
myOctokit.log.info(`Retrying after ${retryAfter} seconds!`);
return true;
}
},
onAbuseLimit: (retryAfter, options) => {
// does not retry, only logs a warning
myOctokit.log.warn(
`Abuse detected for request ${options.method} ${options.url}`
);
}
},
retry: {
doNotRetry: ["429"]
}
});const octokit = require("@octokit/rest");
// Compare: https://developer.github.com/v3/repos/#list-organization-repositories
octokit.repos
.listForOrg({
org: "octokit",
type: "public"
})
.then(({ data, headers, status }) => {
// handle data
});Authentication
Authentication is optional for some REST API endpoints accessing public data, but is required for GraphQL queries. Using authentication also increases your API rate limit.
By default, Octokit authenticates using the token authentication strategy. Pass in a token using options.auth. It can be a personal access token, an OAuth token, an installation access token or a JSON Web Token for GitHub App authentication. The Authorization header will be set according to the type of token.
const { Octokit } = require("@octokit/rest");
const octokit = new Octokit({
auth: "mypersonalaccesstoken123"
});
const { data } = await octokit.request("/user");To use a different authentication strategy, set options.authStrategy. The officially supported authentication strategies are listed on the @octokit/auth README.
Here is an example for GitHub App authentication
const { Octokit } = require("@octokit/rest");
const { createAppAuth } = require("@octokit/auth-app");
const appOctokit = new Octokit({
authStrategy: createAppAuth,
auth: {
id: 123,
privateKey: process.env.PRIVATE_KEY
}
});
const { data } = await appOctokit.request("/app");The .auth() method returned by the current authentication strategy can be accessed at octokit.auth(). Example
const { token } = await appOctokit.auth({
type: "installation",
installationId: 123
});Previews
To enable any of GitHub’s API Previews,
pass the previews option to the GitHub constructor
const octokit = new Octokit({
previews: ["mercy-preview"]
});Previews can also be enabled for a single request by passing the mediaType.preview option
const {
data: { topics }
} = await octokit.repos.get({
owner: "octokit",
repo: "rest.js",
mediaType: {
previews: ["symmetra"]
}
});Request formats & aborts
Some API endpoints support alternative response formats, see Media types.
For example, to request a pull request as diff format, set the mediaType.format option
const { data: prDiff } = await octokit.pulls.get({
owner: "octokit",
repo: "rest.js",
pull_number: 1278,
mediaType: {
format: "diff"
}
});The AbortController interface can be used to abort one or more requests as and when desired. When the request is initiated, an AbortSignal instance can be passed as an option inside the request's options object. For usage in Node, the abort-controller package can be used.
const controller = new AbortController();
const { data: prDiff } = await octokit.pulls.get({
owner: "octokit",
repo: "rest.js",
pull_number: 1278,
request: {
signal: controller.signal
}
});Use controller.abort() to abort the request when desired.
Custom requests
To send custom requests you can use the lower-level octokit.request() method
octokit.request("GET /");The baseUrl, headers and other defaults are already set. For more information on the octokit.request() API see octokit/request.js
All the endpoint methods such as octokit.repos.get() are aliases of octokit.request() with pre-bound default options. So you can use the @octokit/request API to get the default options or get generic request option to use with your preferred request library.
const defaultOptions = octokit.repos.get.endpoint.DEFAULTS;
const requestOptions = octokit.repos.get.endpoint({
owner: "octokit",
repo: "rest.js"
});Note that authentication is not applied when retrieving request options from the *.endpoint APIs.
Pagination
All endpoint methods starting with .list* do not return all responses at once but instead return the first 30 items by default, see also GitHub’s REST API pagination documentation.
To automatically receive all results across all pages, you can use the octokit.paginate() method:
octokit
.paginate("GET /repos/:owner/:repo/issues", {
owner: "octokit",
repo: "rest.js"
})
.then(issues => {
// issues is an array of all issue objects
});octokit.paginate() accepts the same options as octokit.request(). You can optionally pass an additional function to map the results from each response. The map must return a new value, usually an array with mapped data.
octokit
.paginate(
"GET /repos/:owner/:repo/issues",
{ owner: "octokit", repo: "rest.js" },
response => response.data.map(issue => issue.title)
)
.then(issueTitles => {
// issueTitles is now an array with the titles only
});To stop paginating early, you can call the done() function passed as 2nd argument to the response map function. Note that you still have to return the value you want to map the response to, otherwise the last response will be mapped to undefined.
octokit.paginate("GET /organizations", (response, done) => {
if (response.data.find(issues => issue.body.includes("something"))) {
done();
}
return response.data;
});To paginate responses for one of the registered endpoint methods such as octokit.issues.listForRepo() you can use the .endpoint.merge() method registered for all endpoint methods:
const options = octokit.issues.listForRepo.endpoint.merge({
owner: "octokit",
repo: "rest.js"
});
octokit.paginate(options).then(issues => {
// issues is an array of all issue objects
});If your runtime environment supports async iterators (such as most modern browsers and Node 10+), you can iterate through each response
for await (const response of octokit.paginate.iterator(options)) {
// do whatever you want with each response, break out of the loop, etc.
}octokit.paginate.iterator() accepts the same options as octokit.paginate().
Hooks
You can customize Octokit’s request lifecycle with hooks. Available methods are
octokit.hook.before("request", async options => {
validate(options);
});
octokit.hook.after("request", async (response, options) => {
console.log(`${options.method} ${options.url}: ${response.status}`);
});
octokit.hook.error("request", async (error, options) => {
if (error.status === 304) {
return findInCache(error.headers.etag);
}
throw error;
});
octokit.hook.wrap("request", async (request, options) => {
// add logic before, after, catch errors or replace the request altogether
return request(options);
});See before-after-hook for more details on the 4 methods.
Custom endpoint methods
You can register custom endpoint methods such as octokit.repos.get() using the octokit.registerEndpoints(routes) method
octokit.registerEndpoints({
foo: {
bar: {
method: "PATCH",
url: "/repos/:owner/:repo/foo",
headers: {
accept: "application/vnd.github.foo-bar-preview+json"
},
params: {
owner: {
required: true,
type: "string"
},
repo: {
required: true,
type: "string"
},
baz: {
required: true,
type: "string",
enum: ["qux", "quux", "quuz"]
}
}
}
}
});
octokit.foo.bar({
owner: "octokit",
repo: "rest.js",
baz: "quz"
});This is useful when you participate in private beta features and prefer the convenience of methods for the new endpoints instead of using octokit.request().
Plugins
You can customize and extend Octokit’s functionality using plugins
// index.js
const Octokit = require("@octokit/rest");
const MyOctokit = Octokit.plugin([
require("./lib/my-plugin"),
require("octokit-plugin-example")
]);
// lib/my-plugin.js
module.exports = (octokit, options = { greeting: "Hello" }) => {
// add a custom method
octokit.helloWorld = () => console.log(`${options.greeting}, world!`);
// hook into the request lifecycle
octokit.hook.wrap("request", async (request, options) => {
const time = Date.now();
const response = await request(options);
octokit.log.info(
`${options.method} ${options.url} – ${response.status} in ${Date.now() -
time}ms`
);
return response;
});
};.plugin accepts a function or an array of functions.
We recommend using Octokit’s log methods to help users of your plugin with debugging.
You can add new methods to the octokit instance passed as the first argument to
the plugin function. The 2nd argument is the options object passed to the
constructor when instantiating the octokit client.
const octokit = new MyOctokit({ greeting: "Hola" });
octokit.helloWorld();
// Hola, world!Throttling
When you send too many requests in too little time you will likely hit errors due to rate and/or abuse limits.
In order to automatically throttle requests as recommended in GitHub’s best practices for integrators, we recommend you install the @octokit/plugin-throttling plugin.
The throttle.onAbuseLimit and throttle.onRateLimit options are required. Return true to automatically retry the request after retryAfter seconds.
const { Octokit } = require("@octokit/rest");
const MyOctokit = Octokit.plugin(require("@octokit/plugin-throttling"));
const octokit = new MyOctokit({
auth: "token " + process.env.TOKEN,
throttle: {
onRateLimit: (retryAfter, options) => {
octokit.log.warn(
`Request quota exhausted for request ${options.method} ${options.url}`
);
if (options.request.retryCount === 0) {
// only retries once
console.log(`Retrying after ${retryAfter} seconds!`);
return true;
}
},
onAbuseLimit: (retryAfter, options) => {
// does not retry, only logs a warning
octokit.log.warn(
`Abuse detected for request ${options.method} ${options.url}`
);
}
}
});Automatic retries
Many common request errors can be easily remediated by retrying the request. We recommend installing the @octokit/plugin-retry plugin for Automatic retries in these cases
const { Octokit } = require("@octokit/rest");
const MyOctokit = Octokit.plugin(require("@octokit/plugin-retry"));
const octokit = new MyOctokit();
// all requests sent with the `octokit` instance are now retried up to 3 times for recoverable errors.Logging
Octokit has 4 built-in log methods
octokit.log.debug(message[, additionalInfo])octokit.log.info(message[, additionalInfo])octokit.log.warn(message[, additionalInfo])octokit.log.error(message[, additionalInfo])
They can be configured using the log client option. By default, octokit.log.debug() and octokit.log.info() are no-ops, while the other two call console.warn() and console.error() respectively.
This is useful if you build reusable plugins.
Debug
The simplest way to receive debug information is to set the log client option to console.
const octokit = require("@octokit/rest")({
log: console
});
octokit.request("/");This will log
request { method: 'GET',
baseUrl: 'https://api.github.com',
headers:
{ accept: 'application/vnd.github.v3+json',
'user-agent':
'octokit.js/0.0.0-development Node.js/10.15.0 (macOS Mojave; x64)' },
request: {},
url: '/' }
GET / - 200 in 514msIf you like to support a configurable log level, we recommend using the console-log-level module
const octokit = require("@octokit/rest")({
log: require("console-log-level")({ level: "info" })
});
octokit.request("/");This will only log
GET / - 200 in 514msActions
Cancel a workflow run
Cancels a workflow run using its id. Anyone with write access to the repository can use this endpoint. GitHub Apps must have the actions permission to use this endpoint.
octokit.actions.cancelWorkflowRun({
owner,
repo,
run_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| run_id | yes |
run_id parameter |
See also: GitHub Developer Guide documentation.
Create or update a secret for a repository
Creates or updates a secret with an encrypted value. Encrypt your secret using LibSodium. Anyone with write access to the repository can use this endpoint. GitHub Apps must have the secrets permission to use this endpoint.
Encrypt your secret using the tweetsodium library.
Encrypt your secret using pynacl with Python 3.
Encrypt your secret using the Sodium.Core package.
Encrypt your secret using the rbnacl gem.
octokit.actions.createOrUpdateSecretForRepo({
owner,
repo,
name
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| name | yes |
name parameter |
| encrypted_value | no |
Value for your secret, encrypted with LibSodium using the public key retrieved from the Get your public key endpoint. |
| key_id | no |
ID of the key you used to encrypt the secret. |
See also: GitHub Developer Guide documentation.
Create a registration token
Returns a token that you can pass to the config script. The token expires after one hour. Anyone with admin access to the repository can use this endpoint. GitHub Apps must have the administration permission to use this endpoint.
Configure your self-hosted runner, replacing TOKEN with the registration token provided by this endpoint.
octokit.actions.createRegistrationToken({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
Create a remove token
Returns a token that you can pass to remove a self-hosted runner from a repository. The token expires after one hour. Anyone with admin access to the repository can use this endpoint. GitHub Apps must have the administration permission to use this endpoint.
Remove your self-hosted runner from a repository, replacing TOKEN with the remove token provided by this endpoint.
octokit.actions.createRemoveToken({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
Delete an artifact
Deletes an artifact for a workflow run. Anyone with write access to the repository can use this endpoint. GitHub Apps must have the actions permission to use this endpoint.
octokit.actions.deleteArtifact({
owner,
repo,
artifact_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| artifact_id | yes |
artifact_id parameter |
See also: GitHub Developer Guide documentation.
Delete a secret from a repository
Deletes a secret in a repository using the secret name. Anyone with write access to the repository can use this endpoint. GitHub Apps must have the secrets permission to use this endpoint.
octokit.actions.deleteSecretFromRepo({
owner,
repo,
name
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| name | yes |
name parameter |
See also: GitHub Developer Guide documentation.
Download an artifact
Gets a redirect URL to download an archive for a repository. This URL expires after 1 minute. Look for Location: in the response header to find the URL for the download. The :archive_format must be zip. Anyone with read access to the repository can use this endpoint. GitHub Apps must have the actions permission to use this endpoint.
Call this endpoint using the -v flag, which enables verbose output and allows you to see the download URL in the header. To download the file into the current working directory, specify the filename using the -o flag.
octokit.actions.downloadArtifact({
owner,
repo,
artifact_id,
archive_format
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| artifact_id | yes |
artifact_id parameter |
| archive_format | yes |
archive_format parameter |
See also: GitHub Developer Guide documentation.
Get an artifact
Gets a specific artifact for a workflow run. Anyone with read access to the repository can use this endpoint. GitHub Apps must have the actions permission to use this endpoint.
octokit.actions.getArtifact({
owner,
repo,
artifact_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| artifact_id | yes |
artifact_id parameter |
See also: GitHub Developer Guide documentation.
Get your public key
Gets your public key, which you must store. You need your public key to use other secrets endpoints. Use the returned key to encrypt your secrets. Anyone with read access to the repository can use this endpoint. GitHub Apps must have the secrets permission to use this endpoint.
octokit.actions.getPublicKey({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
Get a secret
Gets a single secret without revealing its encrypted value. Anyone with write access to the repository can use this endpoint. GitHub Apps must have the secrets permission to use this endpoint.
octokit.actions.getSecret({
owner,
repo,
name
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| name | yes |
name parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
Get a self-hosted runner
Gets a specific self-hosted runner. Anyone with admin access to the repository can use this endpoint. GitHub Apps must have the administration permission to use this endpoint.
octokit.actions.getSelfHostedRunner({
owner,
repo,
runner_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| runner_id | yes |
runner_id parameter |
See also: GitHub Developer Guide documentation.
Get a workflow
Gets a specific workflow. You can also replace :workflow_id with :workflow_file_name. For example, you could use main.yml. Anyone with read access to the repository can use this endpoint. GitHub Apps must have the actions permission to use this endpoint.
octokit.actions.getWorkflow({
owner,
repo,
workflow_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| workflow_id | yes |
workflow_id parameter |
See also: GitHub Developer Guide documentation.
Get a workflow job
Gets a specific job in a workflow run. Anyone with read access to the repository can use this endpoint. GitHub Apps must have the actions permission to use this endpoint.
octokit.actions.getWorkflowJob({
owner,
repo,
job_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| job_id | yes |
job_id parameter |
See also: GitHub Developer Guide documentation.
Get a workflow run
Gets a specific workflow run. Anyone with read access to the repository can use this endpoint. GitHub Apps must have the actions permission to use this endpoint.
octokit.actions.getWorkflowRun({
owner,
repo,
run_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| run_id | yes |
run_id parameter |
See also: GitHub Developer Guide documentation.
List downloads for the self-hosted runner application
Lists binaries for the self-hosted runner application that you can download and run. Anyone with admin access to the repository can use this endpoint. GitHub Apps must have the administration permission to use this endpoint.
octokit.actions.listDownloadsForSelfHostedRunnerApplication({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
List jobs for a workflow run
Lists jobs for a workflow run. Anyone with read access to the repository can use this endpoint. GitHub Apps must have the actions permission to use this endpoint.
octokit.actions.listJobsForWorkflowRun({
owner,
repo,
run_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| run_id | yes |
run_id parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List repository workflow runs
Lists all workflow runs for a repository. You can use parameters to narrow the list of results. For more information about using parameters, see Parameters.
Anyone with read access to the repository can use this endpoint. GitHub Apps must have the actions permission to use this endpoint.
octokit.actions.listRepoWorkflowRuns({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| actor | no |
Returns someone's workflow runs. Use the login for the user who created the |
| branch | no |
Returns workflow runs associated with a branch. Use the name of the branch of the |
| event | no |
Returns workflow run triggered by the event you specify. For example, |
| status | no |
Returns workflow runs associated with the check run |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List repository workflows
Lists the workflows in a repository. Anyone with read access to the repository can use this endpoint. GitHub Apps must have the actions permission to use this endpoint.
octokit.actions.listRepoWorkflows({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List secrets for a repository
Lists all secrets available in a repository without revealing their encrypted values. Anyone with write access to the repository can use this endpoint. GitHub Apps must have the secrets permission to use this endpoint.
octokit.actions.listSecretsForRepo({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List self-hosted runners for a repository
Lists all self-hosted runners for a repository. Anyone with admin access to the repository can use this endpoint. GitHub Apps must have the administration permission to use this endpoint.
octokit.actions.listSelfHostedRunnersForRepo({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List workflow job logs
Gets a redirect URL to download a plain text file of logs for a workflow job. This link expires after 1 minute. Look for Location: in the response header to find the URL for the download. Anyone with read access to the repository can use this endpoint. GitHub Apps must have the actions permission to use this endpoint.
Call this endpoint using the -v flag, which enables verbose output and allows you to see the download URL in the header. To download the file into the current working directory, specify the filename using the -o flag.
octokit.actions.listWorkflowJobLogs({
owner,
repo,
job_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| job_id | yes |
job_id parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List workflow run artifacts
Lists artifacts for a workflow run. Anyone with read access to the repository can use this endpoint. GitHub Apps must have the actions permission to use this endpoint.
octokit.actions.listWorkflowRunArtifacts({
owner,
repo,
run_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| run_id | yes |
run_id parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List workflow run logs
Gets a redirect URL to download an archive of log files for a workflow run. This link expires after 1 minute. Look for Location: in the response header to find the URL for the download. Anyone with read access to the repository can use this endpoint. GitHub Apps must have the actions permission to use this endpoint.
Call this endpoint using the -v flag, which enables verbose output and allows you to see the download URL in the header. To download the file into the current working directory, specify the filename using the -o flag.
octokit.actions.listWorkflowRunLogs({
owner,
repo,
run_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| run_id | yes |
run_id parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List workflow runs
List all workflow runs for a workflow. You can also replace :workflow_id with :workflow_file_name. For example, you could use main.yml. You can use parameters to narrow the list of results. For more information about using parameters, see Parameters.
Anyone with read access to the repository can use this endpoint.
octokit.actions.listWorkflowRuns({
owner,
repo,
workflow_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| workflow_id | yes |
workflow_id parameter |
| actor | no |
Returns someone's workflow runs. Use the login for the user who created the |
| branch | no |
Returns workflow runs associated with a branch. Use the name of the branch of the |
| event | no |
Returns workflow run triggered by the event you specify. For example, |
| status | no |
Returns workflow runs associated with the check run |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
Re-run a workflow
Re-runs your workflow run using its id. Anyone with write access to the repository can use this endpoint. GitHub Apps must have the actions permission to use this endpoint.
octokit.actions.reRunWorkflow({
owner,
repo,
run_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| run_id | yes |
run_id parameter |
See also: GitHub Developer Guide documentation.
Remove a self-hosted runner
Forces the removal of a self-hosted runner from a repository. You can use this endpoint to completely remove the runner when the machine you were using no longer exists. Anyone with admin access to the repository can use this endpoint. GitHub Apps must have the administration permission to use this endpoint.
octokit.actions.removeSelfHostedRunner({
owner,
repo,
runner_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| runner_id | yes |
runner_id parameter |
See also: GitHub Developer Guide documentation.
Activity
Check if you are starring a repository
Requires for the user to be authenticated.
octokit.activity.checkStarringRepo({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
Check if you are watching a repository (LEGACY)
Requires for the user to be authenticated.
octokit.activity.checkWatchingRepoLegacy({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
Delete a Repository Subscription
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.
octokit.activity.deleteRepoSubscription({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
Delete a thread subscription
Mutes all future notifications for a conversation until you comment on the thread or get @mentioned.
octokit.activity.deleteThreadSubscription({
thread_id
});Parameters
| name | required | description |
|---|---|---|
| thread_id | yes |
thread_id parameter |
See also: GitHub Developer Guide documentation.
Get a Repository Subscription
octokit.activity.getRepoSubscription({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
View a single thread
octokit.activity.getThread({
thread_id
});Parameters
| name | required | description |
|---|---|---|
| thread_id | yes |
thread_id parameter |
See also: GitHub Developer Guide documentation.
Get a thread subscription
This checks to see if the current user is subscribed to a thread. You can also get a repository subscription.
Note that subscriptions are only generated if a user is participating in a conversation--for example, they've replied to the thread, were @mentioned, or manually subscribe to a thread.
octokit.activity.getThreadSubscription({
thread_id
});Parameters
| name | required | description |
|---|---|---|
| thread_id | yes |
thread_id parameter |
See also: GitHub Developer Guide documentation.
List events for an organization
This is the user's organization dashboard. You must be authenticated as the user to view this.
octokit.activity.listEventsForOrg({
username,
org
});Parameters
| name | required | description |
|---|---|---|
| username | yes |
username parameter |
| org | yes |
org parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
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.
octokit.activity.listEventsForUser({
username
});Parameters
| name | required | description |
|---|---|---|
| username | yes |
username parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List feeds
GitHub provides several timeline resources in Atom format. The Feeds API lists all the feeds available to the authenticated user:
- Timeline: The GitHub 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.
- Security advisories: A collection of public announcements that provide information about security-related vulnerabilities in software on GitHub.
Note: Private feeds are only returned when authenticating via Basic Auth since current feed URIs use the older, non revocable auth tokens.
octokit.activity.listFeeds();Parameters
This endpoint has no parameters
See also: GitHub Developer Guide documentation.
List your notifications
List all notifications for the current user, sorted by most recently updated.
The following example uses the since parameter to list notifications that have been updated after the specified time.
octokit.activity.listNotifications();Parameters
| name | required | description |
|---|---|---|
| all | no |
If |
| participating | no |
If |
| since | no |
Only show notifications updated after the given time. This is a timestamp in ISO 8601 format: |
| before | no |
Only show notifications updated before the given time. This is a timestamp in ISO 8601 format: |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List your notifications in a repository
List all notifications for the current user.
octokit.activity.listNotificationsForRepo({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| all | no |
If |
| participating | no |
If |
| since | no |
Only show notifications updated after the given time. This is a timestamp in ISO 8601 format: |
| before | no |
Only show notifications updated before the given time. This is a timestamp in ISO 8601 format: |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List public events
We delay the public events feed by five minutes, which means the most recent event returned by the public events API actually occurred at least five minutes ago.
octokit.activity.listPublicEvents();Parameters
| name | required | description |
|---|---|---|
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List public events for an organization
octokit.activity.listPublicEventsForOrg({
org
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List public events for a network of repositories
octokit.activity.listPublicEventsForRepoNetwork({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List public events performed by a user
octokit.activity.listPublicEventsForUser({
username
});Parameters
| name | required | description |
|---|---|---|
| username | yes |
username parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
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.
octokit.activity.listReceivedEventsForUser({
username
});Parameters
| name | required | description |
|---|---|---|
| username | yes |
username parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List public events that a user has received
octokit.activity.listReceivedPublicEventsForUser({
username
});Parameters
| name | required | description |
|---|---|---|
| username | yes |
username parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List repository events
octokit.activity.listRepoEvents({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List repositories being starred by the authenticated user
You can also find out when stars were created by passing the following custom media type via the Accept header:
octokit.activity.listReposStarredByAuthenticatedUser();Parameters
| name | required | description |
|---|---|---|
| sort | no |
One of |
| direction | no |
One of |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List repositories being starred by a user
You can also find out when stars were created by passing the following custom media type via the Accept header:
octokit.activity.listReposStarredByUser({
username
});Parameters
| name | required | description |
|---|---|---|
| username | yes |
username parameter |
| sort | no |
One of |
| direction | no |
One of |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List repositories being watched by a user
octokit.activity.listReposWatchedByUser({
username
});Parameters
| name | required | description |
|---|---|---|
| username | yes |
username parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List Stargazers
You can also find out when stars were created by passing the following custom media type via the Accept header:
octokit.activity.listStargazersForRepo({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List repositories being watched by the authenticated user
octokit.activity.listWatchedReposForAuthenticatedUser();Parameters
| name | required | description |
|---|---|---|
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List watchers
octokit.activity.listWatchersForRepo({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
Mark as read
Marks a notification as "read" removes it from the default view on GitHub. If the number of notifications is too large to complete in one request, you will receive a 202 Accepted status and GitHub will run an asynchronous process to mark notifications as "read." To check whether any "unread" notifications remain, you can use the List your notifications endpoint and pass the query parameter all=false.
octokit.activity.markAsRead();Parameters
| name | required | description |
|---|---|---|
| last_read_at | no |
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: |
See also: GitHub Developer Guide documentation.
Mark notifications as read in a repository
Marks all notifications in a repository as "read" removes them from the default view on GitHub. If the number of notifications is too large to complete in one request, you will receive a 202 Accepted status and GitHub will run an asynchronous process to mark notifications as "read." To check whether any "unread" notifications remain, you can use the List your notifications in a repository endpoint and pass the query parameter all=false.
octokit.activity.markNotificationsAsReadForRepo({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| last_read_at | no |
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: |
See also: GitHub Developer Guide documentation.
Mark a thread as read
octokit.activity.markThreadAsRead({
thread_id
});Parameters
| name | required | description |
|---|---|---|
| thread_id | yes |
thread_id parameter |
See also: GitHub Developer Guide documentation.
Set a Repository Subscription
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 completely.
octokit.activity.setRepoSubscription({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| subscribed | no |
Determines if notifications should be received from this repository. |
| ignored | no |
Determines if all notifications should be blocked from this repository. |
See also: GitHub Developer Guide documentation.
Set a thread subscription
This lets you subscribe or unsubscribe from a conversation.
octokit.activity.setThreadSubscription({
thread_id
});Parameters
| name | required | description |
|---|---|---|
| thread_id | yes |
thread_id parameter |
| ignored | no |
Unsubscribes and subscribes you to a conversation. Set |
See also: GitHub Developer Guide documentation.
Star a repository
Requires for the user to be authenticated.
Note that you'll need to set Content-Length to zero when calling out to this endpoint. For more information, see "HTTP verbs."
octokit.activity.starRepo({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
Stop watching a repository (LEGACY)
Requires for the user to be authenticated.
octokit.activity.stopWatchingRepoLegacy({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
Unstar a repository
Requires for the user to be authenticated.
octokit.activity.unstarRepo({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
Watch a repository (LEGACY)
Requires the user to be authenticated.
Note that you'll need to set Content-Length to zero when calling out to this endpoint. For more information, see "HTTP verbs."
octokit.activity.watchRepoLegacy({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
Apps
Add repository to installation
Add a single repository to an installation. The authenticated user must have admin access to the repository.
You must use a personal access token (which you can create via the command line or the OAuth Authorizations API) or Basic Authentication to access this endpoint.
octokit.apps.addRepoToInstallation({
installation_id,
repository_id
});Parameters
| name | required | description |
|---|---|---|
| installation_id | yes |
installation_id parameter |
| repository_id | yes |
repository_id parameter |
See also: GitHub Developer Guide documentation.
Check if a GitHub account is associated with any Marketplace listing
Shows whether the user or organization account actively subscribes to a plan listed by the authenticated GitHub App. When someone submits a plan change that won't be processed until the end of their billing cycle, you will also see the upcoming pending change.
GitHub Apps must use a JWT to access this endpoint. OAuth Apps must use basic authentication with their client ID and client secret to access this endpoint.
octokit.apps.checkAccountIsAssociatedWithAny({
account_id
});Parameters
| name | required | description |
|---|---|---|
| account_id | yes |
account_id parameter |
See also: GitHub Developer Guide documentation.
Check if a GitHub account is associated with any Marketplace listing (stubbed)
Shows whether the user or organization account actively subscribes to a plan listed by the authenticated GitHub App. When someone submits a plan change that won't be processed until the end of their billing cycle, you will also see the upcoming pending change.
GitHub Apps must use a JWT to access this endpoint. OAuth Apps must use basic authentication with their client ID and client secret to access this endpoint.
octokit.apps.checkAccountIsAssociatedWithAnyStubbed({
account_id
});Parameters
| name | required | description |
|---|---|---|
| account_id | yes |
account_id parameter |
See also: GitHub Developer Guide documentation.
Check an authorization
This method is deprecated.
Deprecation Notice: GitHub will replace and discontinue OAuth endpoints containing access_token in the path parameter. We are introducing new endpoints that allow you to securely manage tokens for OAuth Apps by using access_token as an input parameter. For more information, see the blog post.
OAuth applications can use a special API method for checking OAuth token validity without exceeding the normal rate limits for failed login attempts. Authentication works differently with this particular endpoint. You must use Basic Authentication when accessing this endpoint, using the OAuth application's client_id and client_secret as the username and password. Invalid tokens will return 404 NOT FOUND.
octokit.apps.checkAuthorization({
client_id,
access_token
});Parameters
| name | required | description |
|---|---|---|
| client_id | yes |
client_id parameter |
| access_token | yes |
access_token parameter |
See also: GitHub Developer Guide documentation.
Check a token
OAuth applications can use a special API method for checking OAuth token validity without exceeding the normal rate limits for failed login attempts. Authentication works differently with this particular endpoint. You must use Basic Authentication to use this endpoint, where the username is the OAuth application client_id and the password is its client_secret. Invalid tokens will return 404 NOT FOUND.
octokit.apps.checkToken({
client_id
});Parameters
| name | required | description |
|---|---|---|
| client_id | yes |
client_id parameter |
| access_token | no |
The OAuth access token used to authenticate to the GitHub API. |
See also: GitHub Developer Guide documentation.
Create a content attachment
Creates an attachment under a content reference URL in the body or comment of an issue or pull request. Use the id of the content reference from the content_reference event to create an attachment.
The app must create a content attachment within six hours of the content reference URL being posted. See "Using content attachments" for details about content attachments.
You must use an installation access token to access this endpoint.
This example creates a content attachment for the domain https://errors.ai/.
octokit.apps.createContentAttachment({
content_reference_id,
title,
body
});Parameters
| name | required | description |
|---|---|---|
| content_reference_id | yes |
content_reference_id parameter |
| title | yes |
The title of the content attachment displayed in the body or comment of an issue or pull request. |
| body | yes |
The body text of the content attachment displayed in the body or comment of an issue or pull request. This parameter supports markdown. |
See also: GitHub Developer Guide documentation.
Create a GitHub App from a manifest
Use this endpoint to complete the handshake necessary when implementing the GitHub App Manifest flow. When you create a GitHub App with the manifest flow, you receive a temporary code used to retrieve the GitHub App's id, pem (private key), and webhook_secret.
octokit.apps.createFromManifest({
code
});Parameters
| name | required | description |
|---|---|---|
| code | yes |
code parameter |
See also: GitHub Developer Guide documentation.
Create a new installation token
Creates an installation access token that enables a GitHub App to make authenticated API requests for the app's installation on an organization or individual account. Installation tokens expire one hour from the time you create them. Using an expired token produces a status code of 401 - Unauthorized, and requires creating a new installation token. By default the installation token has access to all repositories that the installation can access. To restrict the access to specific repositories, you can provide the repository_ids when creating the token. When you omit repository_ids, the response does not contain the repositories key.
You must use a JWT to access this endpoint.
This example grants the token "Read and write" permission to issues and "Read" permission to contents, and restricts the token's access to the repository with an id of 1296269.
octokit.apps.createInstallationToken({
installation_id
});Parameters
| name | required | description |
|---|---|---|
| installation_id | yes |
installation_id parameter |
| repository_ids | no |
The |
| permissions | no |
The permissions granted to the access token. The permissions object includes the permission names and their access type. For a complete list of permissions and allowable values, see "GitHub App permissions." |
See also: GitHub Developer Guide documentation.
Delete an app authorization
OAuth application owners can revoke a grant for their OAuth application and a specific user. You must use Basic Authentication when accessing this endpoint, using the OAuth application's client_id and client_secret as the username and password. You must also provide a valid OAuth access_token as an input parameter and the grant for the token's owner will be deleted.
Deleting an OAuth application's grant will also delete all OAuth tokens associated with the application for the user. Once deleted, the application will have no access to the user's account and will no longer be listed on the application authorizations settings screen within GitHub.
octokit.apps.deleteAuthorization({
client_id
});Parameters
| name | required | description |
|---|---|---|
| client_id | yes |
client_id parameter |
| access_token | no |
The OAuth access token used to authenticate to the GitHub API. |
See also: GitHub Developer Guide documentation.
Delete an installation
Uninstalls a GitHub App on a user, organization, or business account.
You must use a JWT to access this endpoint.
octokit.apps.deleteInstallation({
installation_id
});Parameters
| name | required | description |
|---|---|---|
| installation_id | yes |
installation_id parameter |
See also: GitHub Developer Guide documentation.
Delete an app token
OAuth application owners can revoke a single token for an OAuth application. You must use Basic Authentication when accessing this endpoint, using the OAuth application's client_id and client_secret as the username and password.
octokit.apps.deleteToken({
client_id
});Parameters
| name | required | description |
|---|---|---|
| client_id | yes |
client_id parameter |
| access_token | no |
The OAuth access token used to authenticate to the GitHub API. |
See also: GitHub Developer Guide documentation.
Get an organization installation
Deprecated: This method has been renamed to apps.getOrgInstallation
Enables an authenticated GitHub App to find the organization's installation information.
You must use a JWT to access this endpoint.
octokit.apps.findOrgInstallation({
org
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
See also: GitHub Developer Guide documentation.
Get a repository installation
Deprecated: This method has been renamed to apps.getRepoInstallation
Enables an authenticated GitHub App to find the repository's installation information. The installation's account type will be either an organization or a user account, depending which account the repository belongs to.
You must use a JWT to access this endpoint.
octokit.apps.findRepoInstallation({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
Get a user installation
Deprecated: This method has been renamed to apps.getUserInstallation
Enables an authenticated GitHub App to find the user’s installation information.
You must use a JWT to access this endpoint.
octokit.apps.findUserInstallation({
username
});Parameters
| name | required | description |
|---|---|---|
| username | yes |
username parameter |
See also: GitHub Developer Guide documentation.
Get the authenticated GitHub App
Returns the GitHub App associated with the authentication credentials used. To see how many app installations are associated with this GitHub App, see the installations_count in the response. For more details about your app's installations, see the "List installations" endpoint.
You must use a JWT to access this endpoint.
octokit.apps.getAuthenticated();Parameters
This endpoint has no parameters
See also: GitHub Developer Guide documentation.
Get a single GitHub App
Note: The :app_slug is just the URL-friendly name of your GitHub App. You can find this on the settings page for your GitHub App (e.g., https://github.com/settings/apps/:app_slug).
If the GitHub App you specify is public, you can access this endpoint without authenticating. If the GitHub App you specify is private, you must authenticate with a personal access token or an installation access token to access this endpoint.
octokit.apps.getBySlug({
app_slug
});Parameters
| name | required | description |
|---|---|---|
| app_slug | yes |
app_slug parameter |
See also: GitHub Developer Guide documentation.
Get an installation
You must use a JWT to access this endpoint.
octokit.apps.getInstallation({
installation_id
});Parameters
| name | required | description |
|---|---|---|
| installation_id | yes |
installation_id parameter |
See also: GitHub Developer Guide documentation.
Get an organization installation
Enables an authenticated GitHub App to find the organization's installation information.
You must use a JWT to access this endpoint.
octokit.apps.getOrgInstallation({
org
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
See also: GitHub Developer Guide documentation.
Get a repository installation
Enables an authenticated GitHub App to find the repository's installation information. The installation's account type will be either an organization or a user account, depending which account the repository belongs to.
You must use a JWT to access this endpoint.
octokit.apps.getRepoInstallation({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
Get a user installation
Enables an authenticated GitHub App to find the user’s installation information.
You must use a JWT to access this endpoint.
octokit.apps.getUserInstallation({
username
});Parameters
| name | required | description |
|---|---|---|
| username | yes |
username parameter |
See also: GitHub Developer Guide documentation.
List all GitHub accounts (user or organization) on a specific plan
Returns any accounts associated with a plan, including free plans. For per-seat pricing, you see the list of accounts that have purchased the plan, including the number of seats purchased. When someone submits a plan change that won't be processed until the end of their billing cycle, you will also see the upcoming pending change.
GitHub Apps must use a JWT to access this endpoint. OAuth Apps must use basic authentication with their client ID and client secret to access this endpoint.
octokit.apps.listAccountsUserOrOrgOnPlan({
plan_id
});Parameters
| name | required | description |
|---|---|---|
| plan_id | yes |
plan_id parameter |
| sort | no |
Sorts the GitHub accounts by the date they were created or last updated. Can be one of |
| direction | no |
To return the oldest accounts first, set to |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List all GitHub accounts (user or organization) on a specific plan (stubbed)
Returns any accounts associated with a plan, including free plans. For per-seat pricing, you see the list of accounts that have purchased the plan, including the number of seats purchased. When someone submits a plan change that won't be processed until the end of their billing cycle, you will also see the upcoming pending change.
GitHub Apps must use a JWT to access this endpoint. OAuth Apps must use basic authentication with their client ID and client secret to access this endpoint.
octokit.apps.listAccountsUserOrOrgOnPlanStubbed({
plan_id
});Parameters
| name | required | description |
|---|---|---|
| plan_id | yes |
plan_id parameter |
| sort | no |
Sorts the GitHub accounts by the date they were created or last updated. Can be one of |
| direction | no |
To return the oldest accounts first, set to |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List repositories accessible to the user for an installation
List repositories that the authenticated user has explicit permission (:read, :write, or :admin) to access for an installation.
The authenticated user has explicit permission to access repositories they own, repositories where they are a collaborator, and repositories that they can access through an organization membership.
You must use a user-to-server OAuth access token, created for a user who has authorized your GitHub App, to access this endpoint.
The access the user has to each repository is included in the hash under the permissions key.
octokit.apps.listInstallationReposForAuthenticatedUser({
installation_id
});Parameters
| name | required | description |
|---|---|---|
| installation_id | yes |
installation_id parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List installations
You must use a JWT to access this endpoint.
The permissions the installation has are included under the permissions key.
octokit.apps.listInstallations();Parameters
| name | required | description |
|---|---|---|
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List installations for a user
Lists installations of your GitHub App that the authenticated user has explicit permission (:read, :write, or :admin) to access.
You must use a user-to-server OAuth access token, created for a user who has authorized your GitHub App, to access this endpoint.
The authenticated user has explicit permission to access repositories they own, repositories where they are a collaborator, and repositories that they can access through an organization membership.
You can find the permissions for the installation under the permissions key.
octokit.apps.listInstallationsForAuthenticatedUser();Parameters
| name | required | description |
|---|---|---|
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
Get a user's Marketplace purchases
Returns only active subscriptions. You must use a user-to-server OAuth access token, created for a user who has authorized your GitHub App, to access this endpoint. . OAuth Apps must authenticate using an OAuth token.
octokit.apps.listMarketplacePurchasesForAuthenticatedUser();Parameters
| name | required | description |
|---|---|---|
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
Get a user's Marketplace purchases (stubbed)
Returns only active subscriptions. You must use a user-to-server OAuth access token, created for a user who has authorized your GitHub App, to access this endpoint. . OAuth Apps must authenticate using an OAuth token.
octokit.apps.listMarketplacePurchasesForAuthenticatedUserStubbed();Parameters
| name | required | description |
|---|---|---|
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List all plans for your Marketplace listing
GitHub Apps must use a JWT to access this endpoint. OAuth Apps must use basic authentication with their client ID and client secret to access this endpoint.
octokit.apps.listPlans();Parameters
| name | required | description |
|---|---|---|
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List all plans for your Marketplace listing (stubbed)
GitHub Apps must use a JWT to access this endpoint. OAuth Apps must use basic authentication with their client ID and client secret to access this endpoint.
octokit.apps.listPlansStubbed();Parameters
| name | required | description |
|---|---|---|
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List repositories
List repositories that an installation can access.
You must use an installation access token to access this endpoint.
octokit.apps.listRepos();Parameters
| name | required | description |
|---|---|---|
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
Remove repository from installation
Remove a single repository from an installation. The authenticated user must have admin access to the repository.
You must use a personal access token (which you can create via the command line or the OAuth Authorizations API) or Basic Authentication to access this endpoint.
octokit.apps.removeRepoFromInstallation({
installation_id,
repository_id
});Parameters
| name | required | description |
|---|---|---|
| installation_id | yes |
installation_id parameter |
| repository_id | yes |
repository_id parameter |
See also: GitHub Developer Guide documentation.
Reset an authorization
This method is deprecated.
Deprecation Notice: GitHub will replace and discontinue OAuth endpoints containing access_token in the path parameter. We are introducing new endpoints that allow you to securely manage tokens for OAuth Apps by using access_token as an input parameter. For more information, see the blog post.
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 when accessing this endpoint, using the OAuth application's client_id and client_secret as the username and password. Invalid tokens will return 404 NOT FOUND.
octokit.apps.resetAuthorization({
client_id,
access_token
});Parameters
| name | required | description |
|---|---|---|
| client_id | yes |
client_id parameter |
| access_token | yes |
access_token parameter |
See also: GitHub Developer Guide documentation.
Reset a token
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 when accessing this endpoint, using the OAuth application's client_id and client_secret as the username and password. Invalid tokens will return 404 NOT FOUND.
octokit.apps.resetToken({
client_id
});Parameters
| name | required | description |
|---|---|---|
| client_id | yes |
client_id parameter |
| access_token | no |
The OAuth access token used to authenticate to the GitHub API. |
See also: GitHub Developer Guide documentation.
Revoke an authorization for an application
This method is deprecated.
Deprecation Notice: GitHub will replace and discontinue OAuth endpoints containing access_token in the path parameter. We are introducing new endpoints that allow you to securely manage tokens for OAuth Apps by using access_token as an input parameter. For more information, see the blog post.
OAuth application owners can revoke a single token for an OAuth application. You must use Basic Authentication when accessing this endpoint, using the OAuth application's client_id and client_secret as the username and password.
octokit.apps.revokeAuthorizationForApplication({
client_id,
access_token
});Parameters
| name | required | description |
|---|---|---|
| client_id | yes |
client_id parameter |
| access_token | yes |
access_token parameter |
See also: GitHub Developer Guide documentation.
Revoke a grant for an application
This method is deprecated.
Deprecation Notice: GitHub will replace and discontinue OAuth endpoints containing access_token in the path parameter. We are introducing new endpoints that allow you to securely manage tokens for OAuth Apps by using access_token as an input parameter. For more information, see the blog post.
OAuth application owners can revoke a grant for their OAuth application and a specific user. You must use Basic Authentication when accessing this endpoint, using the OAuth application's client_id and client_secret as the username and password. You must also provide a valid token as :access_token and the grant for the token's owner will be deleted.
Deleting an OAuth application's grant will also delete all OAuth tokens associated with the application for the user. Once deleted, the application will have no access to the user's account and will no longer be listed on the Applications settings page under "Authorized OAuth Apps" on GitHub.
octokit.apps.revokeGrantForApplication({
client_id,
access_token
});Parameters
| name | required | description |
|---|---|---|
| client_id | yes |
client_id parameter |
| access_token | yes |
access_token parameter |
See also: GitHub Developer Guide documentation.
Revoke an installation token
Revokes the installation token you're using to authenticate as an installation and access this endpoint.
Once an installation token is revoked, the token is invalidated and cannot be used. Other endpoints that require the revoked installation token must have a new installation token to work. You can create a new token using the "Create a new installation token" endpoint.
You must use an installation access token to access this endpoint.
octokit.apps.revokeInstallationToken();Parameters
This endpoint has no parameters
See also: GitHub Developer Guide documentation.
Checks
Create a check run
Note: The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty pull_requests array.
Creates a new check run for a specific commit in a repository. Your GitHub App must have the checks:write permission to create check runs.
octokit.checks.create({
owner,
repo,
name,
head_sha,
output.title,
output.summary,
output.annotations[].path,
output.annotations[].start_line,
output.annotations[].end_line,
output.annotations[].annotation_level,
output.annotations[].message,
output.images[].alt,
output.images[].image_url,
actions[].label,
actions[].description,
actions[].identifier
})Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| name | yes |
The name of the check. For example, "code-coverage". |
| head_sha | yes |
The SHA of the commit. |
| details_url | no |
The URL of the integrator's site that has the full details of the check. |
| external_id | no |
A reference for the run on the integrator's system. |
| status | no |
The current status. Can be one of |
| started_at | no |
The time that the check run began. This is a timestamp in ISO 8601 format: |
| conclusion | no |
Required if you provide |
| completed_at | no |
The time the check completed. This is a timestamp in ISO 8601 format: |
| output | no |
Check runs can accept a variety of data in the |
| output.title | yes |
The title of the check run. |
| output.summary | yes |
The summary of the check run. This parameter supports Markdown. |
| output.text | no |
The details of the check run. This parameter supports Markdown. |
| output.annotations | no |
Adds information from your analysis to specific lines of code. Annotations are visible on GitHub in the Checks and Files changed tab of the pull request. The Checks API limits the number of annotations to a maximum of 50 per API request. To create more than 50 annotations, you have to make multiple requests to the Update a check run endpoint. Each time you update the check run, annotations are appended to the list of annotations that already exist for the check run. For details about how you can view annotations on GitHub, see "About status checks". See the |
| output.annotations[].path | yes |
The path of the file to add an annotation to. For example, |
| output.annotations[].start_line | yes |
The start line of the annotation. |
| output.annotations[].end_line | yes |
The end line of the annotation. |
| output.annotations[].start_column | no |
The start column of the annotation. Annotations only support |
| output.annotations[].end_column | no |
The end column of the annotation. Annotations only support |
| output.annotations[].annotation_level | yes |
The level of the annotation. Can be one of |
| output.annotations[].message | yes |
A short description of the feedback for these lines of code. The maximum size is 64 KB. |
| output.annotations[].title | no |
The title that represents the annotation. The maximum size is 255 characters. |
| output.annotations[].raw_details | no |
Details about this annotation. The maximum size is 64 KB. |
| output.images | no |
Adds images to the output displayed in the GitHub pull request UI. See the |
| output.images[].alt | yes |
The alternative text for the image. |
| output.images[].image_url | yes |
The full URL of the image. |
| output.images[].caption | no |
A short image description. |
| actions | no |
Displays a button on GitHub that can be clicked to alert your app to do additional tasks. For example, a code linting app can display a button that automatically fixes detected errors. The button created in this object is displayed after the check run completes. When a user clicks the button, GitHub sends the |
| actions[].label | yes |
The text to be displayed on a button in the web UI. The maximum size is 20 characters. |
| actions[].description | yes |
A short explanation of what this action would do. The maximum size is 40 characters. |
| actions[].identifier | yes |
A reference for the action on the integrator's system. The maximum size is 20 characters. |
See also: GitHub Developer Guide documentation.
Create a check suite
Note: The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty pull_requests array and a null value for head_branch.
By default, check suites are automatically created when you create a check run. You only need to use this endpoint for manually creating check suites when you've disabled automatic creation using "Set preferences for check suites on a repository". Your GitHub App must have the checks:write permission to create check suites.
octokit.checks.createSuite({
owner,
repo,
head_sha
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| head_sha | yes |
The sha of the head commit. |
See also: GitHub Developer Guide documentation.
Get a single check run
Note: The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty pull_requests array.
Gets a single check run using its id. GitHub Apps must have the checks:read permission on a private repository or pull access to a public repository to get check runs. OAuth Apps and authenticated users must have the repo scope to get check runs in a private repository.
octokit.checks.get({
owner,
repo,
check_run_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| check_run_id | yes |
check_run_id parameter |
See also: GitHub Developer Guide documentation.
Get a single check suite
Note: The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty pull_requests array and a null value for head_branch.
Gets a single check suite using its id. GitHub Apps must have the checks:read permission on a private repository or pull access to a public repository to get check suites. OAuth Apps and authenticated users must have the repo scope to get check suites in a private repository.
octokit.checks.getSuite({
owner,
repo,
check_suite_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| check_suite_id | yes |
check_suite_id parameter |
See also: GitHub Developer Guide documentation.
List annotations for a check run
Lists annotations for a check run using the annotation id. GitHub Apps must have the checks:read permission on a private repository or pull access to a public repository to get annotations for a check run. OAuth Apps and authenticated users must have the repo scope to get annotations for a check run in a private repository.
octokit.checks.listAnnotations({
owner,
repo,
check_run_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| check_run_id | yes |
check_run_id parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List check runs for a specific ref
Note: The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty pull_requests array.
Lists check runs for a commit ref. The ref can be a SHA, branch name, or a tag name. GitHub Apps must have the checks:read permission on a private repository or pull access to a public repository to get check runs. OAuth Apps and authenticated users must have the repo scope to get check runs in a private repository.
octokit.checks.listForRef({
owner,
repo,
ref
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| ref | yes |
ref parameter |
| check_name | no |
Returns check runs with the specified |
| status | no |
Returns check runs with the specified |
| filter | no |
Filters check runs by their |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List check runs in a check suite
Note: The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty pull_requests array.
Lists check runs for a check suite using its id. GitHub Apps must have the checks:read permission on a private repository or pull access to a public repository to get check runs. OAuth Apps and authenticated users must have the repo scope to get check runs in a private repository.
octokit.checks.listForSuite({
owner,
repo,
check_suite_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| check_suite_id | yes |
check_suite_id parameter |
| check_name | no |
Returns check runs with the specified |
| status | no |
Returns check runs with the specified |
| filter | no |
Filters check runs by their |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List check suites for a specific ref
Note: The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty pull_requests array and a null value for head_branch.
Lists check suites for a commit ref. The ref can be a SHA, branch name, or a tag name. GitHub Apps must have the checks:read permission on a private repository or pull access to a public repository to list check suites. OAuth Apps and authenticated users must have the repo scope to get check suites in a private repository.
octokit.checks.listSuitesForRef({
owner,
repo,
ref
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| ref | yes |
ref parameter |
| app_id | no |
Filters check suites by GitHub App |
| check_name | no |
Filters checks suites by the name of the check run. |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
Rerequest check suite
Triggers GitHub to rerequest an existing check suite, without pushing new code to a repository. This endpoint will trigger the check_suite webhook event with the action rerequested. When a check suite is rerequested, its status is reset to queued and the conclusion is cleared.
To rerequest a check suite, your GitHub App must have the checks:read permission on a private repository or pull access to a public repository.
octokit.checks.rerequestSuite({
owner,
repo,
check_suite_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| check_suite_id | yes |
check_suite_id parameter |
See also: GitHub Developer Guide documentation.
Set preferences for check suites on a repository
Changes the default automatic flow when creating check suites. By default, the CheckSuiteEvent is automatically created each time code is pushed to a repository. When you disable the automatic creation of check suites, you can manually Create a check suite. You must have admin permissions in the repository to set preferences for check suites.
octokit.checks.setSuitesPreferences({
owner,
repo,
auto_trigger_checks[].app_id,
auto_trigger_checks[].setting
})Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| auto_trigger_checks | no |
Enables or disables automatic creation of CheckSuite events upon pushes to the repository. Enabled by default. See the |
| auto_trigger_checks[].app_id | yes |
The |
| auto_trigger_checks[].setting | yes |
Set to |
See also: GitHub Developer Guide documentation.
Update a check run
Note: The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty pull_requests array.
Updates a check run for a specific commit in a repository. Your GitHub App must have the checks:write permission to edit check runs.
octokit.checks.update({
owner,
repo,
check_run_id,
output.summary,
output.annotations[].path,
output.annotations[].start_line,
output.annotations[].end_line,
output.annotations[].annotation_level,
output.annotations[].message,
output.images[].alt,
output.images[].image_url,
actions[].label,
actions[].description,
actions[].identifier
})Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| check_run_id | yes |
check_run_id parameter |
| name | no |
The name of the check. For example, "code-coverage". |
| details_url | no |
The URL of the integrator's site that has the full details of the check. |
| external_id | no |
A reference for the run on the integrator's system. |
| started_at | no |
This is a timestamp in ISO 8601 format: |
| status | no |
The current status. Can be one of |
| conclusion | no |
Required if you provide |
| completed_at | no |
The time the check completed. This is a timestamp in ISO 8601 format: |
| output | no |
Check runs can accept a variety of data in the |
| output.title | no |
Required. |
| output.summary | yes |
Can contain Markdown. |
| output.text | no |
Can contain Markdown. |
| output.annotations | no |
Adds information from your analysis to specific lines of code. Annotations are visible in GitHub's pull request UI. Annotations are visible in GitHub's pull request UI. The Checks API limits the number of annotations to a maximum of 50 per API request. To create more than 50 annotations, you have to make multiple requests to the Update a check run endpoint. Each time you update the check run, annotations are appended to the list of annotations that already exist for the check run. For details about annotations in the UI, see "About status checks". See the |
| output.annotations[].path | yes |
The path of the file to add an annotation to. For example, |
| output.annotations[].start_line | yes |
The start line of the annotation. |
| output.annotations[].end_line | yes |
The end line of the annotation. |
| output.annotations[].start_column | no |
The start column of the annotation. Annotations only support |
| output.annotations[].end_column | no |
The end column of the annotation. Annotations only support |
| output.annotations[].annotation_level | yes |
The level of the annotation. Can be one of |
| output.annotations[].message | yes |
A short description of the feedback for these lines of code. The maximum size is 64 KB. |
| output.annotations[].title | no |
The title that represents the annotation. The maximum size is 255 characters. |
| output.annotations[].raw_details | no |
Details about this annotation. The maximum size is 64 KB. |
| output.images | no |
Adds images to the output displayed in the GitHub pull request UI. See the |
| output.images[].alt | yes |
The alternative text for the image. |
| output.images[].image_url | yes |
The full URL of the image. |
| output.images[].caption | no |
A short image description. |
| actions | no |
Possible further actions the integrator can perform, which a user may trigger. Each action includes a |
| actions[].label | yes |
The text to be displayed on a button in the web UI. The maximum size is 20 characters. |
| actions[].description | yes |
A short explanation of what this action would do. The maximum size is 40 characters. |
| actions[].identifier | yes |
A reference for the action on the integrator's system. The maximum size is 20 characters. |
See also: GitHub Developer Guide documentation.
Codes-of-Conduct
Get an individual code of conduct
octokit.codesOfConduct.getConductCode({
key
});Parameters
| name | required | description |
|---|---|---|
| key | yes |
key parameter |
See also: GitHub Developer Guide documentation.
Get the contents of a repository's code of conduct
This method returns the contents of the repository's code of conduct file, if one is detected.
octokit.codesOfConduct.getForRepo({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
List all codes of conduct
octokit.codesOfConduct.listConductCodes();Parameters
This endpoint has no parameters
See also: GitHub Developer Guide documentation.
Emojis
Get
Lists all the emojis available to use on GitHub.
octokit.emojis.get();Parameters
This endpoint has no parameters
See also: GitHub Developer Guide documentation.
Gists
Check if a gist is starred
octokit.gists.checkIsStarred({
gist_id
});Parameters
| name | required | description |
|---|---|---|
| gist_id | yes |
gist_id parameter |
See also: GitHub Developer Guide documentation.
Create a gist
Allows you to add a new gist with one or more files.
Note: Don't name your files "gistfile" with a numerical suffix. This is the format of the automatic naming scheme that Gist uses internally.
octokit.gists.create({
files
});Parameters
| name | required | description |
|---|---|---|
| files | yes |
The filenames and content of each file in the gist. The keys in the |
| files.content | no |
The content of the file. |
| description | no |
A descriptive name for this gist. |
| public | no |
When |
See also: GitHub Developer Guide documentation.
Create a comment
octokit.gists.createComment({
gist_id,
body
});Parameters
| name | required | description |
|---|---|---|
| gist_id | yes |
gist_id parameter |
| body | yes |
The comment text. |
See also: GitHub Developer Guide documentation.
Delete a gist
octokit.gists.delete({
gist_id
});Parameters
| name | required | description |
|---|---|---|
| gist_id | yes |
gist_id parameter |
See also: GitHub Developer Guide documentation.
Delete a comment
octokit.gists.deleteComment({
gist_id,
comment_id
});Parameters
| name | required | description |
|---|---|---|
| gist_id | yes |
gist_id parameter |
| comment_id | yes |
comment_id parameter |
See also: GitHub Developer Guide documentation.
Fork a gist
Note: This was previously /gists/:gist_id/fork.
octokit.gists.fork({
gist_id
});Parameters
| name | required | description |
|---|---|---|
| gist_id | yes |
gist_id parameter |
See also: GitHub Developer Guide documentation.
Get a single gist
octokit.gists.get({
gist_id
});Parameters
| name | required | description |
|---|---|---|
| gist_id | yes |
gist_id parameter |
See also: GitHub Developer Guide documentation.
Get a single comment
octokit.gists.getComment({
gist_id,
comment_id
});Parameters
| name | required | description |
|---|---|---|
| gist_id | yes |
gist_id parameter |
| comment_id | yes |
comment_id parameter |
See also: GitHub Developer Guide documentation.
Get a specific revision of a gist
octokit.gists.getRevision({
gist_id,
sha
});Parameters
| name | required | description |
|---|---|---|
| gist_id | yes |
gist_id parameter |
| sha | yes |
sha parameter |
See also: GitHub Developer Guide documentation.
List the authenticated user's gists or if called anonymously, this will return all public gists
octokit.gists.list();Parameters
| name | required | description |
|---|---|---|
| since | no |
This is a timestamp in ISO 8601 format: |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List comments on a gist
octokit.gists.listComments({
gist_id
});Parameters
| name | required | description |
|---|---|---|
| gist_id | yes |
gist_id parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List gist commits
octokit.gists.listCommits({
gist_id
});Parameters
| name | required | description |
|---|---|---|
| gist_id | yes |
gist_id parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List gist forks
octokit.gists.listForks({
gist_id
});Parameters
| name | required | description |
|---|---|---|
| gist_id | yes |
gist_id parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List all public gists
List all public gists sorted by most recently updated to least recently updated.
Note: With 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.
octokit.gists.listPublic();Parameters
| name | required | description |
|---|---|---|
| since | no |
This is a timestamp in ISO 8601 format: |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List public gists for the specified user
octokit.gists.listPublicForUser({
username
});Parameters
| name | required | description |
|---|---|---|
| username | yes |
username parameter |
| since | no |
This is a timestamp in ISO 8601 format: |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List starred gists
List the authenticated user's starred gists:
octokit.gists.listStarred();Parameters
| name | required | description |
|---|---|---|
| since | no |
This is a timestamp in ISO 8601 format: |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
Star a gist
Note that you'll need to set Content-Length to zero when calling out to this endpoint. For more information, see "HTTP verbs."
octokit.gists.star({
gist_id
});Parameters
| name | required | description |
|---|---|---|
| gist_id | yes |
gist_id parameter |
See also: GitHub Developer Guide documentation.
Unstar a gist
octokit.gists.unstar({
gist_id
});Parameters
| name | required | description |
|---|---|---|
| gist_id | yes |
gist_id parameter |
See also: GitHub Developer Guide documentation.
Edit a gist
Allows you to update or delete a gist file and rename gist files. Files from the previous version of the gist that aren't explicitly changed during an edit are unchanged.
octokit.gists.update({
gist_id
});Parameters
| name | required | description |
|---|---|---|
| gist_id | yes |
gist_id parameter |
| description | no |
A descriptive name for this gist. |
| files | no |
The filenames and content that make up this gist. |
| files.content | no |
The updated content of the file. |
| files.filename | no |
The new name for this file. To delete a file, set the value of the filename to |
See also: GitHub Developer Guide documentation.
Edit a comment
octokit.gists.updateComment({
gist_id,
comment_id,
body
});Parameters
| name | required | description |
|---|---|---|
| gist_id | yes |
gist_id parameter |
| comment_id | yes |
comment_id parameter |
| body | yes |
The comment text. |
See also: GitHub Developer Guide documentation.
Git
Create a blob
octokit.git.createBlob({
owner,
repo,
content
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| content | yes |
The new blob's content. |
| encoding | no |
The encoding used for |
See also: GitHub Developer Guide documentation.
Create a commit
Creates a new Git commit object.
In this example, the payload of the signature would be:
Signature verification object
The response will include a verification object that describes the result of verifying the commit's signature. The following fields are included in the verification object:
These are the possible values for reason in the verification object:
| Value | Description |
|---|---|
expired_key | The key that made the signature is expired. |
not_signing_key | The "signing" flag is not among the usage flags in the GPG key that made the signature. |
gpgverify_error | There was an error communicating with the signature verification service. |
gpgverify_unavailable | The signature verification service is currently unavailable. |
unsigned | The object does not include a signature. |
unknown_signature_type | A non-PGP signature was found in the commit. |
no_user | No user was associated with the committer email address in the commit. |
unverified_email | The committer email address in the commit was associated with a user, but the email address is not verified on her/his account. |
bad_email | The committer email address in the commit is not included in the identities of the PGP key that made the signature. |
unknown_key | The key that made the signature has not been registered with any user's account. |
malformed_signature | There was an error parsing the signature. |
invalid | The signature could not be cryptographically verified using the key whose key-id was found in the signature. |
valid | None of the above errors applied, so the signature is considered to be verified. |
octokit.git.createCommit({
owner,
repo,
message,
tree,
parents
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| message | yes |
The commit message |
| tree | yes |
The SHA of the tree object this commit points to |
| parents | yes |
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. |
| author | no |
Information about the author of the commit. By default, the |
| author.name | no |
The name of the author (or committer) of the commit |
| author.email | no |
The email of the author (or committer) of the commit |
| author.date | no |
Indicates when this commit was authored (or committed). This is a timestamp in ISO 8601 format: |
| committer | no |
Information about the person who is making the commit. By default, |
| committer.name | no |
The name of the author (or committer) of the commit |
| committer.email | no |
The email of the author (or committer) of the commit |
| committer.date | no |
Indicates when this commit was authored (or committed). This is a timestamp in ISO 8601 format: |
| signature | no |
The PGP signature of the commit. GitHub adds the signature to the |
See also: GitHub Developer Guide documentation.
Create a reference
Creates a reference for your repository. You are unable to create new references for empty repositories, even if the commit SHA-1 hash used exists. Empty repositories are repositories without branches.
octokit.git.createRef({
owner,
repo,
ref,
sha
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| ref | yes |
The name of the fully qualified reference (ie: |
| sha | yes |
The SHA1 value for this reference. |
See also: GitHub Developer Guide documentation.
Create a tag object
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 only have to create the tag reference - this call would be unnecessary.
Signature verification object
The response will include a verification object that describes the result of verifying the commit's signature. The following fields are included in the verification object:
These are the possible values for reason in the verification object:
| Value | Description |
|---|---|
expired_key | The key that made the signature is expired. |
not_signing_key | The "signing" flag is not among the usage flags in the GPG key that made the signature. |
gpgverify_error | There was an error communicating with the signature verification service. |
gpgverify_unavailable | The signature verification service is currently unavailable. |
unsigned | The object does not include a signature. |
unknown_signature_type | A non-PGP signature was found in the commit. |
no_user | No user was associated with the committer email address in the commit. |
unverified_email | The committer email address in the commit was associated with a user, but the email address is not verified on her/his account. |
bad_email | The committer email address in the commit is not included in the identities of the PGP key that made the signature. |
unknown_key | The key that made the signature has not been registered with any user's account. |
malformed_signature | There was an error parsing the signature. |
invalid | The signature could not be cryptographically verified using the key whose key-id was found in the signature. |
valid | None of the above errors applied, so the signature is considered to be verified. |
octokit.git.createTag({
owner,
repo,
tag,
message,
object,
type
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| tag | yes |
The tag's name. This is typically a version (e.g., "v0.0.1"). |
| message | yes |
The tag message. |
| object | yes |
The SHA of the git object this is tagging. |
| type | yes |
The type of the object we're tagging. Normally this is a |
| tagger | no |
An object with information about the individual creating the tag. |
| tagger.name | no |
The name of the author of the tag |
| tagger.email | no |
The email of the author of the tag |
| tagger.date | no |
When this object was tagged. This is a timestamp in ISO 8601 format: |
See also: GitHub Developer Guide documentation.
Create a tree
The tree creation API accepts nested entries. If you specify both a tree and a nested path modifying that tree, this endpoint will overwrite the contents of the tree with the new path contents, and create a new tree structure.
If you use this endpoint to add, delete, or modify the file contents in a tree, you will need to commit the tree and then update a branch to point to the commit. For more information see "Create a commit" and "Update a reference."
octokit.git.createTree({
owner,
repo,
tree
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| tree | yes |
Objects (of |
| tree[].path | no |
The file referenced in the tree. |
| tree[].mode | no |
The file mode; one of |
| tree[].type | no |
Either |
| tree[].sha | no |
The SHA1 checksum ID of the object in the tree. Also called Note: Use either |
| tree[].content | no |
The content you want this file to have. GitHub will write this blob out and use that SHA for this entry. Use either this, or Note: Use either |
| base_tree | no |
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. |
See also: GitHub Developer Guide documentation.
Delete a reference
DELETE /repos/octocat/Hello-World/git/refs/heads/feature-aDELETE /repos/octocat/Hello-World/git/refs/tags/v1.0octokit.git.deleteRef({
owner,
repo,
ref
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| ref | yes |
ref parameter |
See also: GitHub Developer Guide documentation.
Get a blob
The content in the response will always be Base64 encoded.
Note: This API supports blobs up to 100 megabytes in size.
octokit.git.getBlob({
owner,
repo,
file_sha
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| file_sha | yes |
file_sha parameter |
See also: GitHub Developer Guide documentation.
Get a commit
Gets a Git commit object.
Signature verification object
The response will include a verification object that describes the result of verifying the commit's signature. The following fields are included in the verification object:
These are the possible values for reason in the verification object:
| Value | Description |
|---|---|
expired_key | The key that made the signature is expired. |
not_signing_key | The "signing" flag is not among the usage flags in the GPG key that made the signature. |
gpgverify_error | There was an error communicating with the signature verification service. |
gpgverify_unavailable | The signature verification service is currently unavailable. |
unsigned | The object does not include a signature. |
unknown_signature_type | A non-PGP signature was found in the commit. |
no_user | No user was associated with the committer email address in the commit. |
unverified_email | The committer email address in the commit was associated with a user, but the email address is not verified on her/his account. |
bad_email | The committer email address in the commit is not included in the identities of the PGP key that made the signature. |
unknown_key | The key that made the signature has not been registered with any user's account. |
malformed_signature | There was an error parsing the signature. |
invalid | The signature could not be cryptographically verified using the key whose key-id was found in the signature. |
valid | None of the above errors applied, so the signature is considered to be verified. |
octokit.git.getCommit({
owner,
repo,
commit_sha
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| commit_sha | yes |
commit_sha parameter |
See also: GitHub Developer Guide documentation.
Get a single reference
Returns a single reference from your Git database. The :ref in the URL must be formatted as heads/<branch name> for branches and tags/<tag name> for tags. If the :ref doesn't match an existing ref, a 404 is returned.
Note: You need to explicitly request a pull request to trigger a test merge commit, which checks the mergeability of pull requests. For more information, see "Checking mergeability of pull requests".
To get the reference for a branch named skunkworkz/featureA, the endpoint route is:
octokit.git.getRef({
owner,
repo,
ref
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| ref | yes |
ref parameter |
See also: GitHub Developer Guide documentation.
Get a tag
Signature verification object
The response will include a verification object that describes the result of verifying the commit's signature. The following fields are included in the verification object:
These are the possible values for reason in the verification object:
| Value | Description |
|---|---|
expired_key | The key that made the signature is expired. |
not_signing_key | The "signing" flag is not among the usage flags in the GPG key that made the signature. |
gpgverify_error | There was an error communicating with the signature verification service. |
gpgverify_unavailable | The signature verification service is currently unavailable. |
unsigned | The object does not include a signature. |
unknown_signature_type | A non-PGP signature was found in the commit. |
no_user | No user was associated with the committer email address in the commit. |
unverified_email | The committer email address in the commit was associated with a user, but the email address is not verified on her/his account. |
bad_email | The committer email address in the commit is not included in the identities of the PGP key that made the signature. |
unknown_key | The key that made the signature has not been registered with any user's account. |
malformed_signature | There was an error parsing the signature. |
invalid | The signature could not be cryptographically verified using the key whose key-id was found in the signature. |
valid | None of the above errors applied, so the signature is considered to be verified. |
octokit.git.getTag({
owner,
repo,
tag_sha
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| tag_sha | yes |
tag_sha parameter |
See also: GitHub Developer Guide documentation.
Get a tree
Returns a single tree using the SHA1 value for that tree.
If truncated is true in the response then 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.
octokit.git.getTree({
owner,
repo,
tree_sha
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| tree_sha | yes |
tree_sha parameter |
| recursive | no |
recursive parameter |
See also: GitHub Developer Guide documentation.
List matching references
Returns an array of references from your Git database that match the supplied name. The :ref in the URL must be formatted as heads/<branch name> for branches and tags/<tag name> for tags. If the :ref doesn't exist in the repository, but existing refs start with :ref, they will be returned as an array.
When you use this endpoint without providing a :ref, it will return an array of all the references from your Git database, including notes and stashes if they exist on the server. Anything in the namespace is returned, not just heads and tags.
Note: You need to explicitly request a pull request to trigger a test merge commit, which checks the mergeability of pull requests. For more information, see "Checking mergeability of pull requests".
If you request matching references for a branch named feature but the branch feature doesn't exist, the response can still include other matching head refs that start with the word feature, such as featureA and featureB.
octokit.git.listMatchingRefs({
owner,
repo,
ref
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| ref | yes |
ref parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
Get all references
Returns an array of all the references from your Git database, including notes and stashes if they exist on the server. Anything in the namespace is returned, not just heads and tags. If there are no references to list, a 404 is returned.
octokit.git.listRefs({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| namespace | no |
namespace parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
Update a reference
octokit.git.updateRef({
owner,
repo,
ref,
sha
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| ref | yes |
ref parameter |
| sha | yes |
The SHA1 value to set this reference to |
| force | no |
Indicates whether to force the update or to make sure the update is a fast-forward update. Leaving this out or setting it to |
See also: GitHub Developer Guide documentation.
Gitignore
Get a single template
The API also allows fetching the source of a single template.
Use the raw media type to get the raw contents.
octokit.gitignore.getTemplate({
name
});Parameters
| name | required | description |
|---|---|---|
| name | yes |
name parameter |
See also: GitHub Developer Guide documentation.
Listing available templates
List all templates available to pass as an option when creating a repository.
octokit.gitignore.listTemplates();Parameters
This endpoint has no parameters
See also: GitHub Developer Guide documentation.
Interactions
Add or update interaction restrictions for an organization
Temporarily restricts interactions to certain GitHub users in any public repository in the given organization. You must be an organization owner to set these restrictions.
octokit.interactions.addOrUpdateRestrictionsForOrg({
org,
limit
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| limit | yes |
Specifies the group of GitHub users who can comment, open issues, or create pull requests in public repositories for the given organization. Must be one of: |
See also: GitHub Developer Guide documentation.
Add or update interaction restrictions for a repository
Temporarily restricts interactions to certain GitHub users within the given repository. You must have owner or admin access to set restrictions.
octokit.interactions.addOrUpdateRestrictionsForRepo({
owner,
repo,
limit
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| limit | yes |
Specifies the group of GitHub users who can comment, open issues, or create pull requests for the given repository. Must be one of: |
See also: GitHub Developer Guide documentation.
Get interaction restrictions for an organization
Shows which group of GitHub users can interact with this organization and when the restriction expires. If there are no restrictions, you will see an empty response.
octokit.interactions.getRestrictionsForOrg({
org
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
See also: GitHub Developer Guide documentation.
Get interaction restrictions for a repository
Shows which group of GitHub users can interact with this repository and when the restriction expires. If there are no restrictions, you will see an empty response.
octokit.interactions.getRestrictionsForRepo({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
Remove interaction restrictions for an organization
Removes all interaction restrictions from public repositories in the given organization. You must be an organization owner to remove restrictions.
octokit.interactions.removeRestrictionsForOrg({
org
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
See also: GitHub Developer Guide documentation.
Remove interaction restrictions for a repository
Removes all interaction restrictions from the given repository. You must have owner or admin access to remove restrictions.
octokit.interactions.removeRestrictionsForRepo({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
Issues
Add assignees to an issue
Adds up to 10 assignees to an issue. Users already assigned to an issue are not replaced.
This example adds two assignees to the existing octocat assignee.
octokit.issues.addAssignees({
owner,
repo,
issue_number
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| issue_number | yes |
issue_number parameter |
| assignees | no |
Usernames of people to assign this issue to. NOTE: Only users with push access can add assignees to an issue. Assignees are silently ignored otherwise. |
| number | no |
null |
See also: GitHub Developer Guide documentation.
Add labels to an issue
octokit.issues.addLabels({
owner,
repo,
issue_number,
labels
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| issue_number | yes |
issue_number parameter |
| labels | yes |
The name of the label to add to the issue. Must contain at least one label. Note: Alternatively, you can pass a single label as a |
| number | no |
null |
See also: GitHub Developer Guide documentation.
Check assignee
Checks if a user has permission to be assigned to an issue in this repository.
If the assignee can be assigned to issues in the repository, a 204 header with no content is returned.
Otherwise a 404 status code is returned.
octokit.issues.checkAssignee({
owner,
repo,
assignee
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| assignee | yes |
assignee parameter |
See also: GitHub Developer Guide documentation.
Create an issue
Any user with pull access to a repository can create an issue. If issues are disabled in the repository, the API returns a 410 Gone status.
This endpoint triggers notifications. Creating content too quickly using this endpoint may result in abuse rate limiting. See "Abuse rate limits" and "Dealing with abuse rate limits" for details.
octokit.issues.create({
owner,
repo,
title
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| title | yes |
The title of the issue. |
| body | no |
The contents of the issue. |
| assignee | no |
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. |
| milestone | no |
The |
| labels | no |
Labels to associate with this issue. NOTE: Only users with push access can set labels for new issues. Labels are silently dropped otherwise. |
| assignees | no |
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. |
See also: GitHub Developer Guide documentation.
Create a comment
This endpoint triggers notifications. Creating content too quickly using this endpoint may result in abuse rate limiting. See "Abuse rate limits" and "Dealing with abuse rate limits" for details.
octokit.issues.createComment({
owner,
repo,
issue_number,
body
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| issue_number | yes |
issue_number parameter |
| body | yes |
The contents of the comment. |
| number | no |
null |
See also: GitHub Developer Guide documentation.
Create a label
octokit.issues.createLabel({
owner,
repo,
name,
color
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| name | yes |
The name of the label. Emoji can be added to label names, using either native emoji or colon-style markup. For example, typing |
| color | yes |
The hexadecimal color code for the label, without the leading |
| description | no |
A short description of the label. |
See also: GitHub Developer Guide documentation.
Create a milestone
octokit.issues.createMilestone({
owner,
repo,
title
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| title | yes |
The title of the milestone. |
| state | no |
The state of the milestone. Either |
| description | no |
A description of the milestone. |
| due_on | no |
The milestone due date. This is a timestamp in ISO 8601 format: |
See also: GitHub Developer Guide documentation.
Delete a comment
octokit.issues.deleteComment({
owner,
repo,
comment_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| comment_id | yes |
comment_id parameter |
See also: GitHub Developer Guide documentation.
Delete a label
octokit.issues.deleteLabel({
owner,
repo,
name
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| name | yes |
name parameter |
See also: GitHub Developer Guide documentation.
Delete a milestone
octokit.issues.deleteMilestone({
owner,
repo,
milestone_number
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| milestone_number | yes |
milestone_number parameter |
| number | no |
null |
See also: GitHub Developer Guide documentation.
Get a single issue
The API returns a 301 Moved Permanently status if the issue was transferred to another repository. If the issue was transferred to or deleted from a repository where the authenticated user lacks read access, the API returns a 404 Not Found status. If the issue was deleted from a repository where the authenticated user has read access, the API returns a 410 Gone status. To receive webhook events for transferred and deleted issues, subscribe to the issues webhook.
Note: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request. For this reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by the pull_request key.
Be aware that the id of a pull request returned from "Issues" endpoints will be an issue id. To find out the pull request id, use the "List pull requests" endpoint.
octokit.issues.get({
owner,
repo,
issue_number
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| issue_number | yes |
issue_number parameter |
| number | no |
null |
See also: GitHub Developer Guide documentation.
Get a single comment
octokit.issues.getComment({
owner,
repo,
comment_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| comment_id | yes |
comment_id parameter |
See also: GitHub Developer Guide documentation.
Get a single event
octokit.issues.getEvent({
owner,
repo,
event_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| event_id | yes |
event_id parameter |
See also: GitHub Developer Guide documentation.
Get a single label
octokit.issues.getLabel({
owner,
repo,
name
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| name | yes |
name parameter |
See also: GitHub Developer Guide documentation.
Get a single milestone
octokit.issues.getMilestone({
owner,
repo,
milestone_number
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| milestone_number | yes |
milestone_number parameter |
| number | no |
null |
See also: GitHub Developer Guide documentation.
List all issues assigned to the authenticated user across all visible repositories including owned repositories, member repositories, and organization repositories
Note: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request. For this reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by the pull_request key.
Be aware that the id of a pull request returned from "Issues" endpoints will be an issue id. To find out the pull request id, use the "List pull requests" endpoint.
octokit.issues.list();Parameters
| name | required | description |
|---|---|---|
| filter | no |
Indicates which sorts of issues to return. Can be one of: |
| state | no |
Indicates the state of the issues to return. Can be either |
| labels | no |
A list of comma separated label names. Example: |
| sort | no |
What to sort results by. Can be either |
| direction | no |
The direction of the sort. Can be either |
| since | no |
Only issues updated at or after this time are returned. This is a timestamp in ISO 8601 format: |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List assignees
Lists the available assignees for issues in a repository.
octokit.issues.listAssignees({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List comments on an issue
Issue Comments are ordered by ascending ID.
octokit.issues.listComments({
owner,
repo,
issue_number
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| issue_number | yes |
issue_number parameter |
| since | no |
Only comments updated at or after this time are returned. This is a timestamp in ISO 8601 format: |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
| number | no |
null |
See also: GitHub Developer Guide documentation.
List comments in a repository
By default, Issue Comments are ordered by ascending ID.
octokit.issues.listCommentsForRepo({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| sort | no |
Either |
| direction | no |
Either |
| since | no |
Only comments updated at or after this time are returned. This is a timestamp in ISO 8601 format: |
See also: GitHub Developer Guide documentation.
List events for an issue
octokit.issues.listEvents({
owner,
repo,
issue_number
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| issue_number | yes |
issue_number parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
| number | no |
null |
See also: GitHub Developer Guide documentation.
List events for a repository
octokit.issues.listEventsForRepo({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List events for an issue
octokit.issues.listEventsForTimeline({
owner,
repo,
issue_number
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| issue_number | yes |
issue_number parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
| number | no |
null |
See also: GitHub Developer Guide documentation.
List all issues across owned and member repositories assigned to the authenticated user
Note: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request. For this reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by the pull_request key.
Be aware that the id of a pull request returned from "Issues" endpoints will be an issue id. To find out the pull request id, use the "List pull requests" endpoint.
octokit.issues.listForAuthenticatedUser();Parameters
| name | required | description |
|---|---|---|
| filter | no |
Indicates which sorts of issues to return. Can be one of: |
| state | no |
Indicates the state of the issues to return. Can be either |
| labels | no |
A list of comma separated label names. Example: |
| sort | no |
What to sort results by. Can be either |
| direction | no |
The direction of the sort. Can be either |
| since | no |
Only issues updated at or after this time are returned. This is a timestamp in ISO 8601 format: |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List all issues for a given organization assigned to the authenticated user
Note: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request. For this reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by the pull_request key.
Be aware that the id of a pull request returned from "Issues" endpoints will be an issue id. To find out the pull request id, use the "List pull requests" endpoint.
octokit.issues.listForOrg({
org
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| filter | no |
Indicates which sorts of issues to return. Can be one of: |
| state | no |
Indicates the state of the issues to return. Can be either |
| labels | no |
A list of comma separated label names. Example: |
| sort | no |
What to sort results by. Can be either |
| direction | no |
The direction of the sort. Can be either |
| since | no |
Only issues updated at or after this time are returned. This is a timestamp in ISO 8601 format: |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List issues for a repository
Note: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request. For this reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by the pull_request key.
Be aware that the id of a pull request returned from "Issues" endpoints will be an issue id. To find out the pull request id, use the "List pull requests" endpoint.
octokit.issues.listForRepo({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| milestone | no |
If an |
| state | no |
Indicates the state of the issues to return. Can be either |
| assignee | no |
Can be the name of a user. Pass in |
| creator | no |
The user that created the issue. |
| mentioned | no |
A user that's mentioned in the issue. |
| labels | no |
A list of comma separated label names. Example: |
| sort | no |
What to sort results by. Can be either |
| direction | no |
The direction of the sort. Can be either |
| since | no |
Only issues updated at or after this time are returned. This is a timestamp in ISO 8601 format: |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
Get labels for every issue in a milestone
octokit.issues.listLabelsForMilestone({
owner,
repo,
milestone_number
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| milestone_number | yes |
milestone_number parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
| number | no |
null |
See also: GitHub Developer Guide documentation.
List all labels for this repository
octokit.issues.listLabelsForRepo({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List labels on an issue
octokit.issues.listLabelsOnIssue({
owner,
repo,
issue_number
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| issue_number | yes |
issue_number parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
| number | no |
null |
See also: GitHub Developer Guide documentation.
List milestones for a repository
octokit.issues.listMilestonesForRepo({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| state | no |
The state of the milestone. Either |
| sort | no |
What to sort results by. Either |
| direction | no |
The direction of the sort. Either |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
Lock an issue
Users with push access can lock an issue or pull request's conversation.
Note that, if you choose not to pass any parameters, you'll need to set Content-Length to zero when calling out to this endpoint. For more information, see "HTTP verbs."
octokit.issues.lock({
owner,
repo,
issue_number
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| issue_number | yes |
issue_number parameter |
| lock_reason | no |
The reason for locking the issue or pull request conversation. Lock will fail if you don't use one of these reasons: |
| number | no |
null |
See also: GitHub Developer Guide documentation.
Remove assignees from an issue
Removes one or more assignees from an issue.
This example removes two of three assignees, leaving the octocat assignee.
octokit.issues.removeAssignees({
owner,
repo,
issue_number
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| issue_number | yes |
issue_number parameter |
| assignees | no |
Usernames of assignees to remove from an issue. NOTE: Only users with push access can remove assignees from an issue. Assignees are silently ignored otherwise. |
| number | no |
null |
See also: GitHub Developer Guide documentation.
Remove a label from an issue
Removes the specified label from the issue, and returns the remaining labels on the issue. This endpoint returns a 404 Not Found status if the label does not exist.
octokit.issues.removeLabel({
owner,
repo,
issue_number,
name
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| issue_number | yes |
issue_number parameter |
| name | yes |
name parameter |
| number | no |
null |
See also: GitHub Developer Guide documentation.
Remove all labels from an issue
octokit.issues.removeLabels({
owner,
repo,
issue_number
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| issue_number | yes |
issue_number parameter |
| number | no |
null |
See also: GitHub Developer Guide documentation.
Replace all labels for an issue
octokit.issues.replaceLabels({
owner,
repo,
issue_number
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| issue_number | yes |
issue_number parameter |
| labels | no |
The names of the labels to add to the issue. You can pass an empty array to remove all labels. Note: Alternatively, you can pass a single label as a |
| number | no |
null |
See also: GitHub Developer Guide documentation.
Unlock an issue
Users with push access can unlock an issue's conversation.
octokit.issues.unlock({
owner,
repo,
issue_number
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| issue_number | yes |
issue_number parameter |
| number | no |
null |
See also: GitHub Developer Guide documentation.
Edit an issue
Issue owners and users with push access can edit an issue.
octokit.issues.update({
owner,
repo,
issue_number
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| issue_number | yes |
issue_number parameter |
| title | no |
The title of the issue. |
| body | no |
The contents of the issue. |
| assignee | no |
Login for the user that this issue should be assigned to. This field is deprecated. |
| state | no |
State of the issue. Either |
| milestone | no |
The |
| labels | no |
Labels to associate with this issue. Pass one or more Labels to replace the set of Labels on this Issue. Send an empty array ( |
| assignees | no |
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 ( |
| number | no |
null |
See also: GitHub Developer Guide documentation.
Edit a comment
octokit.issues.updateComment({
owner,
repo,
comment_id,
body
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| comment_id | yes |
comment_id parameter |
| body | yes |
The contents of the comment. |
See also: GitHub Developer Guide documentation.
Update a label
octokit.issues.updateLabel({
owner,
repo,
current_name
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| current_name | yes |
current_name parameter |
| color | no |
The hexadecimal color code for the label, without the leading |
| name | no | |
| description | no |
A short description of the label. |
See also: GitHub Developer Guide documentation.
Update a milestone
octokit.issues.updateMilestone({
owner,
repo,
milestone_number
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| milestone_number | yes |
milestone_number parameter |
| title | no |
The title of the milestone. |
| state | no |
The state of the milestone. Either |
| description | no |
A description of the milestone. |
| due_on | no |
The milestone due date. This is a timestamp in ISO 8601 format: |
| number | no |
null |
See also: GitHub Developer Guide documentation.
Licenses
Get an individual license
octokit.licenses.get({
license
});Parameters
| name | required | description |
|---|---|---|
| license | yes |
license parameter |
See also: GitHub Developer Guide documentation.
Get the contents of a repository's license
This method returns the contents of the repository's license file, if one is detected.
Similar to the repository contents API, this method also supports custom media types for retrieving the raw license content or rendered license HTML.
octokit.licenses.getForRepo({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
List commonly used licenses
Deprecated: This method has been renamed to licenses.listCommonlyUsed
octokit.licenses.list();Parameters
This endpoint has no parameters
See also: GitHub Developer Guide documentation.
List commonly used licenses
octokit.licenses.listCommonlyUsed();Parameters
This endpoint has no parameters
See also: GitHub Developer Guide documentation.
Markdown
Render an arbitrary Markdown document
octokit.markdown.render({
text
});Parameters
| name | required | description |
|---|---|---|
| text | yes |
The Markdown text to render in HTML. Markdown content must be 400 KB or less. |
| mode | no |
The rendering mode. Can be either: |
| context | no |
The repository context to use when creating references in |
See also: GitHub Developer Guide documentation.
Render a Markdown document in raw mode
You must send Markdown as plain text (using a Content-Type header of text/plain or text/x-markdown) to this endpoint, rather than using JSON format. In raw mode, GitHub Flavored Markdown is not supported and Markdown will be rendered in plain format like a README.md file. Markdown content must be 400 KB or less.
octokit.markdown.renderRaw({
data
});Parameters
| name | required | description |
|---|---|---|
| data | yes |
data parameter |
See also: GitHub Developer Guide documentation.
Meta
Get
This endpoint provides a list of GitHub's IP addresses. For more information, see "About GitHub's IP addresses."
octokit.meta.get();Parameters
This endpoint has no parameters
See also: GitHub Developer Guide documentation.
Migrations
Cancel an import
Stop an import for a repository.
octokit.migrations.cancelImport({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
Delete a user migration archive
Deletes a previous migration archive. Downloadable migration archives are automatically deleted after seven days. Migration metadata, which is returned in the List user migrations and Get the status of a user migration endpoints, will continue to be available even after an archive is deleted.
octokit.migrations.deleteArchiveForAuthenticatedUser({
migration_id
});Parameters
| name | required | description |
|---|---|---|
| migration_id | yes |
migration_id parameter |
See also: GitHub Developer Guide documentation.
Delete an organization migration archive
Deletes a previous migration archive. Migration archives are automatically deleted after seven days.
octokit.migrations.deleteArchiveForOrg({
org,
migration_id
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| migration_id | yes |
migration_id parameter |
See also: GitHub Developer Guide documentation.
Download an organization migration archive
Fetches the URL to a migration archive.
octokit.migrations.downloadArchiveForOrg({
org,
migration_id
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| migration_id | yes |
migration_id parameter |
See also: GitHub Developer Guide documentation.
Download a user migration archive
Fetches the URL to download the migration archive as a tar.gz file. Depending on the resources your repository uses, the migration archive can contain JSON files with data for these objects:
- attachments
- bases
- commit_comments
- issue_comments
- issue_events
- issues
- milestones
- organizations
- projects
- protected_branches
- pull_request_reviews
- pull_requests
- releases
- repositories
- review_comments
- schema
- users
The archive will also contain an attachments directory that includes all attachment files uploaded to GitHub.com and a repositories directory that contains the repository's Git data.
octokit.migrations.getArchiveForAuthenticatedUser({
migration_id
});Parameters
| name | required | description |
|---|---|---|
| migration_id | yes |
migration_id parameter |
See also: GitHub Developer Guide documentation.
Download an organization migration archive
Deprecated: This method has been renamed to migrations.downloadArchiveForOrg
Fetches the URL to a migration archive.
octokit.migrations.getArchiveForOrg({
org,
migration_id
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| migration_id | yes |
migration_id parameter |
See also: GitHub Developer Guide documentation.
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 <hubot@12341234-abab-fefe-8787-fedcba987654>.
This API method and the "Map a commit author" method allow you to provide correct Git author information.
octokit.migrations.getCommitAuthors({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| since | no |
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 |
See also: GitHub Developer Guide documentation.
Get import progress
View the progress of an import.
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 avcsparameter. 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 includecommit_count(the total number of raw commits that will be imported) andpercent(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 includepush_percent, which is the percent value reported bygit pushwhen 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 section.error- the import encountered an error. The import progress response will include thefailed_stepand an error message. Contact GitHub Support or GitHub Premium Support 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 section.detection_found_nothing- the importer didn't recognize any source control at the URL. To resolve, Cancel the import and retry 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 aproject_choicesfield with the possible project choices as values. To update project choice, please see the 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.
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 beopt_in,opt_out, orundecidedif no action has been taken.has_large_files- the boolean value describing whether files larger than 100MB were found during theimportingstep.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.
octokit.migrations.getImportProgress({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
Get large files
List files larger than 100MB found during the import
octokit.migrations.getLargeFiles({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
Get the status of a user migration
Fetches a single user migration. The response includes the state of the migration, which can be one of the following values:
pending- the migration hasn't started yet.exporting- the migration is in progress.exported- the migration finished successfully.failed- the migration failed.
Once the migration has been exported you can download the migration archive.
octokit.migrations.getStatusForAuthenticatedUser({
migration_id
});Parameters
| name | required | description |
|---|---|---|
| migration_id | yes |
migration_id parameter |
See also: GitHub Developer Guide documentation.
Get the status of an organization migration
Fetches the status of a migration.
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.
octokit.migrations.getStatusForOrg({
org,
migration_id
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| migration_id | yes |
migration_id parameter |
See also: GitHub Developer Guide documentation.
List user migrations
Lists all migrations a user has started.
octokit.migrations.listForAuthenticatedUser();Parameters
| name | required | description |
|---|---|---|
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List organization migrations
Lists the most recent migrations.
octokit.migrations.listForOrg({
org
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List repositories in an organization migration
List all the repositories for this organization migration.
octokit.migrations.listReposForOrg({
org,
migration_id
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| migration_id | yes |
migration_id parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List repositories for a user migration
Lists all the repositories for this user migration.
octokit.migrations.listReposForUser({
migration_id
});Parameters
| name | required | description |
|---|---|---|
| migration_id | yes |
migration_id parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
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.
octokit.migrations.mapCommitAuthor({
owner,
repo,
author_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| author_id | yes |
author_id parameter |
| no |
The new Git author email. | |
| name | no |
The new Git author name. |
See also: GitHub Developer Guide documentation.
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. You can learn more about our LFS feature and working with large files on our help site.
octokit.migrations.setLfsPreference({
owner,
repo,
use_lfs
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| use_lfs | yes |
Can be one of |
See also: GitHub Developer Guide documentation.
Start a user migration
Initiates the generation of a user migration archive.
octokit.migrations.startForAuthenticatedUser({
repositories
});Parameters
| name | required | description |
|---|---|---|
| repositories | yes |
An array of repositories to include in the migration. |
| lock_repositories | no |
Locks the |
| exclude_attachments | no |
Does not include attachments uploaded to GitHub.com in the migration data when set to |
See also: GitHub Developer Guide documentation.
Start an organization migration
Initiates the generation of a migration archive.
octokit.migrations.startForOrg({
org,
repositories
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| repositories | yes |
A list of arrays indicating which repositories should be migrated. |
| lock_repositories | no |
Indicates whether repositories should be locked (to prevent manipulation) while migrating data. |
| exclude_attachments | no |
Indicates whether attachments should be excluded from the migration (to reduce migration archive file size). |
See also: GitHub Developer Guide documentation.
Start an import
Start a source import to a GitHub repository using GitHub Importer.
octokit.migrations.startImport({
owner,
repo,
vcs_url
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| vcs_url | yes |
The URL of the originating repository. |
| vcs | no |
The originating VCS type. Can be one of |
| vcs_username | no |
If authentication is required, the username to provide to |
| vcs_password | no |
If authentication is required, the password to provide to |
| tfvc_project | no |
For a tfvc import, the name of the project that is being imported. |
See also: GitHub Developer Guide documentation.
Unlock a user repository
Unlocks a repository. You can lock repositories when you start a user migration. Once the migration is complete you can unlock each repository to begin using it again or delete the repository if you no longer need the source data. Returns a status of 404 Not Found if the repository is not locked.
octokit.migrations.unlockRepoForAuthenticatedUser({
migration_id,
repo_name
});Parameters
| name | required | description |
|---|---|---|
| migration_id | yes |
migration_id parameter |
| repo_name | yes |
repo_name parameter |
See also: GitHub Developer Guide documentation.
Unlock an organization repository
Unlocks a repository that was locked for migration. You should unlock each migrated repository and delete them when the migration is complete and you no longer need the source data.
octokit.migrations.unlockRepoForOrg({
org,
migration_id,
repo_name
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| migration_id | yes |
migration_id parameter |
| repo_name | yes |
repo_name parameter |
See also: GitHub Developer Guide documentation.
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.
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:
To restart an import, no parameters are provided in the update request.
octokit.migrations.updateImport({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| vcs_username | no |
The username to provide to the originating repository. |
| vcs_password | no |
The password to provide to the originating repository. |
See also: GitHub Developer Guide documentation.
Oauth-Authorizations
Check an authorization
This method is deprecated.
Deprecated: This method has been renamed to apps.checkAuthorization
Deprecation Notice: GitHub will replace and discontinue OAuth endpoints containing access_token in the path parameter. We are introducing new endpoints that allow you to securely manage tokens for OAuth Apps by using access_token as an input parameter. For more information, see the blog post.
OAuth applications can use a special API method for checking OAuth token validity without exceeding the normal rate limits for failed login attempts. Authentication works differently with this particular endpoint. You must use Basic Authentication when accessing this endpoint, using the OAuth application's client_id and client_secret as the username and password. Invalid tokens will return 404 NOT FOUND.
octokit.oauthAuthorizations.checkAuthorization({
client_id,
access_token
});Parameters
| name | required | description |
|---|---|---|
| client_id | yes |
client_id parameter |
| access_token | yes |
access_token parameter |
See also: GitHub Developer Guide documentation.
Create a new authorization
This method is deprecated.
Deprecation Notice: GitHub will discontinue the OAuth Authorizations API, which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our web application flow. For more information, see the blog post.
Warning: Apps must use the web application flow to obtain OAuth tokens that work with GitHub SAML organizations. OAuth tokens created using the Authorizations API will be unable to access GitHub SAML organizations. For more information, see the blog post.
Creates OAuth tokens using Basic Authentication. If you have two-factor authentication setup, Basic Authentication for this endpoint requires that you use a one-time password (OTP) and your username and password instead of tokens. For more information, see "Working with two-factor authentication."
To create tokens for a particular OAuth application using this endpoint, you must authenticate as the user you want to create an authorization for and provide the app's client ID and secret, found on your OAuth application's settings page. If your OAuth application intends to create multiple tokens for one user, use fingerprint to differentiate between them.
You can also create tokens on GitHub from the personal access tokens settings page. Read more about these tokens in the GitHub Help documentation.
Organizations that enforce SAML SSO require personal access tokens to be whitelisted. Read more about whitelisting tokens in the GitHub Help documentation.
octokit.oauthAuthorizations.createAuthorization({
note
});Parameters
| name | required | description |
|---|---|---|
| scopes | no |
A list of scopes that this authorization is in. |
| note | yes |
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 | no |
A URL to remind you what app the OAuth token is for. |
| client_id | no |
The 20 character OAuth app client key for which to create the token. |
| client_secret | no |
The 40 character OAuth app client secret for which to create the token. |
| fingerprint | no |
A unique string to distinguish an authorization from others created for the same client ID and user. |
See also: GitHub Developer Guide documentation.
Delete an authorization
This method is deprecated.
Deprecation Notice: GitHub will discontinue the OAuth Authorizations API, which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our web application flow. For more information, see the blog post.
octokit.oauthAuthorizations.deleteAuthorization({
authorization_id
});Parameters
| name | required | description |
|---|---|---|
| authorization_id | yes |
authorization_id parameter |
See also: GitHub Developer Guide documentation.
Delete a grant
This method is deprecated.
Deprecation Notice: GitHub will discontinue the OAuth Authorizations API, which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our web application flow. For more information, see the blog post.
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.
octokit.oauthAuthorizations.deleteGrant({
grant_id
});Parameters
| name | required | description |
|---|---|---|
| grant_id | yes |
grant_id parameter |
See also: GitHub Developer Guide documentation.
Get a single authorization
This method is deprecated.
Deprecation Notice: GitHub will discontinue the OAuth Authorizations API, which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our web application flow. For more information, see the blog post.
octokit.oauthAuthorizations.getAuthorization({
authorization_id
});Parameters
| name | required | description |
|---|---|---|
| authorization_id | yes |
authorization_id parameter |
See also: GitHub Developer Guide documentation.
Get a single grant
This method is deprecated.
Deprecation Notice: GitHub will discontinue the OAuth Authorizations API, which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our web application flow. For more information, see the blog post.
octokit.oauthAuthorizations.getGrant({
grant_id
});Parameters
| name | required | description |
|---|---|---|
| grant_id | yes |
grant_id parameter |
See also: GitHub Developer Guide documentation.
Get-or-create an authorization for a specific app
This method is deprecated.
Deprecation Notice: GitHub will discontinue the OAuth Authorizations API, which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our web application flow. For more information, see the blog post.
Warning: Apps must use the web application flow to obtain OAuth tokens that work with GitHub SAML organizations. OAuth tokens created using the Authorizations API will be unable to access GitHub SAML organizations. For more information, see the blog post.
Creates a new authorization for the specified OAuth application, only if an authorization for that application doesn't already exist for the user. The URL includes the 20 character client ID for the OAuth app that is requesting the token. It returns the user's existing authorization for the application if one is present. Otherwise, it creates and returns a new one.
If you have two-factor authentication setup, Basic Authentication for this endpoint requires that you use a one-time password (OTP) and your username and password instead of tokens. For more information, see "Working with two-factor authentication."
Deprecation Notice: GitHub will discontinue the OAuth Authorizations API, which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our web application flow. For more information, see the blog post.
octokit.oauthAuthorizations.getOrCreateAuthorizationForApp({
client_id,
client_secret
});Parameters
| name | required | description |
|---|---|---|
| client_id | yes |
client_id parameter |
| client_secret | yes |
The 40 character OAuth app client secret associated with the client ID specified in the URL. |
| scopes | no |
A list of scopes that this authorization is in. |
| note | no |
A note to remind you what the OAuth token is for. |
| note_url | no |
A URL to remind you what app the OAuth token is for. |
| fingerprint | no |
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. |
See also: GitHub Developer Guide documentation.
Get-or-create an authorization for a specific app and fingerprint
This method is deprecated.
Deprecation Notice: GitHub will discontinue the OAuth Authorizations API, which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our web application flow. For more information, see the blog post.
Warning: Apps must use the web application flow to obtain OAuth tokens that work with GitHub SAML organizations. OAuth tokens created using the Authorizations API will be unable to access GitHub SAML organizations. For more information, see the blog post.
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.
If you have two-factor authentication setup, Basic Authentication for this endpoint requires that you use a one-time password (OTP) and your username and password instead of tokens. For more information, see "Working with two-factor authentication."
octokit.oauthAuthorizations.getOrCreateAuthorizationForAppAndFingerprint({
client_id,
fingerprint,
client_secret
});Parameters
| name | required | description |
|---|---|---|
| client_id | yes |
client_id parameter |
| fingerprint | yes |
fingerprint parameter |
| client_secret | yes |
The 40 character OAuth app client secret associated with the client ID specified in the URL. |
| scopes | no |
A list of scopes that this authorization is in. |
| note | no |
A note to remind you what the OAuth token is for. |
| note_url | no |
A URL to remind you what app the OAuth token is for. |
See also: GitHub Developer Guide documentation.
Get-or-create an authorization for a specific app and fingerprint
This method is deprecated.
Deprecated: This method has been renamed to oauthAuthorizations.getOrCreateAuthorizationForAppAndFingerprint
Deprecation Notice: GitHub will discontinue the OAuth Authorizations API, which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our web application flow. For more information, see the blog post.
Warning: Apps must use the web application flow to obtain OAuth tokens that work with GitHub SAML organizations. OAuth tokens created using the Authorizations API will be unable to access GitHub SAML organizations. For more information, see the blog post.
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.
If you have two-factor authentication setup, Basic Authentication for this endpoint requires that you use a one-time password (OTP) and your username and password instead of tokens. For more information, see "Working with two-factor authentication."
octokit.oauthAuthorizations.getOrCreateAuthorizationForAppFingerprint({
client_id,
fingerprint,
client_secret
});Parameters
| name | required | description |
|---|---|---|
| client_id | yes |
client_id parameter |
| fingerprint | yes |
fingerprint parameter |
| client_secret | yes |
The 40 character OAuth app client secret associated with the client ID specified in the URL. |
| scopes | no |
A list of scopes that this authorization is in. |
| note | no |
A note to remind you what the OAuth token is for. |
| note_url | no |
A URL to remind you what app the OAuth token is for. |
See also: GitHub Developer Guide documentation.
List your authorizations
This method is deprecated.
Deprecation Notice: GitHub will discontinue the OAuth Authorizations API, which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our web application flow. For more information, see the blog post.
octokit.oauthAuthorizations.listAuthorizations();Parameters
| name | required | description |
|---|---|---|
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List your grants
This method is deprecated.
Deprecation Notice: GitHub will discontinue the OAuth Authorizations API, which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our web application flow. For more information, see the blog post.
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 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. 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"].
octokit.oauthAuthorizations.listGrants();Parameters
| name | required | description |
|---|---|---|
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
Reset an authorization
This method is deprecated.
Deprecated: This method has been renamed to apps.resetAuthorization
Deprecation Notice: GitHub will replace and discontinue OAuth endpoints containing access_token in the path parameter. We are introducing new endpoints that allow you to securely manage tokens for OAuth Apps by using access_token as an input parameter. For more information, see the blog post.
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 when accessing this endpoint, using the OAuth application's client_id and client_secret as the username and password. Invalid tokens will return 404 NOT FOUND.
octokit.oauthAuthorizations.resetAuthorization({
client_id,
access_token
});Parameters
| name | required | description |
|---|---|---|
| client_id | yes |
client_id parameter |
| access_token | yes |
access_token parameter |
See also: GitHub Developer Guide documentation.
Revoke an authorization for an application
This method is deprecated.
Deprecated: This method has been renamed to apps.revokeAuthorizationForApplication
Deprecation Notice: GitHub will replace and discontinue OAuth endpoints containing access_token in the path parameter. We are introducing new endpoints that allow you to securely manage tokens for OAuth Apps by using access_token as an input parameter. For more information, see the blog post.
OAuth application owners can revoke a single token for an OAuth application. You must use Basic Authentication when accessing this endpoint, using the OAuth application's client_id and client_secret as the username and password.
octokit.oauthAuthorizations.revokeAuthorizationForApplication({
client_id,
access_token
});Parameters
| name | required | description |
|---|---|---|
| client_id | yes |
client_id parameter |
| access_token | yes |
access_token parameter |
See also: GitHub Developer Guide documentation.
Revoke a grant for an application
This method is deprecated.
Deprecated: This method has been renamed to apps.revokeGrantForApplication
Deprecation Notice: GitHub will replace and discontinue OAuth endpoints containing access_token in the path parameter. We are introducing new endpoints that allow you to securely manage tokens for OAuth Apps by using access_token as an input parameter. For more information, see the blog post.
OAuth application owners can revoke a grant for their OAuth application and a specific user. You must use Basic Authentication when accessing this endpoint, using the OAuth application's client_id and client_secret as the username and password. You must also provide a valid token as :access_token and the grant for the token's owner will be deleted.
Deleting an OAuth application's grant will also delete all OAuth tokens associated with the application for the user. Once deleted, the application will have no access to the user's account and will no longer be listed on the Applications settings page under "Authorized OAuth Apps" on GitHub.
octokit.oauthAuthorizations.revokeGrantForApplication({
client_id,
access_token
});Parameters
| name | required | description |
|---|---|---|
| client_id | yes |
client_id parameter |
| access_token | yes |
access_token parameter |
See also: GitHub Developer Guide documentation.
Update an existing authorization
This method is deprecated.
Deprecation Notice: GitHub will discontinue the OAuth Authorizations API, which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our web application flow. For more information, see the blog post.
If you have two-factor authentication setup, Basic Authentication for this endpoint requires that you use a one-time password (OTP) and your username and password instead of tokens. For more information, see "Working with two-factor authentication."
You can only send one of these scope keys at a time.
octokit.oauthAuthorizations.updateAuthorization({
authorization_id
});Parameters
| name | required | description |
|---|---|---|
| authorization_id | yes |
authorization_id parameter |
| scopes | no |
Replaces the authorization scopes with these. |
| add_scopes | no |
A list of scopes to add to this authorization. |
| remove_scopes | no |
A list of scopes to remove from this authorization. |
| note | no |
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 | no |
A URL to remind you what app the OAuth token is for. |
| fingerprint | no |
A unique string to distinguish an authorization from others created for the same client ID and user. |
See also: GitHub Developer Guide documentation.
Orgs
Add or update organization membership
Only authenticated organization owners can add a member to the organization or update the member's role.
-
If the authenticated user is adding a member to the organization, the invited user will receive an email inviting them to the organization. The user's membership status will be
pendinguntil they accept the invitation. -
Authenticated users can update a user's membership by passing the
roleparameter. If the authenticated user changes a member's role toadmin, the affected user will receive an email notifying them that they've been made an organization owner. If the authenticated user changes an owner's role tomember, no email will be sent.
Rate limits
To prevent abuse, the authenticated user is limited to 50 organization invitations per 24 hour period. If the organization is more than one month old or on a paid plan, the limit is 500 invitations per 24 hour period.
octokit.orgs.addOrUpdateMembership({
org,
username
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| username | yes |
username parameter |
| role | no |
The role to give the user in the organization. Can be one of: |
See also: GitHub Developer Guide documentation.
Block a user
octokit.orgs.blockUser({
org,
username
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| username | yes |
username parameter |
See also: GitHub Developer Guide documentation.
Check whether a user is blocked from an organization
If the user is blocked:
If the user is not blocked:
octokit.orgs.checkBlockedUser({
org,
username
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| username | yes |
username parameter |
See also: GitHub Developer Guide documentation.
Check membership
Check if a user is, publicly or privately, a member of the organization.
octokit.orgs.checkMembership({
org,
username
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| username | yes |
username parameter |
See also: GitHub Developer Guide documentation.
Check public membership
octokit.orgs.checkPublicMembership({
org,
username
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| username | yes |
username parameter |
See also: GitHub Developer Guide documentation.
Conceal a user's membership
octokit.orgs.concealMembership({
org,
username
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| username | yes |
username parameter |
See also: GitHub Developer Guide documentation.
Convert member to outside collaborator
When an organization member is converted to an outside collaborator, they'll only have access to the repositories that their current team membership allows. The user will no longer be a member of the organization. For more information, see "Converting an organization member to an outside collaborator".
octokit.orgs.convertMemberToOutsideCollaborator({
org,
username
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| username | yes |
username parameter |
See also: GitHub Developer Guide documentation.
Create a hook
Here's how you can create a hook that posts payloads in JSON format:
octokit.orgs.createHook({
org,
name,
config,
config.url
})Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| name | yes |
Must be passed as "web". |
| config | yes |
Key/value pairs to provide settings for this webhook. These are defined below. |
| config.url | yes |
The URL to which the payloads will be delivered. |
| config.content_type | no |
The media type used to serialize the payloads. Supported values include |
| config.secret | no |
If provided, the |
| config.insecure_ssl | no |
Determines whether the SSL certificate of the host for |
| events | no |
Determines what events the hook is triggered for. |
| active | no |
Determines if notifications are sent when the webhook is triggered. Set to |
See also: GitHub Developer Guide documentation.
Create organization invitation
Invite people to an organization by using their GitHub user ID or their email address. In order to create invitations in an organization, the authenticated user must be an organization owner.
This endpoint triggers notifications. Creating content too quickly using this endpoint may result in abuse rate limiting. See "Abuse rate limits" and "Dealing with abuse rate limits" for details.
octokit.orgs.createInvitation({
org
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| invitee_id | no |
Required unless you provide |
| no |
Required unless you provide | |
| role | no |
Specify role for new member. Can be one of: |
| team_ids | no |
Specify IDs for the teams you want to invite new members to. |
See also: GitHub Developer Guide documentation.
Delete a hook
octokit.orgs.deleteHook({
org,
hook_id
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| hook_id | yes |
hook_id parameter |
See also: GitHub Developer Guide documentation.
Get an organization
To see many of the organization response values, you need to be an authenticated organization owner with the admin:org scope. When the value of two_factor_requirement_enabled is true, the organization requires all members, billing managers, and outside collaborators to enable two-factor authentication.
GitHub Apps with the Organization plan permission can use this endpoint to retrieve information about an organization's GitHub plan. See "Authenticating with GitHub Apps" for details. For an example response, see "Response with GitHub plan information."
octokit.orgs.get({
org
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
See also: GitHub Developer Guide documentation.
Get single hook
octokit.orgs.getHook({
org,
hook_id
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| hook_id | yes |
hook_id parameter |
See also: GitHub Developer Guide documentation.
Get organization membership
In order to get a user's membership with an organization, the authenticated user must be an organization member.
octokit.orgs.getMembership({
org,
username
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| username | yes |
username parameter |
See also: GitHub Developer Guide documentation.
Get your organization membership
octokit.orgs.getMembershipForAuthenticatedUser({
org
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
See also: GitHub Developer Guide documentation.
List all organizations
Lists all organizations, in the order that they were created on GitHub.
Note: Pagination is powered exclusively by the since parameter. Use the Link header to get the URL for the next page of organizations.
octokit.orgs.list();Parameters
| name | required | description |
|---|---|---|
| since | no |
The integer ID of the last organization that you've seen. |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List blocked users
List the users blocked by an organization.
octokit.orgs.listBlockedUsers({
org
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
See also: GitHub Developer Guide documentation.
List your organizations
List 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.
octokit.orgs.listForAuthenticatedUser();Parameters
| name | required | description |
|---|---|---|
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List user organizations
List public organization memberships 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 API instead.
octokit.orgs.listForUser({
username
});Parameters
| name | required | description |
|---|---|---|
| username | yes |
username parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List hooks
octokit.orgs.listHooks({
org
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List installations for an organization
Lists all GitHub Apps in an organization. The installation count includes all GitHub Apps installed on repositories in the organization. You must be an organization owner with admin:read scope to use this endpoint.
octokit.orgs.listInstallations({
org
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List organization invitation teams
List all teams associated with an invitation. In order to see invitations in an organization, the authenticated user must be an organization owner.
octokit.orgs.listInvitationTeams({
org,
invitation_id
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| invitation_id | yes |
invitation_id parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
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.
octokit.orgs.listMembers({
org
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| filter | no |
Filter members returned in the list. Can be one of: |
| role | no |
Filter members returned by their role. Can be one of: |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List your organization memberships
octokit.orgs.listMemberships();Parameters
| name | required | description |
|---|---|---|
| state | no |
Indicates the state of the memberships to return. Can be either |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List outside collaborators
List all users who are outside collaborators of an organization.
octokit.orgs.listOutsideCollaborators({
org
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| filter | no |
Filter the list of outside collaborators. Can be one of: |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List pending organization invitations
The return hash contains a role field which refers to the Organization Invitation role and will be one of the following values: direct_member, admin, billing_manager, hiring_manager, or reinstate. If the invitee is not a GitHub member, the login field in the return hash will be null.
octokit.orgs.listPendingInvitations({
org
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
Public members list
Members of an organization can choose to have their membership publicized or not.
octokit.orgs.listPublicMembers({
org
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
Ping a hook
This will trigger a ping event to be sent to the hook.
octokit.orgs.pingHook({
org,
hook_id
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| hook_id | yes |
hook_id parameter |
See also: GitHub Developer Guide documentation.
Publicize a user's membership
The user can publicize their own membership. (A user cannot publicize the membership for another user.)
Note that you'll need to set Content-Length to zero when calling out to this endpoint. For more information, see "HTTP verbs."
octokit.orgs.publicizeMembership({
org,
username
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| username | yes |
username parameter |
See also: GitHub Developer Guide documentation.
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.
octokit.orgs.removeMember({
org,
username
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| username | yes |
username parameter |
See also: GitHub Developer Guide documentation.
Remove organization membership
In order to remove a user's membership with an organization, the authenticated user must be an organization owner.
If the specified user is an active member of the organization, this will remove them from the organization. If the specified user has been invited to the organization, this will cancel their invitation. The specified user will receive an email notification in both cases.
octokit.orgs.removeMembership({
org,
username
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| username | yes |
username parameter |
See also: GitHub Developer Guide documentation.
Remove outside collaborator
Removing a user from this list will remove them from all the organization's repositories.
octokit.orgs.removeOutsideCollaborator({
org,
username
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| username | yes |
username parameter |
See also: GitHub Developer Guide documentation.
Unblock a user
octokit.orgs.unblockUser({
org,
username
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| username | yes |
username parameter |
See also: GitHub Developer Guide documentation.
Edit an organization
Parameter Deprecation Notice: GitHub will replace and discontinue members_allowed_repository_creation_type in favor of more granular permissions. The new input parameters are members_can_create_public_repositories, members_can_create_private_repositories for all organizations and members_can_create_internal_repositories for organizations associated with an enterprise account using GitHub Enterprise Cloud. For more information, see the blog post.
Enables an authenticated organization owner with the admin:org scope to update the organization's profile and member privileges.
octokit.orgs.update({
org
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| billing_email | no |
Billing email address. This address is not publicized. |
| company | no |
The company name. |
| no |
The publicly visible email address. | |
| location | no |
The location. |
| name | no |
The shorthand name of the company. |
| description | no |
The description of the company. |
| has_organization_projects | no |
Toggles whether an organization can use organization projects. |
| has_repository_projects | no |
Toggles whether repositories that belong to the organization can use repository projects. |
| default_repository_permission | no |
Default permission level members have for organization repositories: |
| members_can_create_repositories | no |
Toggles the ability of non-admin organization members to create repositories. Can be one of: |
| members_can_create_internal_repositories | no |
Toggles whether organization members can create internal repositories, which are visible to all enterprise members. You can only allow members to create internal repositories if your organization is associated with an enterprise account using GitHub Enterprise Cloud. Can be one of: |
| members_can_create_private_repositories | no |
Toggles whether organization members can create private repositories, which are visible to organization members with permission. Can be one of: |
| members_can_create_public_repositories | no |
Toggles whether organization members can create public repositories, which are visible to anyone. Can be one of: |
| members_allowed_repository_creation_type | no |
Specifies which types of repositories non-admin organization members can create. Can be one of: |
See also: GitHub Developer Guide documentation.
Edit a hook
octokit.orgs.updateHook({
org,
hook_id,
config.url
})Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| hook_id | yes |
hook_id parameter |
| config | no |
Key/value pairs to provide settings for this webhook. These are defined below. |
| config.url | yes |
The URL to which the payloads will be delivered. |
| config.content_type | no |
The media type used to serialize the payloads. Supported values include |
| config.secret | no |
If provided, the |
| config.insecure_ssl | no |
Determines whether the SSL certificate of the host for |
| events | no |
Determines what events the hook is triggered for. |
| active | no |
Determines if notifications are sent when the webhook is triggered. Set to |
See also: GitHub Developer Guide documentation.
Edit your organization membership
octokit.orgs.updateMembership({
org,
state
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| state | yes |
The state that the membership should be in. Only |
See also: GitHub Developer Guide documentation.
Projects
Add user as a collaborator
Adds a collaborator to a an organization project and sets their permission level. You must be an organization owner or a project admin to add a collaborator.
octokit.projects.addCollaborator({
project_id,
username
});Parameters
| name | required | description |
|---|---|---|
| project_id | yes |
project_id parameter |
| username | yes |
username parameter |
| permission | no |
The permission to grant the collaborator. Note that, if you choose not to pass any parameters, you'll need to set |
See also: GitHub Developer Guide documentation.
Create a project card
Note: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request. For this reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by the pull_request key.
Be aware that the id of a pull request returned from "Issues" endpoints will be an issue id. To find out the pull request id, use the "List pull requests" endpoint.
octokit.projects.createCard({
column_id
});Parameters
| name | required | description |
|---|---|---|
| column_id | yes |
column_id parameter |
| note | no |
The card's note content. Only valid for cards without another type of content, so you must omit when specifying |
| content_id | no |
The issue or pull request id you want to associate with this card. You can use the List issues for a repository and List pull requests endpoints to find this id. |
| content_type | no |
Required if you provide |
See also: GitHub Developer Guide documentation.
Create a project column
octokit.projects.createColumn({
project_id,
name
});Parameters
| name | required | description |
|---|---|---|
| project_id | yes |
project_id parameter |
| name | yes |
The name of the column. |
See also: GitHub Developer Guide documentation.
Create a user project
octokit.projects.createForAuthenticatedUser({
name
});Parameters
| name | required | description |
|---|---|---|
| name | yes |
The name of the project. |
| body | no |
The description of the project. |
See also: GitHub Developer Guide documentation.
Create an organization project
Creates an organization project board. Returns a 404 Not Found status if projects are disabled in the organization. If you do not have sufficient privileges to perform this action, a 401 Unauthorized or 410 Gone status is returned.
octokit.projects.createForOrg({
org,
name
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| name | yes |
The name of the project. |
| body | no |
The description of the project. |
See also: GitHub Developer Guide documentation.
Create a repository project
Creates a repository project board. Returns a 404 Not Found status if projects are disabled in the repository. If you do not have sufficient privileges to perform this action, a 401 Unauthorized or 410 Gone status is returned.
octokit.projects.createForRepo({
owner,
repo,
name
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| name | yes |
The name of the project. |
| body | no |
The description of the project. |
See also: GitHub Developer Guide documentation.
Delete a project
Deletes a project board. Returns a 404 Not Found status if projects are disabled.
octokit.projects.delete({
project_id
});Parameters
| name | required | description |
|---|---|---|
| project_id | yes |
project_id parameter |
See also: GitHub Developer Guide documentation.
Delete a project card
octokit.projects.deleteCard({
card_id
});Parameters
| name | required | description |
|---|---|---|
| card_id | yes |
card_id parameter |
See also: GitHub Developer Guide documentation.
Delete a project column
octokit.projects.deleteColumn({
column_id
});Parameters
| name | required | description |
|---|---|---|
| column_id | yes |
column_id parameter |
See also: GitHub Developer Guide documentation.
Get a project
Gets a project by its id. Returns a 404 Not Found status if projects are disabled. If you do not have sufficient privileges to perform this action, a 401 Unauthorized or 410 Gone status is returned.
octokit.projects.get({
project_id
});Parameters
| name | required | description |
|---|---|---|
| project_id | yes |
project_id parameter |
See also: GitHub Developer Guide documentation.
Get a project card
octokit.projects.getCard({
card_id
});Parameters
| name | required | description |
|---|---|---|
| card_id | yes |
card_id parameter |
See also: GitHub Developer Guide documentation.
Get a project column
octokit.projects.getColumn({
column_id
});Parameters
| name | required | description |
|---|---|---|
| column_id | yes |
column_id parameter |
See also: GitHub Developer Guide documentation.
List project cards
octokit.projects.listCards({
column_id
});Parameters
| name | required | description |
|---|---|---|
| column_id | yes |
column_id parameter |
| archived_state | no |
Filters the project cards that are returned by the card's state. Can be one of |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List collaborators
Lists the collaborators for an organization project. For a project, the list of collaborators includes outside collaborators, organization members that are direct collaborators, organization members with access through team memberships, organization members with access through default organization permissions, and organization owners. You must be an organization owner or a project admin to list collaborators.
octokit.projects.listCollaborators({
project_id
});Parameters
| name | required | description |
|---|---|---|
| project_id | yes |
project_id parameter |
| affiliation | no |
Filters the collaborators by their affiliation. Can be one of: |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List project columns
octokit.projects.listColumns({
project_id
});Parameters
| name | required | description |
|---|---|---|
| project_id | yes |
project_id parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List organization projects
Lists the projects in an organization. Returns a 404 Not Found status if projects are disabled in the organization. If you do not have sufficient privileges to perform this action, a 401 Unauthorized or 410 Gone status is returned.
s
octokit.projects.listForOrg({
org
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| state | no |
Indicates the state of the projects to return. Can be either |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List repository projects
Lists the projects in a repository. Returns a 404 Not Found status if projects are disabled in the repository. If you do not have sufficient privileges to perform this action, a 401 Unauthorized or 410 Gone status is returned.
octokit.projects.listForRepo({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| state | no |
Indicates the state of the projects to return. Can be either |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List user projects
octokit.projects.listForUser({
username
});Parameters
| name | required | description |
|---|---|---|
| username | yes |
username parameter |
| state | no |
Indicates the state of the projects to return. Can be either |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
Move a project card
octokit.projects.moveCard({
card_id,
position
});Parameters
| name | required | description |
|---|---|---|
| card_id | yes |
card_id parameter |
| position | yes |
Can be one of |
| column_id | no |
The |
See also: GitHub Developer Guide documentation.
Move a project column
octokit.projects.moveColumn({
column_id,
position
});Parameters
| name | required | description |
|---|---|---|
| column_id | yes |
column_id parameter |
| position | yes |
Can be one of |
See also: GitHub Developer Guide documentation.
Remove user as a collaborator
Removes a collaborator from an organization project. You must be an organization owner or a project admin to remove a collaborator.
octokit.projects.removeCollaborator({
project_id,
username
});Parameters
| name | required | description |
|---|---|---|
| project_id | yes |
project_id parameter |
| username | yes |
username parameter |
See also: GitHub Developer Guide documentation.
Review a user's permission level
Returns the collaborator's permission level for an organization project. Possible values for the permission key: admin, write, read, none. You must be an organization owner or a project admin to review a user's permission level.
octokit.projects.reviewUserPermissionLevel({
project_id,
username
});Parameters
| name | required | description |
|---|---|---|
| project_id | yes |
project_id parameter |
| username | yes |
username parameter |
See also: GitHub Developer Guide documentation.
Update a project
Updates a project board's information. Returns a 404 Not Found status if projects are disabled. If you do not have sufficient privileges to perform this action, a 401 Unauthorized or 410 Gone status is returned.
octokit.projects.update({
project_id
});Parameters
| name | required | description |
|---|---|---|
| project_id | yes |
project_id parameter |
| name | no |
The name of the project. |
| body | no |
The description of the project. |
| state | no |
State of the project. Either |
| organization_permission | no |
The permission level that determines whether all members of the project's organization can see and/or make changes to the project. Setting Note: Updating a project's Can be one of: |
| private | no |
Sets the visibility of a project board. Setting Can be one of: |
See also: GitHub Developer Guide documentation.
Update a project card
octokit.projects.updateCard({
card_id
});Parameters
| name | required | description |
|---|---|---|
| card_id | yes |
card_id parameter |
| note | no |
The card's note content. Only valid for cards without another type of content, so this cannot be specified if the card already has a |
| archived | no |
Use |
See also: GitHub Developer Guide documentation.
Update a project column
octokit.projects.updateColumn({
column_id,
name
});Parameters
| name | required | description |
|---|---|---|
| column_id | yes |
column_id parameter |
| name | yes |
The new name of the column. |
See also: GitHub Developer Guide documentation.
Pulls
Get if a pull request has been merged
octokit.pulls.checkIfMerged({
owner,
repo,
pull_number
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| pull_number | yes |
pull_number parameter |
| number | no |
null |
See also: GitHub Developer Guide documentation.
Create a pull request
Draft pull requests are available in public repositories with GitHub Free and GitHub Pro, and in public and private repositories with GitHub Team and GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
To open or update a pull request in a public repository, you must have write access to the head or the source branch. For organization-owned repositories, you must be a member of the organization that owns the repository to open or update a pull request.
You can create a new pull request.
This endpoint triggers notifications. Creating content too quickly using this endpoint may result in abuse rate limiting. See "Abuse rate limits" and "Dealing with abuse rate limits" for details.
octokit.pulls.create({
owner,
repo,
title,
head,
base
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| title | yes |
The title of the new pull request. |
| head | yes |
The name of the branch where your changes are implemented. For cross-repository pull requests in the same network, namespace |
| base | yes |
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 | no |
The contents of the pull request. |
| maintainer_can_modify | no |
Indicates whether maintainers can modify the pull request. |
| draft | no |
Indicates whether the pull request is a draft. See "Draft Pull Requests" in the GitHub Help documentation to learn more. |
See also: GitHub Developer Guide documentation.
Create a comment
Note: Multi-line comments on pull requests are currently in public beta and subject to change.
Creates a review comment in the pull request diff. To add a regular comment to a pull request timeline, see "Comments." We recommend creating a review comment using line, side, and optionally start_line and start_side if your comment applies to more than one line in the pull request diff.
You can still create a review comment using the position parameter. When you use position, the line, side, start_line, and start_side parameters are not required. For more information, see Multi-line comment summary.
Note: The position value equals the number of lines down from the first "@@" hunk header in the file you want to add a comment. The line just below the "@@" line is position 1, the next line is position 2, and so on. The position in the diff continues to increase through lines of whitespace and additional hunks until the beginning of a new file.
This endpoint triggers notifications. Creating content too quickly using this endpoint may result in abuse rate limiting. See "Abuse rate limits" and "Dealing with abuse rate limits" for details.
Multi-line comment summary
Note: New parameters and response fields are available for developers to preview. During the preview period, these response fields may change without advance notice. Please see the blog post for full details.
Use the comfort-fade preview header and the line parameter to show multi-line comment-supported fields in the response.
If you use the comfort-fade preview header, your response will show:
- For multi-line comments, values for
start_line,original_start_line,start_side,line,original_line, andside. - For single-line comments, values for
line,original_line, andsideand anullvalue forstart_line,original_start_line, andstart_side.
If you don't use the comfort-fade preview header, multi-line and single-line comments will appear the same way in the response with a single position attribute. Your response will show:
- For multi-line comments, the last line of the comment range for the
positionattribute. - For single-line comments, the diff-positioned way of referencing comments for the
positionattribute. For more information, seepositionin the input parameters table.
octokit.pulls.createComment({
owner,
repo,
pull_number,
body,
commit_id,
path
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| pull_number | yes |
pull_number parameter |
| body | yes |
The text of the review comment. |
| commit_id | yes |
The SHA of the commit needing a comment. Not using the latest commit SHA may render your comment outdated if a subsequent commit modifies the line you specify as the |
| path | yes |
The relative path to the file that necessitates a comment. |
| position | no |
Required without |
| side | no |
Required with |
| line | no |
Required with |
| start_line | no |
Required when using multi-line comments. To create multi-line comments, you must use the |
| start_side | no |
Required when using multi-line comments. To create multi-line comments, you must use the |
| number | no |
null |
| in_reply_to | no |
The comment ID to reply to. Note: This must be the ID of a top-level comment, not a reply to that comment. Replies to replies are not supported. |
See also: GitHub Developer Guide documentation.
Create a comment
Deprecated: This method has been renamed to pulls.createComment
Note: Multi-line comments on pull requests are currently in public beta and subject to change.
Creates a review comment in the pull request diff. To add a regular comment to a pull request timeline, see "Comments." We recommend creating a review comment using line, side, and optionally start_line and start_side if your comment applies to more than one line in the pull request diff.
You can still create a review comment using the position parameter. When you use position, the line, side, start_line, and start_side parameters are not required. For more information, see Multi-line comment summary.
Note: The position value equals the number of lines down from the first "@@" hunk header in the file you want to add a comment. The line just below the "@@" line is position 1, the next line is position 2, and so on. The position in the diff continues to increase through lines of whitespace and additional hunks until the beginning of a new file.
This endpoint triggers notifications. Creating content too quickly using this endpoint may result in abuse rate limiting. See "Abuse rate limits" and "Dealing with abuse rate limits" for details.
Multi-line comment summary
Note: New parameters and response fields are available for developers to preview. During the preview period, these response fields may change without advance notice. Please see the blog post for full details.
Use the comfort-fade preview header and the line parameter to show multi-line comment-supported fields in the response.
If you use the comfort-fade preview header, your response will show:
- For multi-line comments, values for
start_line,original_start_line,start_side,line,original_line, andside. - For single-line comments, values for
line,original_line, andsideand anullvalue forstart_line,original_start_line, andstart_side.
If you don't use the comfort-fade preview header, multi-line and single-line comments will appear the same way in the response with a single position attribute. Your response will show:
- For multi-line comments, the last line of the comment range for the
positionattribute. - For single-line comments, the diff-positioned way of referencing comments for the
positionattribute. For more information, seepositionin the input parameters table.
octokit.pulls.createCommentReply({
owner,
repo,
pull_number,
body,
commit_id,
path
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| pull_number | yes |
pull_number parameter |
| body | yes |
The text of the review comment. |
| commit_id | yes |
The SHA of the commit needing a comment. Not using the latest commit SHA may render your comment outdated if a subsequent commit modifies the line you specify as the |
| path | yes |
The relative path to the file that necessitates a comment. |
| position | no |
Required without |
| side | no |
Required with |
| line | no |
Required with |
| start_line | no |
Required when using multi-line comments. To create multi-line comments, you must use the |
| start_side | no |
Required when using multi-line comments. To create multi-line comments, you must use the |
| number | no |
null |
| in_reply_to | no |
The comment ID to reply to. Note: This must be the ID of a top-level comment, not a reply to that comment. Replies to replies are not supported. |
See also: GitHub Developer Guide documentation.
Create from issue
This method is deprecated.
octokit.pulls.createFromIssue({
owner,
repo,
base,
head,
issue,
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| base | yes |
undefined |
| draft | no |
undefined |
| head | yes |
undefined |
| issue | yes |
undefined |
| maintainer_can_modify | no |
undefined |
| owner | yes |
undefined |
| repo | yes |
undefined |
See also: GitHub Developer Guide documentation.
Create a pull request review
This endpoint triggers notifications. Creating content too quickly using this endpoint may result in abuse rate limiting. See "Abuse rate limits" and "Dealing with abuse rate limits" for details.
Note: To comment on a specific line in a file, you need to first determine the position of that line in the diff. The GitHub REST API v3 offers the application/vnd.github.v3.diff media type. To see a pull request diff, add this media type to the Accept header of a call to the single pull request endpoint.
The position value equals the number of lines down from the first "@@" hunk header in the file you want to add a comment. The line just below the "@@" line is position 1, the next line is position 2, and so on. The position in the diff continues to increase through lines of whitespace and additional hunks until the beginning of a new file.
octokit.pulls.createReview({
owner,
repo,
pull_number,
comments[].path,
comments[].position,
comments[].body
})Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| pull_number | yes |
pull_number parameter |
| commit_id | no |
The SHA of the commit that needs a review. Not using the latest commit SHA may render your review comment outdated if a subsequent commit modifies the line you specify as the |
| body | no |
Required when using |
| event | no |
The review action you want to perform. The review actions include: |
| comments | no |
Use the following table to specify the location, destination, and contents of the draft review comment. |
| comments[].path | yes |
The relative path to the file that necessitates a review comment. |
| comments[].position | yes |
The position in the diff where you want to add a review comment. Note this value is not the same as the line number in the file. For help finding the position value, read the note below. |
| comments[].body | yes |
Text of the review comment. |
| number | no |
null |
See also: GitHub Developer Guide documentation.
Create a review comment reply
Creates a reply to a review comment for a pull request. For the comment_id, provide the ID of the review comment you are replying to. This must be the ID of a top-level review comment, not a reply to that comment. Replies to replies are not supported.
This endpoint triggers notifications. Creating content too quickly using this endpoint may result in abuse rate limiting. See "Abuse rate limits" and "Dealing with abuse rate limits" for details.
octokit.pulls.createReviewCommentReply({
owner,
repo,
pull_number,
comment_id,
body
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| pull_number | yes |
pull_number parameter |
| comment_id | yes |
comment_id parameter |
| body | yes |
The text of the review comment. |
See also: GitHub Developer Guide documentation.
Create a review request
This endpoint triggers notifications. Creating content too quickly using this endpoint may result in abuse rate limiting. See "Abuse rate limits" and "Dealing with abuse rate limits" for details.
octokit.pulls.createReviewRequest({
owner,
repo,
pull_number
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| pull_number | yes |
pull_number parameter |
| reviewers | no |
An array of user |
| team_reviewers | no |
An array of team |
| number | no |
null |
See also: GitHub Developer Guide documentation.
Delete a comment
Deletes a review comment.
octokit.pulls.deleteComment({
owner,
repo,
comment_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| comment_id | yes |
comment_id parameter |
See also: GitHub Developer Guide documentation.
Delete a pending review
octokit.pulls.deletePendingReview({
owner,
repo,
pull_number,
review_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| pull_number | yes |
pull_number parameter |
| review_id | yes |
review_id parameter |
| number | no |
null |
See also: GitHub Developer Guide documentation.
Delete a review request
octokit.pulls.deleteReviewRequest({
owner,
repo,
pull_number
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| pull_number | yes |
pull_number parameter |
| reviewers | no |
An array of user |
| team_reviewers | no |
An array of team |
| number | no |
null |
See also: GitHub Developer Guide documentation.
Dismiss a pull request review
Note: To dismiss a pull request review on a protected branch, you must be a repository administrator or be included in the list of people or teams who can dismiss pull request reviews.
octokit.pulls.dismissReview({
owner,
repo,
pull_number,
review_id,
message
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| pull_number | yes |
pull_number parameter |
| review_id | yes |
review_id parameter |
| message | yes |
The message for the pull request review dismissal |
| number | no |
null |
See also: GitHub Developer Guide documentation.
Get a single pull request
Draft pull requests are available in public repositories with GitHub Free and GitHub Pro, and in public and private repositories with GitHub Team and GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
Lists details of a pull request by providing its number.
When you get, create, or edit a pull request, GitHub creates a merge commit to test whether the pull request can be automatically merged into the base branch. This test commit is not added to the base branch or the head branch. You can review the status of the test commit using the mergeable key. For more information, see "Checking mergeability of pull requests".
The value of the mergeable attribute can be true, false, or null. If the value is null, then GitHub has started a background job to compute the mergeability. After giving the job time to complete, resubmit the request. When the job finishes, you will see a non-null value for the mergeable attribute in the response. If mergeable is true, then merge_commit_sha will be the SHA of the test merge commit.
The value of the merge_commit_sha attribute changes depending on the state of the pull request. Before merging a pull request, the merge_commit_sha attribute holds the SHA of the test merge commit. After merging a pull request, the merge_commit_sha attribute changes depending on how you merged the pull request:
- If merged as a merge commit,
merge_commit_sharepresents the SHA of the merge commit. - If merged via a squash,
merge_commit_sharepresents the SHA of the squashed commit on the base branch. - If rebased,
merge_commit_sharepresents the commit that the base branch was updated to.
Pass the appropriate media type to fetch diff and patch formats.
octokit.pulls.get({
owner,
repo,
pull_number
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| pull_number | yes |
pull_number parameter |
| number | no |
null |
See also: GitHub Developer Guide documentation.
Get a single comment
Note: Multi-line comments on pull requests are currently in public beta and subject to change.
Provides details for a review comment.
Multi-line comment summary
Note: New parameters and response fields are available for developers to preview. During the preview period, these response fields may change without advance notice. Please see the blog post for full details.
Use the comfort-fade preview header and the line parameter to show multi-line comment-supported fields in the response.
If you use the comfort-fade preview header, your response will show:
- For multi-line comments, values for
start_line,original_start_line,start_side,line,original_line, andside. - For single-line comments, values for
line,original_line, andsideand anullvalue forstart_line,original_start_line, andstart_side.
If you don't use the comfort-fade preview header, multi-line and single-line comments will appear the same way in the response with a single position attribute. Your response will show:
- For multi-line comments, the last line of the comment range for the
positionattribute. - For single-line comments, the diff-positioned way of referencing comments for the
positionattribute. For more information, seepositionin the input parameters table.
The reactions key will have the following payload where url can be used to construct the API location for listing and creating reactions.
octokit.pulls.getComment({
owner,
repo,
comment_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| comment_id | yes |
comment_id parameter |
See also: GitHub Developer Guide documentation.
Get comments for a single review
octokit.pulls.getCommentsForReview({
owner,
repo,
pull_number,
review_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| pull_number | yes |
pull_number parameter |
| review_id | yes |
review_id parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
| number | no |
null |
See also: GitHub Developer Guide documentation.
Get a single review
octokit.pulls.getReview({
owner,
repo,
pull_number,
review_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| pull_number | yes |
pull_number parameter |
| review_id | yes |
review_id parameter |
| number | no |
null |
See also: GitHub Developer Guide documentation.
List pull requests
Draft pull requests are available in public repositories with GitHub Free and GitHub Pro, and in public and private repositories with GitHub Team and GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
octokit.pulls.list({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| state | no |
Either |
| head | no |
Filter pulls by head user or head organization and branch name in the format of |
| base | no |
Filter pulls by base branch name. Example: |
| sort | no |
What to sort results by. Can be either |
| direction | no |
The direction of the sort. Can be either |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List comments on a pull request
Note: Multi-line comments on pull requests are currently in public beta and subject to change.
Lists review comments for a pull request. By default, review comments are in ascending order by ID.
Multi-line comment summary
Note: New parameters and response fields are available for developers to preview. During the preview period, these response fields may change without advance notice. Please see the blog post for full details.
Use the comfort-fade preview header and the line parameter to show multi-line comment-supported fields in the response.
If you use the comfort-fade preview header, your response will show:
- For multi-line comments, values for
start_line,original_start_line,start_side,line,original_line, andside. - For single-line comments, values for
line,original_line, andsideand anullvalue forstart_line,original_start_line, andstart_side.
If you don't use the comfort-fade preview header, multi-line and single-line comments will appear the same way in the response with a single position attribute. Your response will show:
- For multi-line comments, the last line of the comment range for the
positionattribute. - For single-line comments, the diff-positioned way of referencing comments for the
positionattribute. For more information, seepositionin the input parameters table.
The reactions key will have the following payload where url can be used to construct the API location for listing and creating reactions.
octokit.pulls.listComments({
owner,
repo,
pull_number
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| pull_number | yes |
pull_number parameter |
| sort | no |
Can be either |
| direction | no |
Can be either |
| since | no |
This is a timestamp in ISO 8601 format: |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
| number | no |
null |
See also: GitHub Developer Guide documentation.
List comments in a repository
Note: Multi-line comments on pull requests are currently in public beta and subject to change.
Lists review comments for all pull requests in a repository. By default, review comments are in ascending order by ID.
Multi-line comment summary
Note: New parameters and response fields are available for developers to preview. During the preview period, these response fields may change without advance notice. Please see the blog post for full details.
Use the comfort-fade preview header and the line parameter to show multi-line comment-supported fields in the response.
If you use the comfort-fade preview header, your response will show:
- For multi-line comments, values for
start_line,original_start_line,start_side,line,original_line, andside. - For single-line comments, values for
line,original_line, andsideand anullvalue forstart_line,original_start_line, andstart_side.
If you don't use the comfort-fade preview header, multi-line and single-line comments will appear the same way in the response with a single position attribute. Your response will show:
- For multi-line comments, the last line of the comment range for the
positionattribute. - For single-line comments, the diff-positioned way of referencing comments for the
positionattribute. For more information, seepositionin the input parameters table.
The reactions key will have the following payload where url can be used to construct the API location for listing and creating reactions.
octokit.pulls.listCommentsForRepo({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| sort | no |
Can be either |
| direction | no |
Can be either |
| since | no |
This is a timestamp in ISO 8601 format: |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List commits on a pull request
Lists a maximum of 250 commits for a pull request. To receive a complete commit list for pull requests with more than 250 commits, use the Commit List API.
octokit.pulls.listCommits({
owner,
repo,
pull_number
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| pull_number | yes |
pull_number parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
| number | no |
null |
See also: GitHub Developer Guide documentation.
List pull requests files
Note: Responses include a maximum of 3000 files. The paginated response returns 30 files per page by default.
octokit.pulls.listFiles({
owner,
repo,
pull_number
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| pull_number | yes |
pull_number parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
| number | no |
null |
See also: GitHub Developer Guide documentation.
List review requests
octokit.pulls.listReviewRequests({
owner,
repo,
pull_number
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| pull_number | yes |
pull_number parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
| number | no |
null |
See also: GitHub Developer Guide documentation.
List reviews on a pull request
The list of reviews returns in chronological order.
octokit.pulls.listReviews({
owner,
repo,
pull_number
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| pull_number | yes |
pull_number parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
| number | no |
null |
See also: GitHub Developer Guide documentation.
Merge a pull request (Merge Button)
This endpoint triggers notifications. Creating content too quickly using this endpoint may result in abuse rate limiting. See "Abuse rate limits" and "Dealing with abuse rate limits" for details.
octokit.pulls.merge({
owner,
repo,
pull_number
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| pull_number | yes |
pull_number parameter |
| commit_title | no |
Title for the automatic commit message. |
| commit_message | no |
Extra detail to append to automatic commit message. |
| sha | no |
SHA that pull request head must match to allow merge. |
| merge_method | no |
Merge method to use. Possible values are |
| number | no |
null |
See also: GitHub Developer Guide documentation.
Submit a pull request review
octokit.pulls.submitReview({
owner,
repo,
pull_number,
review_id,
event
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| pull_number | yes |
pull_number parameter |
| review_id | yes |
review_id parameter |
| body | no |
The body text of the pull request review |
| event | yes |
The review action you want to perform. The review actions include: |
| number | no |
null |
See also: GitHub Developer Guide documentation.
Update a pull request
Draft pull requests are available in public repositories with GitHub Free and GitHub Pro, and in public and private repositories with GitHub Team and GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
To open or update a pull request in a public repository, you must have write access to the head or the source branch. For organization-owned repositories, you must be a member of the organization that owns the repository to open or update a pull request.
octokit.pulls.update({
owner,
repo,
pull_number
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| pull_number | yes |
pull_number parameter |
| title | no |
The title of the pull request. |
| body | no |
The contents of the pull request. |
| state | no |
State of this Pull Request. Either |
| base | no |
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. |
| maintainer_can_modify | no |
Indicates whether maintainers can modify the pull request. |
| number | no |
null |
See also: GitHub Developer Guide documentation.
Update a pull request branch
Updates the pull request branch with the latest upstream changes by merging HEAD from the base branch into the pull request branch.
octokit.pulls.updateBranch({
owner,
repo,
pull_number
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| pull_number | yes |
pull_number parameter |
| expected_head_sha | no |
The expected SHA of the pull request's HEAD ref. This is the most recent commit on the pull request's branch. If the expected SHA does not match the pull request's HEAD, you will receive a |
See also: GitHub Developer Guide documentation.
Edit a comment
Note: Multi-line comments on pull requests are currently in public beta and subject to change.
Enables you to edit a review comment.
Multi-line comment summary
Note: New parameters and response fields are available for developers to preview. During the preview period, these response fields may change without advance notice. Please see the blog post for full details.
Use the comfort-fade preview header and the line parameter to show multi-line comment-supported fields in the response.
If you use the comfort-fade preview header, your response will show:
- For multi-line comments, values for
start_line,original_start_line,start_side,line,original_line, andside. - For single-line comments, values for
line,original_line, andsideand anullvalue forstart_line,original_start_line, andstart_side.
If you don't use the comfort-fade preview header, multi-line and single-line comments will appear the same way in the response with a single position attribute. Your response will show:
- For multi-line comments, the last line of the comment range for the
positionattribute. - For single-line comments, the diff-positioned way of referencing comments for the
positionattribute. For more information, seepositionin the input parameters table.
octokit.pulls.updateComment({
owner,
repo,
comment_id,
body
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| comment_id | yes |
comment_id parameter |
| body | yes |
The text of the reply to the review comment. |
See also: GitHub Developer Guide documentation.
Update a pull request review
Update the review summary comment with new text.
octokit.pulls.updateReview({
owner,
repo,
pull_number,
review_id,
body
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| pull_number | yes |
pull_number parameter |
| review_id | yes |
review_id parameter |
| body | yes |
The body text of the pull request review. |
| number | no |
null |
See also: GitHub Developer Guide documentation.
Rate-Limit
Get your current rate limit status
Note: Accessing this endpoint does not count against your REST API rate limit.
Understanding your rate limit status
The Search API has a custom rate limit, separate from the rate limit governing the rest of the REST API. The GraphQL API also has a custom rate limit that is separate from and calculated differently than rate limits in the REST API.
For these reasons, the Rate Limit API response categorizes your rate limit. Under resources, you'll see four objects:
- The
coreobject provides your rate limit status for all non-search-related resources in the REST API. - The
searchobject provides your rate limit status for the Search API. - The
graphqlobject provides your rate limit status for the GraphQL API. - The
integration_manifestobject provides your rate limit status for the GitHub App Manifest code conversion endpoint.
For more information on the headers and values in the rate limit response, see "Rate limiting."
The rate object (shown at the bottom of the response above) is deprecated.
If you're writing new API client code or updating 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.
octokit.rateLimit.get();Parameters
This endpoint has no parameters
See also: GitHub Developer Guide documentation.
Reactions
Create reaction for a commit comment
Create a reaction to a commit comment. A response with a Status: 200 OK means that you already added the reaction type to this commit comment.
octokit.reactions.createForCommitComment({
owner,
repo,
comment_id,
content
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| comment_id | yes |
comment_id parameter |
| content | yes |
The reaction type to add to the commit comment. |
See also: GitHub Developer Guide documentation.
Create reaction for an issue
Create a reaction to an issue. A response with a Status: 200 OK means that you already added the reaction type to this issue.
octokit.reactions.createForIssue({
owner,
repo,
issue_number,
content
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| issue_number | yes |
issue_number parameter |
| content | yes |
The reaction type to add to the issue. |
| number | no |
null |
See also: GitHub Developer Guide documentation.
Create reaction for an issue comment
Create a reaction to an issue comment. A response with a Status: 200 OK means that you already added the reaction type to this issue comment.
octokit.reactions.createForIssueComment({
owner,
repo,
comment_id,
content
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| comment_id | yes |
comment_id parameter |
| content | yes |
The reaction type to add to the issue comment. |
See also: GitHub Developer Guide documentation.
Create reaction for a pull request review comment
Create a reaction to a pull request review comment. A response with a Status: 200 OK means that you already added the reaction type to this pull request review comment.
octokit.reactions.createForPullRequestReviewComment({
owner,
repo,
comment_id,
content
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| comment_id | yes |
comment_id parameter |
| content | yes |
The reaction type to add to the pull request review comment. |
See also: GitHub Developer Guide documentation.
Create reaction for a team discussion (Legacy)
This method is deprecated.
Deprecated: This method has been renamed to reactions.createForTeamDiscussionLegacy
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Create reaction for a team discussion endpoint.
Create a reaction to a team discussion. OAuth access tokens require the write:discussion scope. A response with a Status: 200 OK means that you already added the reaction type to this team discussion.
octokit.reactions.createForTeamDiscussion({
team_id,
discussion_number,
content
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| discussion_number | yes |
discussion_number parameter |
| content | yes |
The reaction type to add to the team discussion. |
See also: GitHub Developer Guide documentation.
Create reaction for a team discussion comment (Legacy)
This method is deprecated.
Deprecated: This method has been renamed to reactions.createForTeamDiscussionCommentLegacy
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Create reaction for a team discussion comment endpoint.
Create a reaction to a team discussion comment. OAuth access tokens require the write:discussion scope. A response with a Status: 200 OK means that you already added the reaction type to this team discussion comment.
octokit.reactions.createForTeamDiscussionComment({
team_id,
discussion_number,
comment_number,
content
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| discussion_number | yes |
discussion_number parameter |
| comment_number | yes |
comment_number parameter |
| content | yes |
The reaction type to add to the team discussion comment. |
See also: GitHub Developer Guide documentation.
Create reaction for a team discussion comment
Create a reaction to a team discussion comment. OAuth access tokens require the write:discussion scope. A response with a Status: 200 OK means that you already added the reaction type to this team discussion comment.
Note: You can also specify a team by org_id and team_id using the route POST /organizations/:org_id/team/:team_id/discussions/:discussion_number/comments/:comment_number/reactions.
octokit.reactions.createForTeamDiscussionCommentInOrg({
org,
team_slug,
discussion_number,
comment_number,
content
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| team_slug | yes |
team_slug parameter |
| discussion_number | yes |
discussion_number parameter |
| comment_number | yes |
comment_number parameter |
| content | yes |
The reaction type to add to the team discussion comment. |
See also: GitHub Developer Guide documentation.
Create reaction for a team discussion comment (Legacy)
This method is deprecated.
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Create reaction for a team discussion comment endpoint.
Create a reaction to a team discussion comment. OAuth access tokens require the write:discussion scope. A response with a Status: 200 OK means that you already added the reaction type to this team discussion comment.
octokit.reactions.createForTeamDiscussionCommentLegacy({
team_id,
discussion_number,
comment_number,
content
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| discussion_number | yes |
discussion_number parameter |
| comment_number | yes |
comment_number parameter |
| content | yes |
The reaction type to add to the team discussion comment. |
See also: GitHub Developer Guide documentation.
Create reaction for a team discussion
Create a reaction to a team discussion. OAuth access tokens require the write:discussion scope. A response with a Status: 200 OK means that you already added the reaction type to this team discussion.
Note: You can also specify a team by org_id and team_id using the route POST /organizations/:org_id/team/:team_id/discussions/:discussion_number/reactions.
octokit.reactions.createForTeamDiscussionInOrg({
org,
team_slug,
discussion_number,
content
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| team_slug | yes |
team_slug parameter |
| discussion_number | yes |
discussion_number parameter |
| content | yes |
The reaction type to add to the team discussion. |
See also: GitHub Developer Guide documentation.
Create reaction for a team discussion (Legacy)
This method is deprecated.
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Create reaction for a team discussion endpoint.
Create a reaction to a team discussion. OAuth access tokens require the write:discussion scope. A response with a Status: 200 OK means that you already added the reaction type to this team discussion.
octokit.reactions.createForTeamDiscussionLegacy({
team_id,
discussion_number,
content
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| discussion_number | yes |
discussion_number parameter |
| content | yes |
The reaction type to add to the team discussion. |
See also: GitHub Developer Guide documentation.
Delete a reaction
OAuth access tokens require the write:discussion scope, when deleting a team discussion or team discussion comment.
octokit.reactions.delete({
reaction_id
});Parameters
| name | required | description |
|---|---|---|
| reaction_id | yes |
reaction_id parameter |
See also: GitHub Developer Guide documentation.
List reactions for a commit comment
List the reactions to a commit comment.
octokit.reactions.listForCommitComment({
owner,
repo,
comment_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| comment_id | yes |
comment_id parameter |
| content | no |
Returns a single reaction type. Omit this parameter to list all reactions to a commit comment. |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List reactions for an issue
List the reactions to an issue.
octokit.reactions.listForIssue({
owner,
repo,
issue_number
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| issue_number | yes |
issue_number parameter |
| content | no |
Returns a single reaction type. Omit this parameter to list all reactions to an issue. |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
| number | no |
null |
See also: GitHub Developer Guide documentation.
List reactions for an issue comment
List the reactions to an issue comment.
octokit.reactions.listForIssueComment({
owner,
repo,
comment_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| comment_id | yes |
comment_id parameter |
| content | no |
Returns a single reaction type. Omit this parameter to list all reactions to an issue comment. |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List reactions for a pull request review comment
List the reactions to a pull request review comment.
octokit.reactions.listForPullRequestReviewComment({
owner,
repo,
comment_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| comment_id | yes |
comment_id parameter |
| content | no |
Returns a single reaction type. Omit this parameter to list all reactions to a pull request review comment. |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List reactions for a team discussion (Legacy)
This method is deprecated.
Deprecated: This method has been renamed to reactions.listForTeamDiscussionLegacy
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new List reactions for a team discussion endpoint.
List the reactions to a team discussion. OAuth access tokens require the read:discussion scope.
octokit.reactions.listForTeamDiscussion({
team_id,
discussion_number
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| discussion_number | yes |
discussion_number parameter |
| content | no |
Returns a single reaction type. Omit this parameter to list all reactions to a team discussion. |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List reactions for a team discussion comment (Legacy)
This method is deprecated.
Deprecated: This method has been renamed to reactions.listForTeamDiscussionCommentLegacy
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new List reactions for a team discussion comment endpoint.
List the reactions to a team discussion comment. OAuth access tokens require the read:discussion scope.
octokit.reactions.listForTeamDiscussionComment({
team_id,
discussion_number,
comment_number
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| discussion_number | yes |
discussion_number parameter |
| comment_number | yes |
comment_number parameter |
| content | no |
Returns a single reaction type. Omit this parameter to list all reactions to a team discussion comment. |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List reactions for a team discussion comment
List the reactions to a team discussion comment. OAuth access tokens require the read:discussion scope.
Note: You can also specify a team by org_id and team_id using the route GET /organizations/:org_id/team/:team_id/discussions/:discussion_number/comments/:comment_number/reactions.
octokit.reactions.listForTeamDiscussionCommentInOrg({
org,
team_slug,
discussion_number,
comment_number
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| team_slug | yes |
team_slug parameter |
| discussion_number | yes |
discussion_number parameter |
| comment_number | yes |
comment_number parameter |
| content | no |
Returns a single reaction type. Omit this parameter to list all reactions to a team discussion comment. |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List reactions for a team discussion comment (Legacy)
This method is deprecated.
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new List reactions for a team discussion comment endpoint.
List the reactions to a team discussion comment. OAuth access tokens require the read:discussion scope.
octokit.reactions.listForTeamDiscussionCommentLegacy({
team_id,
discussion_number,
comment_number
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| discussion_number | yes |
discussion_number parameter |
| comment_number | yes |
comment_number parameter |
| content | no |
Returns a single reaction type. Omit this parameter to list all reactions to a team discussion comment. |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List reactions for a team discussion
List the reactions to a team discussion. OAuth access tokens require the read:discussion scope.
Note: You can also specify a team by org_id and team_id using the route GET /organizations/:org_id/team/:team_id/discussions/:discussion_number/reactions.
octokit.reactions.listForTeamDiscussionInOrg({
org,
team_slug,
discussion_number
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| team_slug | yes |
team_slug parameter |
| discussion_number | yes |
discussion_number parameter |
| content | no |
Returns a single reaction type. Omit this parameter to list all reactions to a team discussion. |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List reactions for a team discussion (Legacy)
This method is deprecated.
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new List reactions for a team discussion endpoint.
List the reactions to a team discussion. OAuth access tokens require the read:discussion scope.
octokit.reactions.listForTeamDiscussionLegacy({
team_id,
discussion_number
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| discussion_number | yes |
discussion_number parameter |
| content | no |
Returns a single reaction type. Omit this parameter to list all reactions to a team discussion. |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
Repos
Accept a repository invitation
octokit.repos.acceptInvitation({
invitation_id
});Parameters
| name | required | description |
|---|---|---|
| invitation_id | yes |
invitation_id parameter |
See also: GitHub Developer Guide documentation.
Add user as a collaborator
This endpoint triggers notifications. Creating content too quickly using this endpoint may result in abuse rate limiting. See "Abuse rate limits" and "Dealing with abuse rate limits" for details.
Note that, if you choose not to pass any parameters, you'll need to set Content-Length to zero when calling out to this endpoint. For more information, see "HTTP verbs."
The invitee will receive a notification that they have been invited to the repository, which they must accept or decline. They may do this via the notifications page, the email they receive, or by using the repository invitations API endpoints.
Rate limits
To prevent abuse, you are limited to sending 50 invitations to a repository per 24 hour period. Note there is no limit if you are inviting organization members to an organization repository.
octokit.repos.addCollaborator({
owner,
repo,
username
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| username | yes |
username parameter |
| permission | no |
The permission to grant the collaborator. Only valid on organization-owned repositories. Can be one of: |
See also: GitHub Developer Guide documentation.
Add a new deploy key
Here's how you can create a read-only deploy key:
octokit.repos.addDeployKey({
owner,
repo,
key
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| title | no |
A name for the key. |
| key | yes |
The contents of the key. |
| read_only | no |
If Deploy keys with write access can perform the same actions as an organization member with admin access, or a collaborator on a personal repository. For more information, see "Repository permission levels for an organization" and "Permission levels for a user account repository." |
See also: GitHub Developer Guide documentation.
Add admin enforcement of protected branch
Protected branches are available in public repositories with GitHub Free, and in public and private repositories with GitHub Pro, GitHub Team, and GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
Adding admin enforcement requires admin or owner permissions to the repository and branch protection to be enabled.
octokit.repos.addProtectedBranchAdminEnforcement({
owner,
repo,
branch
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| branch | yes |
branch parameter |
See also: GitHub Developer Guide documentation.
Add app restrictions of protected branch
Protected branches are available in public repositories with GitHub Free, and in public and private repositories with GitHub Pro, GitHub Team, and GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
Grants the specified apps push access for this branch. Only installed GitHub Apps with write access to the contents permission can be added as authorized actors on a protected branch.
| Type | Description |
|---|---|
array | The GitHub Apps that have push access to this branch. Use the app's slug. Note: The list of users, apps, and teams in total is limited to 100 items. |
octokit.repos.addProtectedBranchAppRestrictions({
owner,
repo,
branch,
apps
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| branch | yes |
branch parameter |
| apps | yes |
apps parameter |
See also: GitHub Developer Guide documentation.
Add required signatures of protected branch
Protected branches are available in public repositories with GitHub Free, and in public and private repositories with GitHub Pro, GitHub Team, and GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
When authenticated with admin or owner permissions to the repository, you can use this endpoint to require signed commits on a branch. You must enable branch protection to require signed commits.
octokit.repos.addProtectedBranchRequiredSignatures({
owner,
repo,
branch
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| branch | yes |
branch parameter |
See also: GitHub Developer Guide documentation.
Add required status checks contexts of protected branch
Protected branches are available in public repositories with GitHub Free, and in public and private repositories with GitHub Pro, GitHub Team, and GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
octokit.repos.addProtectedBranchRequiredStatusChecksContexts({
owner,
repo,
branch,
contexts
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| branch | yes |
branch parameter |
| contexts | yes |
contexts parameter |
See also: GitHub Developer Guide documentation.
Add team restrictions of protected branch
Protected branches are available in public repositories with GitHub Free, and in public and private repositories with GitHub Pro, GitHub Team, and GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
Grants the specified teams push access for this branch. You can also give push access to child teams.
| Type | Description |
|---|---|
array | The teams that can have push access. Use the team's slug. Note: The list of users, apps, and teams in total is limited to 100 items. |
octokit.repos.addProtectedBranchTeamRestrictions({
owner,
repo,
branch,
teams
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| branch | yes |
branch parameter |
| teams | yes |
teams parameter |
See also: GitHub Developer Guide documentation.
Add user restrictions of protected branch
Protected branches are available in public repositories with GitHub Free, and in public and private repositories with GitHub Pro, GitHub Team, and GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
Grants the specified people push access for this branch.
| Type | Description |
|---|---|
array | Usernames for people who can have push access. Note: The list of users, apps, and teams in total is limited to 100 items. |
octokit.repos.addProtectedBranchUserRestrictions({
owner,
repo,
branch,
users
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| branch | yes |
branch parameter |
| users | yes |
users parameter |
See also: GitHub Developer Guide documentation.
Check if a user is a collaborator
For organization-owned repositories, the list of collaborators includes outside collaborators, organization members that are direct collaborators, organization members with access through team memberships, organization members with access through default organization permissions, and organization owners.
Team members will include the members of child teams.
octokit.repos.checkCollaborator({
owner,
repo,
username
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| username | yes |
username parameter |
See also: GitHub Developer Guide documentation.
Check if vulnerability alerts are enabled for a repository
Shows whether vulnerability alerts are enabled or disabled for a repository. The authenticated user must have admin access to the repository. For more information, see "About security alerts for vulnerable dependencies" in the GitHub Help documentation.
octokit.repos.checkVulnerabilityAlerts({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
Compare two commits
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 <USERNAME>:branch.
The response from the API is equivalent to running the git log base..head command; however, commits are returned in chronological order. Pass the appropriate media type to fetch diff and patch formats.
The response also includes details on the files that were changed between the two commits. This includes the status of the change (for example, if a file was added, removed, modified, or renamed), and details of the change itself. For example, files with a renamed status have a previous_filename field showing the previous filename of the file, and files with a modified status have a patch field showing the changes made to the file.
Working with large comparisons
The response will include a comparison of up to 250 commits. If you are working with a larger commit range, you can use the Commit List API to enumerate all commits in the range.
For comparisons with extremely large diffs, you may receive an error response indicating that the diff took too long to generate. You can typically resolve this error by using a smaller commit range.
Signature verification object
The response will include a verification object that describes the result of verifying the commit's signature. The following fields are included in the verification object:
These are the possible values for reason in the verification object:
| Value | Description |
|---|---|
expired_key | The key that made the signature is expired. |
not_signing_key | The "signing" flag is not among the usage flags in the GPG key that made the signature. |
gpgverify_error | There was an error communicating with the signature verification service. |
gpgverify_unavailable | The signature verification service is currently unavailable. |
unsigned | The object does not include a signature. |
unknown_signature_type | A non-PGP signature was found in the commit. |
no_user | No user was associated with the committer email address in the commit. |
unverified_email | The committer email address in the commit was associated with a user, but the email address is not verified on her/his account. |
bad_email | The committer email address in the commit is not included in the identities of the PGP key that made the signature. |
unknown_key | The key that made the signature has not been registered with any user's account. |
malformed_signature | There was an error parsing the signature. |
invalid | The signature could not be cryptographically verified using the key whose key-id was found in the signature. |
valid | None of the above errors applied, so the signature is considered to be verified. |
octokit.repos.compareCommits({
owner,
repo,
base,
head
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| base | yes |
base parameter |
| head | yes |
head parameter |
See also: GitHub Developer Guide documentation.
Create a commit comment
Create a comment for a commit using its :commit_sha.
This endpoint triggers notifications. Creating content too quickly using this endpoint may result in abuse rate limiting. See "Abuse rate limits" and "Dealing with abuse rate limits" for details.
octokit.repos.createCommitComment({
owner,
repo,
commit_sha,
body
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| commit_sha | yes |
commit_sha parameter |
| body | yes |
The contents of the comment. |
| path | no |
Relative path of the file to comment on. |
| position | no |
Line index in the diff to comment on. |
| line | no |
Deprecated. Use position parameter instead. Line number in the file to comment on. |
| sha | no |
null |
See also: GitHub Developer Guide documentation.
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, such as production, staging, and qa. This parameter makes it easier to track which environments have requested deployments. 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 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:
A simple example putting the user and room into the payload to notify back to chat networks.
A more advanced example specifying required commit statuses and bypassing auto-merging.
You will see this response when GitHub automatically merges the base branch into the topic branch instead of creating a deployment. This auto-merge happens when:
- Auto-merge option is enabled in the repository
- Topic branch does not include the latest changes on the base branch, which is
masterin the response example - There are no merge conflicts
If there are no new commits in the base branch, a new request to create a deployment should give a successful response.
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.
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.
octokit.repos.createDeployment({
owner,
repo,
ref
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| ref | yes |
The ref to deploy. This can be a branch, tag, or SHA. |
| task | no |
Specifies a task to execute (e.g., |
| auto_merge | no |
Attempts to automatically merge the default branch into the requested ref, if it's behind the default branch. |
| required_contexts | no |
The status contexts to verify against commit status checks. If you omit this parameter, GitHub verifies all unique contexts before creating a deployment. To bypass checking entirely, pass an empty array. Defaults to all unique contexts. |
| payload | no |
JSON payload with extra information about the deployment. |
| environment | no |
Name for the target deployment environment (e.g., |
| description | no |
Short description of the deployment. |
| transient_environment | no |
Specifies if the given environment is specific to the deployment and will no longer exist at some point in the future. Default: |
| production_environment | no |
Specifies if the given environment is one that end-users directly interact with. Default: |
See also: GitHub Developer Guide documentation.
Create a deployment status
Users with push access can create deployment statuses for a given deployment.
GitHub Apps require read & write access to "Deployments" and read-only access to "Repo contents" (for private repos). OAuth Apps require the repo_deployment scope.
octokit.repos.createDeploymentStatus({
owner,
repo,
deployment_id,
state
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| deployment_id | yes |
deployment_id parameter |
| state | yes |
The state of the status. Can be one of |
| target_url | no |
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. Note: It's recommended to use the |
| log_url | no |
The full URL of the deployment's output. This parameter replaces |
| description | no |
A short description of the status. The maximum description length is 140 characters. |
| environment | no |
Name for the target deployment environment, which can be changed when setting a deploy status. For example, |
| environment_url | no |
Sets the URL for accessing your environment. Default: |
| auto_inactive | no |
Adds a new |
See also: GitHub Developer Guide documentation.
Create a repository dispatch event
You can use this endpoint to trigger a webhook event called repository_dispatch when you want activity that happens outside of GitHub to trigger a GitHub Actions workflow or GitHub App webhook. You must configure your GitHub Actions workflow or GitHub App to run when the repository_dispatch event occurs. For an example repository_dispatch webhook payload, see "RepositoryDispatchEvent."
The client_payload parameter is available for any extra information that your workflow might need. This parameter is a JSON payload that will be passed on when the webhook event is dispatched. For example, the client_payload can include a message that a user would like to send using a GitHub Actions workflow. Or the client_payload can be used as a test to debug your workflow. For a test example, see the input example.
To give you write access to the repository, you must use a personal access token with the repo scope. For more information, see "Creating a personal access token for the command line" in the GitHub Help documentation.
This input example shows how you can use the client_payload as a test to debug your workflow.
octokit.repos.createDispatchEvent({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| event_type | no |
Required: A custom webhook event name. |
| client_payload | no |
JSON payload with extra information about the webhook event that your action or worklow may use. |
See also: GitHub Developer Guide documentation.
Create or update a file
Deprecated: This method has been renamed to repos.createOrUpdateFile
Creates a new file or updates an existing file in a repository.
octokit.repos.createFile({
owner,
repo,
path,
message,
content,
committer.name,
committer.email,
author.name,
author.email
})Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| path | yes |
path parameter |
| message | yes |
The commit message. |
| content | yes |
The new file content, using Base64 encoding. |
| sha | no |
Required if you are updating a file. The blob SHA of the file being replaced. |
| branch | no |
The branch name. Default: the repository’s default branch (usually |
| committer | no |
The person that committed the file. Default: the authenticated user. |
| committer.name | yes |
The name of the author or committer of the commit. You'll receive a |
| committer.email | yes |
The email of the author or committer of the commit. You'll receive a |
| author | no |
The author of the file. Default: The |
| author.name | yes |
The name of the author or committer of the commit. You'll receive a |
| author.email | yes |
The email of the author or committer of the commit. You'll receive a |
See also: GitHub Developer Guide documentation.
Creates a new repository for the authenticated user
Creates a new repository for the authenticated user.
OAuth scope requirements
When using OAuth, authorizations must include:
public_reposcope orreposcope to create a public repositoryreposcope to create a private repository
octokit.repos.createForAuthenticatedUser({
name
});Parameters
| name | required | description |
|---|---|---|
| name | yes |
The name of the repository. |
| description | no |
A short description of the repository. |
| homepage | no |
A URL with more information about the repository. |
| private | no |
Either |
| visibility | no |
Can be |
| has_issues | no |
Either |
| has_projects | no |
Either |
| has_wiki | no |
Either |
| is_template | no |
Either |
| team_id | no |
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 | no |
Pass |
| gitignore_template | no |
Desired language or platform .gitignore template to apply. Use the name of the template without the extension. For example, "Haskell". |
| license_template | no |
Choose an open source license template that best suits your needs, and then use the license keyword as the |
| allow_squash_merge | no |
Either |
| allow_merge_commit | no |
Either |
| allow_rebase_merge | no |
Either |
| delete_branch_on_merge | no |
Either |
See also: GitHub Developer Guide documentation.
Create a fork
Create a fork for the authenticated user.
Note: Forking a Repository happens asynchronously. You may have to wait a short period of time before you can access the git objects. If this takes longer than 5 minutes, be sure to contact GitHub Support or GitHub Premium Support.
octokit.repos.createFork({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| organization | no |
Optional parameter to specify the organization name if forking into an organization. |
See also: GitHub Developer Guide documentation.
Create 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.
Here's how you can create a hook that posts payloads in JSON format:
octokit.repos.createHook({
owner,
repo,
config,
config.url
})Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| name | no |
Use |
| config | yes |
Key/value pairs to provide settings for this webhook. These are defined below. |
| config.url | yes |
The URL to which the payloads will be delivered. |
| config.content_type | no |
The media type used to serialize the payloads. Supported values include |
| config.secret | no |
If provided, the |
| config.insecure_ssl | no |
Determines whether the SSL certificate of the host for |
| events | no |
Determines what events the hook is triggered for. |
| active | no |
Determines if notifications are sent when the webhook is triggered. Set to |
See also: GitHub Developer Guide documentation.
Creates a new repository in the specified organization
Creates a new repository for the authenticated user.
OAuth scope requirements
When using OAuth, authorizations must include:
public_reposcope orreposcope to create a public repositoryreposcope to create a private repository
octokit.repos.createInOrg({
org,
name
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| name | yes |
The name of the repository. |
| description | no |
A short description of the repository. |
| homepage | no |
A URL with more information about the repository. |
| private | no |
Either |
| visibility | no |
Can be |
| has_issues | no |
Either |
| has_projects | no |
Either |
| has_wiki | no |
Either |
| is_template | no |
Either |
| team_id | no |
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 | no |
Pass |
| gitignore_template | no |
Desired language or platform .gitignore template to apply. Use the name of the template without the extension. For example, "Haskell". |
| license_template | no |
Choose an open source license template that best suits your needs, and then use the license keyword as the |
| allow_squash_merge | no |
Either |
| allow_merge_commit | no |
Either |
| allow_rebase_merge | no |
Either |
| delete_branch_on_merge | no |
Either |
See also: GitHub Developer Guide documentation.
Create or update a file
Creates a new file or updates an existing file in a repository.
octokit.repos.createOrUpdateFile({
owner,
repo,
path,
message,
content,
committer.name,
committer.email,
author.name,
author.email
})Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| path | yes |
path parameter |
| message | yes |
The commit message. |
| content | yes |
The new file content, using Base64 encoding. |
| sha | no |
Required if you are updating a file. The blob SHA of the file being replaced. |
| branch | no |
The branch name. Default: the repository’s default branch (usually |
| committer | no |
The person that committed the file. Default: the authenticated user. |
| committer.name | yes |
The name of the author or committer of the commit. You'll receive a |
| committer.email | yes |
The email of the author or committer of the commit. You'll receive a |
| author | no |
The author of the file. Default: The |
| author.name | yes |
The name of the author or committer of the commit. You'll receive a |
| author.email | yes |
The email of the author or committer of the commit. You'll receive a |
See also: GitHub Developer Guide documentation.
Create a release
Users with push access to the repository can create a release.
This endpoint triggers notifications. Creating content too quickly using this endpoint may result in abuse rate limiting. See "Abuse rate limits" and "Dealing with abuse rate limits" for details.
octokit.repos.createRelease({
owner,
repo,
tag_name
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| tag_name | yes |
The name of the tag. |
| target_commitish | no |
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 |
| name | no |
The name of the release. |
| body | no |
Text describing the contents of the tag. |
| draft | no |
|
| prerelease | no |
|
See also: GitHub Developer Guide documentation.
Create a status
Users with push access in a repository can create commit statuses for a given 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.
octokit.repos.createStatus({
owner,
repo,
sha,
state
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| sha | yes |
sha parameter |
| state | yes |
The state of the status. Can be one of |
| target_url | no |
The target URL to associate with this status. This URL will be linked from the GitHub UI to allow users to easily see the source of the status. |
| description | no |
A short description of the status. |
| context | no |
A string label to differentiate this status from the status of other systems. |
See also: GitHub Developer Guide documentation.
Create repository using a repository template
Creates a new repository using a repository template. Use the template_owner and template_repo route parameters to specify the repository to use as the template. The authenticated user must own or be a member of an organization that owns the repository. To check if a repository is available to use as a template, get the repository's information using the GET /repos/:owner/:repo endpoint and check that the is_template key is true.
OAuth scope requirements
When using OAuth, authorizations must include:
public_reposcope orreposcope to create a public repositoryreposcope to create a private repository
`
octokit.repos.createUsingTemplate({
template_owner,
template_repo,
name
});Parameters
| name | required | description |
|---|---|---|
| template_owner | yes |
template_owner parameter |
| template_repo | yes |
template_repo parameter |
| owner | no |
The organization or person who will own the new repository. To create a new repository in an organization, the authenticated user must be a member of the specified organization. |
| name | yes |
The name of the new repository. |
| description | no |
A short description of the new repository. |
| private | no |
Either |
See also: GitHub Developer Guide documentation.
Decline a repository invitation
octokit.repos.declineInvitation({
invitation_id
});Parameters
| name | required | description |
|---|---|---|
| invitation_id | yes |
invitation_id parameter |
See also: GitHub Developer Guide documentation.
Delete a repository
Deleting a repository requires admin access. If OAuth is used, the delete_repo scope is required.
If an organization owner has configured the organization to prevent members from deleting organization-owned repositories, a member will get this response:
octokit.repos.delete({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
Delete a commit comment
octokit.repos.deleteCommitComment({
owner,
repo,
comment_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| comment_id | yes |
comment_id parameter |
See also: GitHub Developer Guide documentation.
Delete a download
octokit.repos.deleteDownload({
owner,
repo,
download_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| download_id | yes |
download_id parameter |
See also: GitHub Developer Guide documentation.
Delete a file
Deletes a file in a repository.
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.
octokit.repos.deleteFile({
owner,
repo,
path,
message,
sha
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| path | yes |
path parameter |
| message | yes |
The commit message. |
| sha | yes |
The blob SHA of the file being replaced. |
| branch | no |
The branch name. Default: the repository’s default branch (usually |
| committer | no |
object containing information about the committer. |
| committer.name | no |
The name of the author (or committer) of the commit |
| committer.email | no |
The email of the author (or committer) of the commit |
| author | no |
object containing information about the author. |
| author.name | no |
The name of the author (or committer) of the commit |
| author.email | no |
The email of the author (or committer) of the commit |
See also: GitHub Developer Guide documentation.
Delete a hook
octokit.repos.deleteHook({
owner,
repo,
hook_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| hook_id | yes |
hook_id parameter |
See also: GitHub Developer Guide documentation.
Delete a repository invitation
octokit.repos.deleteInvitation({
owner,
repo,
invitation_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| invitation_id | yes |
invitation_id parameter |
See also: GitHub Developer Guide documentation.
Delete a release
Users with push access to the repository can delete a release.
octokit.repos.deleteRelease({
owner,
repo,
release_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| release_id | yes |
release_id parameter |
See also: GitHub Developer Guide documentation.
Delete a release asset
octokit.repos.deleteReleaseAsset({
owner,
repo,
asset_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| asset_id | yes |
asset_id parameter |
See also: GitHub Developer Guide documentation.
Disable automated security fixes
Disables automated security fixes for a repository. The authenticated user must have admin access to the repository. For more information, see "Configuring automated security fixes" in the GitHub Help documentation.
octokit.repos.disableAutomatedSecurityFixes({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
Disable a Pages site
octokit.repos.disablePagesSite({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
Disable vulnerability alerts
Disables vulnerability alerts and the dependency graph for a repository. The authenticated user must have admin access to the repository. For more information, see "About security alerts for vulnerable dependencies" in the GitHub Help documentation.
octokit.repos.disableVulnerabilityAlerts({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
Enable automated security fixes
Enables automated security fixes for a repository. The authenticated user must have admin access to the repository. For more information, see "Configuring automated security fixes" in the GitHub Help documentation.
octokit.repos.enableAutomatedSecurityFixes({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
Enable a Pages site
octokit.repos.enablePagesSite({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| source | no |
source parameter |
| source.branch | no |
The repository branch used to publish your site's source files. Can be either |
| source.path | no |
The repository directory that includes the source files for the Pages site. When |
See also: GitHub Developer Guide documentation.
Enable vulnerability alerts
Enables vulnerability alerts and the dependency graph for a repository. The authenticated user must have admin access to the repository. For more information, see "About security alerts for vulnerable dependencies" in the GitHub Help documentation.
octokit.repos.enableVulnerabilityAlerts({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
Get
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.
octokit.repos.get({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
Get apps with access to protected branch
Protected branches are available in public repositories with GitHub Free, and in public and private repositories with GitHub Pro, GitHub Team, and GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
Lists the GitHub Apps that have push access to this branch. Only installed GitHub Apps with write access to the contents permission can be added as authorized actors on a protected branch.
octokit.repos.getAppsWithAccessToProtectedBranch({
owner,
repo,
branch
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| branch | yes |
branch parameter |
See also: GitHub Developer Guide documentation.
Get archive link
Gets a redirect URL to download an archive for a repository. The :archive_format can be either tarball or zipball. The :ref must be a valid Git reference. If you omit :ref, the repository’s default branch (usually master) will be used. Please make sure your HTTP framework is configured to follow redirects or you will need to use the Location header to make a second GET request.
Note: For private repositories, these links are temporary and expire after five minutes.
To follow redirects with curl, use the -L switch:
octokit.repos.getArchiveLink({
owner,
repo,
archive_format,
ref
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| archive_format | yes |
archive_format parameter |
| ref | yes |
ref parameter |
See also: GitHub Developer Guide documentation.
Get branch
octokit.repos.getBranch({
owner,
repo,
branch
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| branch | yes |
branch parameter |
See also: GitHub Developer Guide documentation.
Get branch protection
Protected branches are available in public repositories with GitHub Free, and in public and private repositories with GitHub Pro, GitHub Team, and GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
octokit.repos.getBranchProtection({
owner,
repo,
branch
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| branch | yes |
branch parameter |
See also: GitHub Developer Guide documentation.
Clones
Get the total number of clones and breakdown per day or week for the last 14 days. Timestamps are aligned to UTC midnight of the beginning of the day or week. Week begins on Monday.
octokit.repos.getClones({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| per | no |
Must be one of: |
See also: GitHub Developer Guide documentation.
Get the number of additions and deletions per week
Returns a weekly aggregate of the number of additions and deletions pushed to a repository.
octokit.repos.getCodeFrequencyStats({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
Review a user's permission level
Possible values for the permission key: admin, write, read, none.
octokit.repos.getCollaboratorPermissionLevel({
owner,
repo,
username
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| username | yes |
username parameter |
See also: GitHub Developer Guide documentation.
Get the combined status for a specific ref
Users with pull access in a repository can access a combined view of commit statuses for a given ref. The ref can be a SHA, a branch name, or a tag name.
The most recent status for each context is returned, up to 100. This field paginates 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
errororfailure - pending if there are no statuses or a context is
pending - success if the latest status for all contexts is
success
octokit.repos.getCombinedStatusForRef({
owner,
repo,
ref
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| ref | yes |
ref parameter |
See also: GitHub Developer Guide documentation.
Get a single commit
Returns the contents of a single commit reference. You must have read access for the repository to use this endpoint.
You can pass the appropriate media type to fetch diff and patch formats. Diffs with binary data will have no patch property.
To return only the SHA-1 hash of the commit reference, you can provide the sha custom media type in the Accept header. You can use this endpoint to check if a remote reference's SHA-1 hash is the same as your local reference's SHA-1 hash by providing the local SHA-1 reference as the ETag.
Signature verification object
The response will include a verification object that describes the result of verifying the commit's signature. The following fields are included in the verification object:
These are the possible values for reason in the verification object:
| Value | Description |
|---|---|
expired_key | The key that made the signature is expired. |
not_signing_key | The "signing" flag is not among the usage flags in the GPG key that made the signature. |
gpgverify_error | There was an error communicating with the signature verification service. |
gpgverify_unavailable | The signature verification service is currently unavailable. |
unsigned | The object does not include a signature. |
unknown_signature_type | A non-PGP signature was found in the commit. |
no_user | No user was associated with the committer email address in the commit. |
unverified_email | The committer email address in the commit was associated with a user, but the email address is not verified on her/his account. |
bad_email | The committer email address in the commit is not included in the identities of the PGP key that made the signature. |
unknown_key | The key that made the signature has not been registered with any user's account. |
malformed_signature | There was an error parsing the signature. |
invalid | The signature could not be cryptographically verified using the key whose key-id was found in the signature. |
valid | None of the above errors applied, so the signature is considered to be verified. |
octokit.repos.getCommit({
owner,
repo,
ref
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| ref | yes |
ref parameter |
| sha | no |
null |
| commit_sha | no |
null |
See also: GitHub Developer Guide documentation.
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.
octokit.repos.getCommitActivityStats({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
Get a single commit comment
octokit.repos.getCommitComment({
owner,
repo,
comment_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| comment_id | yes |
comment_id parameter |
See also: GitHub Developer Guide documentation.
Get a commit sha
This method is deprecated.
Note: To access this endpoint, you must provide a custom media type in the Accept header:
application/vnd.github.VERSION.shaReturns the SHA-1 of the commit reference. You must have read access for the repository to get the SHA-1 of a commit reference. You can use this endpoint to check if a remote reference's SHA-1 is the same as your local reference's SHA-1 by providing the local SHA-1 reference as the ETag.
octokit.repos.getCommitRefSha({
owner,
ref,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| ref | yes |
ref parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
Get contents
Gets the contents of a file or directory in a repository. Specify the file path or directory in :path. If you omit :path, you will receive the contents of all files in the repository.
Files and symlinks support a custom media type for retrieving the raw content or rendered HTML (when supported). All content types support a custom media type to ensure the content is returned in a consistent object format.
Note:
- To get a repository's contents recursively, you can recursively get the tree.
- 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.
- This API supports files up to 1 megabyte in size.
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. In the next major version of the API, the type will be returned as "submodule".
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).
Otherwise, the API responds with an object describing the symlink itself:
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.
octokit.repos.getContents({
owner,
repo,
path
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| path | yes |
path parameter |
| ref | no |
The name of the commit/branch/tag. Default: the repository’s default branch (usually |
See also: GitHub Developer Guide documentation.
Get contributors list with additions, deletions, and commit counts
total- The Total number of commits authored by the contributor.
Weekly Hash (weeks array):
w- Start of the week, given as a Unix timestamp.a- Number of additionsd- Number of deletionsc- Number of commits
octokit.repos.getContributorsStats({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
Get a deploy key
octokit.repos.getDeployKey({
owner,
repo,
key_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| key_id | yes |
key_id parameter |
See also: GitHub Developer Guide documentation.
Get a single deployment
octokit.repos.getDeployment({
owner,
repo,
deployment_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| deployment_id | yes |
deployment_id parameter |
See also: GitHub Developer Guide documentation.
Get a single deployment status
Users with pull access can view a deployment status for a deployment:
octokit.repos.getDeploymentStatus({
owner,
repo,
deployment_id,
status_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| deployment_id | yes |
deployment_id parameter |
| status_id | yes |
status_id parameter |
See also: GitHub Developer Guide documentation.
Get a single download
octokit.repos.getDownload({
owner,
repo,
download_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| download_id | yes |
download_id parameter |
See also: GitHub Developer Guide documentation.
Get single hook
octokit.repos.getHook({
owner,
repo,
hook_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| hook_id | yes |
hook_id parameter |
See also: GitHub Developer Guide documentation.
Get latest Pages build
octokit.repos.getLatestPagesBuild({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
Get the latest release
View the latest published full release for the repository.
The latest release is the most recent non-prerelease, non-draft release, sorted by the created_at attribute. The created_at attribute is the date of the commit used for the release, and not the date when the release was drafted or published.
octokit.repos.getLatestRelease({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
Get information about a Pages site
octokit.repos.getPages({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
Get a specific Pages build
octokit.repos.getPagesBuild({
owner,
repo,
build_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| build_id | yes |
build_id parameter |
See also: GitHub Developer Guide documentation.
Get the weekly commit count for the repository owner and everyone else
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.
octokit.repos.getParticipationStats({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
Get admin enforcement of protected branch
Protected branches are available in public repositories with GitHub Free, and in public and private repositories with GitHub Pro, GitHub Team, and GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
octokit.repos.getProtectedBranchAdminEnforcement({
owner,
repo,
branch
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| branch | yes |
branch parameter |
See also: GitHub Developer Guide documentation.
Get pull request review enforcement of protected branch
Protected branches are available in public repositories with GitHub Free, and in public and private repositories with GitHub Pro, GitHub Team, and GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
octokit.repos.getProtectedBranchPullRequestReviewEnforcement({
owner,
repo,
branch
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| branch | yes |
branch parameter |
See also: GitHub Developer Guide documentation.
Get required signatures of protected branch
Protected branches are available in public repositories with GitHub Free, and in public and private repositories with GitHub Pro, GitHub Team, and GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
When authenticated with admin or owner permissions to the repository, you can use this endpoint to check whether a branch requires signed commits. An enabled status of true indicates you must sign commits on this branch. For more information, see Signing commits with GPG in GitHub Help.
Note: You must enable branch protection to require signed commits.
octokit.repos.getProtectedBranchRequiredSignatures({
owner,
repo,
branch
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| branch | yes |
branch parameter |
See also: GitHub Developer Guide documentation.
Get required status checks of protected branch
Protected branches are available in public repositories with GitHub Free, and in public and private repositories with GitHub Pro, GitHub Team, and GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
octokit.repos.getProtectedBranchRequiredStatusChecks({
owner,
repo,
branch
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| branch | yes |
branch parameter |
See also: GitHub Developer Guide documentation.
Get restrictions of protected branch
Protected branches are available in public repositories with GitHub Free, and in public and private repositories with GitHub Pro, GitHub Team, and GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
Lists who has access to this protected branch. {{#note}}
Note: Users, apps, and teams restrictions are only available for organization-owned repositories.
octokit.repos.getProtectedBranchRestrictions({
owner,
repo,
branch
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| branch | yes |
branch parameter |
See also: GitHub Developer Guide documentation.
Get the number of commits per hour in each day
Each array contains the day number, hour number, and number of commits:
0-6: Sunday - Saturday0-23: Hour of day- Number of commits
For example, [2, 14, 25] indicates that there were 25 total commits, during the 2:00pm hour on Tuesdays. All times are based on the time zone of individual commits.
octokit.repos.getPunchCardStats({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
Get the README
Gets the preferred README for a repository.
READMEs support custom media types for retrieving the raw content or rendered HTML.
octokit.repos.getReadme({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| ref | no |
The name of the commit/branch/tag. Default: the repository’s default branch (usually |
See also: GitHub Developer Guide documentation.
Get a single release
Note: This returns an upload_url key corresponding to the endpoint for uploading release assets. This key is a hypermedia resource.
octokit.repos.getRelease({
owner,
repo,
release_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| release_id | yes |
release_id parameter |
See also: GitHub Developer Guide documentation.
Get a single release asset
To download the asset's binary content, set the Accept header of the request to application/octet-stream. 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.
octokit.repos.getReleaseAsset({
owner,
repo,
asset_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| asset_id | yes |
asset_id parameter |
See also: GitHub Developer Guide documentation.
Get a release by tag name
Get a published release with the specified tag.
octokit.repos.getReleaseByTag({
owner,
repo,
tag
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| tag | yes |
tag parameter |
See also: GitHub Developer Guide documentation.
Get teams with access to protected branch
Protected branches are available in public repositories with GitHub Free, and in public and private repositories with GitHub Pro, GitHub Team, and GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
Lists the teams who have push access to this branch. The list includes child teams.
octokit.repos.getTeamsWithAccessToProtectedBranch({
owner,
repo,
branch
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| branch | yes |
branch parameter |
See also: GitHub Developer Guide documentation.
List paths
Get the top 10 popular contents over the last 14 days.
octokit.repos.getTopPaths({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
List referrers
Get the top 10 referrers over the last 14 days.
octokit.repos.getTopReferrers({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
Get users with access to protected branch
Protected branches are available in public repositories with GitHub Free, and in public and private repositories with GitHub Pro, GitHub Team, and GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
Lists the people who have push access to this branch.
octokit.repos.getUsersWithAccessToProtectedBranch({
owner,
repo,
branch
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| branch | yes |
branch parameter |
See also: GitHub Developer Guide documentation.
Views
Get the total number of views and breakdown per day or week for the last 14 days. Timestamps are aligned to UTC midnight of the beginning of the day or week. Week begins on Monday.
octokit.repos.getViews({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| per | no |
Must be one of: |
See also: GitHub Developer Guide documentation.
List your repositories
Lists repositories that the authenticated user has explicit permission (:read, :write, or :admin) to access.
The authenticated user has explicit permission to access repositories they own, repositories where they are a collaborator, and repositories that they can access through an organization membership.
octokit.repos.list();Parameters
| name | required | description |
|---|---|---|
| visibility | no |
Can be one of |
| affiliation | no |
Comma-separated list of values. Can include: |
| type | no |
Can be one of Will cause a |
| sort | no |
Can be one of |
| direction | no |
Can be one of |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
Get apps with access to protected branch
Deprecated: This method has been renamed to repos.getAppsWithAccessToProtectedBranch
Protected branches are available in public repositories with GitHub Free, and in public and private repositories with GitHub Pro, GitHub Team, and GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
Lists the GitHub Apps that have push access to this branch. Only installed GitHub Apps with write access to the contents permission can be added as authorized actors on a protected branch.
octokit.repos.listAppsWithAccessToProtectedBranch({
owner,
repo,
branch
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| branch | yes |
branch parameter |
See also: GitHub Developer Guide documentation.
List assets for a release
octokit.repos.listAssetsForRelease({
owner,
repo,
release_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| release_id | yes |
release_id parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List branches
octokit.repos.listBranches({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| protected | no |
Setting to |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List branches for HEAD commit
Protected branches are available in public repositories with GitHub Free, and in public and private repositories with GitHub Pro, GitHub Team, and GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
Returns all branches where the given commit SHA is the HEAD, or latest commit for the branch.
octokit.repos.listBranchesForHeadCommit({
owner,
repo,
commit_sha
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| commit_sha | yes |
commit_sha parameter |
See also: GitHub Developer Guide documentation.
List collaborators
For organization-owned repositories, the list of collaborators includes outside collaborators, organization members that are direct collaborators, organization members with access through team memberships, organization members with access through default organization permissions, and organization owners.
Team members will include the members of child teams.
octokit.repos.listCollaborators({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| affiliation | no |
Filter collaborators returned by their affiliation. Can be one of: |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List comments for a single commit
Use the :commit_sha to specify the commit that will have its comments listed.
octokit.repos.listCommentsForCommit({
owner,
repo,
commit_sha
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| commit_sha | yes |
commit_sha parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
| ref | no |
null |
See also: GitHub Developer Guide documentation.
List commit comments for a repository
Commit Comments use these custom media types. You can read more about the use of media types in the API here.
Comments are ordered by ascending ID.
octokit.repos.listCommitComments({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List commits on a repository
Signature verification object
The response will include a verification object that describes the result of verifying the commit's signature. The following fields are included in the verification object:
These are the possible values for reason in the verification object:
| Value | Description |
|---|---|
expired_key | The key that made the signature is expired. |
not_signing_key | The "signing" flag is not among the usage flags in the GPG key that made the signature. |
gpgverify_error | There was an error communicating with the signature verification service. |
gpgverify_unavailable | The signature verification service is currently unavailable. |
unsigned | The object does not include a signature. |
unknown_signature_type | A non-PGP signature was found in the commit. |
no_user | No user was associated with the committer email address in the commit. |
unverified_email | The committer email address in the commit was associated with a user, but the email address is not verified on her/his account. |
bad_email | The committer email address in the commit is not included in the identities of the PGP key that made the signature. |
unknown_key | The key that made the signature has not been registered with any user's account. |
malformed_signature | There was an error parsing the signature. |
invalid | The signature could not be cryptographically verified using the key whose key-id was found in the signature. |
valid | None of the above errors applied, so the signature is considered to be verified. |
octokit.repos.listCommits({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| sha | no |
SHA or branch to start listing commits from. Default: the repository’s default branch (usually |
| path | no |
Only commits containing this file path will be returned. |
| author | no |
GitHub login or email address by which to filter by commit author. |
| since | no |
Only commits after this date will be returned. This is a timestamp in ISO 8601 format: |
| until | no |
Only commits before this date will be returned. This is a timestamp in ISO 8601 format: |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List contributors
Lists contributors to the specified repository and sorts them by the number of commits per contributor in descending order. This endpoint may return information that is a few hours old because the GitHub REST API v3 caches contributor data to improve performance.
GitHub identifies contributors by author email address. This endpoint groups contribution counts by GitHub user, which includes all associated email addresses. To improve performance, only the first 500 author email addresses in the repository link to GitHub users. The rest will appear as anonymous contributors without associated GitHub user information.
octokit.repos.listContributors({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| anon | no |
Set to |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List deploy keys
octokit.repos.listDeployKeys({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List deployment statuses
Users with pull access can view deployment statuses for a deployment:
octokit.repos.listDeploymentStatuses({
owner,
repo,
deployment_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| deployment_id | yes |
deployment_id parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List deployments
Simple filtering of deployments is available via query parameters:
octokit.repos.listDeployments({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| sha | no |
The SHA recorded at creation time. |
| ref | no |
The name of the ref. This can be a branch, tag, or SHA. |
| task | no |
The name of the task for the deployment (e.g., |
| environment | no |
The name of the environment that was deployed to (e.g., |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List downloads for a repository
octokit.repos.listDownloads({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List organization repositories
Lists repositories for the specified organization.
octokit.repos.listForOrg({
org
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| type | no |
Specifies the types of repositories you want returned. Can be one of |
| sort | no |
Can be one of |
| direction | no |
Can be one of |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List user repositories
Lists public repositories for the specified user.
octokit.repos.listForUser({
username
});Parameters
| name | required | description |
|---|---|---|
| username | yes |
username parameter |
| type | no |
Can be one of |
| sort | no |
Can be one of |
| direction | no |
Can be one of |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List forks
octokit.repos.listForks({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| sort | no |
The sort order. Can be either |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List hooks
octokit.repos.listHooks({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List invitations for a repository
When authenticating as a user with admin rights to a repository, this endpoint will list all currently open repository invitations.
octokit.repos.listInvitations({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List a user's repository invitations
When authenticating as a user, this endpoint will list all currently open repository invitations for that user.
octokit.repos.listInvitationsForAuthenticatedUser();Parameters
| name | required | description |
|---|---|---|
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List languages
Lists languages for the specified repository. The value shown for each language is the number of bytes of code written in that language.
octokit.repos.listLanguages({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
List Pages builds
octokit.repos.listPagesBuilds({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List required status checks contexts of protected branch
Protected branches are available in public repositories with GitHub Free, and in public and private repositories with GitHub Pro, GitHub Team, and GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
octokit.repos.listProtectedBranchRequiredStatusChecksContexts({
owner,
repo,
branch
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| branch | yes |
branch parameter |
See also: GitHub Developer Guide documentation.
Get teams with access to protected branch
Deprecated: This method has been renamed to repos.getTeamsWithAccessToProtectedBranch
Protected branches are available in public repositories with GitHub Free, and in public and private repositories with GitHub Pro, GitHub Team, and GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
Lists the teams who have push access to this branch. The list includes child teams.
octokit.repos.listProtectedBranchTeamRestrictions({
owner,
repo,
branch
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| branch | yes |
branch parameter |
See also: GitHub Developer Guide documentation.
Get users with access to protected branch
Deprecated: This method has been renamed to repos.getUsersWithAccessToProtectedBranch
Protected branches are available in public repositories with GitHub Free, and in public and private repositories with GitHub Pro, GitHub Team, and GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
Lists the people who have push access to this branch.
octokit.repos.listProtectedBranchUserRestrictions({
owner,
repo,
branch
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| branch | yes |
branch parameter |
See also: GitHub Developer Guide documentation.
List all public repositories
Lists all public repositories in the order that they were created.
Note: Pagination is powered exclusively by the since parameter. Use the Link header to get the URL for the next page of repositories.
octokit.repos.listPublic();Parameters
| name | required | description |
|---|---|---|
| since | no |
The integer ID of the last repository that you've seen. |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List pull requests associated with commit
Lists all pull requests containing the provided commit SHA, which can be from any point in the commit history. The results will include open and closed pull requests. Additional preview headers may be required to see certain details for associated pull requests, such as whether a pull request is in a draft state. For more information about previews that might affect this endpoint, see the List pull requests endpoint.
octokit.repos.listPullRequestsAssociatedWithCommit({
owner,
repo,
commit_sha
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| commit_sha | yes |
commit_sha parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List releases for a repository
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.
Information about published releases are available to everyone. Only users with push access will receive listings for draft releases.
octokit.repos.listReleases({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List statuses for a specific ref
Users with pull access in a repository can view commit statuses for a given ref. The ref can be a SHA, a branch name, or a tag name. Statuses are returned in reverse chronological order. The first status in the list will be the latest one.
This resource is also available via a legacy route: GET /repos/:owner/:repo/statuses/:ref.
octokit.repos.listStatusesForRef({
owner,
repo,
ref
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| ref | yes |
ref parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List tags
octokit.repos.listTags({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List teams
octokit.repos.listTeams({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
Get teams with access to protected branch
Deprecated: This method has been renamed to repos.getTeamsWithAccessToProtectedBranch
Protected branches are available in public repositories with GitHub Free, and in public and private repositories with GitHub Pro, GitHub Team, and GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
Lists the teams who have push access to this branch. The list includes child teams.
octokit.repos.listTeamsWithAccessToProtectedBranch({
owner,
repo,
branch
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| branch | yes |
branch parameter |
See also: GitHub Developer Guide documentation.
List all topics for a repository
octokit.repos.listTopics({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
Get users with access to protected branch
Deprecated: This method has been renamed to repos.getUsersWithAccessToProtectedBranch
Protected branches are available in public repositories with GitHub Free, and in public and private repositories with GitHub Pro, GitHub Team, and GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
Lists the people who have push access to this branch.
octokit.repos.listUsersWithAccessToProtectedBranch({
owner,
repo,
branch
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| branch | yes |
branch parameter |
See also: GitHub Developer Guide documentation.
Perform a merge
octokit.repos.merge({
owner,
repo,
base,
head
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| base | yes |
The name of the base branch that the head will be merged into. |
| head | yes |
The head to merge. This can be a branch name or a commit SHA1. |
| commit_message | no |
Commit message to use for the merge commit. If omitted, a default message will be used. |
See also: GitHub Developer Guide documentation.
Ping a hook
This will trigger a ping event to be sent to the hook.
octokit.repos.pingHook({
owner,
repo,
hook_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| hook_id | yes |
hook_id parameter |
See also: GitHub Developer Guide documentation.
Remove branch protection
Protected branches are available in public repositories with GitHub Free, and in public and private repositories with GitHub Pro, GitHub Team, and GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
octokit.repos.removeBranchProtection({
owner,
repo,
branch
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| branch | yes |
branch parameter |
See also: GitHub Developer Guide documentation.
Remove user as a collaborator
octokit.repos.removeCollaborator({
owner,
repo,
username
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| username | yes |
username parameter |
See also: GitHub Developer Guide documentation.
Remove a deploy key
octokit.repos.removeDeployKey({
owner,
repo,
key_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| key_id | yes |
key_id parameter |
See also: GitHub Developer Guide documentation.
Remove admin enforcement of protected branch
Protected branches are available in public repositories with GitHub Free, and in public and private repositories with GitHub Pro, GitHub Team, and GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
Removing admin enforcement requires admin or owner permissions to the repository and branch protection to be enabled.
octokit.repos.removeProtectedBranchAdminEnforcement({
owner,
repo,
branch
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| branch | yes |
branch parameter |
See also: GitHub Developer Guide documentation.
Remove app restrictions of protected branch
Protected branches are available in public repositories with GitHub Free, and in public and private repositories with GitHub Pro, GitHub Team, and GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
Removes the ability of an app to push to this branch. Only installed GitHub Apps with write access to the contents permission can be added as authorized actors on a protected branch.
| Type | Description |
|---|---|
array | The GitHub Apps that have push access to this branch. Use the app's slug. Note: The list of users, apps, and teams in total is limited to 100 items. |
octokit.repos.removeProtectedBranchAppRestrictions({
owner,
repo,
branch,
apps
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| branch | yes |
branch parameter |
| apps | yes |
apps parameter |
See also: GitHub Developer Guide documentation.
Remove pull request review enforcement of protected branch
Protected branches are available in public repositories with GitHub Free, and in public and private repositories with GitHub Pro, GitHub Team, and GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
octokit.repos.removeProtectedBranchPullRequestReviewEnforcement({
owner,
repo,
branch
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| branch | yes |
branch parameter |
See also: GitHub Developer Guide documentation.
Remove required signatures of protected branch
Protected branches are available in public repositories with GitHub Free, and in public and private repositories with GitHub Pro, GitHub Team, and GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
When authenticated with admin or owner permissions to the repository, you can use this endpoint to disable required signed commits on a branch. You must enable branch protection to require signed commits.
octokit.repos.removeProtectedBranchRequiredSignatures({
owner,
repo,
branch
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| branch | yes |
branch parameter |
See also: GitHub Developer Guide documentation.
Remove required status checks of protected branch
Protected branches are available in public repositories with GitHub Free, and in public and private repositories with GitHub Pro, GitHub Team, and GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
octokit.repos.removeProtectedBranchRequiredStatusChecks({
owner,
repo,
branch
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| branch | yes |
branch parameter |
See also: GitHub Developer Guide documentation.
Remove required status checks contexts of protected branch
Protected branches are available in public repositories with GitHub Free, and in public and private repositories with GitHub Pro, GitHub Team, and GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
octokit.repos.removeProtectedBranchRequiredStatusChecksContexts({
owner,
repo,
branch,
contexts
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| branch | yes |
branch parameter |
| contexts | yes |
contexts parameter |
See also: GitHub Developer Guide documentation.
Remove restrictions of protected branch
Protected branches are available in public repositories with GitHub Free, and in public and private repositories with GitHub Pro, GitHub Team, and GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
Disables the ability to restrict who can push to this branch.
octokit.repos.removeProtectedBranchRestrictions({
owner,
repo,
branch
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| branch | yes |
branch parameter |
See also: GitHub Developer Guide documentation.
Remove team restrictions of protected branch
Protected branches are available in public repositories with GitHub Free, and in public and private repositories with GitHub Pro, GitHub Team, and GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
Removes the ability of a team to push to this branch. You can also remove push access for child teams.
| Type | Description |
|---|---|
array | Teams that should no longer have push access. Use the team's slug. Note: The list of users, apps, and teams in total is limited to 100 items. |
octokit.repos.removeProtectedBranchTeamRestrictions({
owner,
repo,
branch,
teams
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| branch | yes |
branch parameter |
| teams | yes |
teams parameter |
See also: GitHub Developer Guide documentation.
Remove user restrictions of protected branch
Protected branches are available in public repositories with GitHub Free, and in public and private repositories with GitHub Pro, GitHub Team, and GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
Removes the ability of a user to push to this branch.
| Type | Description |
|---|---|
array | Usernames of the people who should no longer have push access. Note: The list of users, apps, and teams in total is limited to 100 items. |
octokit.repos.removeProtectedBranchUserRestrictions({
owner,
repo,
branch,
users
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| branch | yes |
branch parameter |
| users | yes |
users parameter |
See also: GitHub Developer Guide documentation.
Replace app restrictions of protected branch
Protected branches are available in public repositories with GitHub Free, and in public and private repositories with GitHub Pro, GitHub Team, and GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
Replaces the list of apps that have push access to this branch. This removes all apps that previously had push access and grants push access to the new list of apps. Only installed GitHub Apps with write access to the contents permission can be added as authorized actors on a protected branch.
| Type | Description |
|---|---|
array | The GitHub Apps that have push access to this branch. Use the app's slug. Note: The list of users, apps, and teams in total is limited to 100 items. |
octokit.repos.replaceProtectedBranchAppRestrictions({
owner,
repo,
branch,
apps
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| branch | yes |
branch parameter |
| apps | yes |
apps parameter |
See also: GitHub Developer Guide documentation.
Replace required status checks contexts of protected branch
Protected branches are available in public repositories with GitHub Free, and in public and private repositories with GitHub Pro, GitHub Team, and GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
octokit.repos.replaceProtectedBranchRequiredStatusChecksContexts({
owner,
repo,
branch,
contexts
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| branch | yes |
branch parameter |
| contexts | yes |
contexts parameter |
See also: GitHub Developer Guide documentation.
Replace team restrictions of protected branch
Protected branches are available in public repositories with GitHub Free, and in public and private repositories with GitHub Pro, GitHub Team, and GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
Replaces the list of teams that have push access to this branch. This removes all teams that previously had push access and grants push access to the new list of teams. Team restrictions include child teams.
| Type | Description |
|---|---|
array | The teams that can have push access. Use the team's slug. Note: The list of users, apps, and teams in total is limited to 100 items. |
octokit.repos.replaceProtectedBranchTeamRestrictions({
owner,
repo,
branch,
teams
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| branch | yes |
branch parameter |
| teams | yes |
teams parameter |
See also: GitHub Developer Guide documentation.
Replace user restrictions of protected branch
Protected branches are available in public repositories with GitHub Free, and in public and private repositories with GitHub Pro, GitHub Team, and GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
Replaces the list of people that have push access to this branch. This removes all people that previously had push access and grants push access to the new list of people.
| Type | Description |
|---|---|
array | Usernames for people who can have push access. Note: The list of users, apps, and teams in total is limited to 100 items. |
octokit.repos.replaceProtectedBranchUserRestrictions({
owner,
repo,
branch,
users
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| branch | yes |
branch parameter |
| users | yes |
users parameter |
See also: GitHub Developer Guide documentation.
Replace all topics for a repository
octokit.repos.replaceTopics({
owner,
repo,
names
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| names | yes |
An array of topics to add to the repository. Pass one or more topics to replace the set of existing topics. Send an empty array ( |
See also: GitHub Developer Guide documentation.
Request a page build
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.
octokit.repos.requestPageBuild({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
Retrieve community profile metrics
This endpoint will return all community profile metrics, including an overall health score, repository description, the presence of documentation, detected code of conduct, detected license, and the presence of ISSUE_TEMPLATE, PULL_REQUEST_TEMPLATE, README, and CONTRIBUTING files.
octokit.repos.retrieveCommunityProfileMetrics({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
Test a push hook
This will trigger the hook with the latest push to the current 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.
Note: Previously /repos/:owner/:repo/hooks/:hook_id/test
octokit.repos.testPushHook({
owner,
repo,
hook_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| hook_id | yes |
hook_id parameter |
See also: GitHub Developer Guide documentation.
Transfer a repository
A transfer request will need to be accepted by the new owner when transferring a personal repository to another user. The response will contain the original owner, and the transfer will continue asynchronously. For more details on the requirements to transfer personal and organization-owned repositories, see about repository transfers.
octokit.repos.transfer({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| new_owner | no |
Required: The username or organization name the repository will be transferred to. |
| team_ids | no |
ID of the team or teams to add to the repository. Teams can only be added to organization-owned repositories. |
See also: GitHub Developer Guide documentation.
Edit
Note: To edit a repository's topics, use the topics endpoint.
octokit.repos.update({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| name | no |
The name of the repository. |
| description | no |
A short description of the repository. |
| homepage | no |
A URL with more information about the repository. |
| private | no |
Either |
| visibility | no |
Can be |
| has_issues | no |
Either |
| has_projects | no |
Either |
| has_wiki | no |
Either |
| is_template | no |
Either |
| default_branch | no |
Updates the default branch for this repository. |
| allow_squash_merge | no |
Either |
| allow_merge_commit | no |
Either |
| allow_rebase_merge | no |
Either |
| delete_branch_on_merge | no |
Either |
| archived | no |
|
See also: GitHub Developer Guide documentation.
Update branch protection
Protected branches are available in public repositories with GitHub Free, and in public and private repositories with GitHub Pro, GitHub Team, and GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
Protecting a branch requires admin or owner permissions to the repository.
Note: Passing new arrays of users and teams replaces their previous values.
Note: The list of users, apps, and teams in total is limited to 100 items.
octokit.repos.updateBranchProtection({
owner,
repo,
branch,
required_status_checks,
required_status_checks.strict,
required_status_checks.contexts,
enforce_admins,
required_pull_request_reviews,
restrictions,
restrictions.users,
restrictions.teams
})Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| branch | yes |
branch parameter |
| required_status_checks | yes |
Require status checks to pass before merging. Set to |
| required_status_checks.strict | yes |
Require branches to be up to date before merging. |
| required_status_checks.contexts | yes |
The list of status checks to require in order to merge into this branch |
| enforce_admins | yes |
Enforce all configured restrictions for administrators. Set to |
| required_pull_request_reviews | yes |
Require at least one approving review on a pull request, before merging. Set to |
| required_pull_request_reviews.dismissal_restrictions | no |
Specify which users and teams can dismiss pull request reviews. Pass an empty |
| required_pull_request_reviews.dismissal_restrictions.users | no |
The list of user |
| required_pull_request_reviews.dismissal_restrictions.teams | no |
The list of team |
| required_pull_request_reviews.dismiss_stale_reviews | no |
Set to |
| required_pull_request_reviews.require_code_owner_reviews | no |
Blocks merging pull requests until code owners review them. |
| required_pull_request_reviews.required_approving_review_count | no |
Specify the number of reviewers required to approve pull requests. Use a number between 1 and 6. |
| restrictions | yes |
Restrict who can push to the protected branch. User, app, and team |
| restrictions.users | yes |
The list of user |
| restrictions.teams | yes |
The list of team |
| restrictions.apps | no |
The list of app |
| required_linear_history | no |
Enforces a linear commit Git history, which prevents anyone from pushing merge commits to a branch. Set to |
| allow_force_pushes | no |
Permits force pushes to the protected branch by anyone with write access to the repository. Set to |
| allow_deletions | no |
Allows deletion of the protected branch by anyone with write access to the repository. Set to |
See also: GitHub Developer Guide documentation.
Update a commit comment
octokit.repos.updateCommitComment({
owner,
repo,
comment_id,
body
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| comment_id | yes |
comment_id parameter |
| body | yes |
The contents of the comment |
See also: GitHub Developer Guide documentation.
Create or update a file
Deprecated: This method has been renamed to repos.createOrUpdateFile
Creates a new file or updates an existing file in a repository.
octokit.repos.updateFile({
owner,
repo,
path,
message,
content,
committer.name,
committer.email,
author.name,
author.email
})Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| path | yes |
path parameter |
| message | yes |
The commit message. |
| content | yes |
The new file content, using Base64 encoding. |
| sha | no |
Required if you are updating a file. The blob SHA of the file being replaced. |
| branch | no |
The branch name. Default: the repository’s default branch (usually |
| committer | no |
The person that committed the file. Default: the authenticated user. |
| committer.name | yes |
The name of the author or committer of the commit. You'll receive a |
| committer.email | yes |
The email of the author or committer of the commit. You'll receive a |
| author | no |
The author of the file. Default: The |
| author.name | yes |
The name of the author or committer of the commit. You'll receive a |
| author.email | yes |
The email of the author or committer of the commit. You'll receive a |
See also: GitHub Developer Guide documentation.
Edit a hook
octokit.repos.updateHook({
owner,
repo,
hook_id,
config.url
})Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| hook_id | yes |
hook_id parameter |
| config | no |
Key/value pairs to provide settings for this webhook. These are defined below. |
| config.url | yes |
The URL to which the payloads will be delivered. |
| config.content_type | no |
The media type used to serialize the payloads. Supported values include |
| config.secret | no |
If provided, the |
| config.insecure_ssl | no |
Determines whether the SSL certificate of the host for |
| events | no |
Determines what events the hook is triggered for. This replaces the entire array of events. |
| add_events | no |
Determines a list of events to be added to the list of events that the Hook triggers for. |
| remove_events | no |
Determines a list of events to be removed from the list of events that the Hook triggers for. |
| active | no |
Determines if notifications are sent when the webhook is triggered. Set to |
See also: GitHub Developer Guide documentation.
Update information about a Pages site
octokit.repos.updateInformationAboutPagesSite({
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| cname | no |
Specify a custom domain for the repository. Sending a |
| source | no |
Update the source for the repository. Must include the branch name, and may optionally specify the subdirectory |
See also: GitHub Developer Guide documentation.
Update a repository invitation
octokit.repos.updateInvitation({
owner,
repo,
invitation_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| invitation_id | yes |
invitation_id parameter |
| permissions | no |
The permissions that the associated user will have on the repository. Valid values are |
See also: GitHub Developer Guide documentation.
Update pull request review enforcement of protected branch
Protected branches are available in public repositories with GitHub Free, and in public and private repositories with GitHub Pro, GitHub Team, and GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
Updating pull request review enforcement requires admin or owner permissions to the repository and branch protection to be enabled.
Note: Passing new arrays of users and teams replaces their previous values.
octokit.repos.updateProtectedBranchPullRequestReviewEnforcement({
owner,
repo,
branch
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| branch | yes |
branch parameter |
| dismissal_restrictions | no |
Specify which users and teams can dismiss pull request reviews. Pass an empty |
| dismissal_restrictions.users | no |
The list of user |
| dismissal_restrictions.teams | no |
The list of team |
| dismiss_stale_reviews | no |
Set to |
| require_code_owner_reviews | no |
Blocks merging pull requests until code owners have reviewed. |
| required_approving_review_count | no |
Specifies the number of reviewers required to approve pull requests. Use a number between 1 and 6. |
See also: GitHub Developer Guide documentation.
Update required status checks of protected branch
Protected branches are available in public repositories with GitHub Free, and in public and private repositories with GitHub Pro, GitHub Team, and GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
Updating required status checks requires admin or owner permissions to the repository and branch protection to be enabled.
octokit.repos.updateProtectedBranchRequiredStatusChecks({
owner,
repo,
branch
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| branch | yes |
branch parameter |
| strict | no |
Require branches to be up to date before merging. |
| contexts | no |
The list of status checks to require in order to merge into this branch |
See also: GitHub Developer Guide documentation.
Edit a release
Users with push access to the repository can edit a release.
octokit.repos.updateRelease({
owner,
repo,
release_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| release_id | yes |
release_id parameter |
| tag_name | no |
The name of the tag. |
| target_commitish | no |
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 |
| name | no |
The name of the release. |
| body | no |
Text describing the contents of the tag. |
| draft | no |
|
| prerelease | no |
|
See also: GitHub Developer Guide documentation.
Edit a release asset
Users with push access to the repository can edit a release asset.
octokit.repos.updateReleaseAsset({
owner,
repo,
asset_id
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| asset_id | yes |
asset_id parameter |
| name | no |
The file name of the asset. |
| label | no |
An alternate short description of the asset. Used in place of the filename. |
See also: GitHub Developer Guide documentation.
Upload a release asset
This endpoint makes use of a Hypermedia relation to determine which URL to access. The endpoint you call to upload release assets is specific to your release. Use the upload_url returned in the response of the Create a release endpoint to upload a release asset.
You need to use an HTTP client which supports [SNI](http://en.wikipedia.org/wiki/Server_Name_Indication) to make calls to this endpoint.
Most libraries will set the required `Content-Length` header automatically. Use the required `Content-Type` header to provide the media type of the asset. For a list of media types, see [Media Types](https://www.iana.org/assignments/media-types/media-types.xhtml). For example:
`application/zip`
GitHub expects the asset data in its raw binary form, rather than JSON. You will send the raw binary content of the asset as the request body. Everything else about the endpoint is the same as the rest of the API. For example, you'll still need to pass your authentication to be able to upload an asset.octokit.repos.uploadReleaseAsset({
data,
headers,
headers.content-length,
headers.content-type,
name,
url
})Parameters
| name | required | description |
|---|---|---|
| data | yes |
undefined |
| file | no |
undefined |
| headers | yes |
undefined |
| headers.content-length | yes |
undefined |
| headers.content-type | yes |
undefined |
| label | no |
An alternate short description of the asset. Used in place of the filename. This should be set in a URI query parameter. |
| name | yes |
The file name of the asset. This should be set in a URI query parameter. |
| url | yes |
The |
See also: GitHub Developer Guide documentation.
Search
Search code
Find file contents via various criteria. This method returns up to 100 results per page.
When searching for code, you can get text match metadata for the file content and file path fields when you pass the text-match media type. For more details about how to receive highlighted search results, see Text match metadata.
Note: You must authenticate to search for code across all public repositories.
Considerations for code search
Due to the complexity of searching code, there are a few restrictions on how searches are performed:
- Only the default branch is considered. In most cases, this will be the
masterbranch. - Only files smaller than 384 KB are searchable.
- You must always include at least one search term when searching source code. For example, searching for
language:gois not valid, whileamazing language:gois.
Suppose you want to find the definition of the addClass function inside jQuery. Your query would look something like this:
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.
octokit.search.code({
q
});Parameters
| name | required | description |
|---|---|---|
| q | yes |
The query contains one or more search keywords and qualifiers. Qualifiers allow you to limit your search to specific areas of GitHub. The REST API supports the same qualifiers as GitHub.com. To learn more about the format of the query, see Constructing a search query. See "Searching code" for a detailed list of qualifiers. |
| sort | no |
Sorts the results of your query. Can only be |
| order | no |
Determines whether the first search result returned is the highest number of matches ( |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
Search commits
Find commits via various criteria. This method returns up to 100 results per page.
When searching for commits, you can get text match metadata for the message field when you provide the text-match media type. For more details about how to receive highlighted search results, see Text match metadata.
Considerations for commit search
Only the default branch is considered. In most cases, this will be the master branch.
Suppose you want to find commits related to CSS in the octocat/Spoon-Knife repository. Your query would look something like this:
octokit.search.commits({
q
});Parameters
| name | required | description |
|---|---|---|
| q | yes |
The query contains one or more search keywords and qualifiers. Qualifiers allow you to limit your search to specific areas of GitHub. The REST API supports the same qualifiers as GitHub.com. To learn more about the format of the query, see Constructing a search query. See "Searching commits" for a detailed list of qualifiers. |
| sort | no |
Sorts the results of your query by |
| order | no |
Determines whether the first search result returned is the highest number of matches ( |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
Email search
This method is deprecated.
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 GitHub profile).
octokit.search.emailLegacy({
email
});Parameters
| name | required | description |
|---|---|---|
| yes |
The email address. |
See also: GitHub Developer Guide documentation.
Search issues and pull requests
Deprecated: This method has been renamed to search.issuesAndPullRequests
Find issues by state and keyword. This method returns up to 100 results per page.
When searching for issues, you can get text match metadata for the issue title, issue body, and issue comment body fields when you pass the text-match media type. For more details about how to receive highlighted search results, see Text match metadata.
Let's say you want to find the oldest unresolved Python bugs on Windows. Your query might look something like this.
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.
octokit.search.issues({
q
});Parameters
| name | required | description |
|---|---|---|
| q | yes |
The query contains one or more search keywords and qualifiers. Qualifiers allow you to limit your search to specific areas of GitHub. The REST API supports the same qualifiers as GitHub.com. To learn more about the format of the query, see Constructing a search query. See "Searching issues and pull requests" for a detailed list of qualifiers. |
| sort | no |
Sorts the results of your query by the number of |
| order | no |
Determines whether the first search result returned is the highest number of matches ( |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
Search issues and pull requests
Find issues by state and keyword. This method returns up to 100 results per page.
When searching for issues, you can get text match metadata for the issue title, issue body, and issue comment body fields when you pass the text-match media type. For more details about how to receive highlighted search results, see Text match metadata.
Let's say you want to find the oldest unresolved Python bugs on Windows. Your query might look something like this.
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.
octokit.search.issuesAndPullRequests({
q
});Parameters
| name | required | description |
|---|---|---|
| q | yes |
The query contains one or more search keywords and qualifiers. Qualifiers allow you to limit your search to specific areas of GitHub. The REST API supports the same qualifiers as GitHub.com. To learn more about the format of the query, see Constructing a search query. See "Searching issues and pull requests" for a detailed list of qualifiers. |
| sort | no |
Sorts the results of your query by the number of |
| order | no |
Determines whether the first search result returned is the highest number of matches ( |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
Search issues
This method is deprecated.
Find issues by state and keyword.
octokit.search.issuesLegacy({
owner,
repository,
state,
keyword
});Parameters
| name | required | description |
|---|---|---|
| owner | yes |
owner parameter |
| repository | yes |
repository parameter |
| state | yes |
Indicates the state of the issues to return. Can be either |
| keyword | yes |
The search term. |
See also: GitHub Developer Guide documentation.
Search labels
Find labels in a repository with names or descriptions that match search keywords. Returns up to 100 results per page.
When searching for labels, you can get text match metadata for the label name and description fields when you pass the text-match media type. For more details about how to receive highlighted search results, see Text match metadata.
Suppose you want to find labels in the linguist repository that match bug, defect, or enhancement. Your query might look like this:
The labels that best match for the query appear first in the search results.
octokit.search.labels({
repository_id,
q
});Parameters
| name | required | description |
|---|---|---|
| repository_id | yes |
The id of the repository. |
| q | yes |
The search keywords. This endpoint does not accept qualifiers in the query. To learn more about the format of the query, see Constructing a search query. |
| sort | no |
Sorts the results of your query by when the label was |
| order | no |
Determines whether the first search result returned is the highest number of matches ( |
See also: GitHub Developer Guide documentation.
Search repositories
Find repositories via various criteria. This method returns up to 100 results per page.
When searching for repositories, you can get text match metadata for the name and description fields when you pass the text-match media type. For more details about how to receive highlighted search results, see Text match metadata.
Suppose you want to search for popular Tetris repositories written in Assembly. Your query might look like this.
You can search for multiple topics by adding more topic: instances, and including the mercy-preview header. For example:
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.
octokit.search.repos({
q
});Parameters
| name | required | description |
|---|---|---|
| q | yes |
The query contains one or more search keywords and qualifiers. Qualifiers allow you to limit your search to specific areas of GitHub. The REST API supports the same qualifiers as GitHub.com. To learn more about the format of the query, see Constructing a search query. See "Searching for repositories" for a detailed list of qualifiers. |
| sort | no |
Sorts the results of your query by number of |
| order | no |
Determines whether the first search result returned is the highest number of matches ( |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
Search repositories
This method is deprecated.
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.
octokit.search.reposLegacy({
keyword
});Parameters
| name | required | description |
|---|---|---|
| keyword | yes |
The search term. |
| language | no |
Filter results by language. |
| start_page | no |
The page number to fetch. |
| sort | no |
The sort field. One of |
| order | no |
The sort field. if |
See also: GitHub Developer Guide documentation.
Search topics
Find topics via various criteria. Results are sorted by best match. This method returns up to 100 results per page.
When searching for topics, you can get text match metadata for the topic's short_description, description, name, or display_name field when you pass the text-match media type. For more details about how to receive highlighted search results, see Text match metadata.
See "Searching topics" for a detailed list of qualifiers.
Suppose you want to search for topics related to Ruby that are featured on https://github.com/topics. Your query might look like this:
In this request, we're searching for topics with the keyword ruby, and we're limiting the results to find only topics that are featured. The topics that are the best match for the query appear first in the search results.
Note: A search for featured Ruby topics only has 6 total results, so a Link header indicating pagination is not included in the response.
octokit.search.topics({
q
});Parameters
| name | required | description |
|---|---|---|
| q | yes |
The query contains one or more search keywords and qualifiers. Qualifiers allow you to limit your search to specific areas of GitHub. The REST API supports the same qualifiers as GitHub.com. To learn more about the format of the query, see Constructing a search query. |
See also: GitHub Developer Guide documentation.
Search users
Find users via various criteria. This method returns up to 100 results per page.
When searching for users, you can get text match metadata for the issue login, email, and name fields when you pass the text-match media type. For more details about highlighting search results, see Text match metadata. For more details about how to receive highlighted search results, see Text match metadata.
Imagine you're looking for a list of popular users. You might try out this query:
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.
octokit.search.users({
q
});Parameters
| name | required | description |
|---|---|---|
| q | yes |
The query contains one or more search keywords and qualifiers. Qualifiers allow you to limit your search to specific areas of GitHub. The REST API supports the same qualifiers as GitHub.com. To learn more about the format of the query, see Constructing a search query. See "Searching users" for a detailed list of qualifiers. |
| sort | no |
Sorts the results of your query by number of |
| order | no |
Determines whether the first search result returned is the highest number of matches ( |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
Search users
This method is deprecated.
Find users by keyword.
octokit.search.usersLegacy({
keyword
});Parameters
| name | required | description |
|---|---|---|
| keyword | yes |
The search term. |
| start_page | no |
The page number to fetch. |
| sort | no |
The sort field. One of |
| order | no |
The sort field. if |
See also: GitHub Developer Guide documentation.
Teams
Add team member (Legacy)
This method is deprecated.
Deprecated: This method has been renamed to teams.addMemberLegacy
The "Add team member" endpoint (described below) is deprecated.
We recommend using the Add team membership endpoint instead. It allows you to invite new organization members to your teams.
Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
To add someone to a team, the authenticated user must be an organization owner or a team maintainer in the team they're changing. The person being added to the team must be a member of the team's organization.
Note: When you have team synchronization set up for a team with your organization's identity provider (IdP), you will see an error if you attempt to use the API for making changes to the team's membership. If you have access to manage group membership in your IdP, you can manage GitHub team membership through your identity provider, which automatically adds and removes team members in an organization. For more information, see "Synchronizing teams between your identity provider and GitHub."
Note that you'll need to set Content-Length to zero when calling out to this endpoint. For more information, see "HTTP verbs."
octokit.teams.addMember({
team_id,
username
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| username | yes |
username parameter |
See also: GitHub Developer Guide documentation.
Add team member (Legacy)
This method is deprecated.
The "Add team member" endpoint (described below) is deprecated.
We recommend using the Add team membership endpoint instead. It allows you to invite new organization members to your teams.
Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
To add someone to a team, the authenticated user must be an organization owner or a team maintainer in the team they're changing. The person being added to the team must be a member of the team's organization.
Note: When you have team synchronization set up for a team with your organization's identity provider (IdP), you will see an error if you attempt to use the API for making changes to the team's membership. If you have access to manage group membership in your IdP, you can manage GitHub team membership through your identity provider, which automatically adds and removes team members in an organization. For more information, see "Synchronizing teams between your identity provider and GitHub."
Note that you'll need to set Content-Length to zero when calling out to this endpoint. For more information, see "HTTP verbs."
octokit.teams.addMemberLegacy({
team_id,
username
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| username | yes |
username parameter |
See also: GitHub Developer Guide documentation.
Add or update team membership (Legacy)
This method is deprecated.
Deprecated: This method has been renamed to teams.addOrUpdateMembershipLegacy
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Add or update team membership endpoint.
Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
If the user is already a member of the team's organization, this endpoint will add the user to the team. To add a membership between an organization member and a team, the authenticated user must be an organization owner or a team maintainer.
Note: When you have team synchronization set up for a team with your organization's identity provider (IdP), you will see an error if you attempt to use the API for making changes to the team's membership. If you have access to manage group membership in your IdP, you can manage GitHub team membership through your identity provider, which automatically adds and removes team members in an organization. For more information, see "Synchronizing teams between your identity provider and GitHub."
If the user is unaffiliated with the team's organization, this endpoint will send an invitation to the user via email. This newly-created membership will be in the "pending" state until the user accepts the invitation, at which point the membership will transition to the "active" state and the user will be added as a member of the team. To add a membership between an unaffiliated user and a team, the authenticated user must be an organization owner.
If the user is already a member of the team, this endpoint will update the role of the team member's role. To update the membership of a team member, the authenticated user must be an organization owner or a team maintainer.
octokit.teams.addOrUpdateMembership({
team_id,
username
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| username | yes |
username parameter |
| role | no |
The role that this user should have in the team. Can be one of: |
See also: GitHub Developer Guide documentation.
Add or update team membership
Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
Adds an organization member to a team. An authenticated organization owner or team maintainer can add organization members to a team.
Note: When you have team synchronization set up for a team with your organization's identity provider (IdP), you will see an error if you attempt to use the API for making changes to the team's membership. If you have access to manage group membership in your IdP, you can manage GitHub team membership through your identity provider, which automatically adds and removes team members in an organization. For more information, see "Synchronizing teams between your identity provider and GitHub."
An organization owner can add someone who is not part of the team's organization to a team. When an organization owner adds someone to a team who is not an organization member, this endpoint will send an invitation to the person via email. This newly-created membership will be in the "pending" state until the person 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.
If the user is already a member of the team, this endpoint will update the role of the team member's role. To update the membership of a team member, the authenticated user must be an organization owner or a team maintainer.
Note: You can also specify a team by org_id and team_id using the route PUT /organizations/:org_id/team/:team_id/memberships/:username.
octokit.teams.addOrUpdateMembershipInOrg({
org,
team_slug,
username
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| team_slug | yes |
team_slug parameter |
| username | yes |
username parameter |
| role | no |
The role that this user should have in the team. Can be one of: |
See also: GitHub Developer Guide documentation.
Add or update team membership (Legacy)
This method is deprecated.
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Add or update team membership endpoint.
Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
If the user is already a member of the team's organization, this endpoint will add the user to the team. To add a membership between an organization member and a team, the authenticated user must be an organization owner or a team maintainer.
Note: When you have team synchronization set up for a team with your organization's identity provider (IdP), you will see an error if you attempt to use the API for making changes to the team's membership. If you have access to manage group membership in your IdP, you can manage GitHub team membership through your identity provider, which automatically adds and removes team members in an organization. For more information, see "Synchronizing teams between your identity provider and GitHub."
If the user is unaffiliated with the team's organization, this endpoint will send an invitation to the user via email. This newly-created membership will be in the "pending" state until the user accepts the invitation, at which point the membership will transition to the "active" state and the user will be added as a member of the team. To add a membership between an unaffiliated user and a team, the authenticated user must be an organization owner.
If the user is already a member of the team, this endpoint will update the role of the team member's role. To update the membership of a team member, the authenticated user must be an organization owner or a team maintainer.
octokit.teams.addOrUpdateMembershipLegacy({
team_id,
username
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| username | yes |
username parameter |
| role | no |
The role that this user should have in the team. Can be one of: |
See also: GitHub Developer Guide documentation.
Add or update team project (Legacy)
This method is deprecated.
Deprecated: This method has been renamed to teams.addOrUpdateProjectLegacy
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Add or update team project endpoint.
Adds an organization project to a team. To add a project to a team or update the team's permission on a project, the authenticated user must have admin permissions for the project. The project and team must be part of the same organization.
octokit.teams.addOrUpdateProject({
team_id,
project_id
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| project_id | yes |
project_id parameter |
| permission | no |
The permission to grant to the team for this project. Can be one of: |
See also: GitHub Developer Guide documentation.
Add or update team project
Adds an organization project to a team. To add a project to a team or update the team's permission on a project, the authenticated user must have admin permissions for the project. The project and team must be part of the same organization.
Note: You can also specify a team by org_id and team_id using the route PUT /organizations/:org_id/team/:team_id/projects/:project_id.
octokit.teams.addOrUpdateProjectInOrg({
org,
team_slug,
project_id
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| team_slug | yes |
team_slug parameter |
| project_id | yes |
project_id parameter |
| permission | no |
The permission to grant to the team for this project. Can be one of: |
See also: GitHub Developer Guide documentation.
Add or update team project (Legacy)
This method is deprecated.
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Add or update team project endpoint.
Adds an organization project to a team. To add a project to a team or update the team's permission on a project, the authenticated user must have admin permissions for the project. The project and team must be part of the same organization.
octokit.teams.addOrUpdateProjectLegacy({
team_id,
project_id
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| project_id | yes |
project_id parameter |
| permission | no |
The permission to grant to the team for this project. Can be one of: |
See also: GitHub Developer Guide documentation.
Add or update team repository (Legacy)
This method is deprecated.
Deprecated: This method has been renamed to teams.addOrUpdateRepoLegacy
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Add or update team repository endpoint.
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. The repository must be owned by the organization, or a direct fork of a repository owned by the organization. You will get a 422 Unprocessable Entity status if you attempt to add a repository to a team that is not owned by the organization.
Note that, if you choose not to pass any parameters, you'll need to set Content-Length to zero when calling out to this endpoint. For more information, see "HTTP verbs."
octokit.teams.addOrUpdateRepo({
team_id,
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| permission | no |
The permission to grant the team on this repository. Can be one of: If no permission is specified, the team's |
See also: GitHub Developer Guide documentation.
Add or update team repository
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. The repository must be owned by the organization, or a direct fork of a repository owned by the organization. You will get a 422 Unprocessable Entity status if you attempt to add a repository to a team that is not owned by the organization. Note that, if you choose not to pass any parameters, you'll need to set Content-Length to zero when calling out to this endpoint. For more information, see "HTTP verbs."
Note: You can also specify a team by org_id and team_id using the route PUT /organizations/:org_id/team/:team_id/repos/:owner/:repo.
octokit.teams.addOrUpdateRepoInOrg({
org,
team_slug,
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| team_slug | yes |
team_slug parameter |
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| permission | no |
The permission to grant the team on this repository. Can be one of: If no permission is specified, the team's |
See also: GitHub Developer Guide documentation.
Add or update team repository (Legacy)
This method is deprecated.
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Add or update team repository endpoint.
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. The repository must be owned by the organization, or a direct fork of a repository owned by the organization. You will get a 422 Unprocessable Entity status if you attempt to add a repository to a team that is not owned by the organization.
Note that, if you choose not to pass any parameters, you'll need to set Content-Length to zero when calling out to this endpoint. For more information, see "HTTP verbs."
octokit.teams.addOrUpdateRepoLegacy({
team_id,
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
| permission | no |
The permission to grant the team on this repository. Can be one of: If no permission is specified, the team's |
See also: GitHub Developer Guide documentation.
Check if a team manages a repository (Legacy)
This method is deprecated.
Deprecated: This method has been renamed to teams.checkManagesRepoLegacy
Note: Repositories inherited through a parent team will also be checked.
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Check if a team manages a repository endpoint.
You can also get information about the specified repository, including what permissions the team grants on it, by passing the following custom media type via the Accept header:
octokit.teams.checkManagesRepo({
team_id,
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
Check if a team manages a repository
Checks whether a team has admin, push, or pull permission for a repository. Repositories inherited through a parent team will also be checked.
Note: You can also specify a team by org_id and team_id using the route GET /organizations/:org_id/team/:team_id/repos/:owner/:repo.
You can also get information about the specified repository, including what permissions the team grants on it, by passing the following custom media type via the Accept header:
octokit.teams.checkManagesRepoInOrg({
org,
team_slug,
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| team_slug | yes |
team_slug parameter |
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
Check if a team manages a repository (Legacy)
This method is deprecated.
Note: Repositories inherited through a parent team will also be checked.
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Check if a team manages a repository endpoint.
You can also get information about the specified repository, including what permissions the team grants on it, by passing the following custom media type via the Accept header:
octokit.teams.checkManagesRepoLegacy({
team_id,
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
Create team
To create a team, the authenticated user must be a member or owner of :org. By default, organization members can create teams. Organization owners can limit team creation to organization owners. For more information, see "Setting team creation permissions."
When you create a new team, you automatically become a team maintainer without explicitly adding yourself to the optional array of maintainers. For more information, see "About teams" in the GitHub Help documentation.
octokit.teams.create({
org,
name
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| name | yes |
The name of the team. |
| description | no |
The description of the team. |
| maintainers | no |
List GitHub IDs for organization members who will become team maintainers. |
| repo_names | no |
The full name (e.g., "organization-name/repository-name") of repositories to add the team to. |
| privacy | no |
The level of privacy this team should have. The options are: |
| permission | no |
Deprecated. The permission that new repositories will be added to the team with when none is specified. Can be one of: |
| parent_team_id | no |
The ID of a team to set as the parent team. |
See also: GitHub Developer Guide documentation.
Create a discussion (Legacy)
This method is deprecated.
Deprecated: This method has been renamed to teams.createDiscussionLegacy
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Create a discussion endpoint.
Creates a new discussion post on a team's page. OAuth access tokens require the write:discussion scope.
This endpoint triggers notifications. Creating content too quickly using this endpoint may result in abuse rate limiting. See "Abuse rate limits" and "Dealing with abuse rate limits" for details.
octokit.teams.createDiscussion({
team_id,
title,
body
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| title | yes |
The discussion post's title. |
| body | yes |
The discussion post's body text. |
| private | no |
Private posts are only visible to team members, organization owners, and team maintainers. Public posts are visible to all members of the organization. Set to |
See also: GitHub Developer Guide documentation.
Create a comment (Legacy)
This method is deprecated.
Deprecated: This method has been renamed to teams.createDiscussionCommentLegacy
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Create a comment endpoint.
Creates a new comment on a team discussion. OAuth access tokens require the write:discussion scope.
This endpoint triggers notifications. Creating content too quickly using this endpoint may result in abuse rate limiting. See "Abuse rate limits" and "Dealing with abuse rate limits" for details.
octokit.teams.createDiscussionComment({
team_id,
discussion_number,
body
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| discussion_number | yes |
discussion_number parameter |
| body | yes |
The discussion comment's body text. |
See also: GitHub Developer Guide documentation.
Create a comment
Creates a new comment on a team discussion. OAuth access tokens require the write:discussion scope.
This endpoint triggers notifications. Creating content too quickly using this endpoint may result in abuse rate limiting. See "Abuse rate limits" and "Dealing with abuse rate limits" for details.
Note: You can also specify a team by org_id and team_id using the route POST /organizations/:org_id/team/:team_id/discussions/:discussion_number/comments.
octokit.teams.createDiscussionCommentInOrg({
org,
team_slug,
discussion_number,
body
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| team_slug | yes |
team_slug parameter |
| discussion_number | yes |
discussion_number parameter |
| body | yes |
The discussion comment's body text. |
See also: GitHub Developer Guide documentation.
Create a comment (Legacy)
This method is deprecated.
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Create a comment endpoint.
Creates a new comment on a team discussion. OAuth access tokens require the write:discussion scope.
This endpoint triggers notifications. Creating content too quickly using this endpoint may result in abuse rate limiting. See "Abuse rate limits" and "Dealing with abuse rate limits" for details.
octokit.teams.createDiscussionCommentLegacy({
team_id,
discussion_number,
body
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| discussion_number | yes |
discussion_number parameter |
| body | yes |
The discussion comment's body text. |
See also: GitHub Developer Guide documentation.
Create a discussion
Creates a new discussion post on a team's page. OAuth access tokens require the write:discussion scope.
This endpoint triggers notifications. Creating content too quickly using this endpoint may result in abuse rate limiting. See "Abuse rate limits" and "Dealing with abuse rate limits" for details.
Note: You can also specify a team by org_id and team_id using the route POST /organizations/:org_id/team/:team_id/discussions.
octokit.teams.createDiscussionInOrg({
org,
team_slug,
title,
body
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| team_slug | yes |
team_slug parameter |
| title | yes |
The discussion post's title. |
| body | yes |
The discussion post's body text. |
| private | no |
Private posts are only visible to team members, organization owners, and team maintainers. Public posts are visible to all members of the organization. Set to |
See also: GitHub Developer Guide documentation.
Create a discussion (Legacy)
This method is deprecated.
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Create a discussion endpoint.
Creates a new discussion post on a team's page. OAuth access tokens require the write:discussion scope.
This endpoint triggers notifications. Creating content too quickly using this endpoint may result in abuse rate limiting. See "Abuse rate limits" and "Dealing with abuse rate limits" for details.
octokit.teams.createDiscussionLegacy({
team_id,
title,
body
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| title | yes |
The discussion post's title. |
| body | yes |
The discussion post's body text. |
| private | no |
Private posts are only visible to team members, organization owners, and team maintainers. Public posts are visible to all members of the organization. Set to |
See also: GitHub Developer Guide documentation.
Delete team (Legacy)
This method is deprecated.
Deprecated: This method has been renamed to teams.deleteLegacy
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Delete team endpoint.
To delete a team, the authenticated user must be an organization owner or team maintainer.
If you are an organization owner, deleting a parent team will delete all of its child teams as well.
octokit.teams.delete({
team_id
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
See also: GitHub Developer Guide documentation.
Delete a discussion (Legacy)
This method is deprecated.
Deprecated: This method has been renamed to teams.deleteDiscussionLegacy
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Delete a discussion endpoint.
Delete a discussion from a team's page. OAuth access tokens require the write:discussion scope.
octokit.teams.deleteDiscussion({
team_id,
discussion_number
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| discussion_number | yes |
discussion_number parameter |
See also: GitHub Developer Guide documentation.
Delete a comment (Legacy)
This method is deprecated.
Deprecated: This method has been renamed to teams.deleteDiscussionCommentLegacy
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Delete a comment endpoint.
Deletes a comment on a team discussion. OAuth access tokens require the write:discussion scope.
octokit.teams.deleteDiscussionComment({
team_id,
discussion_number,
comment_number
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| discussion_number | yes |
discussion_number parameter |
| comment_number | yes |
comment_number parameter |
See also: GitHub Developer Guide documentation.
Delete a comment
Deletes a comment on a team discussion. OAuth access tokens require the write:discussion scope.
Note: You can also specify a team by org_id and team_id using the route DELETE /organizations/:org_id/team/:team_id/discussions/:discussion_number/comments/:comment_number.
octokit.teams.deleteDiscussionCommentInOrg({
org,
team_slug,
discussion_number,
comment_number
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| team_slug | yes |
team_slug parameter |
| discussion_number | yes |
discussion_number parameter |
| comment_number | yes |
comment_number parameter |
See also: GitHub Developer Guide documentation.
Delete a comment (Legacy)
This method is deprecated.
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Delete a comment endpoint.
Deletes a comment on a team discussion. OAuth access tokens require the write:discussion scope.
octokit.teams.deleteDiscussionCommentLegacy({
team_id,
discussion_number,
comment_number
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| discussion_number | yes |
discussion_number parameter |
| comment_number | yes |
comment_number parameter |
See also: GitHub Developer Guide documentation.
Delete a discussion
Delete a discussion from a team's page. OAuth access tokens require the write:discussion scope.
Note: You can also specify a team by org_id and team_id using the route DELETE /organizations/:org_id/team/:team_id/discussions/:discussion_number.
octokit.teams.deleteDiscussionInOrg({
org,
team_slug,
discussion_number
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| team_slug | yes |
team_slug parameter |
| discussion_number | yes |
discussion_number parameter |
See also: GitHub Developer Guide documentation.
Delete a discussion (Legacy)
This method is deprecated.
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Delete a discussion endpoint.
Delete a discussion from a team's page. OAuth access tokens require the write:discussion scope.
octokit.teams.deleteDiscussionLegacy({
team_id,
discussion_number
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| discussion_number | yes |
discussion_number parameter |
See also: GitHub Developer Guide documentation.
Delete team
To delete a team, the authenticated user must be an organization owner or team maintainer.
Note: You can also specify a team by org_id and team_id using the route DELETE /organizations/:org_id/team/:team_id.
If you are an organization owner, deleting a parent team will delete all of its child teams as well.
octokit.teams.deleteInOrg({
org,
team_slug
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| team_slug | yes |
team_slug parameter |
See also: GitHub Developer Guide documentation.
Delete team (Legacy)
This method is deprecated.
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Delete team endpoint.
To delete a team, the authenticated user must be an organization owner or team maintainer.
If you are an organization owner, deleting a parent team will delete all of its child teams as well.
octokit.teams.deleteLegacy({
team_id
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
See also: GitHub Developer Guide documentation.
Get team (Legacy)
This method is deprecated.
Deprecated: This method has been renamed to teams.getLegacy
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the Get team by name endpoint.
octokit.teams.get({
team_id
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
See also: GitHub Developer Guide documentation.
Get team by name
Gets a team using the team's slug. GitHub generates the slug from the team name.
Note: You can also specify a team by org_id and team_id using the route GET /organizations/:org_id/team/:team_id.
octokit.teams.getByName({
org,
team_slug
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| team_slug | yes |
team_slug parameter |
See also: GitHub Developer Guide documentation.
Get a single discussion (Legacy)
This method is deprecated.
Deprecated: This method has been renamed to teams.getDiscussionLegacy
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Get a single discussion endpoint.
Get a specific discussion on a team's page. OAuth access tokens require the read:discussion scope.
octokit.teams.getDiscussion({
team_id,
discussion_number
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| discussion_number | yes |
discussion_number parameter |
See also: GitHub Developer Guide documentation.
Get a single comment (Legacy)
This method is deprecated.
Deprecated: This method has been renamed to teams.getDiscussionCommentLegacy
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Get a single comment endpoint.
Get a specific comment on a team discussion. OAuth access tokens require the read:discussion scope.
octokit.teams.getDiscussionComment({
team_id,
discussion_number,
comment_number
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| discussion_number | yes |
discussion_number parameter |
| comment_number | yes |
comment_number parameter |
See also: GitHub Developer Guide documentation.
Get a single comment
Get a specific comment on a team discussion. OAuth access tokens require the read:discussion scope.
Note: You can also specify a team by org_id and team_id using the route GET /organizations/:org_id/team/:team_id/discussions/:discussion_number/comments/:comment_number.
octokit.teams.getDiscussionCommentInOrg({
org,
team_slug,
discussion_number,
comment_number
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| team_slug | yes |
team_slug parameter |
| discussion_number | yes |
discussion_number parameter |
| comment_number | yes |
comment_number parameter |
See also: GitHub Developer Guide documentation.
Get a single comment (Legacy)
This method is deprecated.
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Get a single comment endpoint.
Get a specific comment on a team discussion. OAuth access tokens require the read:discussion scope.
octokit.teams.getDiscussionCommentLegacy({
team_id,
discussion_number,
comment_number
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| discussion_number | yes |
discussion_number parameter |
| comment_number | yes |
comment_number parameter |
See also: GitHub Developer Guide documentation.
Get a single discussion
Get a specific discussion on a team's page. OAuth access tokens require the read:discussion scope.
Note: You can also specify a team by org_id and team_id using the route GET /organizations/:org_id/team/:team_id/discussions/:discussion_number.
octokit.teams.getDiscussionInOrg({
org,
team_slug,
discussion_number
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| team_slug | yes |
team_slug parameter |
| discussion_number | yes |
discussion_number parameter |
See also: GitHub Developer Guide documentation.
Get a single discussion (Legacy)
This method is deprecated.
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Get a single discussion endpoint.
Get a specific discussion on a team's page. OAuth access tokens require the read:discussion scope.
octokit.teams.getDiscussionLegacy({
team_id,
discussion_number
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| discussion_number | yes |
discussion_number parameter |
See also: GitHub Developer Guide documentation.
Get team (Legacy)
This method is deprecated.
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the Get team by name endpoint.
octokit.teams.getLegacy({
team_id
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
See also: GitHub Developer Guide documentation.
Get team member (Legacy)
This method is deprecated.
Deprecated: This method has been renamed to teams.getMemberLegacy
The "Get team member" endpoint (described below) is deprecated.
We recommend using the Get team membership endpoint instead. It allows you to get both active and pending memberships.
To list members in a team, the team must be visible to the authenticated user.
octokit.teams.getMember({
team_id,
username
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| username | yes |
username parameter |
See also: GitHub Developer Guide documentation.
Get team member (Legacy)
This method is deprecated.
The "Get team member" endpoint (described below) is deprecated.
We recommend using the Get team membership endpoint instead. It allows you to get both active and pending memberships.
To list members in a team, the team must be visible to the authenticated user.
octokit.teams.getMemberLegacy({
team_id,
username
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| username | yes |
username parameter |
See also: GitHub Developer Guide documentation.
Get team membership (Legacy)
This method is deprecated.
Deprecated: This method has been renamed to teams.getMembershipLegacy
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Get team membership endpoint.
Team members will include the members of child teams.
To get a user's membership with a team, the team must be visible to the authenticated user.
Note: The role for organization owners returns as maintainer. For more information about maintainer roles, see Create team.
octokit.teams.getMembership({
team_id,
username
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| username | yes |
username parameter |
See also: GitHub Developer Guide documentation.
Get team membership
Team members will include the members of child teams.
To get a user's membership with a team, the team must be visible to the authenticated user.
Note: You can also specify a team by org_id and team_id using the route GET /organizations/:org_id/team/:team_id/memberships/:username.
Note: The role for organization owners returns as maintainer. For more information about maintainer roles, see Create team.
octokit.teams.getMembershipInOrg({
org,
team_slug,
username
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| team_slug | yes |
team_slug parameter |
| username | yes |
username parameter |
See also: GitHub Developer Guide documentation.
Get team membership (Legacy)
This method is deprecated.
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Get team membership endpoint.
Team members will include the members of child teams.
To get a user's membership with a team, the team must be visible to the authenticated user.
Note: The role for organization owners returns as maintainer. For more information about maintainer roles, see Create team.
octokit.teams.getMembershipLegacy({
team_id,
username
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| username | yes |
username parameter |
See also: GitHub Developer Guide documentation.
List teams
Lists all teams in an organization that are visible to the authenticated user.
octokit.teams.list({
org
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List child teams (Legacy)
This method is deprecated.
Deprecated: This method has been renamed to teams.listChildLegacy
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new List child teams endpoint.
octokit.teams.listChild({
team_id
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List child teams
Lists the child teams of the team requested by :team_slug.
Note: You can also specify a team by org_id and team_id using the route GET /organizations/:org_id/team/:team_id/teams.
octokit.teams.listChildInOrg({
org,
team_slug
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| team_slug | yes |
team_slug parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List child teams (Legacy)
This method is deprecated.
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new List child teams endpoint.
octokit.teams.listChildLegacy({
team_id
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List comments (Legacy)
This method is deprecated.
Deprecated: This method has been renamed to teams.listDiscussionCommentsLegacy
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new List comments endpoint.
List all comments on a team discussion. OAuth access tokens require the read:discussion scope.
octokit.teams.listDiscussionComments({
team_id,
discussion_number
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| discussion_number | yes |
discussion_number parameter |
| direction | no |
Sorts the discussion comments by the date they were created. To return the oldest comments first, set to |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List comments
List all comments on a team discussion. OAuth access tokens require the read:discussion scope.
Note: You can also specify a team by org_id and team_id using the route GET /organizations/:org_id/team/:team_id/discussions/:discussion_number/comments.
octokit.teams.listDiscussionCommentsInOrg({
org,
team_slug,
discussion_number
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| team_slug | yes |
team_slug parameter |
| discussion_number | yes |
discussion_number parameter |
| direction | no |
Sorts the discussion comments by the date they were created. To return the oldest comments first, set to |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List comments (Legacy)
This method is deprecated.
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new List comments endpoint.
List all comments on a team discussion. OAuth access tokens require the read:discussion scope.
octokit.teams.listDiscussionCommentsLegacy({
team_id,
discussion_number
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| discussion_number | yes |
discussion_number parameter |
| direction | no |
Sorts the discussion comments by the date they were created. To return the oldest comments first, set to |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List discussions (Legacy)
This method is deprecated.
Deprecated: This method has been renamed to teams.listDiscussionsLegacy
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new List discussions endpoint.
List all discussions on a team's page. OAuth access tokens require the read:discussion scope.
octokit.teams.listDiscussions({
team_id
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| direction | no |
Sorts the discussion comments by the date they were created. To return the oldest comments first, set to |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List discussions
List all discussions on a team's page. OAuth access tokens require the read:discussion scope.
Note: You can also specify a team by org_id and team_id using the route GET /organizations/:org_id/team/:team_id/discussions.
octokit.teams.listDiscussionsInOrg({
org,
team_slug
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| team_slug | yes |
team_slug parameter |
| direction | no |
Sorts the discussion comments by the date they were created. To return the oldest comments first, set to |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List discussions (Legacy)
This method is deprecated.
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new List discussions endpoint.
List all discussions on a team's page. OAuth access tokens require the read:discussion scope.
octokit.teams.listDiscussionsLegacy({
team_id
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| direction | no |
Sorts the discussion comments by the date they were created. To return the oldest comments first, set to |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
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.
octokit.teams.listForAuthenticatedUser();Parameters
| name | required | description |
|---|---|---|
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List team members (Legacy)
This method is deprecated.
Deprecated: This method has been renamed to teams.listMembersLegacy
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new List team members endpoint.
Team members will include the members of child teams.
octokit.teams.listMembers({
team_id
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| role | no |
Filters members returned by their role in the team. Can be one of: |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List team members
Team members will include the members of child teams.
To list members in a team, the team must be visible to the authenticated user.
octokit.teams.listMembersInOrg({
org,
team_slug
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| team_slug | yes |
team_slug parameter |
| role | no |
Filters members returned by their role in the team. Can be one of: |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List team members (Legacy)
This method is deprecated.
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new List team members endpoint.
Team members will include the members of child teams.
octokit.teams.listMembersLegacy({
team_id
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| role | no |
Filters members returned by their role in the team. Can be one of: |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List pending team invitations (Legacy)
This method is deprecated.
Deprecated: This method has been renamed to teams.listPendingInvitationsLegacy
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new List pending team invitations endpoint.
The return hash contains a role field which refers to the Organization Invitation role and will be one of the following values: direct_member, admin, billing_manager, hiring_manager, or reinstate. If the invitee is not a GitHub member, the login field in the return hash will be null.
octokit.teams.listPendingInvitations({
team_id
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List pending team invitations
The return hash contains a role field which refers to the Organization Invitation role and will be one of the following values: direct_member, admin, billing_manager, hiring_manager, or reinstate. If the invitee is not a GitHub member, the login field in the return hash will be null.
Note: You can also specify a team by org_id and team_id using the route GET /organizations/:org_id/team/:team_id/invitations.
octokit.teams.listPendingInvitationsInOrg({
org,
team_slug
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| team_slug | yes |
team_slug parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List pending team invitations (Legacy)
This method is deprecated.
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new List pending team invitations endpoint.
The return hash contains a role field which refers to the Organization Invitation role and will be one of the following values: direct_member, admin, billing_manager, hiring_manager, or reinstate. If the invitee is not a GitHub member, the login field in the return hash will be null.
octokit.teams.listPendingInvitationsLegacy({
team_id
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List team projects (Legacy)
This method is deprecated.
Deprecated: This method has been renamed to teams.listProjectsLegacy
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new List team projects endpoint.
Lists the organization projects for a team.
octokit.teams.listProjects({
team_id
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List team projects
Lists the organization projects for a team.
Note: You can also specify a team by org_id and team_id using the route GET /organizations/:org_id/team/:team_id/projects.
octokit.teams.listProjectsInOrg({
org,
team_slug
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| team_slug | yes |
team_slug parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List team projects (Legacy)
This method is deprecated.
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new List team projects endpoint.
Lists the organization projects for a team.
octokit.teams.listProjectsLegacy({
team_id
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List team repos (Legacy)
This method is deprecated.
Deprecated: This method has been renamed to teams.listReposLegacy
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new List team repos endpoint.
octokit.teams.listRepos({
team_id
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List team repos
Lists a team's repositories visible to the authenticated user.
Note: You can also specify a team by org_id and team_id using the route GET /organizations/:org_id/team/:team_id/repos.
octokit.teams.listReposInOrg({
org,
team_slug
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| team_slug | yes |
team_slug parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List team repos (Legacy)
This method is deprecated.
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new List team repos endpoint.
octokit.teams.listReposLegacy({
team_id
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
Remove team member (Legacy)
This method is deprecated.
Deprecated: This method has been renamed to teams.removeMemberLegacy
The "Remove team member" endpoint (described below) is deprecated.
We recommend using the Remove team membership endpoint instead. It allows you to remove both active and pending memberships.
Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
To remove a team member, the authenticated user must have 'admin' permissions to the team or be an owner of the org that the team is associated with. Removing a team member does not delete the user, it just removes them from the team.
Note: When you have team synchronization set up for a team with your organization's identity provider (IdP), you will see an error if you attempt to use the API for making changes to the team's membership. If you have access to manage group membership in your IdP, you can manage GitHub team membership through your identity provider, which automatically adds and removes team members in an organization. For more information, see "Synchronizing teams between your identity provider and GitHub."
octokit.teams.removeMember({
team_id,
username
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| username | yes |
username parameter |
See also: GitHub Developer Guide documentation.
Remove team member (Legacy)
This method is deprecated.
The "Remove team member" endpoint (described below) is deprecated.
We recommend using the Remove team membership endpoint instead. It allows you to remove both active and pending memberships.
Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
To remove a team member, the authenticated user must have 'admin' permissions to the team or be an owner of the org that the team is associated with. Removing a team member does not delete the user, it just removes them from the team.
Note: When you have team synchronization set up for a team with your organization's identity provider (IdP), you will see an error if you attempt to use the API for making changes to the team's membership. If you have access to manage group membership in your IdP, you can manage GitHub team membership through your identity provider, which automatically adds and removes team members in an organization. For more information, see "Synchronizing teams between your identity provider and GitHub."
octokit.teams.removeMemberLegacy({
team_id,
username
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| username | yes |
username parameter |
See also: GitHub Developer Guide documentation.
Remove team membership (Legacy)
This method is deprecated.
Deprecated: This method has been renamed to teams.removeMembershipLegacy
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Remove team membership endpoint.
Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
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. Removing team membership does not delete the user, it just removes their membership from the team.
Note: When you have team synchronization set up for a team with your organization's identity provider (IdP), you will see an error if you attempt to use the API for making changes to the team's membership. If you have access to manage group membership in your IdP, you can manage GitHub team membership through your identity provider, which automatically adds and removes team members in an organization. For more information, see "Synchronizing teams between your identity provider and GitHub."
octokit.teams.removeMembership({
team_id,
username
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| username | yes |
username parameter |
See also: GitHub Developer Guide documentation.
Remove team membership
Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
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. Removing team membership does not delete the user, it just removes their membership from the team.
Note: When you have team synchronization set up for a team with your organization's identity provider (IdP), you will see an error if you attempt to use the API for making changes to the team's membership. If you have access to manage group membership in your IdP, you can manage GitHub team membership through your identity provider, which automatically adds and removes team members in an organization. For more information, see "Synchronizing teams between your identity provider and GitHub."
Note: You can also specify a team by org_id and team_id using the route DELETE /organizations/:org_id/team/:team_id/memberships/:username.
octokit.teams.removeMembershipInOrg({
org,
team_slug,
username
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| team_slug | yes |
team_slug parameter |
| username | yes |
username parameter |
See also: GitHub Developer Guide documentation.
Remove team membership (Legacy)
This method is deprecated.
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Remove team membership endpoint.
Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
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. Removing team membership does not delete the user, it just removes their membership from the team.
Note: When you have team synchronization set up for a team with your organization's identity provider (IdP), you will see an error if you attempt to use the API for making changes to the team's membership. If you have access to manage group membership in your IdP, you can manage GitHub team membership through your identity provider, which automatically adds and removes team members in an organization. For more information, see "Synchronizing teams between your identity provider and GitHub."
octokit.teams.removeMembershipLegacy({
team_id,
username
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| username | yes |
username parameter |
See also: GitHub Developer Guide documentation.
Remove team project (Legacy)
This method is deprecated.
Deprecated: This method has been renamed to teams.removeProjectLegacy
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Remove team project endpoint.
Removes an organization project from a team. An organization owner or a team maintainer can remove any project from the team. To remove a project from a team as an organization member, the authenticated user must have read access to both the team and project, or admin access to the team or project. Note: This endpoint removes the project from the team, but does not delete it.
octokit.teams.removeProject({
team_id,
project_id
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| project_id | yes |
project_id parameter |
See also: GitHub Developer Guide documentation.
Remove team project
Removes an organization project from a team. An organization owner or a team maintainer can remove any project from the team. To remove a project from a team as an organization member, the authenticated user must have read access to both the team and project, or admin access to the team or project. This endpoint removes the project from the team, but does not delete the project.
Note: You can also specify a team by org_id and team_id using the route DELETE /organizations/:org_id/team/:team_id/projects/:project_id.
octokit.teams.removeProjectInOrg({
org,
team_slug,
project_id
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| team_slug | yes |
team_slug parameter |
| project_id | yes |
project_id parameter |
See also: GitHub Developer Guide documentation.
Remove team project (Legacy)
This method is deprecated.
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Remove team project endpoint.
Removes an organization project from a team. An organization owner or a team maintainer can remove any project from the team. To remove a project from a team as an organization member, the authenticated user must have read access to both the team and project, or admin access to the team or project. Note: This endpoint removes the project from the team, but does not delete it.
octokit.teams.removeProjectLegacy({
team_id,
project_id
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| project_id | yes |
project_id parameter |
See also: GitHub Developer Guide documentation.
Remove team repository (Legacy)
This method is deprecated.
Deprecated: This method has been renamed to teams.removeRepoLegacy
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Remove team repository endpoint.
If the authenticated user is an organization owner or a team maintainer, they can remove any repositories from the team. To remove a repository from a team as an organization member, the authenticated user must have admin access to the repository and must be able to see the team. NOTE: This does not delete the repository, it just removes it from the team.
octokit.teams.removeRepo({
team_id,
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
Remove team repository
If the authenticated user is an organization owner or a team maintainer, they can remove any repositories from the team. To remove a repository from a team as an organization member, the authenticated user must have admin access to the repository and must be able to see the team. This does not delete the repository, it just removes it from the team.
Note: You can also specify a team by org_id and team_id using the route DELETE /organizations/:org_id/team/:team_id/repos/:owner/:repo.
octokit.teams.removeRepoInOrg({
org,
team_slug,
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| team_slug | yes |
team_slug parameter |
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
Remove team repository (Legacy)
This method is deprecated.
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Remove team repository endpoint.
If the authenticated user is an organization owner or a team maintainer, they can remove any repositories from the team. To remove a repository from a team as an organization member, the authenticated user must have admin access to the repository and must be able to see the team. NOTE: This does not delete the repository, it just removes it from the team.
octokit.teams.removeRepoLegacy({
team_id,
owner,
repo
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| owner | yes |
owner parameter |
| repo | yes |
repo parameter |
See also: GitHub Developer Guide documentation.
Review a team project (Legacy)
This method is deprecated.
Deprecated: This method has been renamed to teams.reviewProjectLegacy
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Review a team project endpoint.
Checks whether a team has read, write, or admin permissions for an organization project. The response includes projects inherited from a parent team.
octokit.teams.reviewProject({
team_id,
project_id
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| project_id | yes |
project_id parameter |
See also: GitHub Developer Guide documentation.
Review a team project
Checks whether a team has read, write, or admin permissions for an organization project. The response includes projects inherited from a parent team.
Note: You can also specify a team by org_id and team_id using the route GET /organizations/:org_id/team/:team_id/projects/:project_id.
octokit.teams.reviewProjectInOrg({
org,
team_slug,
project_id
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| team_slug | yes |
team_slug parameter |
| project_id | yes |
project_id parameter |
See also: GitHub Developer Guide documentation.
Review a team project (Legacy)
This method is deprecated.
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Review a team project endpoint.
Checks whether a team has read, write, or admin permissions for an organization project. The response includes projects inherited from a parent team.
octokit.teams.reviewProjectLegacy({
team_id,
project_id
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| project_id | yes |
project_id parameter |
See also: GitHub Developer Guide documentation.
Edit team (Legacy)
This method is deprecated.
Deprecated: This method has been renamed to teams.updateLegacy
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Edit team endpoint.
To edit a team, the authenticated user must either be an organization owner or a team maintainer.
Note: With nested teams, the privacy for parent teams cannot be secret.
octokit.teams.update({
team_id,
name
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| name | yes |
The name of the team. |
| description | no |
The description of the team. |
| privacy | no |
The level of privacy this team should have. Editing teams without specifying this parameter leaves |
| permission | no |
Deprecated. The permission that new repositories will be added to the team with when none is specified. Can be one of: |
| parent_team_id | no |
The ID of a team to set as the parent team. |
See also: GitHub Developer Guide documentation.
Edit a discussion (Legacy)
This method is deprecated.
Deprecated: This method has been renamed to teams.updateDiscussionLegacy
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Edit a discussion endpoint.
Edits the title and body text of a discussion post. Only the parameters you provide are updated. OAuth access tokens require the write:discussion scope.
octokit.teams.updateDiscussion({
team_id,
discussion_number
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| discussion_number | yes |
discussion_number parameter |
| title | no |
The discussion post's title. |
| body | no |
The discussion post's body text. |
See also: GitHub Developer Guide documentation.
Edit a comment (Legacy)
This method is deprecated.
Deprecated: This method has been renamed to teams.updateDiscussionCommentLegacy
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Edit a comment endpoint.
Edits the body text of a discussion comment. OAuth access tokens require the write:discussion scope.
octokit.teams.updateDiscussionComment({
team_id,
discussion_number,
comment_number,
body
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| discussion_number | yes |
discussion_number parameter |
| comment_number | yes |
comment_number parameter |
| body | yes |
The discussion comment's body text. |
See also: GitHub Developer Guide documentation.
Edit a comment
Edits the body text of a discussion comment. OAuth access tokens require the write:discussion scope.
Note: You can also specify a team by org_id and team_id using the route PATCH /organizations/:org_id/team/:team_id/discussions/:discussion_number/comments/:comment_number.
octokit.teams.updateDiscussionCommentInOrg({
org,
team_slug,
discussion_number,
comment_number,
body
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| team_slug | yes |
team_slug parameter |
| discussion_number | yes |
discussion_number parameter |
| comment_number | yes |
comment_number parameter |
| body | yes |
The discussion comment's body text. |
See also: GitHub Developer Guide documentation.
Edit a comment (Legacy)
This method is deprecated.
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Edit a comment endpoint.
Edits the body text of a discussion comment. OAuth access tokens require the write:discussion scope.
octokit.teams.updateDiscussionCommentLegacy({
team_id,
discussion_number,
comment_number,
body
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| discussion_number | yes |
discussion_number parameter |
| comment_number | yes |
comment_number parameter |
| body | yes |
The discussion comment's body text. |
See also: GitHub Developer Guide documentation.
Edit a discussion
Edits the title and body text of a discussion post. Only the parameters you provide are updated. OAuth access tokens require the write:discussion scope.
Note: You can also specify a team by org_id and team_id using the route PATCH /organizations/:org_id/team/:team_id/discussions/:discussion_number.
octokit.teams.updateDiscussionInOrg({
org,
team_slug,
discussion_number
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| team_slug | yes |
team_slug parameter |
| discussion_number | yes |
discussion_number parameter |
| title | no |
The discussion post's title. |
| body | no |
The discussion post's body text. |
See also: GitHub Developer Guide documentation.
Edit a discussion (Legacy)
This method is deprecated.
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Edit a discussion endpoint.
Edits the title and body text of a discussion post. Only the parameters you provide are updated. OAuth access tokens require the write:discussion scope.
octokit.teams.updateDiscussionLegacy({
team_id,
discussion_number
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| discussion_number | yes |
discussion_number parameter |
| title | no |
The discussion post's title. |
| body | no |
The discussion post's body text. |
See also: GitHub Developer Guide documentation.
Edit team
To edit a team, the authenticated user must either be an organization owner or a team maintainer.
Note: You can also specify a team by org_id and team_id using the route PATCH /organizations/:org_id/team/:team_id.
octokit.teams.updateInOrg({
org,
team_slug,
name
});Parameters
| name | required | description |
|---|---|---|
| org | yes |
org parameter |
| team_slug | yes |
team_slug parameter |
| name | yes |
The name of the team. |
| description | no |
The description of the team. |
| privacy | no |
The level of privacy this team should have. Editing teams without specifying this parameter leaves |
| permission | no |
Deprecated. The permission that new repositories will be added to the team with when none is specified. Can be one of: |
| parent_team_id | no |
The ID of a team to set as the parent team. |
See also: GitHub Developer Guide documentation.
Edit team (Legacy)
This method is deprecated.
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Edit team endpoint.
To edit a team, the authenticated user must either be an organization owner or a team maintainer.
Note: With nested teams, the privacy for parent teams cannot be secret.
octokit.teams.updateLegacy({
team_id,
name
});Parameters
| name | required | description |
|---|---|---|
| team_id | yes |
team_id parameter |
| name | yes |
The name of the team. |
| description | no |
The description of the team. |
| privacy | no |
The level of privacy this team should have. Editing teams without specifying this parameter leaves |
| permission | no |
Deprecated. The permission that new repositories will be added to the team with when none is specified. Can be one of: |
| parent_team_id | no |
The ID of a team to set as the parent team. |
See also: GitHub Developer Guide documentation.
Users
Add email address(es)
This endpoint is accessible with the user scope.
octokit.users.addEmails({
emails
});Parameters
| name | required | description |
|---|---|---|
| emails | yes |
Adds one or more email addresses to your GitHub account. Must contain at least one email address. Note: Alternatively, you can pass a single email address or an |
See also: GitHub Developer Guide documentation.
Block a user
octokit.users.block({
username
});Parameters
| name | required | description |
|---|---|---|
| username | yes |
username parameter |
See also: GitHub Developer Guide documentation.
Check whether you've blocked a user
If the user is blocked:
If the user is not blocked:
octokit.users.checkBlocked({
username
});Parameters
| name | required | description |
|---|---|---|
| username | yes |
username parameter |
See also: GitHub Developer Guide documentation.
Check if you are following a user
octokit.users.checkFollowing({
username
});Parameters
| name | required | description |
|---|---|---|
| username | yes |
username parameter |
See also: GitHub Developer Guide documentation.
Check if one user follows another
octokit.users.checkFollowingForUser({
username,
target_user
});Parameters
| name | required | description |
|---|---|---|
| username | yes |
username parameter |
| target_user | yes |
target_user parameter |
See also: GitHub Developer Guide documentation.
Create a GPG key
Adds a GPG key to the authenticated user's GitHub account. Requires that you are authenticated via Basic Auth, or OAuth with at least write:gpg_key scope.
octokit.users.createGpgKey();Parameters
| name | required | description |
|---|---|---|
| armored_public_key | no |
Your GPG key, generated in ASCII-armored format. See "Generating a new GPG key" for help creating a GPG key. |
See also: GitHub Developer Guide documentation.
Create a public key
Adds a public SSH key to the authenticated user's GitHub account. Requires that you are authenticated via Basic Auth, or OAuth with at least write:public_key scope.
octokit.users.createPublicKey();Parameters
| name | required | description |
|---|---|---|
| title | no |
A descriptive name for the new key. Use a name that will help you recognize this key in your GitHub account. For example, if you're using a personal Mac, you might call this key "Personal MacBook Air". |
| key | no |
The public SSH key to add to your GitHub account. See "Generating a new SSH key" for guidance on how to create a public SSH key. |
See also: GitHub Developer Guide documentation.
Delete email address(es)
This endpoint is accessible with the user scope.
octokit.users.deleteEmails({
emails
});Parameters
| name | required | description |
|---|---|---|
| emails | yes |
Deletes one or more email addresses from your GitHub account. Must contain at least one email address. Note: Alternatively, you can pass a single email address or an |
See also: GitHub Developer Guide documentation.
Delete a GPG key
Removes a GPG key from the authenticated user's GitHub account. Requires that you are authenticated via Basic Auth or via OAuth with at least admin:gpg_key scope.
octokit.users.deleteGpgKey({
gpg_key_id
});Parameters
| name | required | description |
|---|---|---|
| gpg_key_id | yes |
gpg_key_id parameter |
See also: GitHub Developer Guide documentation.
Delete a public key
Removes a public SSH key from the authenticated user's GitHub account. Requires that you are authenticated via Basic Auth or via OAuth with at least admin:public_key scope.
octokit.users.deletePublicKey({
key_id
});Parameters
| name | required | description |
|---|---|---|
| key_id | yes |
key_id parameter |
See also: GitHub Developer Guide documentation.
Follow a user
Note that you'll need to set Content-Length to zero when calling out to this endpoint. For more information, see "HTTP verbs."
Following a user requires the user to be logged in and authenticated with basic auth or OAuth with the user:follow scope.
octokit.users.follow({
username
});Parameters
| name | required | description |
|---|---|---|
| username | yes |
username parameter |
See also: GitHub Developer Guide documentation.
Get the authenticated user
Lists public and private profile information when authenticated through basic auth or OAuth with the user scope.
Lists public profile information when authenticated through OAuth without the user scope.
octokit.users.getAuthenticated();Parameters
This endpoint has no parameters
See also: GitHub Developer Guide documentation.
Get a single user
Provides publicly available information about someone with a GitHub account.
GitHub Apps with the Plan user permission can use this endpoint to retrieve information about a user's GitHub plan. The GitHub App must be authenticated as a user. See "Identifying and authorizing users for GitHub Apps" for details about authentication. For an example response, see "Response with GitHub plan information."
The email key in the following response is the publicly visible email address from your GitHub profile page. When setting up your profile, you can select a primary email address to be “public” which provides an email entry for this endpoint. If you do not set a public email address for email, then it will have a value of null. You only see publicly visible email addresses when authenticated with GitHub. For more information, see Authentication.
The Emails API enables you to list all of your email addresses, and toggle a primary email to be visible publicly. For more information, see "Emails API".
octokit.users.getByUsername({
username
});Parameters
| name | required | description |
|---|---|---|
| username | yes |
username parameter |
See also: GitHub Developer Guide documentation.
Get contextual information about a user
Provides hovercard information when authenticated through basic auth or OAuth with the repo scope. You can find out more about someone in relation to their pull requests, issues, repositories, and organizations.
The subject_type and subject_id parameters provide context for the person's hovercard, which returns more information than without the parameters. For example, if you wanted to find out more about octocat who owns the Spoon-Knife repository via cURL, it would look like this:
octokit.users.getContextForUser({
username
});Parameters
| name | required | description |
|---|---|---|
| username | yes |
username parameter |
| subject_type | no |
Identifies which additional information you'd like to receive about the person's hovercard. Can be |
| subject_id | no |
Uses the ID for the |
See also: GitHub Developer Guide documentation.
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.
octokit.users.getGpgKey({
gpg_key_id
});Parameters
| name | required | description |
|---|---|---|
| gpg_key_id | yes |
gpg_key_id parameter |
See also: GitHub Developer Guide documentation.
Get a single public key
View extended details for a single public SSH key. Requires that you are authenticated via Basic Auth or via OAuth with at least read:public_key scope.
octokit.users.getPublicKey({
key_id
});Parameters
| name | required | description |
|---|---|---|
| key_id | yes |
key_id parameter |
See also: GitHub Developer Guide documentation.
Get all users
Lists all users, in the order that they signed up on GitHub. This list includes personal user accounts and organization accounts.
Note: Pagination is powered exclusively by the since parameter. Use the Link header to get the URL for the next page of users.
octokit.users.list();Parameters
| name | required | description |
|---|---|---|
| since | no |
The integer ID of the last User that you've seen. |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List blocked users
List the users you've blocked on your personal account.
octokit.users.listBlocked();Parameters
This endpoint has no parameters
See also: GitHub Developer Guide documentation.
List email addresses for a user
Lists all of your email addresses, and specifies which one is visible to the public. This endpoint is accessible with the user:email scope.
octokit.users.listEmails();Parameters
| name | required | description |
|---|---|---|
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List the authenticated user's followers
octokit.users.listFollowersForAuthenticatedUser();Parameters
| name | required | description |
|---|---|---|
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List a user's followers
octokit.users.listFollowersForUser({
username
});Parameters
| name | required | description |
|---|---|---|
| username | yes |
username parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List who the authenticated user is following
octokit.users.listFollowingForAuthenticatedUser();Parameters
| name | required | description |
|---|---|---|
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List who a user is following
octokit.users.listFollowingForUser({
username
});Parameters
| name | required | description |
|---|---|---|
| username | yes |
username parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List your 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.
octokit.users.listGpgKeys();Parameters
| name | required | description |
|---|---|---|
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List GPG keys for a user
Lists the GPG keys for a user. This information is accessible by anyone.
octokit.users.listGpgKeysForUser({
username
});Parameters
| name | required | description |
|---|---|---|
| username | yes |
username parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List public email addresses for a user
Lists your publicly visible email address, which you can set with the Toggle primary email visibility endpoint. This endpoint is accessible with the user:email scope.
octokit.users.listPublicEmails();Parameters
| name | required | description |
|---|---|---|
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List your public keys
Lists the public SSH keys for the authenticated user's GitHub account. Requires that you are authenticated via Basic Auth or via OAuth with at least read:public_key scope.
octokit.users.listPublicKeys();Parameters
| name | required | description |
|---|---|---|
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List public keys for a user
Lists the verified public SSH keys for a user. This is accessible by anyone.
octokit.users.listPublicKeysForUser({
username
});Parameters
| name | required | description |
|---|---|---|
| username | yes |
username parameter |
| per_page | no |
Results per page (max 100) |
| page | no |
Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
Toggle primary email visibility
Sets the visibility for your primary email addresses.
octokit.users.togglePrimaryEmailVisibility({
email,
visibility
});Parameters
| name | required | description |
|---|---|---|
| yes |
Specify the primary email address that needs a visibility change. | |
| visibility | yes |
Use |
See also: GitHub Developer Guide documentation.
Unblock a user
octokit.users.unblock({
username
});Parameters
| name | required | description |
|---|---|---|
| username | yes |
username parameter |
See also: GitHub Developer Guide documentation.
Unfollow a user
Unfollowing a user requires the user to be logged in and authenticated with basic auth or OAuth with the user:follow scope.
octokit.users.unfollow({
username
});Parameters
| name | required | description |
|---|---|---|
| username | yes |
username parameter |
See also: GitHub Developer Guide documentation.
Update the authenticated user
Note: If your email is set to private and you send an email parameter as part of this request to update your profile, your privacy settings are still enforced: the email address will not be displayed on your public profile or via the API.
octokit.users.updateAuthenticated();Parameters
| name | required | description |
|---|---|---|
| name | no |
The new name of the user. |
| no |
The publicly visible email address of the user. | |
| blog | no |
The new blog URL of the user. |
| company | no |
The new company of the user. |
| location | no |
The new location of the user. |
| hireable | no |
The new hiring availability of the user. |
| bio | no |
The new short biography of the user. |
See also: GitHub Developer Guide documentation.