Spaces
Create, maintain, and remove content spaces.
Spaces are containers for your documentation or knowledge base content. Use this API to create new spaces, manage existing ones, and delete or archive spaces you no longer need.
Type of Object, always equals to "space"
Unique identifier for the space
Title of the space
An emoji for this space. It'll match the emoji shown in the GitBook app.
🎉
public
: Anyone can access the content, and the content is indexed by search engines.unlisted
: Anyone can access the content, and the content is not indexed by search enginesshare-link
: Anyone with a secret token in the url can access the content.visitor-auth
: Anyone authenticated through a JWT token can access the content.in-collection
: Anyone who can access the parent collection can access the content. Only available for spaces in a collection.private
: Authorized members can access the content.
Determines how a Space can be edited.
live
: Users can directly edit the spacelocked
: All edits are locked for this space.
ID of the organization owning this space
ID of the parent collection.
ID of the active revision in the space.
Default level for a piece of content
"The role of a member in an organization. "admin": Can administrate the content: create, delete spaces, ... "create": Can create content. "review": Can review content. "edit": Can edit the content (live or change requests). "comment": Can access the content and its discussions. "read": Can access the content, but cannot update it in any way.
Count of opened comments on the space.
Total count of change requests on the space.
Count of open change requests on the space.
Count of draft change requests on the space.
The Space object
{
"object": "space",
"id": "text",
"title": "text",
"emoji": "🎉",
"visibility": "public",
"createdAt": "2025-06-21T02:26:33.714Z",
"updatedAt": "2025-06-21T02:26:33.714Z",
"deletedAt": "2025-06-21T02:26:33.714Z",
"editMode": "live",
"urls": {
"location": "https://example.com",
"app": "https://example.com",
"published": "https://example.com",
"public": "https://example.com",
"icon": "https://example.com"
},
"organization": "text",
"parent": "text",
"gitSync": {
"repoName": "text",
"installationProvider": "github",
"integration": "text",
"url": "text",
"updatedAt": "2025-06-21T02:26:33.714Z"
},
"visitorAuth": {
"backend": "custom"
},
"revision": "text",
"defaultLevel": "admin",
"comments": 1,
"changeRequests": 1,
"changeRequestsOpen": 1,
"changeRequestsDraft": 1,
"permissions": {
"view": true,
"access": true,
"admin": true,
"viewInviteLinks": true,
"edit": true,
"triggerGitSync": true,
"comment": true,
"merge": true,
"review": true
}
}
The unique id of the space
For sites published via share-links, the share key is useful to resolve published URLs.
GET /v1/spaces/{spaceId} HTTP/1.1
Host: api.gitbook.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
OK
{
"object": "space",
"id": "text",
"title": "text",
"emoji": "🎉",
"visibility": "public",
"createdAt": "2025-06-21T02:26:33.714Z",
"updatedAt": "2025-06-21T02:26:33.714Z",
"deletedAt": "2025-06-21T02:26:33.714Z",
"editMode": "live",
"urls": {
"location": "https://example.com",
"app": "https://example.com",
"published": "https://example.com",
"public": "https://example.com",
"icon": "https://example.com"
},
"organization": "text",
"parent": "text",
"gitSync": {
"repoName": "text",
"installationProvider": "github",
"integration": "text",
"url": "text",
"updatedAt": "2025-06-21T02:26:33.714Z"
},
"visitorAuth": {
"backend": "custom"
},
"revision": "text",
"defaultLevel": "admin",
"comments": 1,
"changeRequests": 1,
"changeRequestsOpen": 1,
"changeRequestsDraft": 1,
"permissions": {
"view": true,
"access": true,
"admin": true,
"viewInviteLinks": true,
"edit": true,
"triggerGitSync": true,
"comment": true,
"merge": true,
"review": true
}
}
Deleted spaces will be permanently removed after 7 days.
The unique id of the space
DELETE /v1/spaces/{spaceId} HTTP/1.1
Host: api.gitbook.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
Space has been deleted
No content
The unique id of the space
PATCH /v1/spaces/{spaceId} HTTP/1.1
Host: api.gitbook.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 72
{
"editMode": "live",
"title": "text",
"defaultLevel": "admin",
"emoji": "🎉"
}
The space has been updated
{
"object": "space",
"id": "text",
"title": "text",
"emoji": "🎉",
"visibility": "public",
"createdAt": "2025-06-21T02:26:33.714Z",
"updatedAt": "2025-06-21T02:26:33.714Z",
"deletedAt": "2025-06-21T02:26:33.714Z",
"editMode": "live",
"urls": {
"location": "https://example.com",
"app": "https://example.com",
"published": "https://example.com",
"public": "https://example.com",
"icon": "https://example.com"
},
"organization": "text",
"parent": "text",
"gitSync": {
"repoName": "text",
"installationProvider": "github",
"integration": "text",
"url": "text",
"updatedAt": "2025-06-21T02:26:33.714Z"
},
"visitorAuth": {
"backend": "custom"
},
"revision": "text",
"defaultLevel": "admin",
"comments": 1,
"changeRequests": 1,
"changeRequestsOpen": 1,
"changeRequestsDraft": 1,
"permissions": {
"view": true,
"access": true,
"admin": true,
"viewInviteLinks": true,
"edit": true,
"triggerGitSync": true,
"comment": true,
"merge": true,
"review": true
}
}
The unique id of the space
POST /v1/spaces/{spaceId}/duplicate HTTP/1.1
Host: api.gitbook.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
Space duplicated
{
"object": "space",
"id": "text",
"title": "text",
"emoji": "🎉",
"visibility": "public",
"createdAt": "2025-06-21T02:26:33.714Z",
"updatedAt": "2025-06-21T02:26:33.714Z",
"deletedAt": "2025-06-21T02:26:33.714Z",
"editMode": "live",
"urls": {
"location": "https://example.com",
"app": "https://example.com",
"published": "https://example.com",
"public": "https://example.com",
"icon": "https://example.com"
},
"organization": "text",
"parent": "text",
"gitSync": {
"repoName": "text",
"installationProvider": "github",
"integration": "text",
"url": "text",
"updatedAt": "2025-06-21T02:26:33.714Z"
},
"visitorAuth": {
"backend": "custom"
},
"revision": "text",
"defaultLevel": "admin",
"comments": 1,
"changeRequests": 1,
"changeRequestsOpen": 1,
"changeRequestsDraft": 1,
"permissions": {
"view": true,
"access": true,
"admin": true,
"viewInviteLinks": true,
"edit": true,
"triggerGitSync": true,
"comment": true,
"merge": true,
"review": true
}
}
Only spaces deleted in the last 7 days can be restored.
The unique id of the space
POST /v1/spaces/{spaceId}/restore HTTP/1.1
Host: api.gitbook.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
Space restored
{
"object": "space",
"id": "text",
"title": "text",
"emoji": "🎉",
"visibility": "public",
"createdAt": "2025-06-21T02:26:33.714Z",
"updatedAt": "2025-06-21T02:26:33.714Z",
"deletedAt": "2025-06-21T02:26:33.714Z",
"editMode": "live",
"urls": {
"location": "https://example.com",
"app": "https://example.com",
"published": "https://example.com",
"public": "https://example.com",
"icon": "https://example.com"
},
"organization": "text",
"parent": "text",
"gitSync": {
"repoName": "text",
"installationProvider": "github",
"integration": "text",
"url": "text",
"updatedAt": "2025-06-21T02:26:33.714Z"
},
"visitorAuth": {
"backend": "custom"
},
"revision": "text",
"defaultLevel": "admin",
"comments": 1,
"changeRequests": 1,
"changeRequestsOpen": 1,
"changeRequestsDraft": 1,
"permissions": {
"view": true,
"access": true,
"admin": true,
"viewInviteLinks": true,
"edit": true,
"triggerGitSync": true,
"comment": true,
"merge": true,
"review": true
}
}
The unique id of the space
The unique id of the parent collection
POST /v1/spaces/{spaceId}/move HTTP/1.1
Host: api.gitbook.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 111
{
"parent": "text",
"position": {
"before": {
"type": "space",
"space": "text"
},
"after": {
"type": "space",
"space": "text"
}
}
}
{
"object": "space",
"id": "text",
"title": "text",
"emoji": "🎉",
"visibility": "public",
"createdAt": "2025-06-21T02:26:33.714Z",
"updatedAt": "2025-06-21T02:26:33.714Z",
"deletedAt": "2025-06-21T02:26:33.714Z",
"editMode": "live",
"urls": {
"location": "https://example.com",
"app": "https://example.com",
"published": "https://example.com",
"public": "https://example.com",
"icon": "https://example.com"
},
"organization": "text",
"parent": "text",
"gitSync": {
"repoName": "text",
"installationProvider": "github",
"integration": "text",
"url": "text",
"updatedAt": "2025-06-21T02:26:33.714Z"
},
"visitorAuth": {
"backend": "custom"
},
"revision": "text",
"defaultLevel": "admin",
"comments": 1,
"changeRequests": 1,
"changeRequestsOpen": 1,
"changeRequestsDraft": 1,
"permissions": {
"view": true,
"access": true,
"admin": true,
"viewInviteLinks": true,
"edit": true,
"triggerGitSync": true,
"comment": true,
"merge": true,
"review": true
}
}
Transfer a space to another organization, collection or both.
The unique id of the space
The unique id of the target organization
POST /v1/spaces/{spaceId}/transfer HTTP/1.1
Host: api.gitbook.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 23
{
"organization": "text"
}
{
"object": "space",
"id": "text",
"title": "text",
"emoji": "🎉",
"visibility": "public",
"createdAt": "2025-06-21T02:26:33.714Z",
"updatedAt": "2025-06-21T02:26:33.714Z",
"deletedAt": "2025-06-21T02:26:33.714Z",
"editMode": "live",
"urls": {
"location": "https://example.com",
"app": "https://example.com",
"published": "https://example.com",
"public": "https://example.com",
"icon": "https://example.com"
},
"organization": "text",
"parent": "text",
"gitSync": {
"repoName": "text",
"installationProvider": "github",
"integration": "text",
"url": "text",
"updatedAt": "2025-06-21T02:26:33.714Z"
},
"visitorAuth": {
"backend": "custom"
},
"revision": "text",
"defaultLevel": "admin",
"comments": 1,
"changeRequests": 1,
"changeRequestsOpen": 1,
"changeRequestsDraft": 1,
"permissions": {
"view": true,
"access": true,
"admin": true,
"viewInviteLinks": true,
"edit": true,
"triggerGitSync": true,
"comment": true,
"merge": true,
"review": true
}
}
The unique id of the space
Identifier of the page results to fetch.
The number of results per page
Text to display to represent the reference. Possible values include:
ok
- No problems detected for this content reference.broken
- The target does not exist in the revision.in-app
- The target is a URL link pointing to an internal location in the app.
GET /v1/spaces/{spaceId}/links HTTP/1.1
Host: api.gitbook.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"next": {
"page": "text"
},
"count": 1,
"stats": {
"total": 1,
"broken": {
"total": 1,
"changeRequest": 1
}
},
"items": [
{
"status": "ok",
"relation": "reference",
"targetReference": {
"kind": "file",
"organization": {
"object": "organization",
"id": "text",
"title": "text",
"createdAt": "2025-06-21T02:26:33.714Z",
"emailDomains": [
"text"
],
"hostname": "text",
"type": "business",
"useCase": "internalDocs",
"communityType": "nonProfit",
"defaultRole": "admin",
"defaultContent": {
"type": "site",
"site": "text"
},
"sso": true,
"ai": true,
"inviteLinks": true,
"plan": "free_2024",
"billing": {
"interval": "monthly",
"endDate": "2025-06-21T02:26:33.714Z",
"hasPaymentFailed": true,
"isScheduledToCancel": true
},
"urls": {
"location": "https://example.com",
"app": "https://example.com",
"logo": "https://example.com"
},
"trial": {
"status": "notapplicable",
"endDate": "2025-06-21T02:26:33.714Z",
"decision": "downgrade"
},
"customHostname": "text",
"blocked": {
"reason": "security"
},
"internal_billingMigration": {
"deadline": "2025-06-21T02:26:33.714Z",
"discountPercent": 1,
"discountEndDate": "2025-06-21T02:26:33.714Z"
},
"permissions": {
"view": true,
"admin": true,
"ownTeam": true,
"createContent": true,
"createOpenAPISpec": true,
"ingestConversations": true,
"viewBilling": true,
"listMembers": true,
"listTeams": true,
"listIntegrations": true
}
},
"space": {
"object": "space",
"id": "text",
"title": "text",
"emoji": "🎉",
"visibility": "public",
"createdAt": "2025-06-21T02:26:33.714Z",
"updatedAt": "2025-06-21T02:26:33.714Z",
"deletedAt": "2025-06-21T02:26:33.714Z",
"editMode": "live",
"urls": {
"location": "https://example.com",
"app": "https://example.com",
"published": "https://example.com",
"public": "https://example.com",
"icon": "https://example.com"
},
"organization": "text",
"parent": "text",
"gitSync": {
"repoName": "text",
"installationProvider": "github",
"integration": "text",
"url": "text",
"updatedAt": "2025-06-21T02:26:33.714Z"
},
"visitorAuth": {
"backend": "custom"
},
"revision": "text",
"defaultLevel": "admin",
"comments": 1,
"changeRequests": 1,
"changeRequestsOpen": 1,
"changeRequestsDraft": 1,
"permissions": {
"view": true,
"access": true,
"admin": true,
"viewInviteLinks": true,
"edit": true,
"triggerGitSync": true,
"comment": true,
"merge": true,
"review": true
}
},
"versionContext": "[Circular Reference]",
"file": {
"id": "text",
"name": "text",
"contentType": "text",
"downloadURL": "text",
"size": 1,
"dimensions": {
"width": 1,
"height": 1
},
"git": {
"oid": "text",
"path": "text"
}
}
},
"locationReferences": [
{
"kind": "file",
"organization": {
"object": "organization",
"id": "text",
"title": "text",
"createdAt": "2025-06-21T02:26:33.714Z",
"emailDomains": [
"text"
],
"hostname": "text",
"type": "business",
"useCase": "internalDocs",
"communityType": "nonProfit",
"defaultRole": "admin",
"defaultContent": {
"type": "site",
"site": "text"
},
"sso": true,
"ai": true,
"inviteLinks": true,
"plan": "free_2024",
"billing": {
"interval": "monthly",
"endDate": "2025-06-21T02:26:33.714Z",
"hasPaymentFailed": true,
"isScheduledToCancel": true
},
"urls": {
"location": "https://example.com",
"app": "https://example.com",
"logo": "https://example.com"
},
"trial": {
"status": "notapplicable",
"endDate": "2025-06-21T02:26:33.714Z",
"decision": "downgrade"
},
"customHostname": "text",
"blocked": {
"reason": "security"
},
"internal_billingMigration": {
"deadline": "2025-06-21T02:26:33.714Z",
"discountPercent": 1,
"discountEndDate": "2025-06-21T02:26:33.714Z"
},
"permissions": {
"view": true,
"admin": true,
"ownTeam": true,
"createContent": true,
"createOpenAPISpec": true,
"ingestConversations": true,
"viewBilling": true,
"listMembers": true,
"listTeams": true,
"listIntegrations": true
}
},
"space": {
"object": "space",
"id": "text",
"title": "text",
"emoji": "🎉",
"visibility": "public",
"createdAt": "2025-06-21T02:26:33.714Z",
"updatedAt": "2025-06-21T02:26:33.714Z",
"deletedAt": "2025-06-21T02:26:33.714Z",
"editMode": "live",
"urls": {
"location": "https://example.com",
"app": "https://example.com",
"published": "https://example.com",
"public": "https://example.com",
"icon": "https://example.com"
},
"organization": "text",
"parent": "text",
"gitSync": {
"repoName": "text",
"installationProvider": "github",
"integration": "text",
"url": "text",
"updatedAt": "2025-06-21T02:26:33.714Z"
},
"visitorAuth": {
"backend": "custom"
},
"revision": "text",
"defaultLevel": "admin",
"comments": 1,
"changeRequests": 1,
"changeRequestsOpen": 1,
"changeRequestsDraft": 1,
"permissions": {
"view": true,
"access": true,
"admin": true,
"viewInviteLinks": true,
"edit": true,
"triggerGitSync": true,
"comment": true,
"merge": true,
"review": true
}
},
"versionContext": "[Circular Reference]",
"file": {
"id": "text",
"name": "text",
"contentType": "text",
"downloadURL": "text",
"size": 1,
"dimensions": {
"width": 1,
"height": 1
},
"git": {
"oid": "text",
"path": "text"
}
}
}
]
}
]
}
The unique id of the organization
Identifier of the page results to fetch.
The number of results per page
GET /v1/orgs/{organizationId}/spaces HTTP/1.1
Host: api.gitbook.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
OK
{
"next": {
"page": "text"
},
"count": 1,
"items": [
{
"object": "space",
"id": "text",
"title": "text",
"emoji": "🎉",
"visibility": "public",
"createdAt": "2025-06-21T02:26:33.714Z",
"updatedAt": "2025-06-21T02:26:33.714Z",
"deletedAt": "2025-06-21T02:26:33.714Z",
"editMode": "live",
"urls": {
"location": "https://example.com",
"app": "https://example.com",
"published": "https://example.com",
"public": "https://example.com",
"icon": "https://example.com"
},
"organization": "text",
"parent": "text",
"gitSync": {
"repoName": "text",
"installationProvider": "github",
"integration": "text",
"url": "text",
"updatedAt": "2025-06-21T02:26:33.714Z"
},
"visitorAuth": {
"backend": "custom"
},
"revision": "text",
"defaultLevel": "admin",
"comments": 1,
"changeRequests": 1,
"changeRequestsOpen": 1,
"changeRequestsDraft": 1,
"permissions": {
"view": true,
"access": true,
"admin": true,
"viewInviteLinks": true,
"edit": true,
"triggerGitSync": true,
"comment": true,
"merge": true,
"review": true
}
}
]
}
The unique id of the organization
Unicode codepoint or character of the emoji
🎉
ID of a parent collection
POST /v1/orgs/{organizationId}/spaces HTTP/1.1
Host: api.gitbook.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 47
{
"title": "text",
"emoji": "🎉",
"parent": "text"
}
Space created
{
"object": "space",
"id": "text",
"title": "text",
"emoji": "🎉",
"visibility": "public",
"createdAt": "2025-06-21T02:26:33.714Z",
"updatedAt": "2025-06-21T02:26:33.714Z",
"deletedAt": "2025-06-21T02:26:33.714Z",
"editMode": "live",
"urls": {
"location": "https://example.com",
"app": "https://example.com",
"published": "https://example.com",
"public": "https://example.com",
"icon": "https://example.com"
},
"organization": "text",
"parent": "text",
"gitSync": {
"repoName": "text",
"installationProvider": "github",
"integration": "text",
"url": "text",
"updatedAt": "2025-06-21T02:26:33.714Z"
},
"visitorAuth": {
"backend": "custom"
},
"revision": "text",
"defaultLevel": "admin",
"comments": 1,
"changeRequests": 1,
"changeRequestsOpen": 1,
"changeRequestsDraft": 1,
"permissions": {
"view": true,
"access": true,
"admin": true,
"viewInviteLinks": true,
"edit": true,
"triggerGitSync": true,
"comment": true,
"merge": true,
"review": true
}
}
Was this helpful?