Client library
GitBook's official Node.js client library.
Last updated
Was this helpful?
GitBook's official Node.js client library.
Last updated
Was this helpful?
Was this helpful?
When using the @gitbook/api
module with Node.js < v18, you should pass a custom fetch
function.
You can install one using the node-fetch
module.
The following methods can be found on the client.search
object.
searchContent()
askQuery()
The following methods can be found on the client.user
object.
getAuthenticatedUser()
listSpacesForAuthenticatedUser()
The following methods can be found on the client.users
object.
getUserById()
The following methods can be found on the client.spaces
object.
getSpaceById()
searchSpaceContent()
askQueryInSpace()
importGitRepository()
exportToGitRepository()
getContentAnalyticsForSpaceById()
getSearchAnalyticsForSpaceById()
getTrafficAnalyticsForSpaceById()
trackViewInSpaceById()
getCurrentRevision()
importContent()
The following methods can be found on the client.collections
object.
getCollectionById()
listSpacesInCollectionById()
listPermissionsAggregateInCollection()
The following methods can be found on the client.integrations
object.
listIntegrations()
getIntegrationByName()
publishIntegration()
unpublishIntegration()
listIntegrationInstallations()
listIntegrationSpaceInstallations()
renderIntegrationUiWithGet()
renderIntegrationUiWithPost()
updateIntegrationInstallation()
createIntegrationInstallationToken()
updateIntegrationSpaceInstallation()
The following methods can be found on the client.orgs
object.
listOrganizationsForAuthenticatedUser()
listMembersInOrganizationById()
getMemberInOrganizationById()
updateMemberInOrganizationById()
removeMemberFromOrganizationById()
setUserAsSsoMemberForOrganization()
listSpacesForOrganizationMember()
listTeamsInOrganizationById()
createOrganizationTeam()
getTeamInOrganizationById()
updateTeamInOrganizationById()
The following methods can be found on the client.urls
object.
getContentByUrl()
npm install @gitbook/api
import { GitBookAPI } from '@gitbook/api';
const client = new GitBookAPI({
authToken: <your_access_token>
});
import { GitBookAPI } from '@gitbook/api';
import fetch from 'node-fetch';
const client = new GitBookAPI({
customFetch: fetch
});
listFiles()
getPageById()
importContentInPageById()
getPageByPath()
createChangeRequest()
mergeChangeRequest()
updateChangeRequest()
getRevisionOfChangeRequestById()
importContentInChangeRequest()
listFilesInChangeRequestById()
getPageInChangeRequestById()
importContentInChangeRequestPageById()
getPageInChangeRequestByPath()
getRevisionById()
listFilesInRevisionById()
getPageInRevisionById()
getPageInRevisionByPath()
listPermissionsAggregateInSpace()
removeTeamFromOrganizationById()
updateMembersInOrganizationTeam()
listTeamMembersInOrganizationById()
addMemberToOrganizationTeamById()
deleteMemberFromOrganizationTeamById()
inviteUsersToOrganization()
joinOrganizationWithInvite()
upgradeOrganizationPlan()
getOrganizationBillingPortal()
requestOrganizationUpgrade()
transferOrganization()
searchOrganizationContent()
listSpacesInOrganizationById()
listCollectionsInOrganizationById()
setupDirectorySync()
listDirectorySyncGroups()
syncDirectorySyncGroupsToTeams()