Site AI ask

Allow AI-driven queries within a specific docs site.

Give your users a way to ask content-aware AI queries that are scoped entirely to the site’s published documents.

Ask a question in a site

post

The response is streamed.

Authorizations
Path parameters
organizationIdstringrequired

The unique id of the organization

siteIdstringrequired

The unique id of the site

Query parameters
formatstring · enumoptional

Output format for the content.

Available options:
Body
questionstring · max: 512required
contextobjectoptional

You may optionally provide additional information about the context of the question. This doesn't affect the scope of the search, but GitBook may use this information to provide a better answer. Generally speaking, you should provide as much context as possible.

scopeone ofrequired
Responses
text/event-stream
objectoptional
post
POST /v1/orgs/{organizationId}/sites/{siteId}/ask HTTP/1.1
Host: api.gitbook.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 109

{
  "question": "text",
  "context": {
    "siteSpaceId": "text"
  },
  "scope": {
    "mode": "default",
    "includedSiteSpaces": [
      "text"
    ]
  }
}
200

OK

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

List recommended questions to ask in a site

get

The response is streamed.

Authorizations
Path parameters
organizationIdstringrequired

The unique id of the organization

siteIdstringrequired

The unique id of the site

Responses
text/event-stream
objectoptional
get
GET /v1/orgs/{organizationId}/sites/{siteId}/ask/questions HTTP/1.1
Host: api.gitbook.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
200

OK

{
  "question": "text"
}

Was this helpful?