@octokit/rest
22.0.1 · 31 Oct 2025MIT27.9M / weekRepositoryHomepagenpmAtom feed
17.11.2 is the newest release of 17.x.
In short
10 breaking5 new1 changed
- Breaking
All deprecated methods and options have been removed. Upgrade to the latest
16.x.xversion and address all deprecation messages for an easy upgrade. - Breaking
octokit.paginate()is now always returning an array, even when the response is a single object. - Breaking
Parameters passed to endpoint methods such as
octokit.issues.create(parameters)are no longer validated on the client. We recommend using TypeScript or taking advantage of the TypeScript definitions in JavaScript. - Breaking
Plugins have to return an object in order to extend the
octokitinstance. It is technically still possible to alter theoctokitinstance directly, but returning an object is required for TypeScript support - Breaking
octokit.registerEndpoints()has been removed. - Breaking
The
User-Agentheader now includesoctokit-rest.js/X.Y.Zinstead ofoctokit.js/X.Y.Z - Breaking
The
Octokitconstructor must now be invoked withnew.const octokit = Octokit()will throw a TypeError - Breaking
URL parameters such as
options.baseandoptions.headforoctokit.repos.compareCommitsare now URL encoded automatically, you don't need to useencodeURIComponent()before passing the values to the endpoint methods.
Release note
Breaking Changes
- Breaking
All deprecated methods and options have been removed. Upgrade to the latest
16.x.xversion and address all deprecation messages for an easy upgrade.For deprecated endpoint methods that have no replacement use
octokit.requestinstead.octokit.oauthAuthorizations.createAuthorization()
➡octokit.request("POST /authorizations", parameters)
(see deprecation notice)octokit.oauthAuthorizations.deleteAuthorization()
➡octokit.request("DELETE /authorizations/:authorization_id", parameters)
(see deprecation notice)octokit.oauthAuthorizations.deleteGrant()
➡octokit.request("DELETE /applications/grants/:grant_id", parameters)
(see deprecation notice)octokit.oauthAuthorizations.getAuthorization()
➡octokit.request("GET /authorizations/:authorization_id", parameters)
(see deprecation notice)octokit.oauthAuthorizations.getGrant()
➡octokit.request("GET /applications/grants/:grant_id", parameters)
(see deprecation notice)octokit.oauthAuthorizations.getOrCreateAuthorizationForApp()
➡octokit.request("PUT /authorizations/clients/:client_id", parameters)
(see deprecation notice)octokit.oauthAuthorizations.getOrCreateAuthorizationForAppAndFingerprint()
➡octokit.request("PUT /authorizations/clients/:client_id/:fingerprint", parameters)
(see deprecation notice)octokit.oauthAuthorizations.listAuthorizations()
➡octokit.request("GET /authorizations", parameters)
(see deprecation notice)octokit.oauthAuthorizations.listGrants()
➡octokit.request("GET /applications/grants", parameters)
(see deprecation notice)octokit.oauthAuthorizations.updateAuthorization()
➡octokit.request("PATCH /authorizations/:authorization_id", parameters)
(see deprecation notice)octokit.pulls.createFromIssue()
➡octokit.request("POST /repos/:owner/:repo/pulls", parameters)
(see deprecation notice)octokit.repos.getCommitRefSha()
➡octokit.request("GET /repos/:owner/:repo/commits/:ref", parameters)
(see deprecation notice)octokit.teams.addMemberLegacy()
➡octokit.request("PUT /teams/:team_id/members/:username", parameters)
(see deprecation notice)octokit.teams.getLegacy()
➡octokit.request("GET /teams/:team_id", parameters)
(see deprecation notice)octokit.teams.getMemberLegacy()
➡octokit.request("GET /teams/:team_id/members/:username", parameters)
(see deprecation notice)octokit.teams.removeMemberLegacy()
➡octokit.request("DELETE /teams/:team_id/members/:username", parameters)
(see deprecation notice)
Methods have been replaced by new ones, some of which require new parameters
octokit.apps.checkAuthorization()
➡octokit.apps.checkToken()octokit.apps.resetAuthorization()
➡octokit.apps.resetToken()octokit.apps.revokeAuthorizationForApplication()
➡octokit.apps.deleteToken()octokit.apps.revokeGrantForApplication()
➡octokit.apps.deleteAuthorization()octokit.reactions.createForTeamDiscussionLegacy()
➡octokit.reactions.createForTeamDiscussionInOrg()
(An "org" parameter is now required)octokit.reactions.createForTeamDiscussionCommentLegacy()
➡octokit.reactions.createForTeamDiscussionCommentInOrg()
(An "org" parameter is now required)octokit.reactions.listForTeamDiscussionLegacy()
➡octokit.reactions.listForTeamDiscussionInOrg()
(An "org" parameter is now required)octokit.reactions.listForTeamDiscussionCommentLegacy()
➡octokit.reactions.listForTeamDiscussionCommentInOrg()
(An "org" parameter is now required)octokit.teams.addMemberLegacy()
➡octokit.teams.addMemberInOrg()
(An "org" parameter is now required)octokit.teams.addOrUpdateMembershipLegacy()
➡octokit.teams.addOrUpdateMembershipInOrg()
(An "org" parameter is now required)octokit.teams.addOrUpdateProjectLegacy()
➡octokit.teams.addOrUpdateProjectInOrg()
(An "org" parameter is now required)octokit.teams.addOrUpdateRepoLegacy()
➡octokit.teams.addOrUpdateRepoInOrg()
(An "org" parameter is now required)octokit.teams.checkManagesRepoLegacy()
➡octokit.teams.checkManagesRepoInOrg()
(An "org" parameter is now required)octokit.teams.createDiscussionLegacy()
➡octokit.teams.createDiscussionInOrg()
(An "org" parameter is now required)octokit.teams.createDiscussionCommentLegacy()
➡octokit.teams.createDiscussionCommentInOrg()
(An "org" parameter is now required)octokit.teams.deleteLegacy()
➡octokit.teams.deleteInOrg()
(An "org" parameter is now required)octokit.teams.deleteDiscussionLegacy()
➡octokit.teams.deleteDiscussionInOrg()
(An "org" parameter is now required)octokit.teams.deleteDiscussionCommentLegacy()
➡octokit.teams.deleteDiscussionCommentInOrg()
(An "org" parameter is now required)octokit.teams.getLegacy()
➡octokit.teams.getInOrg()
(An "org" parameter is now required)octokit.teams.getDiscussionLegacy()
➡octokit.teams.getDiscussionInOrg()
(An "org" parameter is now required)octokit.teams.getDiscussionCommentLegacy()
➡octokit.teams.getDiscussionCommentInOrg()
(An "org" parameter is now required)octokit.teams.getMemberLegacy()
➡octokit.teams.getMemberInOrg()
(An "org" parameter is now required)octokit.teams.getMembershipLegacy()
➡octokit.teams.getMembershipInOrg()
(An "org" parameter is now required)octokit.teams.listChildLegacy()
➡octokit.teams.listChildInOrg()
(An "org" parameter is now required)octokit.teams.listDiscussionCommentsLegacy()
➡octokit.teams.listDiscussionCommentsInOrg()
(An "org" parameter is now required)octokit.teams.listDiscussionsLegacy()
➡octokit.teams.listDiscussionsInOrg()
(An "org" parameter is now required)octokit.teams.listMembersLegacy()
➡octokit.teams.listMembersInOrg()
(An "org" parameter is now required)octokit.teams.listPendingInvitationsLegacy()
➡octokit.teams.listPendingInvitationsInOrg()
(An "org" parameter is now required)octokit.teams.listProjectsLegacy()
➡octokit.teams.listProjectsInOrg()
(An "org" parameter is now required)octokit.teams.listReposLegacy()
➡octokit.teams.listReposInOrg()
(An "org" parameter is now required)octokit.teams.removeMemberLegacy()
➡octokit.teams.removeMemberInOrg()
(An "org" parameter is now required)octokit.teams.removeMembershipLegacy()
➡octokit.teams.removeMembershipInOrg()
(An "org" parameter is now required)octokit.teams.removeProjectLegacy()
➡octokit.teams.removeProjectInOrg()
(An "org" parameter is now required)octokit.teams.removeRepoLegacy()
➡octokit.teams.removeRepoInOrg()
(An "org" parameter is now required)octokit.teams.reviewProjectLegacy()
➡octokit.teams.reviewProjectInOrg()
(An "org" parameter is now required)octokit.teams.updateLegacy()
➡octokit.teams.updateInOrg()
(An "org" parameter is now required)octokit.teams.updateDiscussionLegacy()
➡octokit.teams.updateDiscussionInOrg()
(An "org" parameter is now required)octokit.teams.updateDiscussionCommentLegacy()
➡octokit.teams.updateDiscussionCommentInOrg()
(An "org" parameter is now required)octokit.issues.updateLabel({current_name, name})
➡octokit.issues.updateLabel({name, new_name})
(current_nameis nowname,nameis nownew_name)
- Breaking
octokit.paginate()is now always returning an array, even when the response is a single object. - Breaking
Parameters passed to endpoint methods such as
octokit.issues.create(parameters)are no longer validated on the client. We recommend using TypeScript or taking advantage of the TypeScript definitions in JavaScript. - Breaking
Plugins have to return an object in order to extend the
octokitinstance. It is technically still possible to alter theoctokitinstance directly, but returning an object is required for TypeScript supportInstead of
function myPlugin(octokit, options) { octokit.helloWorld = () => console.log('Hello, world!') }do
function myPlugin(octokit, options) { return { helloWorld: () => console.log('Hello, world!') } } - Breaking
octokit.registerEndpoints()has been removed.Instead of
await octokit.registerEndpoints({ misc: { getRoot: { method: "GET", url: "/" } } });do
Object.assign(octokit.misc, { getRoot: octokit.request.defaults({ method: "GET", url: "/" }) })If you use
octokit.registerEndpoints()in a plugin, return an object instead:function myPlugin(octokit, options) { return { misc: { octokit.request.defaults({ method: "GET", url: "/" }) } } } - Breaking
The
User-Agentheader now includesoctokit-rest.js/X.Y.Zinstead ofoctokit.js/X.Y.Z - Breaking
The
Octokitconstructor must now be invoked withnew.const octokit = Octokit()will throw a TypeError - Breaking
URL parameters such as
options.baseandoptions.headforoctokit.repos.compareCommitsare now URL encoded automatically, you don't need to useencodeURIComponent()before passing the values to the endpoint methods. - Breaking
Node 8 is no longer supported.
- Breaking
TypeScript: The exportedUpdate: resolved via #1650{ Octokit }is no longer a type, only a value. Usetypeof Octokitinstead #1624
Features
The documentation website is now versioned. octokit.github.io/rest.js/v17/ has the docs for the latest version, the docs for v16 are still accessible at octokit.github.io/rest.js/v16. Old links pointing to octokit.github.io/rest.js should redirect correctly to octokit.github.io/rest.js/v16.
Reduction in bundle size: 23KB down to 10kb
octokit.graphql().@octokit/restis no longer a REST-only library, but a REST best-practice library. All Octokit libraries based on@ocotkit/corehave both.request()and.graphql()methods.octokit.auth(). Async method that returns the currently used authentcation, based on configuredauthStrategy. See github.com/octokit/auth.js for official strategiesoctokit.repos.uploadReleaseAsset(parameters)now accepts URL parametersownerreporelease_id
Passing
urlwill still work, but is not recommended. Useoctokit.requestinstead:octokit.request(url, { method: "POST", ...parameters })
TypeScript
In v16, many types have been exported on the exported Octokit Constructor. Although they were never documented, types such as Octokit.ChecksCreateParams have been used when wrapping Octokit's code in custom logic.
Starting with v17.5.0, parameter and response times are being officially exported. For example:
import { RestEndpointMethodTypes } from "@octokit/rest";
// for `octokit.checks.create()`
RestEndpointMethodTypes["checks"]["create"]["parameters"]
RestEndpointMethodTypes["checks"]["create"]["response"]48,624 lines of code down to 10. As in 10. Not 10,000. 10. Learn more about that on GitHub's blog: From 48k lines of code to 10—the story of GitHub’s JavaScript SDK
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.