API Reference [Sample]

Get information about the state of the GitBook API

get

Access the release version and build date of the GitBook codebase

Authorizations
Responses
200
OK
application/json
get
GET /v1/ HTTP/1.1
Host: api.gitbook.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "version": "text",
  "build": "text"
}
get
Authorizations
Query parameters
querystring ยท max: 512Required
pagestringOptional

Identifier of the page results to fetch.

limitnumber ยท max: 1000Optional

The number of results per page

Responses
200
OK
application/json
Responseall of
get
GET /v1/search HTTP/1.1
Host: api.gitbook.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "next": {
    "page": "text"
  },
  "count": 1,
  "items": [
    {
      "id": "text",
      "title": "text",
      "pages": [
        {
          "id": "text",
          "title": "text",
          "path": "text",
          "sections": [
            {
              "id": "text",
              "title": "text",
              "path": "text",
              "body": "text",
              "urls": {
                "app": "https://example.com"
              }
            }
          ],
          "urls": {
            "app": "https://example.com"
          }
        }
      ]
    }
  ]
}
Deprecated

Ask a question to an AI across spaces that is accessible by the currently authenticated target.

get
Authorizations
Query parameters
querystringRequired
formatstring ยท enumOptional

Output format for the content.

Possible values:
detailsbooleanOptional

Return query details in the result

Responses
200
OK
application/json
get
GET /v1/search/ask HTTP/1.1
Host: api.gitbook.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "answer": {
    "answer": {
      "markdown": "text"
    },
    "followupQuestions": [
      "text"
    ],
    "sources": [
      {
        "type": "page",
        "page": "text",
        "revision": "text",
        "space": "text",
        "sections": [
          "text"
        ]
      }
    ]
  }
}

Ask a question to an AI across spaces that is accessible by the currently authenticated target.

post
Authorizations
Query parameters
formatstring ยท enumOptional

Output format for the content.

Possible values:
detailsbooleanOptional

Return query details in the result

Body
querystringRequired
previousQueriesstring[] ยท max: 10OptionalDeprecated
Responses
200
OK
application/json
post
POST /v1/search/ask HTTP/1.1
Host: api.gitbook.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 16

{
  "query": "text"
}
{
  "answer": {
    "answer": {
      "markdown": "text"
    },
    "followupQuestions": [
      "text"
    ],
    "sources": [
      {
        "type": "page",
        "page": "text",
        "revision": "text",
        "space": "text",
        "sections": [
          "text"
        ]
      }
    ]
  }
}

Update the details of a space

patch
Authorizations
Path parameters
spaceIdstringRequired

The unique id of the space

Body
all ofOptional
and
one ofOptional
or
or
Responses
200
The space has been updated
application/json
patch
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": "๐ŸŽ‰"
}
{
  "object": "space",
  "id": "text",
  "title": "text",
  "emoji": "๐ŸŽ‰",
  "visibility": "public",
  "createdAt": "2025-07-13T03:44:09.605Z",
  "updatedAt": "2025-07-13T03:44:09.605Z",
  "deletedAt": "2025-07-13T03:44:09.605Z",
  "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": {
    "installationProvider": "github",
    "integration": "text",
    "url": "text",
    "updatedAt": "2025-07-13T03:44:09.605Z"
  },
  "visitorAuth": {
    "backend": "custom"
  },
  "revision": "text",
  "defaultLevel": "admin",
  "comments": 1,
  "changeRequests": 1,
  "changeRequestsOpen": 1,
  "changeRequestsDraft": 1,
  "permissions": {
    "access": true,
    "admin": true,
    "edit": true,
    "comment": true,
    "merge": true,
    "review": true
  }
}

Soft-deletes a space. Soft-deleted spaces will be permanently removed after 7 days.

delete
Authorizations
Path parameters
spaceIdstringRequired

The unique id of the space

Responses
205
Space has been deleted
delete
DELETE /v1/spaces/{spaceId} HTTP/1.1
Host: api.gitbook.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*

No content

Was this helpful?