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
curl -L \
  --request POST \
  --url 'https://api.gitbook.com/v1/orgs/{organizationId}/sites/{siteId}/ask' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "question": "text",
    "context": {
      "siteSpaceId": "text"
    },
    "scope": {
      "mode": "default",
      "includedSiteSpaces": [
        "text"
      ]
    }
  }'
{
  "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
curl -L \
  --url 'https://api.gitbook.com/v1/orgs/{organizationId}/sites/{siteId}/ask/questions' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'
{
  "question": "text"
}

Was this helpful?