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.

Possible values:
Body
questionstring · max: 512Required
scopeone ofRequired
or
or
Responses
200
OK
text/event-stream
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

Query parameters
spaceIdstringOptional

The ID of the space to filter the recommended questions for.

Responses
200
OK
text/event-stream
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?