Search

Search in GitBook is the entity for searches made across organizations, spaces, and pages.

get
Authorizations
Path parameters
organizationIdstringRequired

The unique id of the organization

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
/orgs/{organizationId}/search
GET /v1/orgs/{organizationId}/search?query=text HTTP/1.1
Host: api.gitbook.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
200

OK

{
  "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"
              }
            }
          ],
          "ancestors": [
            {
              "title": "text"
            }
          ],
          "urls": {
            "app": "https://example.com"
          }
        }
      ]
    }
  ]
}
get
Authorizations
Path parameters
spaceIdstringRequired

The unique id of the space

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
/spaces/{spaceId}/search
GET /v1/spaces/{spaceId}/search?query=text HTTP/1.1
Host: api.gitbook.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
200

OK

{
  "next": {
    "page": "text"
  },
  "count": 1,
  "items": [
    {
      "id": "text",
      "title": "text",
      "path": "text",
      "sections": [
        {
          "id": "text",
          "title": "text",
          "path": "text",
          "body": "text",
          "urls": {
            "app": "https://example.com"
          }
        }
      ],
      "ancestors": [
        {
          "title": "text"
        }
      ],
      "urls": {
        "app": "https://example.com"
      }
    }
  ]
}

Ask a question in an organization

post

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

Authorizations
Path parameters
organizationIdstringRequired

The unique id of the organization

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
/orgs/{organizationId}/ask
POST /v1/orgs/{organizationId}/ask HTTP/1.1
Host: api.gitbook.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 16

{
  "query": "text"
}
200

OK

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

Was this helpful?